Skip to content

Commit

Permalink
BUG: Remove option to transfer data from the voxels to the mesh.
Browse files Browse the repository at this point in the history
This does not work with SurfaceNets. Needs a whole different approach.

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Feb 5, 2025
1 parent 385955c commit b77ed3c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SIMPLNXCORE_EXPORT AbstractTupleTransfer
* @param secondcIndex
* @param forceSecondToZero
*/
virtual void transfer(size_t faceIndex, size_t firstcIndex, size_t secondcIndex, bool forceSecondToZero = false) = 0;
virtual void transfer(size_t faceIndex, size_t firstcIndex, size_t secondcIndex, bool forceSecondToZero) = 0;

virtual void transfer(size_t faceIndex, size_t firstcIndex) = 0;

Expand Down Expand Up @@ -82,7 +82,7 @@ class TransferTuple : public AbstractTupleTransfer
* @param secondcIndex
* @param forceSecondToZero
*/
void transfer(size_t faceIndex, size_t firstcIndex, size_t secondcIndex, bool forceSecondToZero = false) override
void transfer(size_t faceIndex, size_t firstcIndex, size_t secondcIndex, bool forceSecondToZero) override
{
for(size_t i = 0; i < m_NumComps; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ Parameters SurfaceNetsFilter::parameters() const
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));
params.insert(std::make_unique<ArraySelectionParameter>(k_CellFeatureIdsArrayPath_Key, "Cell Feature Ids", "The complete path to the Array specifying which Feature each Cell belongs to", DataPath{},
ArraySelectionParameter::AllowedTypes{DataType::int32}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<MultiArraySelectionParameter>(
k_SelectedDataArrayPaths_Key, "Attribute Arrays to Transfer", "The paths to the Arrays specifying which Cell Attribute Arrays to transfer to the created Triangle Geometry",
MultiArraySelectionParameter::ValueType{}, MultiArraySelectionParameter::AllowedTypes{IArray::ArrayType::DataArray}, nx::core::GetAllDataTypes()));
// params.insert(std::make_unique<MultiArraySelectionParameter>(
// k_SelectedDataArrayPaths_Key, "Attribute Arrays to Transfer", "The paths to the Arrays specifying which Cell Attribute Arrays to transfer to the created Triangle Geometry",
// MultiArraySelectionParameter::ValueType{}, MultiArraySelectionParameter::AllowedTypes{IArray::ArrayType::DataArray}, nx::core::GetAllDataTypes()));

params.insertSeparator(Parameters::Separator{"Output Triangle Geometry"});
params.insert(
Expand Down Expand Up @@ -119,7 +119,7 @@ IFilter::PreflightResult SurfaceNetsFilter::preflightImpl(const DataStructure& d
{
auto pGridGeomDataPath = filterArgs.value<DataPath>(k_GridGeometryDataPath_Key);
auto pFeatureIdsArrayPathValue = filterArgs.value<DataPath>(k_CellFeatureIdsArrayPath_Key);
auto pSelectedDataArrayPaths = filterArgs.value<MultiArraySelectionParameter::ValueType>(k_SelectedDataArrayPaths_Key);
// auto pSelectedDataArrayPaths = filterArgs.value<MultiArraySelectionParameter::ValueType>(k_SelectedDataArrayPaths_Key);

auto pTriangleGeometryPath = filterArgs.value<DataPath>(k_CreatedTriangleGeometryPath_Key);
auto pVertexGroupDataName = filterArgs.value<std::string>(k_VertexDataGroupName_Key);
Expand Down Expand Up @@ -162,17 +162,17 @@ IFilter::PreflightResult SurfaceNetsFilter::preflightImpl(const DataStructure& d
resultOutputActions.value().appendAction(std::move(createArrayAction));
}

for(const auto& selectedDataPath : pSelectedDataArrayPaths)
{
DataPath createdDataPath = pFaceGroupDataPath.createChildPath(selectedDataPath.getTargetName());
const auto& iDataArray = dataStructure.getDataRefAs<IDataArray>(selectedDataPath);
auto compShape = iDataArray.getComponentShape();
// Double the size of the DataArray because we need the value from both sides of the triangle.
compShape.insert(compShape.begin(), 2);

auto createArrayAction = std::make_unique<CreateArrayAction>(iDataArray.getDataType(), std::vector<usize>{numElements}, compShape, createdDataPath, dataStoreFormat);
resultOutputActions.value().appendAction(std::move(createArrayAction));
}
// for(const auto& selectedDataPath : pSelectedDataArrayPaths)
// {
// DataPath createdDataPath = pFaceGroupDataPath.createChildPath(selectedDataPath.getTargetName());
// const auto& iDataArray = dataStructure.getDataRefAs<IDataArray>(selectedDataPath);
// auto compShape = iDataArray.getComponentShape();
// // Double the size of the DataArray because we need the value from both sides of the triangle.
// compShape.insert(compShape.begin(), 2);
//
// auto createArrayAction = std::make_unique<CreateArrayAction>(iDataArray.getDataType(), std::vector<usize>{numElements}, compShape, createdDataPath, dataStoreFormat);
// resultOutputActions.value().appendAction(std::move(createArrayAction));
// }

{
auto faceFeatureAttributeMatrixName = filterArgs.value<DataObjectNameParameter::ValueType>(k_FaceFeatureAttributeMatrixName_Key);
Expand All @@ -197,7 +197,7 @@ Result<> SurfaceNetsFilter::executeImpl(DataStructure& dataStructure, const Argu

inputValues.GridGeomDataPath = filterArgs.value<DataPath>(k_GridGeometryDataPath_Key);
inputValues.FeatureIdsArrayPath = filterArgs.value<DataPath>(k_CellFeatureIdsArrayPath_Key);
inputValues.SelectedDataArrayPaths = filterArgs.value<MultiArraySelectionParameter::ValueType>(k_SelectedDataArrayPaths_Key);
// inputValues.SelectedDataArrayPaths = filterArgs.value<MultiArraySelectionParameter::ValueType>(k_SelectedDataArrayPaths_Key);
inputValues.TriangleGeometryPath = filterArgs.value<DataPath>(k_CreatedTriangleGeometryPath_Key);
inputValues.VertexGroupDataPath = inputValues.TriangleGeometryPath.createChildPath(filterArgs.value<std::string>(k_VertexDataGroupName_Key));
inputValues.NodeTypesDataPath = inputValues.VertexGroupDataPath.createChildPath(filterArgs.value<std::string>(k_NodeTypesArrayName_Key));
Expand Down
24 changes: 12 additions & 12 deletions src/Plugins/SimplnxCore/test/SurfaceNetsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: NO Smoothing", "[SimplnxCore][Surface
const DataPath gridGeomDataPath({k_DataContainer});
args.insertOrAssign(SurfaceNetsFilter::k_GridGeometryDataPath_Key, std::make_any<DataPath>(gridGeomDataPath));
args.insertOrAssign(SurfaceNetsFilter::k_CellFeatureIdsArrayPath_Key, std::make_any<DataPath>(featureIdsDataPath));
const MultiArraySelectionParameter::ValueType selectedArrayPaths = {ebsdSanDataPath.createChildPath("BoundaryCells"), ebsdSanDataPath.createChildPath("ConfidenceIndex"),
ebsdSanDataPath.createChildPath("IPFColors")};

args.insertOrAssign(SurfaceNetsFilter::k_SelectedDataArrayPaths_Key, std::make_any<MultiArraySelectionParameter::ValueType>(selectedArrayPaths));
// const MultiArraySelectionParameter::ValueType selectedArrayPaths = {ebsdSanDataPath.createChildPath("BoundaryCells"), ebsdSanDataPath.createChildPath("ConfidenceIndex"),
// ebsdSanDataPath.createChildPath("IPFColors")};
//
// args.insertOrAssign(SurfaceNetsFilter::k_SelectedDataArrayPaths_Key, std::make_any<MultiArraySelectionParameter::ValueType>(selectedArrayPaths));

args.insertOrAssign(SurfaceNetsFilter::k_CreatedTriangleGeometryPath_Key, std::make_any<DataPath>(triangleGeometryPath));

Expand All @@ -63,11 +63,11 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: NO Smoothing", "[SimplnxCore][Surface

// Preflight the filter and check result
auto preflightResult = filter.preflight(dataStructure, args);
REQUIRE(preflightResult.outputActions.valid());
SIMPLNX_RESULT_REQUIRE_VALID(preflightResult.outputActions)

// Execute the filter and check the result
auto executeResult = filter.execute(dataStructure, args);
REQUIRE(executeResult.result.valid());
SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result)

// Check a few things about the generated data.
TriangleGeom& triangleGeom = dataStructure.getDataRefAs<TriangleGeom>(triangleGeometryPath);
Expand Down Expand Up @@ -119,10 +119,10 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: With Smoothing", "[SimplnxCore][Surfa
args.insertOrAssign(SurfaceNetsFilter::k_GridGeometryDataPath_Key, std::make_any<DataPath>(gridGeomDataPath));
args.insertOrAssign(SurfaceNetsFilter::k_CellFeatureIdsArrayPath_Key, std::make_any<DataPath>(featureIdsDataPath));

MultiArraySelectionParameter::ValueType const selectedArrayPaths = {ebsdSanDataPath.createChildPath("BoundaryCells"), ebsdSanDataPath.createChildPath("ConfidenceIndex"),
ebsdSanDataPath.createChildPath("IPFColors")};

args.insertOrAssign(SurfaceNetsFilter::k_SelectedDataArrayPaths_Key, std::make_any<MultiArraySelectionParameter::ValueType>(selectedArrayPaths));
// MultiArraySelectionParameter::ValueType const selectedArrayPaths = {ebsdSanDataPath.createChildPath("BoundaryCells"), ebsdSanDataPath.createChildPath("ConfidenceIndex"),
// ebsdSanDataPath.createChildPath("IPFColors")};
//
// args.insertOrAssign(SurfaceNetsFilter::k_SelectedDataArrayPaths_Key, std::make_any<MultiArraySelectionParameter::ValueType>(selectedArrayPaths));

args.insertOrAssign(SurfaceNetsFilter::k_CreatedTriangleGeometryPath_Key, std::make_any<DataPath>(triangleGeometryPath));

Expand All @@ -140,11 +140,11 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: With Smoothing", "[SimplnxCore][Surfa

// Preflight the filter and check result
auto preflightResult = filter.preflight(dataStructure, args);
REQUIRE(preflightResult.outputActions.valid());
SIMPLNX_RESULT_REQUIRE_VALID(preflightResult.outputActions)

// Execute the filter and check the result
auto executeResult = filter.execute(dataStructure, args);
REQUIRE(executeResult.result.valid());
SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result)

// Check a few things about the generated data.
TriangleGeom& triangleGeom = dataStructure.getDataRefAs<TriangleGeom>(triangleGeometryPath);
Expand Down

0 comments on commit b77ed3c

Please sign in to comment.