From 3086358389a36437040fc104c82c93454dae0243 Mon Sep 17 00:00:00 2001 From: dekken Date: Mon, 3 May 2021 10:18:07 +0200 Subject: [PATCH] comments/cleanup --- res/cmake/dep/highfive.cmake | 1 - res/cmake/test.cmake | 3 +-- .../maxwellian_particle_initializer.h | 3 +-- src/core/data/particles/particle_packer.h | 5 +++-- src/core/data/particles/particle_utilities.h | 2 +- src/core/numerics/interpolator/interpolator.h | 8 ++++---- src/diagnostic/detail/types/particle.h | 12 +++++++----- tests/core/data/particles/test_main.cpp | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/res/cmake/dep/highfive.cmake b/res/cmake/dep/highfive.cmake index 1b2cc9745..40b6baa84 100644 --- a/res/cmake/dep/highfive.cmake +++ b/res/cmake/dep/highfive.cmake @@ -30,7 +30,6 @@ if(HighFive) set(HIGHFIVE_USE_BOOST OFF) set(HIGHFIVE_BUILD_DOCS OFF) # conflicts with phare doc target set(HIGHFIVE_EXAMPLES OFF) - set(HIGHFIVE_PARALLEL_HDF5 ON) # causes failure if cannot occure add_subdirectory(${HIGHFIVE_SRC}) message("HighFive enabled - checking HDF5") diff --git a/res/cmake/test.cmake b/res/cmake/test.cmake index 827c8dc72..05c994f2f 100644 --- a/res/cmake/test.cmake +++ b/res/cmake/test.cmake @@ -22,8 +22,6 @@ # if level >= PHARE_EXEC_LEVEL_MIN AND level <= PHARE_EXEC_LEVEL_MAX # -# this define breaks pgcc / and appears unnecessary -# sed -i 's/# define GTEST_CAN_STREAM_RESULTS_ 1/# define GTEST_CAN_STREAM_RESULTS_ 0/g' subprojects/googletest/googletest/include/gtest/internal/gtest-port.h if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests @@ -36,6 +34,7 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests function(set_exe_paths_ binary) set_property(TEST ${binary} PROPERTY ENVIRONMENT "PYTHONPATH=${PHARE_PYTHONPATH}") + set_property(TEST ${binary} APPEND PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}") endfunction(set_exe_paths_) function(add_phare_test_ binary) diff --git a/src/core/data/ions/particle_initializers/maxwellian_particle_initializer.h b/src/core/data/ions/particle_initializers/maxwellian_particle_initializer.h index df0424ffa..4db25fb73 100644 --- a/src/core/data/ions/particle_initializers/maxwellian_particle_initializer.h +++ b/src/core/data/ions/particle_initializers/maxwellian_particle_initializer.h @@ -57,8 +57,7 @@ class MaxwellianParticleInitializer : public ParticleInitializer packer_keys() { + // The order of this array must match the tuple order of ParticlePacker::get(particle) return {"weight", "charge", "iCell", "delta", "v"}; } diff --git a/src/core/data/particles/particle_utilities.h b/src/core/data/particles/particle_utilities.h index 1f07b4e21..f32f38eb6 100644 --- a/src/core/data/particles/particle_utilities.h +++ b/src/core/data/particles/particle_utilities.h @@ -23,7 +23,7 @@ namespace core auto origin = layout.origin(); auto startIndexes = layout.physicalStartIndex(QtyCentering::primal); auto meshSize = layout.meshSize(); - auto iCell = layout.AMRToLocal(particle.iCell); + auto iCell = layout.AMRToLocal(Point{particle.iCell}); for (auto iDim = 0u; iDim < GridLayout::dimension; ++iDim) { diff --git a/src/core/numerics/interpolator/interpolator.h b/src/core/numerics/interpolator/interpolator.h index cae58400f..d15f45202 100644 --- a/src/core/numerics/interpolator/interpolator.h +++ b/src/core/numerics/interpolator/interpolator.h @@ -534,7 +534,7 @@ namespace core auto indexAndWeightDual = [this, &layout](auto const& part) { for (auto iDim = 0u; iDim < dimension; ++iDim) { - auto iCell = layout.AMRToLocal(part.iCell); + auto iCell = layout.AMRToLocal(Point{part.iCell}); double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder); startIndex_[centering2int(QtyCentering::dual)][iDim] @@ -550,7 +550,7 @@ namespace core auto indexAndWeightPrimal = [this, &layout](auto const& part) { for (auto iDim = 0u; iDim < dimension; ++iDim) { - auto iCell = layout.AMRToLocal(part.iCell); + auto iCell = layout.AMRToLocal(Point{part.iCell}); double normalizedPos = iCell[iDim] + part.delta[iDim]; startIndex_[centering2int(QtyCentering::primal)][iDim] @@ -623,7 +623,7 @@ namespace core auto indexAndWeightDual = [this, &layout](auto const& part) { for (auto iDim = 0u; iDim < dimension; ++iDim) { - auto iCell = layout.AMRToLocal(part.iCell); + auto iCell = layout.AMRToLocal(Point{part.iCell}); double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder); startIndex_[centering2int(QtyCentering::dual)][iDim] @@ -639,7 +639,7 @@ namespace core auto indexAndWeightPrimal = [this, &layout](auto const& part) { for (auto iDim = 0u; iDim < dimension; ++iDim) { - auto iCell = layout.AMRToLocal(part.iCell); + auto iCell = layout.AMRToLocal(Point{part.iCell}); double normalizedPos = iCell[iDim] + part.delta[iDim]; startIndex_[centering2int(QtyCentering::primal)][iDim] diff --git a/src/diagnostic/detail/types/particle.h b/src/diagnostic/detail/types/particle.h index 48c7cc18a..5bbf1535f 100644 --- a/src/diagnostic/detail/types/particle.h +++ b/src/diagnostic/detail/types/particle.h @@ -62,6 +62,10 @@ class ParticlesDiagnosticWriter : public H5TypeWriter DiagnosticProperties&, Attributes&, std::unordered_map>>&, std::size_t maxLevel) override; + +private: + // PGI compiler (nvc++ 21.3-0) doesn't like static initializations of arrays + std::array packer_keys_ = core::packer_keys(); }; @@ -94,7 +98,7 @@ void ParticlesDiagnosticWriter::getDataSetInfo(DiagnosticProperties& d auto particleInfo = [&](auto& attr, auto& particles) { std::size_t part_idx = 0; - auto keys = core::packer_keys(); + auto const& keys = packer_keys_; core::apply(Packer::empty(), [&](auto const& arg) { attr[keys[part_idx]] = getSize(arg) * particles.size(); ++part_idx; @@ -141,9 +145,7 @@ void ParticlesDiagnosticWriter::initDataSets( std::string path{h5Writer_.getPatchPathAddTimestamp(lvl, patchID) + "/"}; std::size_t part_idx = 0; core::apply(Packer::empty(), [&](auto const& arg) { - auto keys = core::packer_keys(); - // PGI compiler doesn't like static array initializations - assert(keys[part_idx].size() > 0); + auto const& keys = packer_keys_; createDataSet(path + keys[part_idx], null ? 0 : attr[keys[part_idx]].template to(), arg); ++part_idx; @@ -183,7 +185,7 @@ void ParticlesDiagnosticWriter::write(DiagnosticProperties& diagnostic core::ContiguousParticles copy{particles.size()}; packer.pack(copy); - auto keys = core::packer_keys(); + auto const& keys = packer_keys_; h5Writer.writeDataSet(h5file, path + keys[0], copy.weight.data()); h5Writer.writeDataSet(h5file, path + keys[1], copy.charge.data()); h5Writer.writeDataSet(h5file, path + keys[2], copy.iCell.data()); diff --git a/tests/core/data/particles/test_main.cpp b/tests/core/data/particles/test_main.cpp index 3ea38419c..b58a908aa 100644 --- a/tests/core/data/particles/test_main.cpp +++ b/tests/core/data/particles/test_main.cpp @@ -92,7 +92,7 @@ TEST_F(AParticle, CanBeReducedToAnAbsolutePositionPoint) GridLayout> layout{meshSize, nbrCells, origin, Box{Point{40, 60, 80}, Point{59, 89, 119}}}; - auto iCell = layout.AMRToLocal(part.iCell); + auto iCell = layout.AMRToLocal(Point{part.iCell}); auto p = positionAsPoint(part, layout); auto startIndexes = layout.physicalStartIndex(QtyCentering::primal); auto expectedPosition = Point{};