11 #include <ddMd/communicate/Plan.h> 12 #include <ddMd/communicate/Buffer.h> 28 std::ostream& operator << (std::ostream& out, const Group<N> &group);
30 template <
class Archive,
int N>
57 static int packedSize();
81 void setTypeId(
int typeId);
89 void setAtomId(
int i,
int atomId);
97 void setAtomPtr(
int i,
Atom* atomPtr);
104 void clearAtomPtr(
int i);
128 int atomId(
int i)
const;
135 Atom* atomPtr(
int i)
const;
145 const Plan& plan()
const;
152 void pack(
Buffer& buffer);
165 void unpack(
Buffer& buffer);
190 std::istream& operator >> <> (std::istream& in,
Group<N> &group);
193 std::ostream& operator << <> (std::ostream& out,
const Group<N> &group);
195 template <
class Archive>
223 std::ostream& operator<<(std::ostream& out, const Group<N> &group);
235 template <
class Archive,
int N>
237 const unsigned int version);
250 for (
int i=0; i < N; ++i) {
266 for (
int i=0; i < N; ++i) {
303 if (atomPtrs_[i] == 0) {
315 if (atomPtrs_[i] != 0) {
349 {
return atomIds_[i]; }
356 {
return atomPtrs_[i]; }
382 for (
int i=0; i < N; ++i) {
383 in >> group.atomIds_[i];
392 std::ostream& operator << (std::ostream& out, const Group<N> &group)
397 out << group.typeId_;
398 for (
int i = 0; i < N; ++i) {
400 out << group.atomIds_[i];
407 template <
class Archive>
412 for (
int i = 0; i < 2; ++i) {
413 ar & group.atomIds_[i];
417 template <
class Archive>
422 for (
int i = 0; i < 3; ++i) {
423 ar & group.atomIds_[i];
427 template <
class Archive>
432 for (
int i = 0; i < 4; ++i) {
433 ar & group.atomIds_[i];
442 {
return (2 + N)*
sizeof(int) +
sizeof(
unsigned int); }
452 for (
int j = 0; j < N; ++j) {
470 for (
int j = 0; j < N; ++j) {
476 buffer.
unpack<
unsigned int>(ui);
void serialize(Archive &ar, AtomType &atomType, const unsigned int version)
Serialize an AtomType.
void pack(Buffer &buffer)
Pack a Group into a send buffer.
int typeId() const
Get the typeId for this group.
std::istream & operator>>(std::istream &in, AtomType &atomType)
istream extractor (>>) for an AtomType.
unsigned int flags() const
Return raw flags unsigned int.
void unpack(Buffer &buffer)
Unpack a Group from the recv buffer.
void setAtomPtr(int i, Atom *atomPtr)
Set the pointer to a specific atom.
void setFlags(unsigned int flags)
Set all flags (contains all bits).
void clear()
Set group to empty initial state.
friend void serialize(Archive &ar, Group< N > &group, const unsigned int version)
Serialize one Group<N>.
void clearFlags()
Clear all flags (set all to false, set flags_ = 0).
Atom * atomPtr(int i) const
Get a pointer to a specific Atom.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
void unpack(T &data)
Function template unpacking one variable from the receive buffer.
friend std::istream & operator>>(std::istream &in, Group< N > &group)
istream extractor (>>) for a Group.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void setTypeId(int typeId)
Set the group type id for this group.
void incrementSendSize()
Increment sendSize counter after packing an item (an Atom or Group).
Utility classes for scientific computation.
Buffer for interprocessor communication.
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.
A group of covalently interacting atoms.
int nPtr() const
Return the number of non-null atom pointers in this group.
static int packedSize()
Return packed size of a Group<N> object in a send buffer, in bytes.
void setAtomId(int i, int atomId)
Set the id for a specific atom.
void clearAtomPtr(int i)
Clear the pointer to a specific atom.
int id() const
Get the global id for this group.
int atomId(int i) const
Get the id for a specific atom in the Group.
Plan & plan()
Get communication plan by reference.
void setId(int id)
Set the global id for this group.