Peano
Loading...
Searching...
No Matches
ParticleUpdatePredicates.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace swift2 {
8 namespace kernels {
9 template <typename Particle>
10 using UpdateParticlePairWithinCellPredicate = std::function<bool(
12 const Particle& localParticle,
13 const Particle& activeParticle
14 )>;
15
16 template <typename Particle>
17 using UpdateParticleAssignedToCellPredicate = std::function<bool(
19 const bool& localParticleIsContainedInCell,
20 const Particle& localParticle
21 )>;
22
23 template <typename Particle>
24 using UpdateParticleAssignedToVertexPredicate = std::function<bool(
26 const Particle& localParticle
27 )>;
28
29
39 template <typename Particle>
42 const Particle& localParticle
43 ) {
44 return true;
45 }
46
47
54 template <typename Particle>
57 const bool& localParticleIsContainedInCell,
58 const Particle& localParticle
59 ) {
60 return true;
61 }
62
63
70 template <typename ParticleA, typename ParticleB = ParticleA>
73 const ParticleA& localParticle,
74 const ParticleB& activeParticle
75 ) {
76 return true;
77 }
78
79
90 template <typename Particle>
93 const Particle& localParticle
94 ) {
95 return localParticle.getParallelState() == Particle::ParallelState::Local;
96 }
97
98
112 template <typename Particle>
115 const Particle& localParticle
116 ) {
117 return (
118 (localParticle.getMoveState() == Particle::MoveState::NotMovedYet)
119 & particleIsLocal(marker, localParticle)
120 );
121 }
122
187 template <typename ParticleA, typename ParticleB = ParticleA>
190 const ParticleA& localParticle,
191 const ParticleB& activeParticle
192 ) {
193 return (void*)(&localParticle) != (void*)(&activeParticle)
194 and not localParticle.getCellHasUpdatedParticle()
195 and marker.isContained(
196 localParticle.getX(),
200 )
201 and localParticle.getParallelState(
202 ) == ParticleA::ParallelState::Local;
203 }
204
205 template <typename ParticleA, typename ParticleB = ParticleA>
207 const peano4::datamanagement::CellMarker& marker, const ParticleA& localParticle, const ParticleB& activeParticle
208 ) {
209 return (void*)(&localParticle) != (void*)(&activeParticle);
210 }
211
212 template <typename ParticleA, typename ParticleB = ParticleA>
215 const ParticleA& localParticle,
216 const ParticleB& activeParticle
217 ) {
218 return (void*)(&localParticle) != (void*)(&activeParticle)
219 and not localParticle.getCellHasUpdatedParticle()
220 and marker.isContained(
221 localParticle.getX(),
225 )
226 and localParticle.getParallelState(
227 ) == ParticleA::ParallelState::Local;
228 }
229
230
231 template <typename Particle>
234 const bool& localParticleIsContainedInCell,
235 const Particle& localParticle
236 ) {
238 localParticleIsContainedInCell,
239 marker.isContained(
240 localParticle.getX(),
242 relativeGrabOwnershipSpatialSortingTolerance(marker)
244 ),
245 marker.toString(),
246 localParticle.toString()
247 );
248
249 return not localParticle.getCellHasUpdatedParticle()
250 and localParticleIsContainedInCell
251 and localParticle.getParallelState(
252 ) == Particle::ParallelState::Local;
253 }
254
255
269 template <typename Particle>
272 const Particle& localParticle
273 ) {
274 return particleIsLocal(marker, localParticle);
275 }
276 } // namespace kernels
277} // namespace swift2
#define assertionEquals2(lhs, rhs, a, b)
Definition idx.h:5
std::function< bool( const peano4::datamanagement::CellMarker &marker, const bool & localParticleIsContainedInCell, const Particle & localParticle)> UpdateParticleAssignedToCellPredicate
bool localParticleCanBeUpdatedInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Can we do work on this particle during a vertex kernel sweep stage?
bool alwaysUpdateParticlePairs(const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
Degenerated update in cell predicate.
bool particleIsLocal(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Is a particle local.
bool alwaysUpdateInCellKernel(const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)
Degenerated update in cell predicate.
bool updateFromAnyOtherParticle(const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
bool alwaysUpdateInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Degenerated predicate which always allows for an update.
std::function< bool( const peano4::datamanagement::CellMarker &marker, const Particle & localParticle, const Particle & activeParticle)> UpdateParticlePairWithinCellPredicate
bool localParticleCanBeUpdatedInCellKernelFromAnyOtherParticle(const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
Can we do work on this particle during a cell kernel sweep stage?
bool localParticleCanBeUpdatedAndMovedInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Can we move (drift) this particle?
std::function< bool( const peano4::datamanagement::VertexMarker &marker, const Particle & localParticle)> UpdateParticleAssignedToVertexPredicate
bool localParticleCanBeUpdatedInCellKernel(const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)
bool localParticleCanBeUpdatedInCellKernelFromAnyOtherParticleWithinIterationRange(const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
This file is part of the SWIFT 2 project.
constexpr double NUMERICAL_ZERO_DIFFERENCE
Definition Scalar.h:17
double relativeGrabOwnershipSpatialSortingTolerance(const ::peano4::datamanagement::VertexMarker &marker)
Vertex marker to provide information about selected vertex.