This repository show how to "convert" vertex, face, and cell data from vertex-like models (vertex or Voronoi) into VTK polyhedral unstructured meshes. I
modify three examples from voro++ library to show how this "conversion" is performed. In addition, it shows how to output binary or ASCII files in .vtu
file format that can be read in ParaView. random_points_vtk.cc
shows how to output a series of files as a timeseries such that the user can create movies/animations.
The output files of the examples below are provided in the folder output
. To create figures 4 and 6 of the manuscript, I provided two ParaView state files (.pvsm
):
threshold_2Dcross_section_filters.pvsm
: Figure 4calculator_filter.pvsm
: Figure 6 For more details on how to implement, refer to manuscript under Citation.
Please, if you use this in your publication, cite the following publication:
Interactive 3D visualization and post-processing analysis of vertex-based unstructured polyhedral meshes with ParaView
Paula C Sanematsu
bioRxiv 2021.10.15.464601; doi: https://doi.org/10.1101/2021.10.15.464601
The examples require the libraries
Examples were written and tested in a Linux machine. Codes were compiled and run using a Singularity container where the host machine had Singularity 2.6.0-dist installed. You can directly download the Singularity container (create link here) or use the Singularity deifinition file voroVTKPy.def
from this repository to create on your container.
Singularity containers allows reproducibility of computational results in different machines. It also allows one to avoid going through the pain of installing all of the libraries' dependencies. voro++ has a few dependencies, so to simplify things, it is probably easier to the Singularity container.
- Clone this repository
- Then
cd vis3Dvertex
- Compile with the command
make all
This code was based on voro++-0.4.6/examples/custom/cell_statistics.cc
.
This example shows how to create convert cell, face, and vertex data of a single cell into VTK polyhedral unstructured grid and outputs a *.vtu file to be opened in ParaView.
This code was based on voro++-0.4.6/examples/basic/random_points.cc
.
In addition to converting cell, face, and vextex data into a VTK polyhedral unstructured mesh, it creates the following scalar VTK CellData
:
cellID
: the index of each cellcellFaces
: the number of faces (i.e. neighbors) of each cellcellVolume
: the volume of each cellcellSurfaceArea
: the surface area of the cell
It also creates a timeseries file timeseries.pvd
such that the user can see the time evolution of a simulation in ParaView and then export movies.
This code was based on voro++-0.4.6/examples/basic/import.cc
.
In addition to some of the items included in the examples above, this examples shows how to add vectorial CellData
in the polyhedral unstructured mesh. The following CellData
are included:
cellID
(scalar): the index of each cellcellVolume
(scalar): the volume of each cellcellPosition
(vectorial): the position of the cell center in global coordinatescellMajorRadius
(scalar): the radius of the major axis of the ellipsoid that was fitted for the a polyhedral cellcellMajorAxis
(vectorial): the vector that describes the major axis of the ellipsoid that was fitted for the polyhedral cell; vector is in local (the cell's) coordinate system.
This is not really an example of using the VTK library. It shows how to calculate the point-mass moment of inertia of a polyhedron Dobrovolskis, A. R. (1996). "Inertia of Any Polyhedron." Icarus 124(2): 698-704.. The user can access the major, intermediate, and minor radii and axes with the getter functions:
majorRadius()
,majorAxis()
interRadius()
,interAxis()
minorRadius()
,minorAxis()