|
IFEM
90A354
|
Simple class for representing a non-symmetric second-order tensor. More...
#include <Tensor.h>


Public Member Functions | |
| Tensor (const t_ind nsd, bool identity=false) | |
| Constructor creating a zero or identity tesnor. | |
| Tensor (const Vec3 &vn, bool vnIsX=false) | |
| Constructor creating a transformation from a face normal vector. More... | |
| Tensor (const Vec3 &t1, const Vec3 &t2, bool t1isZ=false, bool t2isXZ=false) | |
| Constructor creating a transformation from two tangent vectors. More... | |
| Tensor (const Vec3 &v1, const Vec3 &v2, const Vec3 &v3) | |
| Constructor creating a transformation from three unit vectors. More... | |
| Tensor (Real a1, Real a2, Real a3) | |
| Constructor creating a transformation from three rotation angles. More... | |
| Tensor (const Tensor &T, bool transpose=false) | |
| Copy constructor, optionally creating the transpose of T. | |
| Tensor (const std::vector< Real > &a, bool transpose=false) | |
| Constructor copying its content from a one-dimensional array. | |
| virtual | ~Tensor () |
| Empty destructor. | |
| void | zero () |
| Sets *this to the 0-tensor. | |
| void | diag (Real value=Real(1)) |
| Sets *this to a diagonal tensor with value on the diagonal. | |
| void | diag (const Vec3 &diagonal) |
| Sets *this to a diagonal tensor with given vector as diagonal. | |
| operator const std::vector< Real > & () const | |
| Type casting to a one-dimensional vector, for referencing. | |
| operator std::vector< Real > & () | |
| Type casting to a one-dimensional vector, for assignment. | |
| const Real * | ptr () const |
| Reference through a pointer. | |
| const Real & | operator() (t_ind i, t_ind j) const |
| Index-1 based component reference. | |
| Real & | operator() (t_ind i, t_ind j) |
| Index-1 based component access. | |
| Vec3 | operator[] (t_ind i) const |
| Index-0 based column reference. | |
| Tensor & | operator= (const Tensor &T) |
| Assignment operator. | |
| Tensor & | operator= (const std::vector< Real > &val) |
| Overloaded assignment operator. | |
| Tensor & | operator= (Real val) |
| Overloaded assignment operator. | |
| Tensor & | operator+= (const Tensor &T) |
| Incrementation operator. | |
| Tensor & | operator+= (Real val) |
| Incrementation operator. | |
| Tensor & | operator-= (const Tensor &T) |
| Decrementation operator. | |
| Tensor & | operator-= (Real val) |
| Decrementation operator. | |
| Tensor & | operator*= (Real val) |
| Scaling operator. | |
| Tensor & | operator*= (const Tensor &B) |
| Post-multiplication with another Tensor. | |
| Tensor & | postMult (const Tensor &B) |
| Post-multiplication with another Tensor. | |
| Tensor & | preMult (const Tensor &A) |
| Pre-multiplication with another Tensor. | |
| Tensor & | rotate (Real alpha, t_ind axis) |
| Rotates the tensor about given coordinate axis. | |
| Tensor & | outerProd (const Vec3 &a, const Vec3 &b) |
| Dyadic (outer) product between two vectors. | |
| Real | innerProd (const Tensor &T) const |
| Returns the inner-product of *this and the given tensor. | |
| t_ind | dim () const |
| Returns the dimension of this tensor. | |
| size_t | size () const |
| Returns the size of this tensor. | |
| virtual bool | symmetric () const |
| Query whether this tensor is symmetric or not. | |
| bool | equal (const Tensor &T, Real tol=Real(1.0e-6)) const |
| Query whether this tensor equals another within given tolerance. | |
| bool | isZero (Real tol=Real(1.0e-6)) const |
| Query whether this tensor is zero within given tolerance. | |
| virtual Tensor & | transpose () |
| Transposes the tensor. | |
| virtual Tensor & | symmetrize () |
| Makes the tensor symmetric. | |
| Tensor & | shift (short int idx=1) |
| Performs a cyclic permutation of the tensor columns. | |
| virtual Real | trace () const |
| Returns the trace of the tensor. | |
| virtual Real | det () const |
| Returns the determinant of the tensor. | |
| virtual Real | inverse (Real tol=Real(0)) |
| Inverts the tensor. More... | |
| Vec3 | rotVec () const |
| Returns the rotation angles corresponding to the tensor. | |
| virtual std::ostream & | print (std::ostream &os, int prec=0) const |
| Prints out the tensor to an output stream. | |
Protected Types | |
| using | t_ind = unsigned short int |
| Tensor index type (for convenience) | |
Protected Member Functions | |
| virtual t_ind | index (t_ind i, t_ind j) const |
| Returns a 0-based array index for the given tensor indices. More... | |
Protected Attributes | |
| const t_ind | n |
| Number of spatial dimensions for the tensor. | |
| std::vector< Real > | v |
| The actual tensor component values. | |
Private Member Functions | |
| void | define3Dtransform (const Vec3 &v1, const Vec3 &v2, const Vec3 &v3) |
| Creates a 3D transformation from three unit vectors. | |
Friends | |
| Vec3 | operator* (const Tensor &T, const Vec3 &v) |
| Multiplication between a tensor and a point vector. | |
| Vec3 | operator* (const Vec3 &v, const Tensor &T) |
| Multiplication between a point vector and transpose of a tensor. | |
| Tensor | operator* (const Tensor &A, const Tensor &B) |
| Multiplication between two tensors. | |
| Tensor | operator* (Real a, const Tensor &T) |
| Multiplication between a scalar and a tensor. | |
| std::ostream & | operator<< (std::ostream &os, const Tensor &T) |
| Output stream operator. | |
Simple class for representing a non-symmetric second-order tensor.
|
explicit |
Constructor creating a transformation from a face normal vector.
The provided vector vn is taken as the local Z-axis. The local X- and Y-axes are then defined by projecting either the global X- or Y-axis onto the normal plane, depending on whether vn points mostly in the global Y- or X-direction, respectively.
If vnIsX is true, vn is taken as the local X-axis instead and the other two axes are shifted accordingly.
References Vec3::cross(), define3Dtransform(), Vec3::normalize(), Vec3::x, Vec3::y, and Vec3::z.
Constructor creating a transformation from two tangent vectors.
The first tangent vector t1 is taken as the local X-axis (or Z-axis, if t1isZ is true). The local Z-axis (X-axis) is then defined as the cross product between t1 and t2. If t2isXZ is true, the local Y-axis is instead defined as the cross product between t2 and t1.
References Vec3::cross(), define3Dtransform(), and Vec3::normalize().
Constructor creating a transformation from three unit vectors.
This constructor assumes the three vectors provided form an orthonormal basis.
References define3Dtransform().
Constructor creating a transformation from three rotation angles.
This constructor computes an incremental rotation tensor from the given rotation angles via a quaternion representation of the rotation. The angles provided are those related to a Rodrigues parameterization.
References epsZ, Vec3::length(), Real, v, Vec3::x, Vec3::y, and Vec3::z.
Returns a 0-based array index for the given tensor indices.
Assuming column-wise storage for non-symmetric tensors.
Reimplemented in SymmTensor.
References n.
Referenced by operator()(), and rotVec().
Inverts the tensor.
| [in] | tol | Division by zero tolerance |
Reimplemented in SymmTensor.