Peano 4
Loading...
Searching...
No Matches
particles.cpp
Go to the documentation of this file.
1#include "particles.h"
2#include "peano4/peano.h"
4
5
9) {
10 std::bitset<TwoPowerD> adjacentCellWhichHostsParticle = getAdjacentCellsOwningParticle(
11 x,
12 marker
13 );
14
15 return adjacentCellWhichHostsParticle.to_ulong() & marker.areAdjacentCellsLocal().to_ulong();
16}
17
18
22 const tarch::la::Vector<Dimensions,double> domainOffset,
24 const std::bitset<Dimensions> periodicBC
25) {
27
28 for (int d=0; d<Dimensions; d++) {
29 if ( periodicBC[d] ) {
30 if ( tarch::la::equals( marker.x()(d), domainOffset(d) ) ) {
31 result(d) -= domainSize(d);
32 }
33 if ( tarch::la::equals( marker.x()(d), domainOffset(d)+domainSize(d) ) ) {
34 result(d) += domainSize(d);
35 }
36 }
37 }
38
39 return result;
40}
41
42
std::bitset< Dimensions > periodicBC
Definition main.cpp:19
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.
tarch::la::Vector< Dimensions, double > mirrorParticleAlongPeriodicDomains(const tarch::la::Vector< Dimensions, double > &x, const peano4::datamanagement::VertexMarker &marker, const tarch::la::Vector< Dimensions, double > domainOffset, const tarch::la::Vector< Dimensions, double > domainSize, const std::bitset< Dimensions > periodicBC)
Mirror a particle along the periodic domain boundaries.
Definition particles.cpp:19
bool particleAssignedToVertexWillBeLocal(const tarch::la::Vector< Dimensions, double > &x, const peano4::datamanagement::VertexMarker &marker)
Definition particles.cpp:6
std::bitset< TwoPowerD > getAdjacentCellsOwningParticle(const tarch::la::Vector< Dimensions, double > &x, const peano4::datamanagement::VertexMarker &marker)
Find out which adjacent cell will hold a particle.
Vertex marker to provide information about selected vertex.
Simple vector class.
Definition Vector.h:134