Skip to content

Commit 5f8d3f3

Browse files
committed
PGI C++ compiling/test passing
1 parent 5a3c7ce commit 5f8d3f3

File tree

15 files changed

+114
-60
lines changed

15 files changed

+114
-60
lines changed

res/cmake/dep/highfive.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ if(HighFive)
2929
)
3030
set(HIGHFIVE_USE_BOOST OFF)
3131
set(HIGHFIVE_BUILD_DOCS OFF) # conflicts with phare doc target
32+
set(HIGHFIVE_EXAMPLES OFF)
33+
set(HIGHFIVE_PARALLEL_HDF5 ON) # causes failure if cannot occure
3234
add_subdirectory(${HIGHFIVE_SRC})
3335

3436
message("HighFive enabled - checking HDF5")

res/cmake/test.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
# if level >= PHARE_EXEC_LEVEL_MIN AND level <= PHARE_EXEC_LEVEL_MAX
2323
#
2424

25+
# this define breaks pgcc / and appears unnecessary
26+
# 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
2527

2628
if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
2729

@@ -34,7 +36,6 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
3436

3537
function(set_exe_paths_ binary)
3638
set_property(TEST ${binary} PROPERTY ENVIRONMENT "PYTHONPATH=${PHARE_PYTHONPATH}")
37-
set_property(TEST ${binary} APPEND PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}")
3839
endfunction(set_exe_paths_)
3940

4041
function(add_phare_test_ binary)

src/amr/tagging/tagger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#ifndef PHARE_TAGGER_H
33
#define PHARE_TAGGER_H
44

5-
#include "physical_models/physical_model.h"
65
#include "amr/types/amr_types.h"
6+
#include "solver/physical_models/physical_model.h"
77

88
#include <memory>
99

src/core/data/grid/gridlayout.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,9 @@ namespace core
757757
* @brief AMRToLocal returns the local index associated with the given AMR one.
758758
* This method only deals with **cell** indexes.
759759
*/
760+
760761
template<typename T>
761-
auto AMRToLocal(Point<T, dimension> AMRPoint) const
762+
auto AMRToLocal(std::array<T, dimension> const& AMRPoint) const
762763
{
763764
static_assert(std::is_integral_v<T>, "Error, must be MeshIndex (integral Point)");
764765
Point<T, dimension> localPoint;
@@ -774,6 +775,12 @@ namespace core
774775
return localPoint;
775776
}
776777

778+
template<typename T>
779+
auto AMRToLocal(Point<T, dimension> AMRPoint) const
780+
{
781+
return AMRToLocal(AMRPoint());
782+
}
783+
777784

