12#ifndef CD_ParticleOpsImplem_H
13#define CD_ParticleOpsImplem_H
27#include <CD_NamespaceHeader.H>
49template <
typename P, const Real& (P::*weight)() const>
53 CH_TIME(
"ParticleOps::getPhysicalParticlesPerCell");
64#pragma omp parallel for schedule(runtime)
76 const Real w = (p.*weight)();
89 CH_TIME(
"ParticleOps::getComputationalParticlesPerCell");
100#pragma omp parallel for schedule(runtime)
141 a_s = std::numeric_limits<Real>::max();
163 if (
s >= 0.0 &&
s <= 1.0) {
187 a_s = std::numeric_limits<Real>::max();
202 if (
fa *
fb <= 0.0) {
228 a_s = std::numeric_limits<Real>::max();
274 CH_TIME(
"ParticleOps::copy(ParticleContainer<P> x2)");
284#pragma omp parallel for schedule(runtime)
297 CH_TIME(
"ParticleOps::copyDestructive(ParticleContainer<P> x2)");
307#pragma omp parallel for schedule(runtime)
318template <
typename P, const Real& (P::*scalarQuantity)() const>
322 CH_TIME(
"ParticleOps::sum(ParticleContainer<P>)");
332#pragma omp parallel for schedule(runtime) reduction(+ : particleSum)
347template <
typename P, Real (P::*scalarQuantity)()>
351 CH_TIME(
"ParticleOps::sum(ParticleContainer<P>)");
361#pragma omp parallel for schedule(runtime) reduction(+ : particleSum)
381 CH_TIME(
"ParticleOps::removeParticles(ParticleContainer<P>, std::function<bool(const P&)>)");
389#pragma omp parallel for schedule(runtime)
413 CH_TIME(
"ParticleOps::transferParticles(ParticleContainer<P>, ParticleContainer<P>& std::function<bool(const P&)>)");
424#pragma omp parallel for schedule(runtime)
447 CH_TIME(
"ParticleOps::setData(ParticleContainer<P>, std::function<void(P&)>)");
455#pragma omp parallel for schedule(runtime)
468template <
typename P, Real& (P::*particleScalarField)()>
472 CH_TIME(
"ParticleOps::setValue(ParticleContainer<P>, Real");
480#pragma omp parallel for schedule(runtime)
495template <
typename P, RealVect& (P::*particleVectorField)()>
499 CH_TIME(
"ParticleOps::setValue(ParticleContainer<P>, RealVect");
507#pragma omp parallel for schedule(runtime)
528 CH_TIME(
"ParticleOps::scatterParticles");
561 MayDay::Error(
"ParticleOps::scatterParticles - MPI communication error in MPI_AlltoAll(1)");
566 MayDay::Error(
"ParticleOps::scatterParticles - 'recvSizes[procID()] != 0' failed");
573 for (
size_t i = 1;
i <
counts.size();
i++) {
607 *((
size_t*)
data) =
cur.second.length();
614 p.linearOut((
void*)
data);
624 for (
size_t i = 0;
i <
v64.size(); ++
i) {
627 v[
i] =
static_cast<int>(
v64[
i]);
649 MayDay::Error(
"ParticleOps::scatterParticles - MPI communication error in MPI_AlltoAll(2)");
683 p.linearIn(
static_cast<void*
>(
data));
696#include <CD_NamespaceFooter.H>
Agglomeration of basic MPI reductions.
Declaration of a static class containing some common useful particle routines that would otherwise be...
Agglomeration of some useful algebraic/polynomial routines.
File containing some useful static methods related to random number generation.
static void copy(ParticleContainer< P > &a_dst, const ParticleContainer< P > &a_src) noexcept
Copy all the particles from the a_src to a_dst.
Definition CD_ParticleOpsImplem.H:272
static Real sum(const ParticleContainer< P > &a_particles) noexcept
Perform a sum of some particle quantity.
Definition CD_ParticleOpsImplem.H:320
static void getComputationalParticlesPerCell(EBAMRCellData &a_ppc, const ParticleContainer< P > &a_src) noexcept
Get the number of computational particles per cell.
Definition CD_ParticleOpsImplem.H:87
static void transferParticles(ParticleContainer< P > &a_dstParticles, ParticleContainer< P > &a_srcParticles, const std::function< bool(const P &)> &a_transferCrit) noexcept
Transfer particles if they fulfill a certain removal criterion. Takes particles from a_srcParticles a...
Definition CD_ParticleOpsImplem.H:409
static bool ebIntersectionRaycast(const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_tolerance, Real &a_s)
Compute the intersection point between a particle path and an implicit function using a ray-casting a...
Definition CD_ParticleOpsImplem.H:221
static bool ebIntersectionBisect(const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_bisectStep, Real &a_s)
Compute the intersection point between a particle path and an implicit function using a bisection alg...
Definition CD_ParticleOpsImplem.H:177
static void setValue(ParticleContainer< P > &a_particles, const Real a_value) noexcept
Set value function. Lets the user set scalar particle quantity. Use with e.g. setValue<P,...
Definition CD_ParticleOpsImplem.H:470
static void removeParticles(ParticleContainer< P > &a_particles, const std::function< bool(const P &)> &a_removeCriterion) noexcept
Remove particles if they fulfill certain removal criterion.
Definition CD_ParticleOpsImplem.H:378
static void getPhysicalParticlesPerCell(EBAMRCellData &a_ppc, const ParticleContainer< P > &a_src) noexcept
Get the number of physical particles per cell.
Definition CD_ParticleOpsImplem.H:51
static void copyDestructive(ParticleContainer< P > &a_dst, ParticleContainer< P > &a_src) noexcept
Copy all the particles from the a_src to a_dst. This destroys the source particles.
Definition CD_ParticleOpsImplem.H:295
static IntVect getParticleGridCell(const RealVect &a_particlePosition, const RealVect &a_probLo, const RealVect &a_dx) noexcept
Get the grid cell where the particle lives.
Definition CD_ParticleOpsImplem.H:121
static IntVect getParticleCellIndex(const RealVect &a_particlePosition, const RealVect &a_probLo, const Real &a_dx) noexcept
Get the cell index corresponding to the particle position.
Definition CD_ParticleOpsImplem.H:30
static void setData(ParticleContainer< P > &a_particles, const std::function< void(P &)> &a_functor) noexcept
Set value function. Lets the user set particle parameters.
Definition CD_ParticleOpsImplem.H:445
static bool domainIntersection(const RealVect &a_oldPos, const RealVect &a_newPos, const RealVect &a_probLo, const RealVect &a_probHi, Real &a_s)
Compute the intersection point between a particle path and a domain side.
Definition CD_ParticleOpsImplem.H:131
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
Real sum(const Real &a_value) noexcept
Compute the sum across all MPI ranks.
Definition CD_ParallelOpsImplem.H:353
RealVect brentRootFinder(const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_point1, const RealVect &a_point2)
Compute the root of a function between two points. This is a 1D problem along the line.
Definition CD_PolyUtils.cpp:24