Skip to content

NodeDF

NodeDF is a double-indexed, dynamic storage container which stores only non-zero values of the local driving forces. It is used as a storage unit in Storage3D container.

The storage unit inside of the NodeDF container is the DrivingForceEntry which contains six members: indexA and indexB which designate a pair of phase field indices for which the driving force is stored, raw, tmp and average values of the driving force and local weight used for the driving force. All these parameters are always stored together in one structure.

The data inside of the NodeDF container is manipulated using a number of dedicated methods:

Arithmetic operations

cpp
NodeDF operator+(const NodeDF& n);

Plus operator, which adds values with identical indices from two contains. The entries with indices existing only in one of the containers are simply copied into the resulting output container. For the summation of the entries existing in both containers but with reverse index order the raw, tmp and average values are added up considering antisimmetric rule, e.g., f(m,n) = -f(n,m), while the sign of the weights is unchanged. The content of both operands is not changed.

cpp
NodeDF operator-(const NodeDF& n);

Minus operator, which subtracts the values with identical indices from two containers. The entries with indices existing only in the leftmost container are simply copied into the resulting output container. The entries with indices existing only in the rightmost container are copied into the resulting container with their signs inverted. For the subtraction of the entries existing in both containers but with reverse index order the raw, tmp and average values are subtracted considering antisimmetric rule, e.g., f(m,n) = -f(n,m), while the sign of the weights is unchanged. The content of both operands is not changed.

cpp
NodeDF operator*(const double n);

Multiplication operator, which multiplies all values stored in the container by a specified number n and copies the result into the output container. The content of the input container is not changed.

cpp
NodeDF& operator=(const NodeDF& n);

Assignment operator, which copies the content of container n into the receiving container. The initial content of the receiving container is erased and all the entries stored in the right-hand-side container n are copied into it. The content of the container n is unchanged.

cpp
NodeDF& operator+=(const NodeDF& n);
NodeDF& operator-=(const NodeDF& n);
NodeDF& operator*=(const double n);

Arithmetic operators similar to the ordinary operators above except they modify the left-hand-side container and return a reference to it instead of returning a new container.

Data access and manipulation

cpp
void set_raw(const size_t n, const size_t m, const double value);

The method, which sets the raw driving force value for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, its raw value is overwritten. If the entry with the reverse index order (m,n) already exists in the container the raw value is assigned to it with the opposite sign, e.g., f(m,n) = -f(n,m), otherwise a new entry is created with the corresponding indices and the given raw value and zero other values.

cpp
void set_tmp(const size_t n, const size_t m, const double value);

The method, which sets the tmp driving force value (used in the averaging procedure) for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, its tmp value is overwritten. If the entry with the reverse index order (m,n) already exists in the container the tmp value is assigned to it with the opposite sign, e.g., f(m,n) = -f(n,m), otherwise a new entry is created with the corresponding indices and the given tmp value and zero other values.

cpp
void set_average(const size_t n, const size_t m, const double value);

The method, which sets the average driving force value (used in the averaging procedure) for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, its average value is overwritten. If the entry with the reverse index order (m,n) already exists in the container the average value is assigned to it with the opposite sign, e.g., f(m,n) = -f(n,m), otherwise a new entry is created with the corresponding indices and the given average value and zero other values.

cpp
void set_weight(const size_t n, const size_t m, const double value);

The method, which sets the weight driving force value (used in the averaging procedure) for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, its weight value is overwritten. If the entry with the reverse index order (m,n) already exists in the container the weight value is assigned to it without changing the sign, e.g., f(m,n) = f(n,m), otherwise a new entry is created with the specified indices and the given average value and zero other values.

cpp
void set_all(const size_t n, const size_t m, const double raw_value,
                                             const double tmp_value,
                                             const double avg_value,
                                             const double wgt_value);

The method, which sets all driving force values,raw, tmp and average, for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, its values are overwritten. If the entry with the reverse index order (m,n) already exists in the container the values are assigned to it with the opposite sign, e.g., f(m,n) = -f(n,m), and the weight is assigned without changing the sign, e.g., f(m,n) = f(n,m). Otherwise a new entry is created with the specified index order and the given raw, tmp and average values and weight.

