Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AMReX version of TypeMultiplier #1061

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/fields/Fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "utils/Constants.H"
#include "utils/GPUUtil.H"
#include "utils/InsituUtil.H"
#include "utils/TemplateUtil.H"
#include "particles/particles_utils/ShapeFactors.H"
#ifdef HIPACE_USE_OPENPMD
# include <openPMD/auxiliary/Filesystem.hpp>
Expand Down Expand Up @@ -726,7 +725,7 @@ Fields::SetBoundaryCondition (amrex::Vector<amrex::Geometry> const& geom, const
const amrex::Real x = (i * dx + poff_x) * scale;
const amrex::Real y = (j * dy + poff_y) * scale;
if (x*x + y*y > cutoff_sq) {
return MakeZeroTuple(MultipoleTuple{});
return amrex::IdentityTuple(MultipoleTuple{}, MultipoleReduceOpList{});
}
amrex::Real s_v = arr_staging_area(i, j);
return GetMultipoleCoeffs(s_v, x, y);
Expand Down Expand Up @@ -1284,8 +1283,8 @@ Fields::InSituComputeDiags (int step, amrex::Real time, int islice, const amrex:

amrex::MultiFab& slicemf = getSlices(lev);

TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp]> reduce_op;
TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp]> reduce_data(reduce_op);
amrex::TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp]> reduce_op;
amrex::TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp]> reduce_data(reduce_op);
using ReduceTuple = typename decltype(reduce_data)::Type;

for ( amrex::MFIter mfi(slicemf, DfltMfi); mfi.isValid(); ++mfi ) {
Expand Down
8 changes: 3 additions & 5 deletions src/fields/OpenBoundary.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#ifndef OPEN_BOUNDARY_H_
#define OPEN_BOUNDARY_H_

#include "utils/TemplateUtil.H"

#include <AMReX_AmrCore.H>
#include <cmath>

Expand All @@ -29,9 +27,9 @@ amrex::Real pow (amrex::Real base) {
return 0._rt; //shut up compiler
}

using MultipoleTuple = TypeMultiplier<amrex::GpuTuple, amrex::Real[37]>;
using MultipoleReduceOpList = TypeMultiplier<amrex::TypeList, amrex::ReduceOpSum[37]>;
using MultipoleReduceTypeList = TypeMultiplier<amrex::TypeList, amrex::Real[37]>;
using MultipoleTuple = amrex::TypeMultiplier<amrex::GpuTuple, amrex::Real[37]>;
using MultipoleReduceOpList = amrex::TypeMultiplier<amrex::TypeList, amrex::ReduceOpSum[37]>;
using MultipoleReduceTypeList = amrex::TypeMultiplier<amrex::TypeList, amrex::Real[37]>;

// To solve a poisson equation (d^2/dx^2 + d^2/dy^2)phi = source with open boundary conditions for
// phi(x,y), the source field at (x',y') is integrated together with the Green's function
Expand Down
7 changes: 3 additions & 4 deletions src/particles/beam/BeamParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "Hipace.H"
#include "utils/HipaceProfilerWrapper.H"
#include "utils/InsituUtil.H"
#include "utils/TemplateUtil.H"
#ifdef HIPACE_USE_OPENPMD
# include <openPMD/auxiliary/Filesystem.hpp>
#endif
Expand Down Expand Up @@ -456,8 +455,8 @@ BeamParticleContainer::InSituComputeDiags (int islice)
const amrex::Real clight_inv = 1.0_rt/phys_const.c;
const auto ptd = getBeamSlice(WhichBeamSlice::This).getParticleTileData();

TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp + m_insitu_nip]> reduce_op;
TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp], int[m_insitu_nip]> reduce_data(reduce_op);
amrex::TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp + m_insitu_nip]> reduce_op;
amrex::TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp], int[m_insitu_nip]> reduce_data(reduce_op);
using ReduceTuple = typename decltype(reduce_data)::Type;
reduce_op.eval(
getNumParticles(WhichBeamSlice::This), reduce_data,
Expand All @@ -472,7 +471,7 @@ BeamParticleContainer::InSituComputeDiags (int islice)
const amrex::Real w = ptd.rdata(BeamIdx::w)[ip];

if (ptd.id(ip) < 0 || x*x + y*y > insitu_radius_sq) {
return MakeZeroTuple(ReduceTuple{});
return amrex::IdentityTuple(ReduceTuple{}, reduce_op);
}
const amrex::Real gamma = std::sqrt(1.0_rt + ux*ux + uy*uy + uz*uz);
return { // Tuple contains:
Expand Down
7 changes: 3 additions & 4 deletions src/particles/plasma/PlasmaParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "utils/DeprecatedInput.H"
#include "utils/GPUUtil.H"
#include "utils/InsituUtil.H"
#include "utils/TemplateUtil.H"
#ifdef HIPACE_USE_OPENPMD
# include <openPMD/auxiliary/Filesystem.hpp>
#endif
Expand Down Expand Up @@ -472,8 +471,8 @@ PlasmaParticleContainer::InSituComputeDiags (int islice)

amrex::Long const num_particles = pti.numParticles();

TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp + m_insitu_nip]> reduce_op;
TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp], int[m_insitu_nip]> reduce_data(reduce_op);
amrex::TypeMultiplier<amrex::ReduceOps, amrex::ReduceOpSum[m_insitu_nrp + m_insitu_nip]> reduce_op;
amrex::TypeMultiplier<amrex::ReduceData, amrex::Real[m_insitu_nrp], int[m_insitu_nip]> reduce_data(reduce_op);
using ReduceTuple = typename decltype(reduce_data)::Type;
reduce_op.eval(
num_particles, reduce_data,
Expand All @@ -486,7 +485,7 @@ PlasmaParticleContainer::InSituComputeDiags (int islice)
const amrex::Real psi = ptd.rdata(PlasmaIdx::psi)[ip];

if (ptd.id(ip) < 0 || x*x + y*y > insitu_radius_sq) {
return MakeZeroTuple(ReduceTuple{});
return amrex::IdentityTuple(ReduceTuple{}, reduce_op);
}
// particle's Lorentz factor
const amrex::Real gamma = (1.0_rt + ux*ux + uy*uy + psi*psi)/(2.0_rt*psi);
Expand Down
66 changes: 0 additions & 66 deletions src/utils/TemplateUtil.H

This file was deleted.

Loading