Skip to content

Commit

Permalink
Fixed unit test errors
Browse files Browse the repository at this point in the history
* Enabled disabled unit tests
* Remove added debug print statements
  • Loading branch information
mmarineBlueQuartz authored and imikejackson committed Jun 27, 2024
1 parent e19fb70 commit aced6b0
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct MapPointCloudDataByKernelFunctor
continue;
}
index = (z * dims[1] * dims[0]) + (y * dims[0]) + x;
interpolatedDataPtr->addEntry(index, kernelVals[counter] * inputData[vertIdx]);
interpolatedDataPtr->addEntry(index, kernelVals[counter] * inputData.at(vertIdx));
counter++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include <catch2/catch.hpp>

#include <xtensor/xio.hpp>

#include <filesystem>
#include <iostream>
#include <string>
Expand Down Expand Up @@ -723,13 +721,6 @@ TEST_CASE("SimplnxCore::ApplyTransformationToGeometryFilter:Precomputed_Image_NN
const auto& exemplarData = dataStructure.getDataRefAs<IDataArray>(exemplarPath);
const auto& calculatedData = dataStructure.getDataRefAs<IDataArray>(calculatedPath);

{
const auto& exemplarArr = dataStructure.getDataRefAs<DataArray<int32>>(exemplarPath);
std::cout << "ApplyTransformationToGeometryFilter: Exemplar: " << exemplarArr.getDataStoreRef().xarray() << std::endl;

const auto& calculatedDataArr = dataStructure.getDataRefAs<DataArray<int32>>(calculatedPath);
std::cout << "ApplyTransformationToGeometryFilter: Data: " << calculatedDataArr.getDataStoreRef().xarray() << std::endl;
}
UnitTest::CompareDataArrays<int32>(exemplarData, calculatedData);
}
}
112 changes: 55 additions & 57 deletions src/Plugins/SimplnxCore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ set(${PLUGIN_NAME}UnitTest_SRCS
CreateAMScanPathsTest.cpp
SliceTriangleGeometryTest.cpp
# ReadDeformKeyFileV12Test.cpp
# AddBadDataTest.cpp
# AlignGeometriesTest.cpp
# AlignSectionsFeatureCentroidTest.cpp
# AlignSectionsListTest.cpp
# AppendImageGeometryZSliceTest.cpp
AddBadDataTest.cpp
AlignGeometriesTest.cpp
AlignSectionsFeatureCentroidTest.cpp
AlignSectionsListTest.cpp
AppendImageGeometryZSliceTest.cpp
ApplyTransformationToGeometryTest.cpp
ApproximatePointCloudHullTest.cpp
ArrayCalculatorTest.cpp
Expand Down Expand Up @@ -83,59 +83,57 @@ set(${PLUGIN_NAME}UnitTest_SRCS
InitializeDataTest.cpp
InitializeImageGeomCellDataTest.cpp
InterpolatePointCloudToRegularGridTest.cpp

# IterativeClosestPointTest.cpp
# LabelTriangleGeometryTest.cpp
# LaplacianSmoothingFilterTest.cpp
# MapPointCloudToRegularGridTest.cpp
# RequireMinNumNeighborsTest.cpp
# MoveDataTest.cpp
# MultiThresholdObjectsTest.cpp
# NearestPointFuseRegularGridsTest.cpp
# PartitionGeometryTest.cpp
# PipelineTest.cpp
# PointSampleTriangleGeometryFilterTest.cpp
# QuickSurfaceMeshFilterTest.cpp
# ReadBinaryCTNorthstarTest.cpp
# ReadCSVFileTest.cpp
# ReadHDF5DatasetTest.cpp
# ReadRawBinaryTest.cpp
# ReadStlFileTest.cpp
# ReadTextDataArrayTest.cpp
# ReadVolumeGraphicsFileTest.cpp
# ReadVtkStructuredPointsTest.cpp
# RegularGridSampleSurfaceMeshTest.cpp
# RemoveFlaggedFeaturesTest.cpp
# RemoveFlaggedTrianglesTest.cpp
# RemoveFlaggedVerticesTest.cpp
# RequireMinimumSizeFeaturesTest.cpp
# RenameDataObjectTest.cpp
# ReplaceElementAttributesWithNeighborValuesTest.cpp
IterativeClosestPointTest.cpp
LabelTriangleGeometryTest.cpp
LaplacianSmoothingFilterTest.cpp
MapPointCloudToRegularGridTest.cpp
RequireMinNumNeighborsTest.cpp
MoveDataTest.cpp
MultiThresholdObjectsTest.cpp
NearestPointFuseRegularGridsTest.cpp
PartitionGeometryTest.cpp
PipelineTest.cpp
PointSampleTriangleGeometryFilterTest.cpp
QuickSurfaceMeshFilterTest.cpp
ReadBinaryCTNorthstarTest.cpp
ReadCSVFileTest.cpp
ReadHDF5DatasetTest.cpp
ReadRawBinaryTest.cpp
ReadStlFileTest.cpp
ReadTextDataArrayTest.cpp
ReadVolumeGraphicsFileTest.cpp
ReadVtkStructuredPointsTest.cpp
RegularGridSampleSurfaceMeshTest.cpp
RemoveFlaggedFeaturesTest.cpp
RemoveFlaggedTrianglesTest.cpp
RemoveFlaggedVerticesTest.cpp
RequireMinimumSizeFeaturesTest.cpp
RenameDataObjectTest.cpp
ReplaceElementAttributesWithNeighborValuesTest.cpp
ResampleImageGeomTest.cpp

# ResampleRectGridToImageGeomTest.cpp
# ReverseTriangleWindingTest.cpp
# RobustAutomaticThresholdTest.cpp
# RotateSampleRefFrameTest.cpp
# ScalarSegmentFeaturesFilterTest.cpp
# SetImageGeomOriginScalingFilterTest.cpp
# SharedFeatureFaceTest.cpp
# SilhouetteTest.cpp
# SplitAttributeArrayTest.cpp
# SurfaceNetsTest.cpp
# TriangleCentroidTest.cpp
# TriangleDihedralAngleFilterTest.cpp
# TriangleNormalFilterTest.cpp
# UncertainRegularGridSampleSurfaceMeshTest.cpp
# WriteAbaqusHexahedronTest.cpp
# WriteASCIIDataTest.cpp
# WriteAvizoRectilinearCoordinateTest.cpp
# WriteAvizoUniformCoordinateTest.cpp
# WriteBinaryDataTest.cpp
# WriteFeatureDataCSVTest.cpp
# WriteLosAlamosFFTTest.cpp
# WriteStlFileTest.cpp
# WriteVtkRectilinearGridTest.cpp
ResampleRectGridToImageGeomTest.cpp
ReverseTriangleWindingTest.cpp
RobustAutomaticThresholdTest.cpp
RotateSampleRefFrameTest.cpp
ScalarSegmentFeaturesFilterTest.cpp
SetImageGeomOriginScalingFilterTest.cpp
SharedFeatureFaceTest.cpp
SilhouetteTest.cpp
SplitAttributeArrayTest.cpp
SurfaceNetsTest.cpp
TriangleCentroidTest.cpp
TriangleDihedralAngleFilterTest.cpp
TriangleNormalFilterTest.cpp
UncertainRegularGridSampleSurfaceMeshTest.cpp
WriteAbaqusHexahedronTest.cpp
WriteASCIIDataTest.cpp
WriteAvizoRectilinearCoordinateTest.cpp
WriteAvizoUniformCoordinateTest.cpp
WriteBinaryDataTest.cpp
WriteFeatureDataCSVTest.cpp
WriteLosAlamosFFTTest.cpp
WriteStlFileTest.cpp
WriteVtkRectilinearGridTest.cpp
)

create_simplnx_plugin_unit_test(PLUGIN_NAME ${PLUGIN_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#include <catch2/catch.hpp>

#include <xtensor/xio.hpp>

#include <string>

namespace fs = std::filesystem;
Expand Down Expand Up @@ -118,9 +116,6 @@ TEST_CASE("SimplnxCore::InterpolatePointCloudToRegularGridFilter: Valid Filter E
auto executeResult = filter.execute(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result)

const auto& neighborList = dataStructure.getDataRefAs<NeighborList<float64>>(k_GaussianFaceAreasComputed);
std::cout << "InterpolatePointCloudToRegularGridFilter: " << neighborList.getStore()->xarray() << std::endl;

UnitTest::CompareNeighborLists<float64>(dataStructure, k_GaussianFaceAreasExemplar, k_GaussianFaceAreasComputed);
UnitTest::CompareNeighborLists<uint64>(dataStructure, k_GaussianVoxelIndicesExemplar, k_GaussianVoxelIndicesComputed);
UnitTest::CompareNeighborLists<float32>(dataStructure, k_GaussianKernalDistancesExemplar, k_GaussianKernalDistancesComputed);
Expand Down
2 changes: 0 additions & 2 deletions src/Plugins/SimplnxCore/test/ResampleImageGeomTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#include <catch2/catch.hpp>

#include <xtensor/xio.hpp>

#include <filesystem>

namespace fs = std::filesystem;
Expand Down
13 changes: 11 additions & 2 deletions src/simplnx/DataStructure/AbstractDataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define NOMINMAX

#include <xtensor/xarray.hpp>
#include <xtensor/xchunked_array.hpp>
#include <xtensor/xstrides.hpp>

#include <nonstd/span.hpp>
Expand Down Expand Up @@ -38,7 +39,7 @@ class AbstractDataStore : public IDataStore
using const_reference = const T&;
using ShapeType = typename IDataStore::ShapeType;
using index_type = uint64;
using XArrayType = typename xt::xarray<T, xt::layout_type::row_major>;
using XArrayType = typename xt::xarray<T>;
using Iterator = typename XArrayType::iterator;
using ConstIterator = typename XArrayType::const_iterator;

Expand Down Expand Up @@ -240,7 +241,6 @@ class AbstractDataStore : public IDataStore
totalSrcTuples * sourceNumComponents, destTupleOffset * numComponents, getSize()));
}

return {};
auto srcBegin = source.begin() + (srcTupleOffset * sourceNumComponents);
auto srcEnd = srcBegin + (totalSrcTuples * sourceNumComponents);
auto dstBegin = begin() + (destTupleOffset * numComponents);
Expand Down Expand Up @@ -401,6 +401,15 @@ class AbstractDataStore : public IDataStore
* @brief Default constructor
*/
AbstractDataStore() = default;
AbstractDataStore(const AbstractDataStore& other)
: IDataStore(other)
{
}

AbstractDataStore(AbstractDataStore&& other)
: IDataStore(std::move(other))
{
}

mutable std::mutex m_Mutex;
};
Expand Down
9 changes: 4 additions & 5 deletions src/simplnx/DataStructure/AbstractListStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ class AbstractListStore
{
usize listSize = getListSize(grainId);
usize interalListSize = xtensorListSize();
if(listSize >= interalListSize + 1)
if(listSize + 1 >= interalListSize)
{
interalListSize *= 2;
interalListSize = listSize + 2;
setXtensorListSize(interalListSize);
}

std::lock_guard<std::mutex> guard(m_Mutex);
uint64 offset = (grainId * interalListSize); // First element is list size
listSize++;

std::lock_guard<std::mutex> guard(m_Mutex);
auto& xarr = xarray();
xarr.flat(offset) = listSize;
xarr.flat(offset + listSize) = value;
Expand Down Expand Up @@ -150,7 +150,6 @@ class AbstractListStore
*/
virtual vector_type getList(int32 grainId) const
{

return copyOfList(grainId);
}

Expand Down Expand Up @@ -414,7 +413,7 @@ class AbstractListStore

uint64 internalCount = xtensorListSize();
uint64 offset = grainId * (internalCount); // First element is list size
xarray().flat(offset) = size;
xarray().flat(offset) = static_cast<T>(size);
}

private:
Expand Down
11 changes: 10 additions & 1 deletion src/simplnx/DataStructure/DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,16 @@ class DataStore : public AbstractDataStore<T>
* @param rhs
* @return
*/
DataStore& operator=(DataStore&& rhs) = default;
DataStore& operator=(DataStore&& rhs)
{
m_ComponentShape = std::move(rhs.m_ComponentShape);
m_TupleShape = std::move(rhs.m_TupleShape);
m_Array = std::move(rhs.m_Array);
m_NumComponents = std::move(rhs.m_NumComponents);
m_NumTuples = std::move(rhs.m_NumTuples);

return *this;
}

~DataStore() override = default;

Expand Down
Loading

0 comments on commit aced6b0

Please sign in to comment.