50 std::array<double, SPACE_DIM> lowerCorner,
51 std::array<double, SPACE_DIM> upperCorner,
52 std::array<bool, SPACE_DIM> periodicity,
55 : mLowerCorner(lowerCorner),
56 mUpperCorner(upperCorner),
57 mPeriodicity(periodicity),
58 mLengthScale(lengthScale),
59 mpBoxCollection(nullptr)
64 const double max_box_width = 4.0 * lengthScale;
65 boxWidth = std::min(max_box_width, upperCorner[0] - lowerCorner[0]);
69 c_vector<double, 2 * SPACE_DIM> domain_size;
70 for (
unsigned dim = 0; dim < SPACE_DIM; ++dim)
72 domain_size[2 * dim] = lowerCorner[dim];
73 domain_size[2 * dim + 1] = upperCorner[dim];
77 bool periodic_x = periodicity[0];
78 bool periodic_y = SPACE_DIM > 1 ? periodicity[1] :
false;
79 bool periodic_z = SPACE_DIM > 2 ? periodicity[2] :
false;
112 std::vector<double> samples(rNodes.size());
113 for (
unsigned i = 0; i < samples.size(); ++i)
115 const c_vector<double, SPACE_DIM> node_location = rNodes[i]->rGetLocation();
120 samples[i] = random_field::Reshape(mOpenSimplex.noise2_XBeforeY(node_location[0] * mLengthScale, time + 0.5));
125 samples[i] = random_field::Reshape(mOpenSimplex.noise3_XYBeforeZ(node_location[0] * mLengthScale, node_location[1] * mLengthScale, time));
130 samples[i] = random_field::Reshape(mOpenSimplex.noise4_XYBeforeZW(node_location[0] * mLengthScale, node_location[1] * mLengthScale, node_location[2] * mLengthScale, time));
OffLatticeRandomFieldGenerator(std::array< double, SPACE_DIM > lowerCorner, std::array< double, SPACE_DIM > upperCorner, std::array< bool, SPACE_DIM > periodicity, double lengthScale, double boxWidth=DOUBLE_UNSET)