17 double cartesianMeshH = marker.h()(0) / voxelsPerAxis;
19 for (
int d = 0; d < Dimensions; d++) {
20 double positionWithinPatch = particleX(d) - marker.getOffset()(d);
21 result(d) =
static_cast<int>(std::floor(positionWithinPatch / cartesianMeshH));
22 result(d) = std::max(0, result(d));
23 result(d) = std::min(voxelsPerAxis - 1, result(d));
36 assertion3(voxelsPerAxis>=2, marker, voxelsPerAxis, particleX);
37 double cartesianMeshH = marker.h()(0) / voxelsPerAxis;
39 for (
int d = 0; d < Dimensions; d++) {
40 double biasedPositionWithinPatch = particleX(d) - marker.getOffset()(d) - cartesianMeshH / 2.0;
41 result(d) =
static_cast<int>(std::floor(biasedPositionWithinPatch / cartesianMeshH));
42 result(d) = std::max(0, result(d));
43 result(d) = std::min(voxelsPerAxis - 2, result(d));
53 const double* __restrict__ Q,
58 marker, voxelsPerAxis, particleX
63 return Q[voxelIndex * unknownsPerVoxel + unknown];
70 const double* __restrict__ Q,
83 marker.x(), marker.h(), voxelsPerAxis, currentVoxel
87 for (
int d = 0; d < Dimensions; d++) {
88 double relativeDistance =
std::abs(currentVoxelX(d) - particleX(d)) / h;
89 if (particleX(d) < currentVoxelX(d) and currentVoxel(d) == 0) {
92 else if (particleX(d) > currentVoxelX(d) and currentVoxel(d) == voxelsPerAxis - 1) {
94 }
else if (relativeDistance < 1.0) {
95 weight *= (1.0 - relativeDistance);
102 result += weight * Q[currentVoxelIndex * unknownsPerVoxel + unknown];
#define assertion3(expr, param0, param1, param2)
#define dfor2(counter)
Shortcut For dfor(counter,2)
#define enddforx
I prefer to use this macro for dforx instead of a closing bracket as many syntax parser fail otherwis...
tarch::logging::Log _log("::")
double projectValueOntoParticle_piecewiseConstant(const peano4::datamanagement::CellMarker &marker, int voxelsPerAxis, int unknownsPerVoxel, const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &particleX, int unknown)
Project one quantity from the patch data onto the particle.
double projectValueOntoParticle_piecewiseLinear(const peano4::datamanagement::CellMarker &marker, int voxelsPerAxis, int unknownsPerVoxel, const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &particleX, int unknown)
tarch::la::Vector< Dimensions, int > mapParticleOntoVoxel(const peano4::datamanagement::CellMarker &marker, int voxelsPerAxis, const tarch::la::Vector< Dimensions, double > &particleX)
Assume that we have a particle suspended in a cell.
tarch::la::Vector< Dimensions, int > mapBiasedParticleOntoVoxel(const peano4::datamanagement::CellMarker &marker, int voxelsPerAxis, const tarch::la::Vector< Dimensions, double > &particleX)
Similar to mapParticleOntoVoxel() but this time, we always take the biased voxel to the left.
double getVolumeLength(const tarch::la::Vector< 2, double > &h, int numberOfVolumesPerAxisInPatch)
With GCC 10, it was impossible to return/copy the vector class.
CPUGPUMethod int dLinearised(const tarch::la::Vector< Dimensions, int > &counter, int max)
Map d-dimensional vector onto integer index.
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)