/home/runner/work/spades/spades/Source/MessageOps.H Source File

SPADES API: /home/runner/work/spades/spades/Source/MessageOps.H Source File
SPADES API
MessageOps.H
Go to the documentation of this file.
1#ifndef MESSAGEOPS_H
2#define MESSAGEOPS_H
3
4#include <AMReX.H>
5#include <AMReX_Array4.H>
6#include <AMReX_Print.H>
7#include "MessageData.H"
8#include "ParticleOps.H"
9
10namespace spades::particles {
11
14{
27 template <class PArrs>
28 AMREX_GPU_DEVICE AMREX_FORCE_INLINE void operator()(
29 const amrex::Long n,
30 PArrs& parrs,
31 const amrex::Real timestamp,
32 const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& pos,
33 const amrex::IntVect& iv,
34 const int sender_lp,
35 const int sender_entity,
36 const int receiver_lp,
37 const int receiver_entity) const
38 {
39 AMREX_ASSERT(
40 parrs.m_idata[CommonIntData::type_id][n] ==
42
44 parrs.m_rdata[CommonRealData::timestamp][n] = timestamp;
45
46 auto& p = parrs.m_aos[n];
47 AMREX_D_TERM(p.pos(0) = pos[0];, p.pos(1) = pos[1];, p.pos(2) = pos[2];)
48 AMREX_D_TERM(parrs.m_idata[CommonIntData::i][n] = iv[0];
49 , parrs.m_idata[CommonIntData::j][n] = iv[1];
50 , parrs.m_idata[CommonIntData::k][n] = iv[2];)
51 parrs.m_idata[MessageIntData::sender_lp][n] = sender_lp;
52 parrs.m_idata[MessageIntData::sender_entity][n] = sender_entity;
53 parrs.m_idata[MessageIntData::receiver_lp][n] = receiver_lp;
54 parrs.m_idata[MessageIntData::receiver_entity][n] = receiver_entity;
55 }
56};
57
60{
66 template <class PArrs>
67 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void
68 operator()(const amrex::Long n, PArrs& parrs) const
69 {
71 parrs.m_idata[MessageIntData::pair_cpu][n] = -1;
72 parrs.m_idata[MessageIntData::pair_id][n] = -1;
73 parrs.m_rdata[CommonRealData::timestamp][n] = 0.0;
74 parrs.m_rdata[MessageRealData::old_timestamp][n] = 0.0;
75 parrs.m_rdata[MessageRealData::creation_time][n] = 0.0;
76 }
77};
78
79} // namespace spades::particles
80#endif
SPADES particles.
Definition EntityData.H:7
@ type_id
Definition ParticleData.H:18
@ timestamp
Definition ParticleData.H:12
Functor for populating message data.
Definition MessageOps.H:14
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void operator()(const amrex::Long n, PArrs &parrs, const amrex::Real timestamp, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &pos, const amrex::IntVect &iv, const int sender_lp, const int sender_entity, const int receiver_lp, const int receiver_entity) const
Create a message.
Definition MessageOps.H:28
Functor for making a message undefined.
Definition MessageOps.H:60
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const amrex::Long n, PArrs &parrs) const
Mark a message as undefined.
Definition MessageOps.H:68
@ receiver_lp
Definition MessageData.H:23
@ pair_id
Definition MessageData.H:27
@ sender_entity
Definition MessageData.H:24
@ pair_cpu
Definition MessageData.H:26
@ sender_lp
Definition MessageData.H:22
@ receiver_entity
Definition MessageData.H:25
@ old_timestamp
Definition MessageData.H:12
@ creation_time
Definition MessageData.H:13
static constexpr int UNDEFINED
Undefined message.
Definition MessageData.H:44
static constexpr int MESSAGE
Message.
Definition MessageData.H:36