12template <
typename Iterator>
14 const typename Iterator::value_type& particle,
19 while (begin != end) {
26 "particleIsDuplicate(...)",
28 << particle->toString() <<
" and " << (*begin)->toString()
39template <
typename Particle>
41 const Particle& particle,
45 return particle.getParallelState() == Particle::ParallelState::Local
52template <
typename Particle,
typename ParticleSet>
55 const std::vector<Particle*>& newParticles,
59 for (
auto& p : newParticles) {
67 const std::bitset<Dimensions>& assignedVertex,
78 vertexPositionOfAssignedVertex,
102 std::bitset<TwoPowerD> result = 0;
109 tarch::la::convertScalar< double >(k),
121 particle.setContainedInAdjacentCell( result );
125template <
typename Particle,
typename ParticleSet>
128 Particle* newParticle,
133 std::bitset<Dimensions> targetVertex;
134 for (
int d = 0; d < Dimensions; d++) {
137 newParticle->getX()(d),
138 marker.x()(d) - marker.h()(d) / 2.0
141 newParticle->toString(),
142 marker.x()(d) - marker.h()(d) / 2.0,
147 newParticle->getX()(d),
148 marker.x()(d) + marker.h()(d) / 2.0
151 newParticle->toString(),
152 marker.x()(d) + marker.h()(d) / 2.0,
155 targetVertex[d] = newParticle->getX()(d) > marker.x()(d);
160 smaller(2.0 * newParticle->getSearchRadius(),
tarch::la::min(marker.h())),
162 newParticle->toString(),
166 newParticle->setParallelState(Particle::ParallelState::Local);
167 newParticle->setCellH(marker.h());
170 const int linearisedTargetVertex = targetVertex.to_ulong();
173 "insertParticleIntoCell(...)",
175 << newParticle->toString() <<
" to vertex " << linearisedTargetVertex
176 <<
" in cell " << marker.toString() <<
" (vertex="
177 << fineGridVertices(targetVertex.to_ulong()).toString() <<
")"
179 fineGridVertices(linearisedTargetVertex).addParticle(newParticle);
182 int partID = newParticle->getPartid();
188 vertexX = marker.x() - 0.5 * marker.h()
195 toolbox::particles::assignmentchecks::pruneTypeName<Particle>(),
202 "toolbox::particles::insertParticleIntoCell()",
#define assertion4(expr, param0, param1, param2, param3)
#define assertion3(expr, param0, param1, param2)
#define logDebug(methodName, logMacroMessageStream)
#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("exahype2::fv")
My collection of tiny vector operations.
bool allGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool greaterEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
constexpr double NUMERICAL_ZERO_DIFFERENCE
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool allSmallerEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
Matrix< Rows, Cols, Scalar > multiplyComponents(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
Scalar min(const Vector< Size, Scalar > &vector)
Returns the element with minimal value (NOT absolute value).
void assignParticleToVertex(const std::string &particleName, const tarch::la::Vector< Dimensions, double > &particleX, const int particleID, bool isLocal, const tarch::la::Vector< Dimensions, double > &vertexX, const tarch::la::Vector< Dimensions, double > &vertexH, int treeId, const std::string &trace, const tarch::la::Vector< Dimensions, double > &prevVertexX, const tarch::la::Vector< Dimensions, double > &prevVertexH, bool particleIsNew=false, bool reassignmentOnSameTreeDepthAllowed=false)
Assign a particle to a vertex.
double relativeGrabOwnershipSpatialSortingTolerance(const ::peano4::datamanagement::VertexMarker &marker)
constexpr double SpatialDuplicateTolerance
Default tolerance to decide when two particles are the same.
void updateContainedInAdjacentCellProperty(const peano4::datamanagement::CellMarker &marker, const std::bitset< Dimensions > &assignedVertex, auto &particle)
Update helper flag per particle for cell.
void insertParticleIntoCell(const peano4::datamanagement::CellMarker &marker, Particle *newParticles, peano4::datamanagement::VertexEnumerator< ParticleSet > &fineGridVertices, int spacetreeId)
Insert particle into cell.
Iterator particleIsDuplicate(const typename Iterator::value_type &particle, Iterator begin, const Iterator &end)
Check if there's already a particle at p's position in the set.
void insertParticlesIntoCell(const peano4::datamanagement::CellMarker &marker, const std::vector< Particle * > &newParticles, peano4::datamanagement::VertexEnumerator< ParticleSet > &fineGridVertices, int spacetreeId)
Insert particle into a cell.
bool particleWillStayWithinComputationalDomain(const Particle &particle, const tarch::la::Vector< Dimensions, double > &domainOffset, const tarch::la::Vector< Dimensions, double > &domainWidth)
Return true if and only if.
bool isContained(const tarch::la::Vector< Dimensions, double > &x, double tolerance=tarch::la::NUMERICAL_ZERO_DIFFERENCE) const
Is x contained within cell identified by marker object.
Vertex enumerator within array.
Vertex marker to provide information about selected vertex.