Skip to content

Commit 61ff01d

Browse files
committed
spr: add allreduce
element size field (elmSizeField) has obvious discontinuity at part boundary when viewed with log scale in paraview
1 parent 3203542 commit 61ff01d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/MeshField_SPR_ErrorEstimator.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ static double getNaN() { return std::numeric_limits<double>::quiet_NaN(); }
1919
/* common base for Scalar Integrator. */
2020
class SInt : public MeshField::Integrator {
2121
public:
22-
SInt(int order) : MeshField::Integrator(order), r(0) {}
22+
SInt(int order, Omega_h::CommPtr comm_in)
23+
: MeshField::Integrator(order), r(0), comm(comm_in) {}
2324
void reset() { r = 0; }
2425
MeshField::Real r;
26+
Omega_h::CommPtr comm;
27+
void parallelReduce() { comm->allreduce(r, OMEGA_H_SUM); }
2528
};
2629

2730
template <typename ShapeField> class Estimation {
@@ -83,8 +86,8 @@ template <typename EstimationT, typename OmegahMeshField>
8386
class SelfProduct : public SInt {
8487
public:
8588
SelfProduct(EstimationT &estimation_in, OmegahMeshField &omf_in)
86-
: SInt(estimation_in.integration_order), estimation(estimation_in),
87-
omf(omf_in) {}
89+
: SInt(estimation_in.integration_order, estimation_in.mesh.comm()),
90+
estimation(estimation_in), omf(omf_in) {}
8891
void atPoints(Kokkos::View<MeshField::Real **> p,
8992
Kokkos::View<MeshField::Real *> w,
9093
Kokkos::View<MeshField::Real *> dV) {
@@ -155,8 +158,9 @@ template <typename EstimationT, typename OmegahMeshField>
155158
class Error : public SInt {
156159
public:
157160
Error(EstimationT &estimation_in, OmegahMeshField &omf_in)
158-
: SInt(estimation_in.integration_order), estimation(estimation_in),
159-
omf(omf_in), errorNorm("errorNorm", estimation_in.mesh.nelems()) {}
161+
: SInt(estimation_in.integration_order, estimation_in.mesh.comm()),
162+
estimation(estimation_in), omf(omf_in),
163+
errorNorm("errorNorm", estimation_in.mesh.nelems()) {}
160164
void atPoints(Kokkos::View<MeshField::Real **> p,
161165
Kokkos::View<MeshField::Real *> w,
162166
Kokkos::View<MeshField::Real *> dV) {

0 commit comments

Comments
 (0)