10 #include <util/misc/Memory.h> 41 Memory::deallocate<Vector>(velocities_,
capacity_);
42 Memory::deallocate<Mask>(masks_,
capacity_);
43 Memory::deallocate<Plan>(plans_,
capacity_);
45 Memory::deallocate<unsigned int>(groups_,
capacity_);
47 Memory::deallocate<AtomContext>(contexts_,
capacity_);
62 UTIL_THROW(
"Cannot allocate with capacity <= 0");
64 if (
sizeof(
Atom) != 64) {
65 Log::file() <<
"Warning: sizeof(Atom) != 64" << std::endl;
66 Log::file() <<
"Size of Atom = " <<
sizeof(
Atom) << std::endl;
67 Log::file() <<
"Size of Atom* = " <<
sizeof(
Atom*) << std::endl;
73 Memory::allocate<Vector>(velocities_,
capacity);
74 Memory::allocate<Mask>(masks_,
capacity);
75 Memory::allocate<Plan>(plans_,
capacity);
76 Memory::allocate<int>(ids_,
capacity);
77 Memory::allocate<unsigned int>(groups_,
capacity);
79 Memory::allocate<AtomContext>(contexts_,
capacity);
85 data_[i].localId_ = (i << 1);
86 data_[i].arrayPtr_ =
this;
88 plans_[i].clearFlags();
104 data_[i].force_[0] = 0.0;
105 data_[i].force_[1] = 0.0;
106 data_[i].force_[2] = 0.0;
114 {
return (
bool)
data_; }
void allocate(int capacity)
Allocate memory on the heap.
Atom * data_
Pointer to an array of Data elements.
bool isAllocated() const
Return true if this is already allocated, false otherwise.
virtual ~AtomArray()
Destructor.
int capacity_
Allocated size of the data_ array.
Array container class template.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
static bool hasAtomContext()
Is AtomContext data enabled?
void clear()
Set all data members to null default values.
static std::ostream & file()
Get log ostream by reference.
int capacity() const
Return allocated size.
void zeroForces()
Set force vector to zero for all atoms in this array.