Skip to content

NodeIP

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

The storage unit inside of the NodeIP container is the InterfacePropertiesEntry which contains five members: indexA and indexB which designate a pair of phase field indices for which the interface properties are stored, and energy, stiffness and mobility values. All these parameters are always stored together in one structure.

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

Arithmetic operations

cpp
NodeIP operator+(const NodeIP& 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 sign of the values is unchanged. The content of both operands is not changed.

cpp
NodeIP operator-(const NodeIP& 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 sign of the values is unchanged. The content of both operands is not changed.

cpp
NodeIP 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
NodeIP& operator=(const NodeIP& 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
NodeIP& operator+=(const NodeIP& n);
NodeIP& operator-=(const NodeIP& n);
NodeIP& 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_energy(const size_t n, const size_t m, const double energy_value);

The method, which sets the interface energy value for a pair of phase fields. If the entry with direct, (n,m), or reverse (m,n) index order already exists in the container, its energy value is overwritten, otherwise a new entry is created with the specified indices and the given energy value and zero other values.

cpp
void set_stiffness(const size_t n, const size_t m, const double stiffness_value);

The method, which sets the interface stiffness value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its stiffness value is overwritten, otherwise a new entry is created with the specified indices and the given stiffness value and zero other values.

cpp
void set_mobility(const size_t n, const size_t m, const double mobility_value);

The method, which sets the interface mobility value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its mobility value is overwritten, otherwise a new entry is created with the specified indices and the given mobility value and zero other values.

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

The method, which returns the interface energy value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its energy value is returned, otherwise zero value is returned. The content of the container is not changed.

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

The method, which returns the interface stiffness value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its stiffness value is returned, otherwise zero value is returned. The content of the container is not changed.

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

The method, which returns the interface mobility value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its mobility value is returned, otherwise zero value is returned. The content of the container is not changed.

cpp
void add_energy(const size_t n, const size_t m, const double energy_value);

The method, which increments the interface energy value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its energy value is incremented by energy_value, otherwise a new entry is created with the specified indices and the given energy value and zero other values.

cpp
void add_stiffness(const size_t n, const size_t m, const double stiffness_value);

The method, which increments the interface stiffness value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its stiffness value is incremented by stiffness_value, otherwise a new entry is created with the specified indices and the given stiffness value and zero other values.

cpp
void add_mobility(const size_t n, const size_t m, const double mobility_value);

The method, which increments the interface mobility value for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order exists in the container, its mobility value is incremented by mobility_value, otherwise a new entry is created with the specified indices and the given mobility value and zero other values.

cpp
void set_energy_and_mobility(const size_t n, const size_t m,
                             const double energy_value,
                             const double mobility_value);

The method, which sets the interface energy and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and mobility values are overwritten, otherwise a new entry is created with the specified indices and the given energy and mobility values and zero stiffness value.

cpp
void set_stiffness_and_mobility(const size_t n, const size_t m,
                                const double stiffness_value,
                                const double mobility_value);

The method, which sets the interface stiffness and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its stiffness and mobility values are overwritten, otherwise a new entry is created with the specified indices and the given stiffness and mobility values and zero energy value.

cpp
void set_energy_and_stiffness(const size_t n, const size_t m,
                              const double energy_value,
                              const double stiffness_value);

The method, which sets the interface energy and stiffness values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and stiffness values are overwritten, otherwise a new entry is created with the specified indices and the given energy and stiffness values and zero mobility value.

cpp
void set_energy_stiffness_and_mobility(const size_t n, const size_t m,
                                       const double energy_value,
                                       const double stiffness_value,
                                       const double mobility_value);

The method, which sets the interface energy, stiffness and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy, stiffness and mobility values are overwritten, otherwise a new entry is created with the specified indices and the given energy, stiffness and mobility values.

cpp
void add_energy_and_mobility(const size_t n, const size_t m,
                             const double energy_value,
                             const double mobility_value);

The method, which increments the interface energy and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and mobility values are incremented with the specified energy_value and mobility_value values, correspondingly, otherwise a new entry is created with the specified indices and the given energy and mobility values and zero stiffness value.

cpp
void add_stiffness_and_mobility(const size_t n, const size_t m,
                                const double stiffness_value,
                                const double mobility_value);

The method, which increments the interface stiffness and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its stiffness and mobility values are incremented with the specified stiffness_value and mobility_value values, correspondingly, otherwise a new entry is created with the specified indices and the given stiffness and mobility values and zero energy value.

cpp
void add_energy_and_stiffness(const size_t n, const size_t m,
                              const double energy_value,
                              const double stiffness_value);

The method, which increments the interface energy and stiffness values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and stiffness values are incremented with the specified energy_value and stiffness_value values, correspondingly, otherwise a new entry is created with the specified indices and the given energy and stiffness values and zero mobility value.

cpp
void add_energy_stiffness_and_mobility(const size_t n, const size_t m,
                                       const double energy_value,
                                       const double stiffness_value,
                                       const double mobility_value);

The method, which increments the interface energy, stiffness and mobility values for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy, stiffness and mobility values are incremented with the specified energy_value, stiffness_value and mobility_value values, correspondingly, otherwise a new entry is created with the specified indices and the given energy, stiffness and mobility values.

cpp
std::pair<double,double> get_energy_and_mobility(const size_t n,
                                                 const size_t m) const;

The method, which returns std::pair<energy_value, mobility_value> for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and mobility values are returned, otherwise zero energy and mobility values are returned. The content of the container is not changed.

cpp
std::pair<double,double> get_stiffness_and_mobility(const size_t n,
                                                    const size_t m) const;

The method, which returns std::pair<stiffness_value, mobility_value> for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its stiffness and mobility values are returned, otherwise zero stiffness and mobility values are returned. The content of the container is not changed.

cpp
std::pair<double,double> get_energy_and_stiffness(const size_t n,
                                                  const size_t m) const;

The method, which returns std::pair<energy_value,stiffness_value> for a pair of phase fields. If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its energy and stiffness values are returned, otherwise zero energy and stiffness values are returned. The content of the container is not changed.

cpp
InterfacePropertiesEntry get_entry(const size_t n, const size_t m) const;

The method, which returns InterfacePropertiesEntry for a pair of phase fields (n,m). If the entry with direct, (n,m), or reverse, (m,n), index order already exists in the container, its content is returned, otherwise an entry with the specified indices and zero energy, stiffness and mobility values is returned. The content of the container is not changed.

cpp
void add_energies(const NodeIP& energy_value);

The method, which adds energy values of all entries in the energy_value container to the current container. The energy values of the entries with similar index pairs are added to the corresponding entries in the current container, the energy values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_stiffnesses(const NodeIP& stiffness_values);

The method, which adds stiffness values of all entries in the stiffness_values container to the current container. The stiffness values of the entries with similar index pairs are added to the corresponding entries in the current container, the stiffness values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_mobilities(const NodeIP& mobility_values);

The method, which adds mobility values of all entries in the mobility_values container to the current container. The mobility values of the entries with similar index pairs are added to the corresponding entries in the current container, the mobility values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_energies_and_mobilities(const NodeIP& values);

The method, which adds energy and mobility values of all entries in the values container to the current container. The energy and mobility values of the entries with similar index pairs are added to the corresponding entries in the current container, the energy and mobility values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_energies_and_stiffnesses(const NodeIP& values);

The method, which adds energy and stiffness values of all entries in the values container to the current container. The energy and stiffness values of the entries with similar index pairs are added to the corresponding entries in the current container, the energy and stiffness values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_energies_stiffnesses_and_mobilities(const NodeIP& values);

The method, which adds energy, stiffness and mobility values of all entries in the values container to the current container. The energy, stiffness and mobility values of the entries with similar index pairs are added to the corresponding entries in the current container, the energy, stiffness and mobility values of the entries with indices not existing in the current container are copied into the newly created entries in the current container.

cpp
void add_energies_exist(const NodeIP& energy_values);

The method, which adds energy values of entries in the energy_value container to the current container if the entries with the same index pairs exist in the current container. The energy values of other entries are ignored.

cpp
void add_stiffnesses_exist(const NodeIP& stiffness_values);

The method, which adds stiffness values of entries in the stiffness_values container to the current container if the entries with the same index pairs exist in the current container. The stiffness values of other entries are ignored.

cpp
void add_mobilities_exist(const NodeIP& mobility_values);

The method, which adds mobility values of entries in the mobility_values container to the current container if the entries with the same index pairs exist in the current container. The mobility values of other entries are ignored.

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 InterfacePropertiesEntry entries.

cpp
iterator end();

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

cpp
const_iterator cbegin();

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

cpp
const_iterator cend();

Constant iterator to the end of the underlying std::vector<> container which stores InterfacePropertiesEntry 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 NodeIP 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 NodeIP 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 NodeIP object from the input stream.

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

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

Released under the GNU GPLv3 License.