cpp
double get_raw(const size_t n, const size_t m) const;

The method, which returns existing raw value in antisymmetric case (changes sign when index order changes): f(m,n) = -f(n,m). Returns zero otherwise.

cpp
double get_tmp(const size_t n, const size_t m) const;

The method, which returns existing tmp value in antisymmetric case (changes sign when index order changes): f(m,n) = -f(n,m). Returns zero otherwise.

cpp
double get_average(const size_t n, const size_t m) const;

The method, which returns existing average value in antisymmetric case (changes sign when index order changes): f(m,n) = -f(n,m). Returns zero otherwise.

cpp
double get_weight(const size_t n, const size_t m) const;

The method, which returns existing weight value in a symmetric case (keeps sign when index order changes): f(m,n) = f(n,m). Returns zero otherwise.

cpp
void add_raw(const size_t n, const size_t m, const double value);

The method, which increments the existing raw value in antisymmetric case (changes sign when index order changes): f(m,n) = -f(n,m). If the entry does not exists in the container a new entry is created with the specified index order and the given raw value and zero other values.

cpp
void add_tmp(const size_t n, const size_t m, const double value);

The method, which increments the existing tmp value in antisymmetric case (changes sign when index order changes): f(n,m) = -f(m,n). If the entry does not exists in the container a new entry is created with the specified index order and the given tmp value and zero other values.

cpp
void add_average(const size_t n, const size_t m, const double value);

The method, which increments the existing average value in antisymmetric case (changes sign when index order changes): f(n,m) = -f(m,n). If the entry does not exists in the container a new entry is created with the specified index order and the given average value and zero other values.

cpp
void add_weight(const size_t n, const size_t m, const double value);

The method, which increments the existing weight in symmetric case (keeps the sign when index order changes): f(m,n) = f(n,m). If the entry does not exists in the container a new entry is created with the specified index order and the given weight value and zero other values.

cpp
void add_all(const size_t n, const size_t m, const double raw_value,
                                             const double tmp_value,
                                             const double avg_value,
                                             const double wgt_value);

The method, which increments all driving force values,raw, tmp and average, for a pair of phase fields. If the entry with direct index order (n,m) already exists in the container, the corresponding values are added to it. If the entry with the reverse index order (m,n) already exists in the container the values are added with the opposite signs, e.g., f(m,n) = -f(n,m), and the weight is added without changing the sign, e.g., f(m,n) = f(n,m). Otherwise a new entry is created with the specified index order and the given raw, tmp and average values and weight.

cpp
void clear()

The method, which clears the container erasing all entries.

Iterators

cpp
iterator begin();

Iterator to the begin of the underlying std::vector<> container which stores DrivingForceEntry entries.

cpp
iterator end();

Iterator to the end of the underlying std::vector<> container which stores DrivingForceEntry entries.

cpp
const_iterator cbegin();

Constant iterator to the begin of the underlying std::vector<> container which stores DrivingForceEntry entries.

cpp
const_iterator cend();

Constant iterator to the end of the underlying std::vector<> container which stores DrivingForceEntry entries.

cpp
iterator erase(iterator it);

The method which erases the entry pointed to by the iterator it. It returns the next iterator following the erazed one. The storage is modified and its size is reduced.

Container properties

cpp
size_t size();

The method which returns the size of the underlying std::vector<> container. It is equivalent to the number of stored entries.

cpp
size_t capacity();

The method which returns the capacity of the underlying std::vector<> container. It is equivalent to the number of stored entries.

MPI communication methods

cpp
void pack(std::vector<double>& buffer);

The method, which packs the content of the current NodeDF object into the MPI communication buffer.

cpp
void unpack(std::vector<double>& buffer, size_t& it);

The method, which unpacks (reads) the content of the current NodeDF object from the MPI communication buffer. The existing data in the container is overwritten.

Read/write methods

cpp
void read(std::istream& inp);

The method, which reads the content of the current NodeDF object from the input stream.

cpp
void write(std::ostream& outp) const;

The method, which writes the content of the current NodeDF object into the output stream.

Released under the GNU GPLv3 License.