9 #include <ddMd/chemistry/Mask.h> 10 #include <ddMd/communicate/Plan.h> 12 #include <ddMd/communicate/Buffer.h> 24 bool Atom::hasAtomContext_ =
false;
30 { hasAtomContext_ = hasAtomContext; }
51 position_ = other.position_;
52 typeId_ = other.typeId_;
53 force_ = other.force_;
57 plan() = other.
plan();
59 if (hasAtomContext_) {
62 mask() = other.
mask();
76 if (hasAtomContext_) {
90 buffer.
pack<
int>(id());
91 buffer.
pack<
int>(typeId());
94 buffer.
pack<
unsigned int>(plan().flags());
95 buffer.
pack<
unsigned int>(groups());
96 if (hasAtomContext_) {
103 buffer.
pack<
int>(size);
104 for (
int j = 0; j < size; ++j) {
105 buffer.
pack<
int>(m[j]);
124 buffer.
unpack<
unsigned int>(ui);
126 buffer.
unpack<
unsigned int>(ui);
128 if (hasAtomContext_) {
137 for (
int j = 0; j < size; ++j) {
141 assert(m.size() == size);
152 size += 2*
sizeof(int);
154 size += 2*
sizeof(
unsigned int);
155 if (hasAtomContext_) {
159 size += Mask::Capacity*
sizeof(int);
171 buffer.
pack<
int>(id());
172 buffer.
pack<
int>(typeId());
174 buffer.
pack<
unsigned int>(plan().flags());
175 if (hasAtomContext_) {
193 buffer.
unpack<
unsigned int>(ui);
195 if (hasAtomContext_) {
207 size += 2*
sizeof(int);
209 size +=
sizeof(
unsigned int);
210 if (hasAtomContext_) {
257 #endif // ifdef UTIL_MPI 264 setId(sendAtom.
id());
265 setTypeId(sendAtom.
typeId());
266 plan().setFlags(sendAtom.
plan().
flags());
268 if (hasAtomContext_) {
269 context() = sendAtom.
context();
277 { position_ = sendAtom.
position(); }
Set of Atoms for which pair interactions with a parent Atom are "masked".
int typeId() const
Get atom type index.
A Vector is a Cartesian vector.
void unpackUpdate(Buffer &buffer)
Unpack updated ghost position from recv buffer.
void clear()
Reset integer members to initial null values.
unsigned int flags() const
Return raw flags unsigned int.
void unpackForce(Buffer &buffer)
Unpack updated position of ghost Atom from recv buffer.
void packAtom(Buffer &buffer)
Pack an Atom into a send buffer, for exchange of ownership.
Vector & position()
Get position Vector by reference.
static int packedAtomSize()
Return max size of an atom packed for exchange, in bytes.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
void unpackAtom(Buffer &buffer)
Unpack an atom from a recv buffer and receive ownership.
int id() const
Get unique global index for this atom.
void copyLocalUpdate(Atom const &sendAtom)
Copies position of local atom to update this ghost atom.
void unpack(T &data)
Function template unpacking one variable from the receive buffer.
void packForce(Buffer &buffer)
Pack update of ghost Atom force into send buffer.
bool isGhost() const
Is this atom a ghost?
void packGhost(Buffer &buffer)
Pack a ghost Atom into a send buffer.
unsigned int & groups()
Get groups bit field by non-const reference.
Descriptor for context of an Atom within a molecule and species.
void incrementSendSize()
Increment sendSize counter after packing an item (an Atom or Group).
Utility classes for scientific computation.
void packUpdate(Buffer &buffer)
Pack updated ghost position into send buffer.
Buffer for interprocessor communication.
AtomContext & context()
Get the AtomContext struct by non-const reference.
void copyLocalGhost(Atom const &sendAtom)
Copies data from local atom to update this ghost atom.
static void setHasAtomContext(bool hasAtomContext)
Enable (true) or disable (false) use of AtomContext data.
Atom & operator=(Atom const &other)
Assignment.
Vector & velocity()
Get velocity Vector by reference.
void decrementRecvSize()
Decrement recvSize counter after completely unpacking an item.
void pack(const T &data)
Function template for packing one variable into the send buffer.
static int packedGhostSize()
Return size of ghost atom packed for communication, in bytes.
void unpackGhost(Buffer &buffer)
Unpack a ghost Atom from a recv buffer.
Plan & plan()
Get communication plan by reference.
Mask & mask()
Get the associated Mask by reference.