Skip to content

Commit

Permalink
comments/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed May 3, 2021
1 parent 8fa6529 commit fcd20eb
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
1 change: 0 additions & 1 deletion res/cmake/dep/highfive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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")
Expand Down
3 changes: 1 addition & 2 deletions res/cmake/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class MaxwellianParticleInitializer : public ParticleInitializer<ParticleArray,


/**
* @brief load pacore
} // namespace PHARErticles in a ParticleArray in a domain defined by the given layout
* @brief load particles in a ParticleArray in a domain defined by the given layout
*/
void loadParticles(ParticleArray& particles, GridLayout const& layout) const override;

Expand Down
5 changes: 3 additions & 2 deletions src/core/data/particles/particle_packer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

namespace PHARE::core
{
// PGI compiler doesn't (didn't at least) like static initializations of arrays, would result in an
// empty string
// PGI compiler (nvc++ 21.3-0) doesn't like static initializations of arrays,
// would result in empty strings
inline std::array<std::string, 5> packer_keys()
{
// The order of this array must match the tuple order of ParticlePacker::get(particle)
return {"weight", "charge", "iCell", "delta", "v"};
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/numerics/interpolator/interpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, dim>{part.iCell});
double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder);

startIndex_[centering2int(QtyCentering::dual)][iDim]
Expand All @@ -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<int, dim>{part.iCell});
double normalizedPos = iCell[iDim] + part.delta[iDim];

startIndex_[centering2int(QtyCentering::primal)][iDim]
Expand Down Expand Up @@ -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<int, dim>{part.iCell});
double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder);

startIndex_[centering2int(QtyCentering::dual)][iDim]
Expand All @@ -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<int, dim>{part.iCell});
double normalizedPos = iCell[iDim] + part.delta[iDim];

startIndex_[centering2int(QtyCentering::primal)][iDim]
Expand Down
12 changes: 7 additions & 5 deletions src/diagnostic/detail/types/particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class ParticlesDiagnosticWriter : public H5TypeWriter<H5Writer>
DiagnosticProperties&, Attributes&,
std::unordered_map<std::size_t, std::vector<std::pair<std::string, Attributes>>>&,
std::size_t maxLevel) override;

private:
// PGI compiler (nvc++ 21.3-0) doesn't like static initializations of arrays
std::array<std::string, 5> packer_keys_ = core::packer_keys();
};


Expand Down Expand Up @@ -95,7 +99,7 @@ void ParticlesDiagnosticWriter<H5Writer>::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;
Expand Down Expand Up @@ -142,9 +146,7 @@ void ParticlesDiagnosticWriter<H5Writer>::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<std::size_t>(), arg);
++part_idx;
Expand Down Expand Up @@ -184,7 +186,7 @@ void ParticlesDiagnosticWriter<H5Writer>::write(DiagnosticProperties& diagnostic
core::ContiguousParticles<dimension> 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());
Expand Down
2 changes: 1 addition & 1 deletion tests/core/data/particles/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEST_F(AParticle, CanBeReducedToAnAbsolutePositionPoint)
GridLayout<GridLayoutImplYee<3, 1>> layout{meshSize, nbrCells, origin,
Box{Point{40, 60, 80}, Point{59, 89, 119}}};

auto iCell = layout.AMRToLocal(part.iCell);
auto iCell = layout.AMRToLocal(Point<int, 3>{part.iCell});
auto p = positionAsPoint(part, layout);
auto startIndexes = layout.physicalStartIndex(QtyCentering::primal);
auto expectedPosition = Point<double, 3>{};
Expand Down

0 comments on commit fcd20eb

Please sign in to comment.