Skip to content

Commit

Permalink
Update documentation, update unit tests. Add new example file
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Feb 2, 2024
1 parent eef4306 commit b772c4a
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/Plugins/SimplnxCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ if(EXISTS "${DREAM3D_DATA_DIR}" AND SIMPLNX_DOWNLOAD_TEST_FILES)

download_test_data(DREAM3D_DATA_DIR ${DREAM3D_DATA_DIR}
ARCHIVE_NAME STL_Models.tar.gz
SHA512 14d5bbb1dcc241a5ad9b17e7647144926f22fca9af5e426798c2ed423d8d3b5d89d8c66ce9e6854bfcdbaea7f72b69980477ab837498e3dca89b5cd2870e2cff
SHA512 6a17caa1c5b60740a18d30732b10139b5864e12abd5009ce482972f4070f86e1762a3bf2bbceb8f178187b4d70bedbde1516f32397c3d4424404557b320dde9d
INSTALL
COPY_DATA
)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Plugins/SimplnxCore/docs/Images/connectivity_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/Plugins/SimplnxCore/docs/LabelTriangleGeometryFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ This **Filter** accepts a **Triangle Geometry** and checks the connectivity of *

Note: Our connectivity is different from other connectivity algorithms, in that it is dependent on the dimensionality of the geometry it is run on. A triangle geometry is two dimensional thus it must share one edge with another triangle to be considered connected. Only one shared vertex will not be enough to count triangles as connected. See the following image for reference:

![Connectivity Image](/Images/connectivity_image.png)
![Connectivity Image](Images/connectivity_image.png)

The image in question demonstrates what geometric shapes would be considered connected according to matching color scheme. The colors are relative to the shapes dimensionality. Thus the fact there is a yellow triangle and a yellow cube does not mean they are related.

- 1D Geometry: Two edges are considered connected if they share a vertex.
- 2D Geometry: Triangle and Quad Geometries are considered connected if they share an entire edge. As shown in the image above, Triangles 1 & 2 are connected while triangles 2 & 3 are **not** connected.
- 3D Geometry: Hexahedron/Tetrahedron: In the image above the hexahedrons 4,5, and 6 are **not** considered connected while 6 & 7 are considered connected.

## Example Output

The image below shows a single STL file that contains 12 different geometries. This filter labeled each geometry with a unique "Region ID" and the visualization is colored by those "Region Ids"

![Filter Output](Images/LabelTriangleGeometry_1.png)

% Auto generated parameter table will be inserted here

## License & Copyright
Expand Down
26 changes: 1 addition & 25 deletions src/Plugins/SimplnxCore/docs/RegularGridSampleSurfaceMesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,7 @@ This **Filter** "samples" a triangulated surface mesh on a rectilinear grid. The
3. For each bounding box a **Cell** falls in, check against that **Feature's** **Triangle** list to determine if the **Cell** falls within that n-sided polyhedra (*Note:* if the surface mesh is conformal, then each **Cell** will only belong to one **Feature**, but if not, the last **Feature** the **Cell** is found to fall inside of will *own* the **Cell**)
4. Assign the **Feature** number that the **Cell** falls within to the *Feature Ids* array in the new rectilinear grid geometry

## Parameters

| Name | Type | Description |
|------------|------| --------------------------------- |
| Dimensions | uint64 | Number of **Cells** along each axis |
| Resolution | float32 (3x) | The resolution values (dx, dy, dz) |
| Origin | float32 (3x) | The origin of the sampling volume |

## Required Geometry

Triangle

## Required Objects

| Type | Default Name | Type | Comp Dims | Description |
|------|--------------|-----|-----|-----------------------------------|
| Data Array | Face Labels | int32 | (2) | Specifies which **Features** are on either side of each **Face**. |

## Created

| Kind | Default Name | Type | Comp Dims | Description |
|---------------------------|--------------|----------|--------|---------------------------------------------|
| Image Geometry | Image Geometry | N/A | N/A | Created **Image Geometry** name and *DataPath* |
| Attribute Matrix | Cell Data | Cell | N/A | Created **Cell Attribute Matrix** name |
| Data Array | Feature Ids | int32 | (1) | Specifies to which **Feature** each **Cell** belongs |
% Auto generated parameter table will be inserted here

## License & Copyright

Expand Down
10 changes: 5 additions & 5 deletions src/Plugins/SimplnxCore/docs/RemoveFlaggedFeaturesFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Processing (Cleanup)

## Description

