Module i2pp.core.discretization_readers.discretization_reader
Import Discretization.
Classes
class BoundingBox (min: np.ndarray, max: np.ndarray)-
Expand source code
@dataclass class BoundingBox: """Dataclass for storing the boundaries (BoundingBox) of a set of points. Attributes: min (np.ndarray): An array representing the minimum values along each axis (e.g., x, y, z) of the set of points. max (np.ndarray): An array representing the maximum values along each axis (e.g., x, y, z) of the set of points. """ min: np.ndarray max: np.ndarrayDataclass for storing the boundaries (BoundingBox) of a set of points.
Attributes
min:np.ndarray- An array representing the minimum values along each axis (e.g., x, y, z) of the set of points.
max:np.ndarray- An array representing the maximum values along each axis (e.g., x, y, z) of the set of points.
Instance variables
var max : numpy.ndarrayvar min : numpy.ndarray
class Discretization (nodes: Nodes,
elements: list[Element],
surfaces: list[Surface],
bounding_box: Optional[BoundingBox] = None)-
Expand source code
@dataclass class Discretization: """Class for storing Discretization data. This class is used to represent the Discretization of a mesh, including information about the nodes' coordinates, the elements that form the mesh, and the bounding box that define the boundaries of the Discretization. Attributes: nodes (Nodes): The nodes of the Discretization, which include the coordinates and IDs of each node. elements (list[Element]): A list of elements, each representing a part of the Discretization, containing information such as node IDs, element ID, center coordinates, and element data. surfaces (list[Surface]): A list of surfaces, each representing a part of the Discretization, containing information such as node IDs and surface ID. bounding_box (Optional[np.ndarray]): Boundary limits of the Discretization. """ nodes: Nodes elements: list[Element] surfaces: list[Surface] bounding_box: Optional[BoundingBox] = NoneClass for storing Discretization data.
This class is used to represent the Discretization of a mesh, including information about the nodes' coordinates, the elements that form the mesh, and the bounding box that define the boundaries of the Discretization.
Attributes
nodes:Nodes- The nodes of the Discretization, which include the coordinates and IDs of each node.
elements:list[Element]- A list of elements, each representing a part of the Discretization, containing information such as node IDs, element ID, center coordinates, and element data.
surfaces:list[Surface]- A list of surfaces, each representing a part of the Discretization, containing information such as node IDs and surface ID.
bounding_box:Optional[np.ndarray]- Boundary limits of the Discretization.
Instance variables
var bounding_box : BoundingBox | Nonevar elements : list[Element]var nodes : Nodesvar surfaces : list[Surface]
class DiscretizationReader-
Expand source code
class DiscretizationReader(ABC): """Abstract base class for reading and processing finite element Discretizations. The `DiscretizationReader` class defines the interface for reading and processing discretization data from different file formats. Subclasses must implement the `load_discretization` method to handle specific file formats. """ def __init__(self): """Init DiscretizationReader.""" pass @abstractmethod def load_discretization( self, file_path: Path, options: dict, processing: Processing, ) -> Discretization: """Abstract method to load discretization data from a file path. This method imports the nodes and elements of a discretization from a specific file format. The method will parse the file, extract the relevant information, and return a Discretization object that encapsulates the nodes, elements, and the boundaries in which the discretization nodes are located. Arguments: file_path (Path): Path to the discretization file. options (dict): A dictionary containing options for loading the discretization. processing (Processing): Processing configuration object. Returns: Discretization: An instance of Discretization containing information of the nodes and elements of the imported mesh, along with the boundaries in which the discretization nodes are located. """ passAbstract base class for reading and processing finite element Discretizations.
The
DiscretizationReaderclass defines the interface for reading and processing discretization data from different file formats. Subclasses must implement theload_discretizationmethod to handle specific file formats.Init DiscretizationReader.
Ancestors
- abc.ABC
Subclasses
Methods
def load_discretization(self, file_path: Path, options: dict, processing: Processing) ‑> Discretization-
Expand source code
@abstractmethod def load_discretization( self, file_path: Path, options: dict, processing: Processing, ) -> Discretization: """Abstract method to load discretization data from a file path. This method imports the nodes and elements of a discretization from a specific file format. The method will parse the file, extract the relevant information, and return a Discretization object that encapsulates the nodes, elements, and the boundaries in which the discretization nodes are located. Arguments: file_path (Path): Path to the discretization file. options (dict): A dictionary containing options for loading the discretization. processing (Processing): Processing configuration object. Returns: Discretization: An instance of Discretization containing information of the nodes and elements of the imported mesh, along with the boundaries in which the discretization nodes are located. """ passAbstract method to load discretization data from a file path.
This method imports the nodes and elements of a discretization from a specific file format. The method will parse the file, extract the relevant information, and return a Discretization object that encapsulates the nodes, elements, and the boundaries in which the discretization nodes are located.
Arguments
file_path (Path): Path to the discretization file. options (dict): A dictionary containing options for loading the discretization. processing (Processing): Processing configuration object.
Returns
Discretization- An instance of Discretization containing information of the nodes and elements of the imported mesh, along with the boundaries in which the discretization nodes are located.
class Element (node_ids: np.ndarray,
id: int,
center_coords: Optional[np.ndarray] = None,
data: Optional[np.ndarray] = None)-
Expand source code
@dataclass class Element: """Class for storing information about an individual element in the Discretization. This class represents a single element in the mesh Discretization, defined by its node IDs, an element ID, the coordinates of its center, and associated data. Attributes: node_ids (np.ndarray): An array of node IDs that define the nodes of the element. id (int): A unique identifier for the element. world_coords (Optional[np.ndarray]): An (N, 3) array containing the (x, y, z) world coordinates of the center of the element. data (Optional[np.ndarray]): An array representing the data associated with the element, such as RGB colors or grayscale intensities """ node_ids: np.ndarray id: int center_coords: Optional[np.ndarray] = None data: Optional[np.ndarray] = NoneClass for storing information about an individual element in the Discretization.
This class represents a single element in the mesh Discretization, defined by its node IDs, an element ID, the coordinates of its center, and associated data.
Attributes
node_ids:np.ndarray- An array of node IDs that define the nodes of the element.
id:int- A unique identifier for the element.
world_coords:Optional[np.ndarray]- An (N, 3) array containing the (x, y, z) world coordinates of the center of the element.
data:Optional[np.ndarray]- An array representing the data associated with the element, such as RGB colors or grayscale intensities
Instance variables
var center_coords : numpy.ndarray | Nonevar data : numpy.ndarray | Nonevar id : intvar node_ids : numpy.ndarray
class Nodes (coords: np.ndarray,
ids: np.ndarray,
scaling_factors: Optional[np.ndarray] = None)-
Expand source code
@dataclass class Nodes: """Class for storing information about nodes in a Discretization. Attributes: coords (np.ndarray): An (N, 3) array containing the (x, y, z) world coordinates of each node. ids (np.ndarray): An array of IDs for each node. scaling_factors (Optional[np.ndarray]): Optional per-node scaling_factors that can be used to adjust the contribution of each node during interpolation, e.g., low scaling factor for surface nodes. """ coords: np.ndarray ids: np.ndarray scaling_factors: Optional[np.ndarray] = NoneClass for storing information about nodes in a Discretization.
Attributes
coords:np.ndarray- An (N, 3) array containing the (x, y, z) world coordinates of each node.
ids:np.ndarray- An array of IDs for each node.
scaling_factors (Optional[np.ndarray]): Optional per-node scaling_factors that can be used to adjust the contribution of each node during interpolation, e.g., low scaling factor for surface nodes.
Instance variables
var coords : numpy.ndarrayvar ids : numpy.ndarrayvar scaling_factors : numpy.ndarray | None
class Surface (node_ids: np.ndarray, id: int)-
Expand source code
@dataclass class Surface: """Class for storing information about a surface in the Discretization. This class represents a surface in the mesh Discretization, defined by its node IDs, a surface ID, and associated data. Attributes: node_ids (np.ndarray): An array of node IDs that define the nodes of the surface. id (int): A unique identifier for the surface. """ node_ids: np.ndarray id: intClass for storing information about a surface in the Discretization.
This class represents a surface in the mesh Discretization, defined by its node IDs, a surface ID, and associated data.
Attributes
node_ids:np.ndarray- An array of node IDs that define the nodes of the surface.
id:int- A unique identifier for the surface.
Instance variables
var id : intvar node_ids : numpy.ndarray