Module i2pp.core.discretization_readers.discretization_reader
Import Discretization.
Classes
class BoundingBox (min: numpy.ndarray, max: numpy.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.ndarray
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.
Instance variables
var max : numpy.ndarray
var min : numpy.ndarray
class Discretization (nodes: Nodes,
elements: list[Element],
bounding_box: BoundingBox | None = 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. bounding_box (Optional[np.ndarray]): Boundary limits of the Discretization. """ nodes: Nodes elements: list[Element] bounding_box: Optional[BoundingBox] = None
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.
bounding_box
:Optional[np.ndarray]
- Boundary limits of the Discretization.
Instance variables
var bounding_box : BoundingBox | None
var elements : list[Element]
var nodes : Nodes
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 ) -> 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. 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. """ pass
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 theload_discretization
method to handle specific file formats.Init DiscretizationReader.
Ancestors
- abc.ABC
Subclasses
Methods
def load_discretization(self, file_path: pathlib.Path, options: dict) ‑> Discretization
-
Expand source code
@abstractmethod def load_discretization( self, file_path: Path, options: dict ) -> 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. 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. """ pass
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.
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: numpy.ndarray,
id: int,
center_coords: numpy.ndarray | None = None,
data: numpy.ndarray | None = 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] = None
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
Instance variables
var center_coords : numpy.ndarray | None
var data : numpy.ndarray | None
var id : int
var node_ids : numpy.ndarray
class Nodes (coords: numpy.ndarray, ids: numpy.ndarray)
-
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. """ coords: np.ndarray ids: np.ndarray
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.
Instance variables
var coords : numpy.ndarray
var ids : numpy.ndarray