This **Filter** will remove **Features** that have been flagged by another **Filter** from the structure. The **Filter**
requires that the user point to a boolean array at the **Feature** level that tells the **Filter** whether the **Feature**
should remain in the structure. If the boolean array is *false* for a **Feature**, then all **Cells** that belong to that
**Feature** are temporarily *unassigned*. Optionally, after all *undesired* **Features** are removed, the remaining **Features** are
isotropically coarsened to fill in the gaps left by the removed **Features**.
This **Filter** will remove **Features** that have been flagged by another **Filter** from the structure. The **Filter** requires that the user point to a boolean array at the **Feature** level that tells the **Filter** whether the **Feature** should remain in the structure. If the boolean array is *false* for a **Feature**, then all **Cells** that belong to that **Feature** are temporarily *unassigned*. Optionally, after all *undesired* **Features** are removed, the remaining **Features** are isotropically coarsened to fill in the gaps left by the removed **Features**.

## Caveats

This filter will **ONLY** run on an Image Geometry.

% Auto generated parameter table will be inserted here

Expand Down
26 changes: 17 additions & 9 deletions src/Plugins/SimplnxCore/docs/RemoveFlaggedTrianglesFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ Surface Meshing (Misc)

## Description

This **Filter** removes **Triangles** from the supplied **Triangle Geometry** that are flagged by a boolean mask array.
Specifically, **Triangles** flagged as _true_ are removed from the **Geometry**. A new reduced **Geometry** is created
that contains all the remaining **Triangles**. It is unknown until run time how many **Triangles** will be removed from the
**Geometry**. Therefore, this **Filter** requires that a new **TriangleGeom** be created to contain the reduced **Triangle Geometry**.
This new **Geometry** will NOT contain copies of any **Feature** or **Ensemble** **Attribute Matrices** from the original **Geometry**.
Additionally, all **Vertex** data will be copied, with tuples _removed_ for any **Vertices** removed by the **Filter**.
The user must supply a name for the reduced **Geometry**.
This **Filter** removes **Triangles** from the supplied **Triangle Geometry** that are flagged by a boolean mask array as **true**. A new reduced **Geometry** is created that contains all the remaining **Triangles**. It is unknown until run time how many **Triangles** will be removed from the **Geometry**. Therefore, this **Filter** requires that a new **TriangleGeom** be created to contain the reduced **Triangle Geometry**. This new **Geometry** will *NOT* contain copies of any **Feature Attribute Matrix** or **Ensemble Attribute Matrix** from the original **Geometry**.

The mask is expected to be over the triangles themselves so it should be based on something from the **_Face Data_** **Attribute Matrix**, generally we suggest basing the mask on the created **_Region Ids_** array from the _Label Triangle Geometry Filter_.
- Additionally, all **Vertex** data will be copied, with tuples *removed* for any **Vertices** removed by the **Filter**. The user must supply a name for the reduced **Geometry**.

_Note:_ Since it cannot be known before run time how many **Vertices** will be removed, the new **Vertex Geometry** and
The mask is expected to be over the triangles themselves so it should be based on something from the ***Face Data*** **Attribute Matrix**, generally we suggest basing the mask on the created **Region Ids** array from the *Label Triangle Geometry Filter*.

*Note:* Since it cannot be known before run time how many **Vertices** will be removed, the new **Vertex Geometry** and
all associated **Vertex** data to be copied will be initialized to have size 0.

## Example Output

- The next figure shows a triangle geometry that has had a mask generated. Yellow parts are flagged as true.

![Masked triangle geometries for removal.](Images/RemoveFlaggedTriangles_1.png)

- The next figure shows the result of running the filter.

![Resulting triangle geometry](Images/RemoveFlaggedTriangles_2.png)

% Auto generated parameter table will be inserted here

## Example Pipelines

## License & Copyright

