NodePF
NodePF is an indexed, dynamic storage container which stores only non-zero values of the local phase fields and their derivatives. It is used as a storage unit in Storage3D container.
The storage unit inside of the NodePF container is the PhaseFieldEntry which contains four entries: index which designates the phase-field index, value which is the value of the stored phase field, gradient, a dVector3 container storing the phase-field gradient, laplacian which is the phase-field Laplacian value. All these parameters are always stored together in one structure.
The data inside of the NodePF container is manipulated using a number of dedicated methods:
Constructors
cppNodePF();Default constructor. Creates empty node.
cppNodePF(const NodePF& n);Copy constructor. Initializes current container with the copy of
n.
Arithmetic operations
cppNodePF operator+(const NodePF& 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. The content of both operands is not changed.
cppNodePF operator-(const NodePF& 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. The content of both operands is not changed.
cppNodePF operator*(const double n);Multiplication operator, which multiplies all values stored in the container by a specified number
nand copies the result into the output container. The content of the input container is not changed.
cppNodePF& operator=(const NodePF& n);Assignment operator, which copies the content of container
ninto the receiving container. The initial content of the receiving container is erased and all the entries stored in the right-hand-side containernare copied into it. The content of the containernis unchanged.
cppNodePF& operator+=(const NodePF& n); NodePF& operator-=(const NodePF& n); NodePF& 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
cppbool present(const size_t idx) const;Checks if the entry with the given phase-field index
idxexists in the current container. It returnstrueif the entry if found in the container,falseotherwise. The content of the container is unchanged.
cppvoid set_value(const size_t n, const double value);Sets the value of the entry with the phase-field index
nto a givenvalue. If the entry already exists in the container its value is overwritten, otherwise the new entry with indexnand valuevalueis created.
cppvoid add_value(const size_t n, const double value);Adds the
valueto the entry with the phase-field indexnin the current container. If the entry with indexndoes not exists in the container it is created with the valuevalue.
cppdouble get_value(const size_t n) const;Returns the value of the phase-field
n. If the entry with indexndoes not exists in the container zero value is returned.
cppvoid set_laplacian(const size_t n, const double laplacian);Sets Laplacian of the phase-field
n.
cppvoid add_laplacian(const size_t n, const double laplacian);Increments Laplacian of the phase-field with index
n.
cppvoid add_laplacian_tmp(const size_t n, const double laplacian);Increments temporary Laplacian of the phase-field
n(used to avoid data race condition in OpenMP parallel mode).
cppdouble get_laplacian(const size_t n) const;Returns Laplacian of the phase-field
n. If the entry with indexndoes not exists in the container zero value is returned.
cppvoid set_gradient(const size_t n, const dVector3 gradient);Sets gradient of the phase-field
n.
cppvoid add_gradient(const size_t n, const dVector3 gradient);Increments gradient of the phase-field
n.
cppvoid add_gradient_tmp(const size_t n, const dVector3 gradient);Increments temporary gradient of the phase-field
n(used to avoid data race condition in OpenMP parallel mode).
cppdVector3 get_gradient(const size_t n) const;Returns gradient for the phase-field
n. If the entry with indexndoes not exists in the container zero vector is returned.
cppNodeA<dVector3> get_gradients() const;Returns
NodeAcontaining gradients of all phase-fields stored in teh current node.
cppvoid set_derivatives(const size_t n, const double laplacian, const dVector3 gradient);Sets gradient and Laplacian for the phase-field
n.
cppvoid add_derivatives(const size_t n, const double laplacian, const dVector3 gradient);Increments values of gradient and Laplacian of teh phase field
n.
cppstd::pair<double,dVector3> get_derivatives(const size_t n) const;Returns
std::pair<Laplacian, gradient>containing Laplacian and gradient of the phase fieldn.
cppvoid set_all(const size_t n, const double value, const double laplacian, const dVector3 gradient);Sets value, Laplacian and gradient of the phase field
n.
cppvoid add_all(const size_t n, const double value, const double laplacian, const dVector3 gradient);Increments value and Laplacian and gradient of the phase field
n.
cppvoid get_all(const size_t n, double& value, double& laplacian, dVector3& gradient) const;Returns (by reference) value, Laplacian and gradient of the phase field
n.
cppvoid add_values(const NodePF& value);Adds values of phase fields from incoming container to the current one.
cppvoid add_laplacians(const NodePF& value);Adds Laplacians from incoming container to the current one.
cppvoid add_gradients(const NodePF& value);Adds gradients from incoming container to the current one.
cppvoid add_derivatives(const NodePF& value);Adds derivatives from incoming container to the current one.
cppvoid add_existing_values(const NodePF& value);Adds only values of phase fields existing in the current and incoming nodes simultaneously.
cppvoid add_existing_all(const NodePF& value);Adds only phase-field entries existing in the current and incoming nodes simultaneously.
cppvoid set_temporary(void);Sets temporary copy of the node data (used to avoid data race condition in OpenMP parallel mode).
cppvoid copy_from_temporary(void);Restores node data from its temporary storage (used to avoid data race condition in OpenMP parallel mode).
cppPhaseFieldEntry get_max(void) const;Returns
PhaseFieldEntrywith the maximum phase-field value.
cppPhaseFieldEntry& front(void);Returns reference to the first entry in the underlying
std::vector<>container.
cppconst PhaseFieldEntry& front(void);Returns constant reference to the first entry in the underlying
std::vector<>container.
cppvoid clear()Clears the container erasing all entries. Sets
flagto 0.
cppint finalize(void);Adjusts phase-field values to
interval. Makes sure that the phase-fields um contraint is fullfilled.
cppint majority_index(void) const;Returns index of the phase field with the highest value in the current container instance.
Node location indicators
cppint flag;Interface flag. It is set to
1if the node is located near the interface,2if it is in the interface and0if it is in the bulk.
cppbool interface(void) const;Returns true if flag == 2.
cppbool interface_halo(void) const;Returns true if flag == 1.
cppbool wide_interface(void) const;Returns true if flag != 0.
cppbool bulk(void) const;Returns true if flag != 2.
Iterators
cppiterator begin();Iterator to the begin of the underlying
std::vector<>container which storesPhaseFieldEntryentries.
cppiterator end();Iterator to the end of the underlying
std::vector<>container which storesPhaseFieldEntryentries.
cppconst_iterator cbegin();Constant iterator to the begin of the underlying
std::vector<>container which storesPhaseFieldEntryentries.
cppconst_iterator cend();Constant iterator to the end of the underlying
std::vector<>container which storesPhaseFieldEntryentries.
cppiterator erase(iterator it);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
cppsize_t size();Returns the size of the underlying
std::vector<>container. It is equivalent to the number of stored entries.
cppsize_t capacity();Returns the capacity of the underlying
std::vector<>container. It is equivalent to the number of stored entries.
MPI communication methods
cppvoid pack(std::vector<double>& buffer);Packs (writes) the content of the current
NodePFobject into the MPI communication buffer.
cppvoid unpack(std::vector<double>& buffer, size_t& it);Unpacks (reads) the content of the current
NodePFobject from the MPI communication buffer. The existing data in the container is overwritten.
Read/write methods
cppvoid read(std::istream& inp);Reads the content of the current
NodePFobject from the input stream.
cppvoid write(std::ostream& outp) const;Writes the content of the current
NodePFobject into the output stream.