Skip to content

Add a Geometry

Create a class with the geometry protocol:

class MyGeometry:
    design_dim = 12

    def sample_prior(self, n, device=None):
        ...

    def decode(self, params):
        ...

    def encode(self, raw_geometry):
        ...

    def validate(self, params):
        ...

    def plot(self, params):
        ...

Then register it:

from flowdesign.registry import Registry, register_defaults

registry = register_defaults()
registry.add("geometry", "my_geometry", MyGeometry)

A geometry should avoid hard-coded paths and should make optional heavy assets explicit constructor arguments.