Giter Site home page Giter Site logo

chengshunshang1996 / vis3dvertex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pcsanematsu/vis3dvertex

0.0 0.0 0.0 1.96 MB

How to create VTK polyhedral unstructured grid from certex, face, and cell data of 3D vertex-like models. Here, the voro++ library is used to create polyhedral unstructured grids

License: GNU General Public License v2.0

JavaScript 0.07% C++ 10.02% Perl 0.22% CSS 0.53% Gnuplot 24.72% Makefile 0.22% POV-Ray SDL 63.94% Roff 0.27%

vis3dvertex's Introduction

vis3Dvertex

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 4
  • calculator_filter.pvsm: Figure 6 For more details on how to implement, refer to manuscript under Citation.

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

Dependencies

The examples require the libraries

Singularity container

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.

Compilation

  1. Clone this repository
  2. Then cd vis3Dvertex
  3. Compile with the command make all

Examples

cell_statistics_vtk.cc

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.

random_points_vtk.cc

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 cell
  • cellFaces: the number of faces (i.e. neighbors) of each cell
  • cellVolume: the volume of each cell
  • cellSurfaceArea: 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.

import_vtk.cc

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 cell
  • cellVolume (scalar): the volume of each cell
  • cellPosition (vectorial): the position of the cell center in global coordinates
  • cellMajorRadius (scalar): the radius of the major axis of the ellipsoid that was fitted for the a polyhedral cell
  • cellMajorAxis (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.

fitEllipsoid.cc

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()

vis3dvertex's People

Contributors

pcsanematsu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.