10 #include <application/exceptions.hpp>
13 #include <athena/bvals/bvals.hpp>
14 #include <athena/mesh/mesh.hpp>
24 auto pm = pmb->pmy_mesh;
26 for (
auto &nb : pmb->pbval->neighbor) {
27 if (
status_flag_[nb.bufid] == BoundaryStatus::completed)
continue;
31 MPI_Test(&req_mpi_recv_[nb.bufid], &test, MPI_STATUS_IGNORE);
46 if (pm->mesh_bcs[(nb.ni.ox1 + 1) >> 1] == BoundaryFlag::periodic) {
47 if (it->x1 >= pm->mesh_size.x1max)
48 it->x1 -= pm->mesh_size.x1max - pm->mesh_size.x1min;
49 if (it->x1 <= pm->mesh_size.x1min)
50 it->x1 += pm->mesh_size.x1max - pm->mesh_size.x1min;
54 if (pm->mesh_bcs[2 + ((nb.ni.ox2 + 1) >> 1)] ==
55 BoundaryFlag::periodic) {
56 if (it->x2 >= pm->mesh_size.x2max)
57 it->x2 -= pm->mesh_size.x2max - pm->mesh_size.x2min;
58 if (it->x2 <= pm->mesh_size.x2min)
59 it->x2 += pm->mesh_size.x2max - pm->mesh_size.x2min;
63 if (pm->mesh_bcs[4 + ((nb.ni.ox3 + 1) >> 1)] ==
64 BoundaryFlag::periodic) {
65 if (it->x3 >= pm->mesh_size.x3max)
66 it->x3 -= pm->mesh_size.x3max - pm->mesh_size.x3min;
67 if (it->x3 <= pm->mesh_size.x3min)
68 it->x3 += pm->mesh_size.x3max - pm->mesh_size.x3min;
73 throw RuntimeError(
"ParticleBase::AttachParticles",
74 "Particle moved out of MeshBlock limits");
90 auto pm = pmb->pmy_mesh;
92 Real x1min = pmb->block_size.x1min;
93 Real x1max = pmb->block_size.x1max;
94 Real x2min = pmb->block_size.x2min;
95 Real x2max = pmb->block_size.x2max;
96 Real x3min = pmb->block_size.x3min;
97 Real x3max = pmb->block_size.x3max;
99 int ox1 = 0, ox2 = 0, ox3 = 0, fi1 = 0, fi2 = 0;
100 auto qi =
pc.begin();
111 if (pmb->pbval->block_bcs[inner_x1] == BoundaryFlag::reflect &&
113 qi->x1 = 2 * x1min - qi->x1;
116 if (pmb->pbval->block_bcs[outer_x1] == BoundaryFlag::reflect &&
118 qi->x1 = 2 * x1max - qi->x1;
121 ox1 = qi->x1 < x1min ? -1 : (qi->x1 > x1max ? 1 : 0);
124 if (pmb->pbval->block_bcs[inner_x2] == BoundaryFlag::reflect &&
126 qi->x2 = 2 * x2min - qi->x2;
128 }
else if (pmb->pbval->block_bcs[inner_x2] == BoundaryFlag::polar &&
132 if (pmb->pbval->block_bcs[outer_x2] == BoundaryFlag::reflect &&
134 qi->x2 = 2 * x2max - qi->x2;
136 }
else if (pmb->pbval->block_bcs[outer_x2] == BoundaryFlag::polar &&
137 qi->x2 > 2. * M_PI) {
140 ox2 = qi->x2 < x2min ? -1 : (qi->x2 > x2max ? 1 : 0);
144 if (pmb->pbval->block_bcs[inner_x3] == BoundaryFlag::reflect &&
146 qi->x3 = 2 * x3min - qi->x3;
149 if (pmb->pbval->block_bcs[outer_x3] == BoundaryFlag::reflect &&
151 qi->x3 = 2 * x3max - qi->x3;
154 ox3 = qi->x3 < x3min ? -1 : (qi->x3 > x3max ? 1 : 0);
157 if (pm->multilevel) {
161 int bid = BoundaryBase::FindBufferID(ox1, ox2, ox3, fi1, fi2);
176 pc.resize(qi -
pc.begin());
void SetBoundaryStatus(int bid, BoundaryStatus status)
Set the boundary status.
enum BoundaryStatus status_flag_[MessageTraits< T >::num_buffers]
BufferType recv_buffer_[MessageTraits< ParticleBase >::num_buffers]
BufferType send_buffer_[MessageTraits< ParticleBase >::num_buffers]
void PackData(MeshBlock const *pmb) override
Pack data to send buffer.
bool UnpackData(MeshBlock const *pmb) override
Unpack data from receive buffer.
bool check_in_meshblock(ParticleData const &pd, MeshBlock const *pmb)