Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Remove submodule for geometry creation helper methods. #1007

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,9 +1526,7 @@ PYBIND11_MODULE(simplnx, mod)
manualImportFinder.def("contains_module", &ManualImportFinder::containsModule, "mod_name"_a);

// Geometry Helper Methods
py::module_ sub = mod.def_submodule("CreateGeometry", "Submodule that contains the CreateGeometry utility methods.");

sub.def(
mod.def(
"create_image_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const std::vector<uint64>& dims, const std::vector<float32>& origin, const std::vector<float32>& spacing,
const std::string& cellAttrMatrixName) {
Expand All @@ -1547,7 +1545,7 @@ PYBIND11_MODULE(simplnx, mod)
},
"data_structure"_a, "geometry_path"_a, "dimensions"_a, "origin"_a, "spacing"_a, "cell_attr_matrix_name"_a = "Cell Data");

sub.def(
mod.def(
"create_rect_grid_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& xBoundsPath, const DataPath& yBoundsPath, const DataPath& zBoundsPath, const std::string& cellAttrMatrixName,
ArrayHandlingType arrayHandling) {
Expand All @@ -1567,7 +1565,7 @@ PYBIND11_MODULE(simplnx, mod)
},
"data_structure"_a, "geometry_path"_a, "x_bounds_path"_a, "y_bounds_path"_a, "z_bounds_path"_a, "cell_attr_matrix_name"_a = "Cell Data", "array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_vertex_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const std::string& vertexAttrMatrixName, ArrayHandlingType arrayHandling) {
CreateGeometryFilter filter;
Expand All @@ -1584,7 +1582,7 @@ PYBIND11_MODULE(simplnx, mod)
},
"data_structure"_a, "geometry_path"_a, "vertices_path"_a, "vertex_attr_matrix_name"_a = "Vertex Data", "array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_edge_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const DataPath& edgeListPath, const std::string& vertexAttrMatrixName, const std::string& edgeAttrMatrixName,
ArrayHandlingType arrayHandling) {
Expand All @@ -1605,7 +1603,7 @@ PYBIND11_MODULE(simplnx, mod)
"data_structure"_a, "geometry_path"_a, "vertices_path"_a, "edge_list_path"_a, "vertex_attr_matrix_name"_a = "Vertex Data", "edge_attr_matrix_name"_a = "Edge Data",
"array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_triangle_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const DataPath& triangleListPath, const std::string& vertexAttrMatrixName,
const std::string& faceAttrMatrixName, ArrayHandlingType arrayHandling) {
Expand All @@ -1626,7 +1624,7 @@ PYBIND11_MODULE(simplnx, mod)
"data_structure"_a, "geometry_path"_a, "vertices_path"_a, "triangle_list_path"_a, "vertex_attr_matrix_name"_a = "Vertex Data", "face_attr_matrix_name"_a = "Face Data",
"array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_quad_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const DataPath& quadListPath, const std::string& vertexAttrMatrixName, const std::string& faceAttrMatrixName,
ArrayHandlingType arrayHandling) {
Expand All @@ -1647,7 +1645,7 @@ PYBIND11_MODULE(simplnx, mod)
"data_structure"_a, "geometry_path"_a, "vertices_path"_a, "quad_list_path"_a, "vertex_attr_matrix_name"_a = "Vertex Data", "face_attr_matrix_name"_a = "Quad Data",
"array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_tetrahedral_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const DataPath& tetrahedralListPath, const std::string& vertexAttrMatrixName,
const std::string& cellAttrMatrixName, ArrayHandlingType arrayHandling) {
Expand All @@ -1668,7 +1666,7 @@ PYBIND11_MODULE(simplnx, mod)
"data_structure"_a, "geometry_path"_a, "vertices_path"_a, "tetrahedral_list_path"_a, "vertex_attr_matrix_name"_a = "Vertex Data", "cell_attr_matrix_name"_a = "Cell Data",
"array_handling"_a = ArrayHandlingType::Copy);