778785
/**
779786
* @brief AMRToLocal returns the local Box associated with the given AMR one.

src/core/data/ions/particle_initializers/maxwellian_particle_initializer.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,18 @@ void MaxwellianParticleInitializer<ParticleArray, GridLayout>::loadParticles(
144144
};
145145

146146

147-
auto deltas = [](auto& pos, auto& gen) -> std::array<float, dimension> {
148-
if constexpr (dimension == 1)
149-
return {pos(gen)};
150-
if constexpr (dimension == 2)
151-
return {pos(gen), pos(gen)};
152-
if constexpr (dimension == 3)
153-
return {pos(gen), pos(gen), pos(gen)};
154-
};
147+
// auto deltas = core::ConstArrayFrom()
148+
149+
// [](auto& pos, auto& gen)
150+
// ->std::array<float, dimension>
151+
// {
152+
// if constexpr (dimension == 1)
153+
// return {pos(gen)};
154+
// if constexpr (dimension == 2)
155+
// return {pos(gen), pos(gen)};
156+
// if constexpr (dimension == 3)
157+
// return {pos(gen), pos(gen), pos(gen)};
158+
// };
155159

156160

157161
// in the following two calls,
@@ -197,9 +201,10 @@ void MaxwellianParticleInitializer<ParticleArray, GridLayout>::loadParticles(
197201
if (basis_ == Basis::Magnetic)
198202
particleVelocity = basisTransform(basis, particleVelocity);
199203

200-
particles.emplace_back(Particle{cellWeight, particleCharge_,
201-
AMRCellIndex.template toArray<int>(),
202-
deltas(deltaDistrib, randGen), particleVelocity});
204+
particles.emplace_back(
205+
Particle{cellWeight, particleCharge_, AMRCellIndex.template toArray<int>(),
206+
core::ConstArrayFrom<dimension>([&] { return deltaDistrib(randGen); }),
207+
particleVelocity});
203208
}
204209
}
205210
}

src/core/data/particles/particle_packer.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
namespace PHARE::core
1212
{
13+
inline std::array<std::string, 5> packer_keys()
14+
{
15+
return {"weight", "charge", "iCell", "delta", "v"};
16+
}
17+
1318
template<std::size_t dim>
1419
class ParticlePacker
1520
{
@@ -31,8 +36,6 @@ class ParticlePacker
3136
return get(particle);
3237
}
3338

34-
static auto& keys() { return keys_; }
35-
3639
auto get(std::size_t i) const { return get(particles_[i]); }
3740
bool hasNext() const { return it_ < particles_.size(); }
3841
auto next() { return get(it_++); }
@@ -55,10 +58,10 @@ class ParticlePacker
5558
}
5659
}
5760

61+
5862
private:
5963
ParticleArray<dim> const& particles_;
6064
std::size_t it_ = 0;
61-
static inline std::array<std::string, 5> keys_{"weight", "charge", "iCell", "delta", "v"};
6265
};
6366

6467

src/core/data/particles/particle_utilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace core
2323
auto origin = layout.origin();
2424
auto startIndexes = layout.physicalStartIndex(QtyCentering::primal);
2525
auto meshSize = layout.meshSize();
26-
auto iCell = layout.AMRToLocal(Point{particle.iCell});
26+
auto iCell = layout.AMRToLocal(particle.iCell);
2727

2828
for (auto iDim = 0u; iDim < GridLayout::dimension; ++iDim)
2929
{

src/core/numerics/interpolator/interpolator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ namespace core
534534
auto indexAndWeightDual = [this, &layout](auto const& part) {
535535
for (auto iDim = 0u; iDim < dimension; ++iDim)
536536
{
537-
auto iCell = layout.AMRToLocal(Point{part.iCell});
537+
auto iCell = layout.AMRToLocal(part.iCell);
538538
double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder);
539539

540540
startIndex_[centering2int(QtyCentering::dual)][iDim]
@@ -550,7 +550,7 @@ namespace core
550550
auto indexAndWeightPrimal = [this, &layout](auto const& part) {
551551
for (auto iDim = 0u; iDim < dimension; ++iDim)
552552
{
553-
auto iCell = layout.AMRToLocal(Point{part.iCell});
553+
auto iCell = layout.AMRToLocal(part.iCell);
554554
double normalizedPos = iCell[iDim] + part.delta[iDim];
555555

556556
startIndex_[centering2int(QtyCentering::primal)][iDim]
@@ -623,7 +623,7 @@ namespace core
623623
auto indexAndWeightDual = [this, &layout](auto const& part) {
624624
for (auto iDim = 0u; iDim < dimension; ++iDim)
625625
{
626-
auto iCell = layout.AMRToLocal(Point{part.iCell});
626+
auto iCell = layout.AMRToLocal(part.iCell);
627627
double normalizedPos = iCell[iDim] + part.delta[iDim] + dualOffset(interpOrder);
628628

629629
startIndex_[centering2int(QtyCentering::dual)][iDim]
@@ -639,7 +639,7 @@ namespace core
639639
auto indexAndWeightPrimal = [this, &layout](auto const& part) {
640640
for (auto iDim = 0u; iDim < dimension; ++iDim)
641641
{
642-
auto iCell = layout.AMRToLocal(Point{part.iCell});
642+
auto iCell = layout.AMRToLocal(part.iCell);
643643
double normalizedPos = iCell[iDim] + part.delta[iDim];
644644

645645
startIndex_[centering2int(QtyCentering::primal)][iDim]

src/core/utilities/mpi_utils.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int size();
2929
int rank();
3030

3131
template<typename Data>
32-
auto mpi_type_for()
32+
MPI_Datatype mpi_type_for()
3333
{
3434
if constexpr (std::is_same_v<double, Data>)
3535
return MPI_DOUBLE;
@@ -45,7 +45,7 @@ auto mpi_type_for()
4545
return MPI_UINT64_T;
4646
else if constexpr (std::is_same_v<char, Data>)
4747
return MPI_CHAR;
48-
48+
4949
// don't return anything = compile failure if tried to use this function
5050
}
5151

@@ -73,9 +73,9 @@ void _collect_vector(SendBuff const& sendBuff, RcvBuff& rcvBuff, std::vector<int
7373
std::vector<int> const& displs, int const mpi_size)
7474
{
7575
auto mpi_type = mpi_type_for<Data>();
76-
76+
7777
assert(recvcounts.size() == displs.size() and static_cast<int>(displs.size()) == mpi_size);
78-
78+
7979
MPI_Allgatherv( // MPI_Allgatherv
8080
sendBuff.data(), // void *sendbuf,
8181
sendBuff.size(), // int sendcount,
@@ -85,7 +85,7 @@ void _collect_vector(SendBuff const& sendBuff, RcvBuff& rcvBuff, std::vector<int
8585
displs.data(), // int *displs,
8686
mpi_type, // MPI_Datatype recvtype,
8787
MPI_COMM_WORLD // MPI_Comm comm
88-
);
88+
);
8989
}
9090

9191
template<typename Vector>

src/core/utilities/point/point.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ namespace core
129129
auto begin() { return r.begin(); }
130130
auto end() { return r.end(); }
131131

132+
auto const& operator()() const { return r; }
132133

133134
private:
134135
std::array<Type, dim> r{};

0 commit comments

Comments
 (0)