vStress
vStress is a static storage container which stores a vector of six double values. It is used to store mechanical stress in Voigt notations, as a storage unit in Storage3D container.
The data inside of the vStress container is manipulated using a number of dedicated methods:
Constructors
cppvStress();Default constructor, sets vector values to zero;
cppvStress(const vStress& vecinit);Copy constructor, initializes the current vector with a copy of
vecinit.
cppvStress(std::array<double,6> vecinit);Constructor, initializes the current vector with a copy of
vecinit.
cppvStress(std::initializer_list<double> vecinit);Constructor, initializes the current vector using initializer list
vecinit.
Access operators
cppdouble& operator[](const size_t i); double const& operator[](const size_t i) const;Return (const) reference to the element
i.
cppdouble* data(void); const double* data(void) const;Returns (const) pointer to the first element of the vector.
Arithmetic and vector operations
cppvStress operator*(const double m) const;Returns current vector with all components multiplied by the factor
m.
cppvStress operator/(const double m) const;Returns current vector with all components divided by the factor
m.
cppvStress operator+(const vStress& rhs) const;Returns the sum of two vectors.
cppvStress operator-(const vStress& rhs) const;Returns the difference of two vectors.
cppvStress& operator*=(const double m);Multiplies all entries of the current vector by the factor
m.
cppvStress& operator/=(const double m);Divides all entries of the current vector by the factor
m.
cppvStress& operator-=(const vStress& rhs);Subtracts vector
rhsfrom the current vector.
cppvStress& operator+=(const vStress& rhs);Adds vector
rhsto the current vector.
cppvStress& operator=(const vStress& rhs);Assigns the content of the vector
rhsto the current vector.
cppdouble norm(double p);Returns Frobenius norm of the stress tensor (internally considers full tensor notations).
cppdouble double_contract(const vStress& Bstress) const;Returns double contraction of two stress tensors (internally considers full tensor notations).
cppdouble Pressure() const;Returns hydrostatic pressure.
cppdouble trace() const;Returns the trace of the stress tensor.
cppdouble determinant() const;Returns the determinant of the stress tensor (internally considers full tensor notations).
cppdVector3 invariants(void) const;Returns three stress invariants
{I1, I2, I3}.
cppdouble Mises(void) const;Returns von Mises stress.
cppvStress rotated(const dMatrix3x3& RotationMatrix) const;Returns the copy of the current stress vector rotated by
RotationMatrix(internally considers full tensor notations).
cppvStress& rotate(const dMatrix3x3& RotationMatrix);Rotates the current stress vector by
RotationMatrix(internally considers full tensor notations).
cppdouble get_tensor(const int i, const int j) const;Returns stress tensor element using tensor indices
i,j.
cppdMatrix3x3 tensor(void) const;Returns stress tensor corresponding to the current Voigt vector.
Data manipulation methods
cppvoid set_to_zero(void);Sets all entries to zero.
Container properties
cppconstexpr size_t size(void) const;Returns the size of the stored vector.
MPI communication methods
cppvoid pack(std::vector<double>& buffer);The method, which packs the content of the current object into the MPI communication buffer.
cppvoid unpack(std::vector<double>& buffer, size_t& it);The method, which unpacks (reads) the content of the current object from the MPI communication buffer. The existing data in the container is overwritten.
Read/write methods
cppstd::string print(void) const;Returns formatted string of the vector values ready to print to the terminal.
cppvoid read_ASCII(std::istream& inp);Reads vector content from the input stream.
cppvoid write_ASCII(std::ostream& outp, const int precision = 16, const char sep = ' ') const;Writes vector content in ASCII format with the specified
precisionusingsepas entry separator into the output stream.
cppstd::string get_output_string(const int precision = 16, const char sep = ' ') const;Returns output string with vector content in ASCII format with the specified
precisionusingsepas entry separator.
cppstd::vector<double> get_vector() const;Returns
std::vectorcontaining current vector components.
cppstd::vector<float> get_vector_float() const;Returns
std::vector<float>containing current vector components rounded tofloatprecision.