Architecture#
This page summarizes the parts of the design note that matter most when you are trying to modify the codebase safely.
Design goals#
The project is built around three goals:
compute differentiable geometry metrics from mesh coordinates
build topology-derived graph and sparse operators
expose the same workflow through torch and phlower_tensor backends
Core design split#
The most important boundary in the project is this:
coordinate-dependent geometry should stay differentiable
connectivity-derived topology should stay cacheable
In practice, this means geometry values are recomputed from points while topology skeletons and backend sparse materializations are reused.
High-level module map#
flowchart TD
tensorMesh["TensorMesh"] --> geometryLayer["mesh.geometry"]
tensorMesh --> topologyLayer["mesh.topology"]
tensorMesh --> pyvistaMesh["PyVista mesh"]
geometryLayer --> geometryPkg["src/graphlow/geometry"]
topologyLayer --> graphPkg["src/graphlow/graph"]
tensorMesh --> backendLayer["Backend / BackendCache"]
Main directories#
src/graphlow/core:TensorMeshand wrapper objects for geometry and topologysrc/graphlow/geometry: geometry metrics, operators, and analytic or isoparametric methodssrc/graphlow/graph: skeleton builders, mappings, and sparse graph logicsrc/graphlow/io: user-facing mesh loading entry points
Data model#
TensorMesh keeps:
backend tensors for
points,point_data, andcell_datathe original PyVista mesh as the static topology source
attached geometry and topology helpers
This lets autograd follow coordinate and data tensors without turning the whole topology pipeline into a differentiable object.
Caching model#
Two cache layers matter:
a backend-neutral topology cache that stores scipy sparse skeletons and blocks
a backend-specific cache that materializes sparse tensors only when needed
That split is the reason many topology changes should avoid touching geometry code, and vice versa.
Contributor reading order#
If you are new to the codebase, the efficient reading order is:
src/graphlow/core/mesh.pysrc/graphlow/core/geometry.pyandsrc/graphlow/core/topology.pythe concrete implementation modules under
src/graphlow/geometryorsrc/graphlow/graph
For concrete examples of that traversal, continue with Internals.