hguo / DeformingSpacetimeMesh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DeformingSpacetimeMesh

This is a Python implementation of building a simplical mesh for a deforming 3D spacetime generated by a time-varying 2D triangular spatial field. Input files include two 2D triangular spatial meshes in two successive timesteps and node correspondence (Figure A); the output file is a 3D simplicial mesh of the spacetime generated by them (Figure B).

The algorithm is based on algorithm in paper Meshing Deforming Spacetime for Visualization and Analysis (under review).

Installation

Dependencies

To run the meshing algorithm, following packages are required:

To run the synthetic data generation needs an additional package:

If you do not have these packages installed, please use the following command to intall them:

$ pip install numpy
$ pip install shapely
$ pip install networkx
$ pip install matplotlib
$ pip install vtk
$ pip install scipy

Usage

$ python DeformingSpacetimeMesh.py [Path to input file 1] [Path to input file 2] [Node correspondence] [Path to output file (optional)] [Name of scalar function (optional)]

Parameters

  • [Path to input file 1]
    • Path to the input file of the time-varying 2D triangular mesh at timestep t.
    • Acceptable format of input file: .vtu
    • Point attributes should include following:
      • next_node:
      • value:
  • [Path to input file 2]
    • Path to the input file of the time-varying 2D triangular mesh at timestep t+1.
    • Acceptable format of input file: .vtu
    • Point attributes should include following:
      • previous_node:
      • value:
  • [Node correspondence]
    • Temporal correspondence between nodes in two meshes built by underlying properties.
    • See for a format. Every row must have only indices for two nodes separated by space, the former from mesh at t and the latter from mesh at t+1. One node in a mesh can appear multiple times, indicating this node is corresponding to multiple nodes in the other mesh. Not all nodes need to appear; nodes can have no temporal correspondence with others.
  • [Path to output file (optional)]
    • Path to the output file of a simplical mesh for the 3D deforming spacetime generated by the two inputted 2D triangular meshes.
  • [Name of scalar function (optional)]
    • The name of scalar value one want to interpolate. Default is value if not specified.

Output

Output file is in .vtu format with scalar value specified above as node attribute.

Examples

One can run the following code to generate a 3D spacetime mesh for a synthetic dataset which depicts rotating two Gaussian blobs with cycle 16 and phase difference π around the center of a circular field, as shown in Figure C.

$ python DeformingSpacetimeMesh.py data/mesh1.vtu data/mesh2.vtu value spacetime_mesh.vtu

Citation

Ren, Congrong, and Hanqi Guo. "Meshing Deforming Spacetime for Visualization and Analysis." arXiv preprint arXiv:2309.02677 (2023).

License

Standard MIT disclaimer applies, see LICENSE for full text.

About

License:MIT License


Languages

Language:Python 100.0%