Please see the description file distributed with this plugin.
Expand Down
113 changes: 113 additions & 0 deletions src/Plugins/SimplnxCore/pipelines/Remove_Triangles.d3dpipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"isDisabled": false,
"name": "Untitled Pipeline",
"pipeline": [
{
"args": {
"face_attribute_matrix": "Face Data",
"face_normals_data_path": "Face Normals",
"scale_factor": 1.0,
"scale_output": false,
"stl_file_path": "Data/STL_Models/Example_Triangle_Geometry.stl",
"triangle_geometry_name": "TriangleDataContainer",
"vertex_attribute_matrix": "Vertex Data"
},
"comments": "",
"filter": {
"name": "nx::core::ReadStlFileFilter",
"uuid": "2f64bd45-9d28-4254-9e07-6aa7c6d3d015"
},
"isDisabled": false
},
{
"args": {
"created_region_ids_path": "TriangleDataContainer/Face Data/Region Ids",
"num_triangles_name": "NumTriangles",
"triangle_attribute_matrix_name": "CAD Part Data",
"triangle_geom_path": "TriangleDataContainer"
},
"comments": "",
"filter": {
"name": "nx::core::LabelTriangleGeometryFilter",
"uuid": "7a7a2c6f-3b03-444d-8b8c-5976b0e5c82e"
},
"isDisabled": false
},
{
"args": {
"array_thresholds": {
"inverted": false,
"thresholds": [
{
"array_path": "TriangleDataContainer/Face Data/Region Ids",
"comparison": 0,
"inverted": false,
"type": "array",
"union": 0,
"value": 9.0
}
],
"type": "collection",
"union": 0
},
"created_data_path": "Mask",
"created_mask_type": 1,
"custom_false_value": 0.0,
"custom_true_value": 1.0,
"use_custom_false_value": false,
"use_custom_true_value": false
},
"comments": "",
"filter": {
"name": "nx::core::MultiThresholdObjects",
"uuid": "4246245e-1011-4add-8436-0af6bed19228"
},
"isDisabled": false
},
{
"args": {
"array_thresholds": {
"inverted": false,
"thresholds": [
{
"array_path": "TriangleDataContainer/Face Data/Region Ids",
"comparison": 0,
"inverted": false,
"type": "array",
"union": 0,
"value": 9.0
}
],
"type": "collection",
"union": 0
},
"created_data_path": "Mask2",
"created_mask_type": 10,
"custom_false_value": 0.0,
"custom_true_value": 1.0,
"use_custom_false_value": false,
"use_custom_true_value": false
},
"comments": "",
"filter": {
"name": "nx::core::MultiThresholdObjects",
"uuid": "4246245e-1011-4add-8436-0af6bed19228"
},
"isDisabled": false
},
{
"args": {
"input_geometry": "TriangleDataContainer",
"mask_array_path": "TriangleDataContainer/Face Data/Mask2",
"output_geometry": "Part 10"
},
"comments": "",
"filter": {
"name": "nx::core::RemoveFlaggedTrianglesFilter",
"uuid": "38155c61-2709-4731-be95-43745bb3f8d8"
},
"isDisabled": false
}
],
"version": 1
}
3 changes: 2 additions & 1 deletion src/Plugins/SimplnxCore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ set(PREBUILT_PIPELINE_NAMES
"${${PLUGIN_NAME}_SOURCE_DIR}/pipelines/Import_CSV_Data.d3dpipeline"
"${${PLUGIN_NAME}_SOURCE_DIR}/pipelines/Import_STL_Model.d3dpipeline"
"${${PLUGIN_NAME}_SOURCE_DIR}/pipelines/Triangle_Face_Data_Demo.d3dpipeline"

"${${PLUGIN_NAME}_SOURCE_DIR}/pipelines/Remove_Triangles.d3dpipeline"

# These are workflow files
# "${${PLUGIN_NAME}_SOURCE_DIR}/pipelines/Import_ASCII_Data.d3dworkflow"

Expand Down
4 changes: 1 addition & 3 deletions src/Plugins/SimplnxCore/test/CombineStlFilesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ TEST_CASE("SimplnxCore::CombineStlFilesFilter: Valid Filter Execution", "[Simpln
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_CMakeExecutable, nx::core::unit_test::k_TestFilesDir, "6_6_combine_stl_files.tar.gz",
"6_6_combine_stl_files.dream3d");

const nx::core::UnitTest::TestFileSentinel testDataSentinel1(nx::core::unit_test::k_CMakeExecutable, nx::core::unit_test::k_TestFilesDir, "STL_Models.tar.gz", "STL_Models");

// Read Exemplar DREAM3D File Filter
auto exemplarFilePath = fs::path(fmt::format("{}/6_6_combine_stl_files.dream3d", unit_test::k_TestFilesDir));
DataStructure dataStructure = UnitTest::LoadDataStructure(exemplarFilePath);

std::string inputStlDir = fmt::format("{}/STL_Models", unit_test::k_TestFilesDir.view());
std::string inputStlDir = fmt::format("{}/6_6_combine_stl_files/STL_Models", unit_test::k_TestFilesDir.view());

// Instantiate the filter, a DataStructure object and an Arguments Object
CombineStlFilesFilter filter;
Expand Down

0 comments on commit b772c4a

Please sign in to comment.