Module i2pp.core.discretization_readers.discretization_format

Discretization format detection and handling.

Classes

class DiscretizationFormat (*args, **kwds)
Expand source code
class DiscretizationFormat(Enum):
    """DiscretizationFormat (Enum): Defines the supported file formats for
    discretization data.

    Attributes:
        MESH: Represents the discretization data in '.mesh' format
        YAML: Represents the discretization data in the '.4C.yaml' format
    """

    MESH = ".mesh"
    YAML = ".yaml"

    def get_reader(self) -> Type[DiscretizationReader]:
        """Returns the appropriate discretization reader class based on the
        discretization format.

        Returns:
            Type[DiscretizationReader]: A class that is a subclass of
        `DiscretizationReader`, either `MeshReader` or `FourCYamlReader`.
        """
        return {
            DiscretizationFormat.MESH: MeshReader,
            DiscretizationFormat.YAML: FourCYamlReader,
        }[self]

DiscretizationFormat (Enum): Defines the supported file formats for discretization data.

Attributes

MESH
Represents the discretization data in '.mesh' format
YAML
Represents the discretization data in the '.4C.yaml' format

Ancestors

  • enum.Enum

Class variables

var MESH
var YAML

Methods

def get_reader(self) ‑> Type[DiscretizationReader]
Expand source code
def get_reader(self) -> Type[DiscretizationReader]:
    """Returns the appropriate discretization reader class based on the
    discretization format.

    Returns:
        Type[DiscretizationReader]: A class that is a subclass of
    `DiscretizationReader`, either `MeshReader` or `FourCYamlReader`.
    """
    return {
        DiscretizationFormat.MESH: MeshReader,
        DiscretizationFormat.YAML: FourCYamlReader,
    }[self]

Returns the appropriate discretization reader class based on the discretization format.

Returns

Type[DiscretizationReader]
A class that is a subclass of

DiscretizationReader, either MeshReader or FourCYamlReader.