sub.def(
mod.def(
"create_hexahedral_geometry",
[](DataStructure& ds, const DataPath& geometryPath, const DataPath& verticesPath, const DataPath& hexahedralListPath, const std::string& vertexAttrMatrixName,
const std::string& cellAttrMatrixName, ArrayHandlingType arrayHandling) {
Expand Down
48 changes: 24 additions & 24 deletions wrapping/python/docs/source/User_API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Creating Geometries

All the `simplnx` geometries can be created in Python using the following helper methods:

+ CreateGeometry.create_image_geometry
+ CreateGeometry.create_rect_grid_geometry
+ CreateGeometry.create_vertex_geometry
+ CreateGeometry.create_edge_geometry
+ CreateGeometry.create_triangle_geometry
+ CreateGeometry.create_quad_geometry
+ CreateGeometry.create_tetrahedral_geometry
+ CreateGeometry.create_hexahedral_geometry
+ create_image_geometry
+ create_rect_grid_geometry
+ create_vertex_geometry
+ create_edge_geometry
+ create_triangle_geometry
+ create_quad_geometry
+ create_tetrahedral_geometry
+ create_hexahedral_geometry

The enumeration `ArrayHandlingType` defines how existing arrays will be handled when creating a new geometry. It includes the following values:

Expand All @@ -57,7 +57,7 @@ The enumeration `ArrayHandlingType` defines how existing arrays will be handled
Creating An Image Geometry
##########################

To create an image geometry, use the `CreateGeometry.create_image_geometry` method. This method requires the following parameters:
To create an image geometry, use the `create_image_geometry` method. This method requires the following parameters:

- `data_structure`: The data structure where the geometry will be created.
- `geometry_path`: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -73,7 +73,7 @@ Example usage:
import simplnx as nx

# Create an image geometry
result: nx.Result = nx.CreateGeometry.create_image_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Image Geometry"]), dimensions=[100, 150, 200], origin=[0, 5, -2], spacing=[0.5, 0.5, 0.5], cell_attr_matrix_name='Image Data')
result: nx.Result = nx.create_image_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Image Geometry"]), dimensions=[100, 150, 200], origin=[0, 5, -2], spacing=[0.5, 0.5, 0.5], cell_attr_matrix_name='Image Data')
if result.valid():
image_geom = data_structure[nx.DataPath(["Image Geometry"])]
print("Image Geometry Created!")
Expand All @@ -82,7 +82,7 @@ Example usage:
Creating A Rectilinear Grid Geometry
####################################

To create a rectilinear grid geometry, use the `CreateGeometry.create_rect_grid_geometry` method. This method requires the following parameters:
To create a rectilinear grid geometry, use the `create_rect_grid_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -99,15 +99,15 @@ Example usage:
import simplnx as nx

# Create a rect grid geometry
result = nx.CreateGeometry.create_rect_grid_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Rect Grid Geometry"]), x_bounds_path=nx.DataPath(["Foo"]), y_bounds_path=nx.DataPath(["Y Bounds"]), z_bounds_path=nx.DataPath(["Z Bounds"]), cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_rect_grid_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Rect Grid Geometry"]), x_bounds_path=nx.DataPath(["Foo"]), y_bounds_path=nx.DataPath(["Y Bounds"]), z_bounds_path=nx.DataPath(["Z Bounds"]), cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
rect_grid_geom = data_structure[nx.DataPath(["Rect Grid Geometry"])]
print("Rect Grid Geometry Created!")

Creating A Vertex Geometry
##########################

To create a vertex geometry, use the `CreateGeometry.create_vertex_geometry` method. This method requires the following parameters:
To create a vertex geometry, use the `create_vertex_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -122,15 +122,15 @@ Example usage:
import simplnx as nx

# Create a vertex geometry
result = nx.CreateGeometry.create_vertex_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Vertex Geometry"]), vertices_path=nx.DataPath("Vertices"), vertex_attr_matrix_name='Vertex Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_vertex_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Vertex Geometry"]), vertices_path=nx.DataPath("Vertices"), vertex_attr_matrix_name='Vertex Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
vertex_geom = data_structure[nx.DataPath("Vertex Geometry")]
print("Vertex Geometry Created!")

Creating An Edge Geometry
#########################

To create an edge geometry, use the `CreateGeometry.create_edge_geometry` method. This method requires the following parameters:
To create an edge geometry, use the `create_edge_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -147,15 +147,15 @@ Example usage:
import simplnx as nx

# Create an edge geometry
result = nx.CreateGeometry.create_edge_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Edge Geometry"]), vertices_path=nx.DataPath("Vertices"), edge_list_path=nx.DataPath("Edge List"), vertex_attr_matrix_name='Vertex Data', edge_attr_matrix_name='Edge Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_edge_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Edge Geometry"]), vertices_path=nx.DataPath("Vertices"), edge_list_path=nx.DataPath("Edge List"), vertex_attr_matrix_name='Vertex Data', edge_attr_matrix_name='Edge Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
edge_geom = data_structure[nx.DataPath("Edge Geometry")]
print("Edge Geometry Created!")

Creating A Triangle Geometry
############################

To create a triangle geometry, use the `CreateGeometry.create_triangle_geometry` method. This method requires the following parameters:
To create a triangle geometry, use the `create_triangle_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -172,15 +172,15 @@ Example usage:
import simplnx as nx

# Create a triangle geometry
result = nx.CreateGeometry.create_triangle_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Triangle Geometry"]), vertices_path=nx.DataPath("Vertices"), triangle_list_path=nx.DataPath("Triangle List"), vertex_attr_matrix_name='Vertex Data', face_attr_matrix_name='Face Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_triangle_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Triangle Geometry"]), vertices_path=nx.DataPath("Vertices"), triangle_list_path=nx.DataPath("Triangle List"), vertex_attr_matrix_name='Vertex Data', face_attr_matrix_name='Face Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
triangle_geom = data_structure[nx.DataPath("Triangle Geometry")]
print("Triangle Geometry Created!")

