11#include "AMReX_Geometry.H"
12#include "AMReX_GpuQualifiers.H"
13#include "AMReX_IndexType.H"
14#include "AMReX_MFIter.H"
15#include "AMReX_Random.H"
16#include "AMReX_RandomEngine.H"
17#include "AMReX_Vector.H"
30 static constexpr const char *
name =
"random";
45 for (amrex::MFIter mfi(*a_field[lev], amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
48 amrex::IndexType type = a_field[lev]->ixType();
49 if (type == amrex::IndexType::TheCellType())
50 bx = mfi.growntilebox();
51 else if (type == amrex::IndexType::TheNodeType())
52 bx = mfi.grownnodaltilebox();
57 for (
int n = 0; n < a_field[lev]->nComp(); n++)
59 amrex::ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k, amrex::RandomEngine
const &engine) {
60 field(i, j, k, n) +=
offset +
mult * amrex::Random(engine);
virtual void Add(const int &lev, Set::Field< T > &field, Set::Scalar time)=0
Set each point to a random value.
Random(amrex::Vector< amrex::Geometry > &_geom, IO::ParmParse &pp, std::string name)
static void Parse(Random &value, IO::ParmParse &pp)
void Add(const int &lev, Set::Field< Set::Scalar > &a_field, Set::Scalar)
Random(amrex::Vector< amrex::Geometry > &_geom, Set::Scalar a_mult)
static constexpr const char * name
void queryclass(std::string name, T *value)
int query_default(std::string name, T &value, T defaultvalue)
amrex::Array4< T > Patch(int lev, amrex::MFIter &mfi) const &
Initialize a spherical inclusion.
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
void Abort(const char *msg)