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(const peano4::datamanagement::CellMarker& marker, const Particle& localParticle, const Particle& activeParticle)>;
11
12 template <typename Particle>
13 using UpdateParticleAssignedToCellPredicate = std::function<bool(const peano4::datamanagement::CellMarker& marker, const bool& localParticleIsContainedInCell, const Particle& localParticle)>;
14
15 template <typename Particle>
16 using UpdateParticleAssignedToVertexPredicate = std::function<bool(const peano4::datamanagement::VertexMarker& marker, const Particle& localParticle)>;
17
18
28 template <typename Particle>
29 bool alwaysUpdateInVertexKernel(const peano4::datamanagement::VertexMarker& marker, const Particle& localParticle) {
30 return true;
31 }
32
33
40 template <typename Particle>
41 bool alwaysUpdateInCellKernel(const peano4::datamanagement::CellMarker& marker, const bool& localParticleIsContainedInCell, const Particle& localParticle) {
42 return true;
43 }
44
45
52 template <typename Particle>
53 bool alwaysUpdateParticlePairs(const peano4::datamanagement::CellMarker& marker, const Particle& localParticle, const Particle& activeParticle) {
54 return true;
55 }
56
57
67 template <typename Particle>
68 bool particleIsLocal(const peano4::datamanagement::VertexMarker& marker, const Particle& localParticle) {
69 return localParticle.getParallelState() == Particle::ParallelState::Local;
70 }
71
72
86 template <typename Particle>
88 return (
89 (localParticle.getMoveState() == Particle::MoveState::NotMovedYet)
90 & particleIsLocal(marker, localParticle)
91 );
92 }
93
137 template <typename Particle>
139 const peano4::datamanagement::CellMarker& marker, const Particle& localParticle, const Particle& activeParticle
140 ) {
141 return &localParticle != &activeParticle
142 and not localParticle.getCellHasUpdatedParticle()
143 and marker.isContained(
144 localParticle.getX(),
146 )
147 and localParticle.getParallelState() == Particle::ParallelState::Local;
148 }
149
150
151 template <typename Particle>
153 const peano4::datamanagement::CellMarker& marker, const Particle& localParticle, const Particle& activeParticle
154 ) {
155 return &localParticle != &activeParticle
156 and not localParticle.getCellHasUpdatedParticle()
157 and marker.isContained(
158 localParticle.getX(),
160 )
161 and localParticle.getParallelState() == Particle::ParallelState::Local;
162 }
163
164
165 template <typename Particle>
167 const peano4::datamanagement::CellMarker& marker, const bool& localParticleIsContainedInCell, const Particle& localParticle
168 ) {
170 localParticleIsContainedInCell,
171 marker.isContained(
172 localParticle.getX(),
174 ),
175 marker.toString(), localParticle.toString()
176 );
177
178 return not localParticle.getCellHasUpdatedParticle()
179 and localParticleIsContainedInCell
180 and localParticle.getParallelState() == Particle::ParallelState::Local;
181 }
182
183
196 template <typename Particle>
197 bool localParticleCanBeUpdatedInVertexKernel(const peano4::datamanagement::VertexMarker& marker, const Particle& localParticle) {
198 return particleIsLocal(marker, localParticle);
199 }
200 } // namespace kernels
201} // namespace swift2
#define assertionEquals2(lhs, rhs, a, b)
Definition idx.h:5
bool localParticleCanBeUpdatedInCellKernelFromAnyOtherParticle(const peano4::datamanagement::CellMarker &marker, const Particle &localParticle, const Particle &activeParticle)
Can we do work on this particle during a cell kernel sweep stage?
bool localParticleCanBeUpdatedInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Can we do work on this particle during a vertex kernel sweep stage?
std::function< bool(const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)> UpdateParticleAssignedToCellPredicate
std::function< bool(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)> UpdateParticleAssignedToVertexPredicate
bool alwaysUpdateParticlePairs(const peano4::datamanagement::CellMarker &marker, const Particle &localParticle, const Particle &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 alwaysUpdateInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Degenerated predicate which always allows for an update.
bool localParticleCanBeUpdatedAndMovedInVertexKernel(const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
Can we move (drift) this particle?
std::function< bool(const peano4::datamanagement::CellMarker &marker, const Particle &localParticle, const Particle &activeParticle)> UpdateParticlePairWithinCellPredicate
bool localParticleCanBeUpdatedInCellKernelFromAnyOtherParticleWithinIterationRange(const peano4::datamanagement::CellMarker &marker, const Particle &localParticle, const Particle &activeParticle)
bool localParticleCanBeUpdatedInCellKernel(const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)
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)
Definition internal.cpp:23
Vertex marker to provide information about selected vertex.