Creating A Quadrilateral Geometry
#################################

To create a quadrilateral geometry, use the `CreateGeometry.create_quad_geometry` method. This method requires the following parameters:
To create a quadrilateral geometry, use the `create_quad_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -197,15 +197,15 @@ Example usage:
import simplnx as nx

# Create a quad geometry
result = nx.CreateGeometry.create_quad_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Quad Geometry"]), vertices_path=nx.DataPath("Vertices"), quad_list_path=nx.DataPath("Quad List"), vertex_attr_matrix_name='Vertex Data', face_attr_matrix_name='Quad Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_quad_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Quad Geometry"]), vertices_path=nx.DataPath("Vertices"), quad_list_path=nx.DataPath("Quad List"), vertex_attr_matrix_name='Vertex Data', face_attr_matrix_name='Quad Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
quad_geom = data_structure[nx.DataPath("Quad Geometry")]
print("Quad Geometry Created!")

Creating A Tetrahedral Geometry
###############################

To create a tetrahedral geometry, use the `CreateGeometry.create_tetrahedral_geometry` method. This method requires the following parameters:
To create a tetrahedral geometry, use the `create_tetrahedral_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -222,15 +222,15 @@ Example usage:
import simplnx as nx

# Create a tetrahedral geometry
result = nx.CreateGeometry.create_tetrahedral_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Tetrahedral Geometry"]), vertices_path=nx.DataPath("Vertices"), tetrahedral_list_path=nx.DataPath("Tetrahedral List"), vertex_attr_matrix_name='Vertex Data', cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_tetrahedral_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Tetrahedral Geometry"]), vertices_path=nx.DataPath("Vertices"), tetrahedral_list_path=nx.DataPath("Tetrahedral List"), vertex_attr_matrix_name='Vertex Data', cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
tetrahedral_geom = data_structure[nx.DataPath("Tetrahedral Geometry")]
print("Tetrahedral Geometry Created!")

Creating A Hexahedral Geometry
##############################

To create a hexahedral geometry, use the `CreateGeometry.create_hexahedral_geometry` method. This method requires the following parameters:
To create a hexahedral geometry, use the `create_hexahedral_geometry` method. This method requires the following parameters:

- **data_structure**: The data structure where the geometry will be created.
- **geometry_path**: The :ref:`DataPath <DataPath>` where the geometry will be stored.
Expand All @@ -247,7 +247,7 @@ Example usage:
import simplnx as nx

# Create a hexahedral geometry
result = nx.CreateGeometry.create_hexahedral_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Hexahedral Geometry"]), vertices_path=nx.DataPath("Vertices"), hexahedral_list_path=nx.DataPath("Hexahedral List"), vertex_attr_matrix_name='Vertex Data', cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
result = nx.create_hexahedral_geometry(data_structure=data_structure, geometry_path=nx.DataPath(["Hexahedral Geometry"]), vertices_path=nx.DataPath("Vertices"), hexahedral_list_path=nx.DataPath("Hexahedral List"), vertex_attr_matrix_name='Vertex Data', cell_attr_matrix_name='Cell Data', array_handling=nx.ArrayHandlingType.Copy)
if result.valid():
hexahedral_geom = data_structure[nx.DataPath("Hexahedral Geometry")]
print("Hexahedral Geometry Created!")
Expand Down
Loading