Skip to content

Commit 218e0c9

Browse files
authored
ENH: Improve performance of the Surface Mesh to Regular Grid. (#1146)
* ENH: Improve performance of the Surface Mesh to Regular Grid. * ENH: Parallelize the codes over the z slice being raster. * Add check for canceled filter * Rewrote core algorithm of CreateScanPathsFilter * ENH: Adds option to STL Readers to create the Face Labels array. --------- Signed-off-by: Michael Jackson <[email protected]>
1 parent fcfc58a commit 218e0c9

31 files changed

+1296
-1008
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ set(SIMPLNX_HDRS
548548
${SIMPLNX_SOURCE_DIR}/Utilities/ClusteringUtilities.hpp
549549
${SIMPLNX_SOURCE_DIR}/Utilities/MontageUtilities.hpp
550550
${SIMPLNX_SOURCE_DIR}/Utilities/SIMPLConversion.hpp
551+
${SIMPLNX_SOURCE_DIR}/Utilities/IntersectionUtilities.hpp
551552

552553
${SIMPLNX_SOURCE_DIR}/Utilities/Math/GeometryMath.hpp
553554
${SIMPLNX_SOURCE_DIR}/Utilities/Math/MatrixMath.hpp

src/Plugins/OrientationAnalysis/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ set(PLUGIN_EXTRA_SOURCES
249249
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/TiffWriter.cpp"
250250
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/delaunator.cpp"
251251
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/delaunator.h"
252-
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/IntersectionUtilities.hpp"
253252
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/GrainMapper3DUtilities.hpp"
254253
"${${PLUGIN_NAME}_SOURCE_DIR}/src/${PLUGIN_NAME}/utilities/GrainMapper3DUtilities.cpp"
255254
)

src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/WritePoleFigure.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "OrientationAnalysis/utilities/FiraSansRegular.hpp"
44
#include "OrientationAnalysis/utilities/Fonts.hpp"
5-
#include "OrientationAnalysis/utilities/IntersectionUtilities.hpp"
65
#include "OrientationAnalysis/utilities/LatoBold.hpp"
76
#include "OrientationAnalysis/utilities/LatoRegular.hpp"
87
#include "OrientationAnalysis/utilities/TiffWriter.hpp"
@@ -15,6 +14,7 @@
1514
#include "simplnx/DataStructure/Geometry/TriangleGeom.hpp"
1615
#include "simplnx/Pipeline/Pipeline.hpp"
1716
#include "simplnx/Utilities/DataArrayUtilities.hpp"
17+
#include "simplnx/Utilities/IntersectionUtilities.hpp"
1818
#include "simplnx/Utilities/ParallelTaskAlgorithm.hpp"
1919
#include "simplnx/Utilities/Parsing/DREAM3D/Dream3dIO.hpp"
2020
#include "simplnx/Utilities/RTree.hpp"
@@ -123,7 +123,7 @@ class ComputeIntensityStereographicProjection
123123
size_t numTris = delaunayGeom->getNumberOfFaces();
124124
for(size_t tIndex = 0; tIndex < numTris; tIndex++)
125125
{
126-
std::array<float, 6> boundBox = nx::IntersectionUtilities::GetBoundingBoxAtTri(*delaunayGeom, tIndex);
126+
std::array<float, 6> boundBox = nx::core::IntersectionUtilities::GetBoundingBoxAtTri(*delaunayGeom, tIndex);
127127
m_RTree.Insert(boundBox.data(), boundBox.data() + 3, tIndex); // Note, all values including zero are fine in this version
128128
}
129129

@@ -167,7 +167,7 @@ class ComputeIntensityStereographicProjection
167167

168168
// Get the vertex Indices from the triangle
169169
delaunayGeom->getFacePointIds(triIndex, triVertIndices);
170-
bool inTriangle = nx::IntersectionUtilities::RayTriangleIntersect2(rayOrigin, rayDirection, v0, v1, v2, barycentricCoord);
170+
bool inTriangle = nx::core::IntersectionUtilities::RayTriangleIntersect2(rayOrigin, rayDirection, v0, v1, v2, barycentricCoord);
171171
if(inTriangle)
172172
{
173173
// Linear Interpolate dx and dy values using the barycentric coordinates

src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/CombineStlFiles.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ Result<> CombineStlFiles::operator()()
195195
triCounter += currentGeomNumVertices;
196196
}
197197

198-
if(m_InputValues->LabelFaces)
198+
if(m_InputValues->CreatePartNumbers)
199199
{
200200
// Type checked in preflight; Unsafe acceptable; pointer for speed
201-
auto* faceLabelsStore = m_DataStructure.getDataAsUnsafe<Int32Array>(m_InputValues->FaceFileIndexArrayPath)->getDataStore();
202-
std::fill(faceLabelsStore->begin() + faceLabelOffset, faceLabelsStore->begin() + faceLabelOffset + currentGeomNumTriangles, fileIndex);
201+
auto* partNumberDataStore = m_DataStructure.getDataAsUnsafe<Int32Array>(m_InputValues->PartNumberIndexArrayPath)->getDataStore();
202+
std::fill(partNumberDataStore->begin() + faceLabelOffset, partNumberDataStore->begin() + faceLabelOffset + currentGeomNumTriangles, fileIndex);
203203
}
204204

205205
faceLabelOffset += currentGeomNumTriangles;
@@ -224,5 +224,30 @@ Result<> CombineStlFiles::operator()()
224224
}
225225
taskRunner.wait(); // This will spill over if the number of geometries to processes does not divide evenly by the number of threads.
226226

227+
// Create the Face Labels Array if the user asked for it.
228+
if(m_InputValues->CreateFaceLabels)
229+
{
230+
auto* faceLabelDataStorePtr = m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->FaceLabelIndexArrayPath).getDataStore();
231+
usize numTuples = faceLabelDataStorePtr->getNumberOfTuples();
232+
AbstractDataStore<int32>* partNumberDataStorePtr = nullptr;
233+
if(m_InputValues->CreatePartNumbers)
234+
{
235+
partNumberDataStorePtr = m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->PartNumberIndexArrayPath).getDataStore();
236+
}
237+
238+
for(usize idx = 0; idx < numTuples; idx++)
239+
{
240+
faceLabelDataStorePtr->setComponent(idx, 0, 0);
241+
if(partNumberDataStorePtr != nullptr)
242+
{
243+
faceLabelDataStorePtr->setComponent(idx, 1, (*partNumberDataStorePtr)[idx]);
244+
}
245+
else
246+
{
247+
faceLabelDataStorePtr->setComponent(idx, 1, 1);
248+
}
249+
}
250+
}
251+
227252
return {};
228253
}

src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/CombineStlFiles.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ struct SIMPLNXCORE_EXPORT CombineStlFilesInputValues
1818
DataPath TriangleDataContainerName;
1919
DataPath FaceAttributeMatrixName;
2020
DataPath FaceNormalsArrayName;
21-
DataPath FaceFileIndexArrayPath;
22-
bool LabelFaces;
21+
22+
DataPath PartNumberIndexArrayPath;
23+
bool CreatePartNumbers;
24+
25+
DataPath FaceLabelIndexArrayPath;
26+
bool CreateFaceLabels;
27+
2328
DataPath VertexFileIndexArrayPath;
2429
bool LabelVertices;
30+
2531
DataObjectNameParameter::ValueType CellFeatureAttributeMatrixName;
2632
DataObjectNameParameter::ValueType ActiveArrayName;
2733
DataObjectNameParameter::ValueType FileListArrayName;

0 commit comments

Comments
 (0)