geometry
Abstract Base Interface for Geometry and Mesh Operations.
This module provides the base interface for implementing geometry and mesh handling capabilities in both 2D and 3D. It defines the essential structure for mesh operations including reading, generation, and manipulation.
Key functionalities
- Abstract interface for mesh reading operations
- Common mesh generation method definitions
- VTK file generation specifications
- Test point extraction framework
- Mesh type and generation method standardization
The module serves as a foundation for
- Both 2D and 3D mesh implementations
- Various element type support
- Multiple mesh generation approaches
- Consistent mesh handling interface
Key classes
- Geometry: Abstract base class for all geometry implementations
Dependencies
- numpy: For numerical operations
- meshio: For mesh input/output operations
- gmsh: For mesh generation capabilities
- matplotlib: For visualization
- pyDOE: For sampling methods
- abc: For abstract base class functionality
Note
This module provides only the interface definitions. Concrete implementations must be provided by derived classes for specific dimensional and element type requirements.
Geometry
Abstract base class for geometry and mesh operations.
This class defines the interface that all geometry implementations must follow, providing the basic structure for mesh handling operations in both 2D and 3D contexts.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh_type |
Type of mesh elements (e.g., 'quadrilateral', 'triangle') |
|
mesh_generation_method |
Method for mesh generation ('internal'/'external') |
Example
class Geometry2D(Geometry): ... def init(self, mesh_type='quadrilateral', ... method='internal'): ... super().init(mesh_type, method) ... ... def read_mesh(self, mesh_file, boundary_level, ... sampling_method, refine_level): ... # Implementation ... pass ... ... def generate_vtk_for_test(self): ... # Implementation ... pass ... ... def get_test_points(self): ... # Implementation ... return points
Note
This is an abstract base class. Concrete implementations must override: - read_mesh() - generate_vtk_for_test() - get_test_points()
Each implementation should provide appropriate mesh handling for its specific dimensional and element type requirements.
Source code in scirex/core/sciml/geometry/geometry.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
__init__(mesh_type, mesh_generation_method)
Constructor for the Geometry class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_type
|
str
|
Type of mesh elements (e.g., 'quadrilateral', 'triangle') |
required |
mesh_generation_method
|
str
|
Method for mesh generation ('internal'/'external') |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in scirex/core/sciml/geometry/geometry.py
generate_vtk_for_test()
abstractmethod
Generates a VTK from Mesh file (External) or using gmsh (for Internal).
Args: None
Returns: None
get_test_points()
abstractmethod
This function is used to extract the test points from the given mesh
Returns:
| Name | Type | Description |
|---|---|---|
points |
ndarray
|
Test points extracted from the mesh |
read_mesh(mesh_file, boundary_point_refinement_level, bd_sampling_method, refinement_level)
abstractmethod
Abstract method to read mesh from Gmsh. This method should be implemented by the derived classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_file
|
str
|
Path to the mesh file |
required |
boundary_point_refinement_level
|
int
|
Level of refinement for boundary points |
required |
bd_sampling_method
|
str
|
Sampling method for boundary points |
required |
refinement_level
|
int
|
Level of mesh refinement |
required |
Returns:
| Type | Description |
|---|---|
|
None |