From e49f5ac48659b0470a06125128b8982de047da9d Mon Sep 17 00:00:00 2001 From: Massimiliano Date: Mon, 24 Oct 2022 19:55:46 -0400 Subject: [PATCH] Cleaning up --- .../include/Neon/core/tools/io/IODense_imp.h | 6 +++--- .../include/Neon/core/tools/io/exportVTI.h | 2 +- .../include/Neon/core/tools/io/ioToVti.h | 4 ++-- .../unit/coreUt_io/src/coreUt_io.dense.cpp | 3 +-- .../domain-unit-test-map/src/TestInformation.h | 4 +++- .../src/RunHelper.h | 13 +++++++------ .../src/TestInformation.h | 18 ++++++++++++++++++ .../src/staggeredGrid.cpp | 14 +++++++++----- libNeonSys/include/Neon/sys/memory/memConf.h | 2 +- 9 files changed, 45 insertions(+), 21 deletions(-) create mode 100644 libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h diff --git a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h index f8c2a355..8b5da32e 100644 --- a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h +++ b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h @@ -56,10 +56,10 @@ IODense::IODense(const Integer_3d& d, template -IODense::IODense(const Integer_3d& d, - int c, +IODense::IODense(const Integer_3d& d, + int c, const std::function&, int cardinality)>& fun) - : mSpace(d), mCardinality(c), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun) + : mSpace(d), mCardinality(c), mOrder(), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun) { initPitch(); diff --git a/libNeonCore/include/Neon/core/tools/io/exportVTI.h b/libNeonCore/include/Neon/core/tools/io/exportVTI.h index 246c1e5a..4509de82 100644 --- a/libNeonCore/include/Neon/core/tools/io/exportVTI.h +++ b/libNeonCore/include/Neon/core/tools/io/exportVTI.h @@ -1104,7 +1104,7 @@ class vtiOutput_t interlivingError = interlivingError || ((!isNode) && m_voxelSectionDone); if (interlivingError) { std::string msg = std::string( - "VoxelGeneric and NodeGeneric data can not be interleaved in the same VTI file. Pleas add " + "Voxel and Node data can not be interleaved in the same VTI file. Pleas add " "first all the data for one of the two, then add the remaining one."); throw std::runtime_error(msg); } diff --git a/libNeonCore/include/Neon/core/tools/io/ioToVti.h b/libNeonCore/include/Neon/core/tools/io/ioToVti.h index d71b2e5d..1152dcd5 100644 --- a/libNeonCore/include/Neon/core/tools/io/ioToVti.h +++ b/libNeonCore/include/Neon/core/tools/io/ioToVti.h @@ -628,7 +628,7 @@ template if (!(voxSpace == (nodeSpace - 1))) { NeonException exception("ioToVTI"); - exception << "Inconsistent data. NodeGeneric space dimension should be bigger than voxel of one unit."; + exception << "Inconsistent data. Node space dimension should be bigger than voxel of one unit."; NEON_THROW(exception); } @@ -679,7 +679,7 @@ void ioToVTI(const std::vector>& gridsInfo, using namespace internal_implicit::ns_help_write_vti; if (!(voxSpace == (nodeSpace - 1))) { NeonException exception("ioToVTI"); - exception << "Inconsistent data. NodeGeneric space dimension should be bigger than voxel of one unit."; + exception << "Inconsistent data. Node space dimension should be bigger than voxel of one unit."; NEON_THROW(exception); } diff --git a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp index 261f8bc4..346ee231 100644 --- a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp +++ b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp @@ -73,5 +73,4 @@ TEST(coreUt_io, denseDiffRandom) ASSERT_EQ(maxDiff.z, id.z); ASSERT_EQ(maxCard, card); } - A.ioVtk("A", "A"); -} \ No newline at end of file +} diff --git a/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h b/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h index cb96dc7d..3ac50ecd 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h +++ b/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h @@ -2,12 +2,14 @@ namespace { struct TestInformation { - static auto prefix() -> std::string + static auto prefix() + -> std::string { return "domain-unit-test-map"; } static auto fullName(const std::string& gridName) + -> std::string { return prefix() + "-" + gridName; } diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h index e354a164..f5fdd993 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h @@ -21,7 +21,7 @@ using namespace Neon::domain::tool::testing; using namespace Neon::domain::tool; template -void runAllTestConfiguration(const std::string& , +void runAllTestConfiguration(const std::string&, std::function&)> f, int nGpus, int minNumGpus) @@ -33,12 +33,12 @@ void runAllTestConfiguration(const std::string& , } // std::vector nGpuTest{2,4,6,8}; std::vector cardinalityTest{1}; - //nGpuTest = std::vector(1,1); + // nGpuTest = std::vector(1,1); - std::vector dimTest{{60, 10, 250}, {10, 50, 40}}; + std::vector dimTest{{60, 10, 250}, {10, 50, 80}}; std::vector runtimeE{Neon::Runtime::openmp, Neon::Runtime::stream}; - //std::vector dimTest{{3}}; - //std::vector runtimeE{Neon::Runtime::stream}; + // std::vector dimTest{{3}}; + // std::vector runtimeE{Neon::Runtime::stream}; std::vector geos; @@ -66,7 +66,8 @@ void runAllTestConfiguration(const std::string& , ids.push_back(i % maxnGPUs); } - Neon::Backend backend(ids, runtime); + Neon::Backend backend(ids, runtime); + NEON_INFO("{}",backend.toString()); Neon::MemoryOptions memoryOptions = backend.getMemoryOptions(); TestData testData(backend, diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h new file mode 100644 index 00000000..46051bc4 --- /dev/null +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h @@ -0,0 +1,18 @@ +#pragma once +namespace { +struct TestInformation +{ + static auto prefix() + -> std::string + { + return "domain-unit-test-staggered-grid"; + } + + static auto fullName(const std::string& gridName, + const std::string& subTestName) + -> std::string + { + return prefix() + "-" +subTestName+"-"+ gridName; + } +}; +} // namespace \ No newline at end of file diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp index bb7071d0..3f28187c 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp @@ -7,12 +7,11 @@ #include "containers.h" #include "Neon/domain/StaggeredGrid.h" +#include "TestInformation.h" #define EXECUTE_IO_TO_VTK 0 using namespace Neon::domain::tool::testing; -static const std::string testFilePrefix("domain-unit-test-staggered-grid"); - template void StaggeredGrid_Map(TestData& data) @@ -51,7 +50,8 @@ void StaggeredGrid_Map(TestData& data) temperature.updateCompute(Neon::Backend::mainStreamIdx); density.updateCompute(Neon::Backend::mainStreamIdx); - const std::string appName(testFilePrefix + "_Map_" + data.getGrid().getImplementationName()); + const std::string appName = TestInformation::fullName("_map_", data.getGrid().getImplementationName()); + if constexpr (EXECUTE_IO_TO_VTK == 1) { temperature.ioToVtk(appName + "-temperature_asVoxels", "temperature", false, Neon::IoFileType::ASCII, false); density.ioToVtk(appName + "-density_0000", "density"); @@ -98,12 +98,16 @@ template void StaggeredGrid_VoxToNodes(TestData& data) { // - Neon::int32_3d dims{3, 2, 4}; + Neon::int32_3d voxDim = [&] { + auto dim = data.getGrid().getDimension(); + return dim; + }(); + std::vector empty; using FeaGrid = Neon::domain::internal::experimental::staggeredGrid::StaggeredGrid; FeaGrid FEA( data.getBackend(), - dims, + voxDim, [](const Neon::index_3d&) -> bool { return true; }); diff --git a/libNeonSys/include/Neon/sys/memory/memConf.h b/libNeonSys/include/Neon/sys/memory/memConf.h index 0030323c..f07667e3 100644 --- a/libNeonSys/include/Neon/sys/memory/memConf.h +++ b/libNeonSys/include/Neon/sys/memory/memConf.h @@ -179,7 +179,7 @@ struct [[deprecated("This feature is going to be replaced by a new API for Neon * * @return */ - auto padding() const->const Neon::memLayout_et:: padding_e& + auto padding() const->const Neon::memLayout_et::padding_e& { return m_paddingEt; }