random#

Random mesh source for testing and examples.

Generates synthetic Mesh objects with random geometry and scalar/vector fields. Useful for unit tests, example pipelines, and quick prototyping without needing real data files.

Classes#

RandomMeshSource

Generate random tetrahedral meshes with configurable fields.

Module Contents#

class physicsnemo_curator.domains.mesh.sources.random.RandomMeshSource(
n_samples: int = 10,
n_points: int = 1000,
n_cells: int = 500,
n_fields: int = 3,
n_timesteps: int = 5,
seed: int = 42,
)#

Bases: physicsnemo_curator.core.base.Source[physicsnemo.mesh.Mesh]

Generate random tetrahedral meshes with configurable fields.

Each index yields a single Mesh with random point coordinates, tetrahedral connectivity, and a set of random scalar point-data fields.

Parameters:
  • n_samples (int) – Number of meshes this source provides (i.e. len(source)).

  • n_points (int) – Number of vertices per mesh.

  • n_cells (int) – Number of tetrahedral cells per mesh.

  • n_fields (int) – Number of random scalar point-data fields to generate.

  • n_timesteps (int) – Number of displacement timesteps to generate (produces displacement_t000, displacement_t001, …).

  • seed (int) – Base random seed. Each index uses seed + index for reproducibility.

Examples

>>> from physicsnemo_curator.domains.mesh.sources import RandomMeshSource
>>> source = RandomMeshSource(n_samples=10, n_points=100, n_cells=50)
>>> len(source)
10
>>> mesh = next(source[0])
>>> mesh.points.shape
torch.Size([100, 3])

Initialize the random mesh source.

classmethod params() list[physicsnemo_curator.core.base.Param]#

Declare configurable parameters.

description: ClassVar[str] = 'Generate random tetrahedral meshes with configurable fields for testing and prototyping'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Random Mesh'#

Human-readable display name for the interactive CLI.