30 using t_ind =
unsigned short int;
45 explicit Tensor(
const t_ind nsd,
bool identity =
false);
47 explicit Tensor(
const Vec3& vn,
bool vnIsX =
false);
50 bool t1isZ =
false,
bool t2isXZ =
false);
72 operator const std::vector<Real>&()
const {
return v; }
74 operator std::vector<Real>&() {
return v; }
124 size_t size()
const {
return v.size(); }
157 virtual std::ostream&
print(std::ostream& os,
int prec = 0)
const;
191 bool redim(
const t_ind nsd,
bool with33 =
false);
205 if (i == j+1 || i+2 == j) std::swap(i,j);
272 std::ostream&
print(std::ostream& os,
int prec = 0)
const override;
static SystemMatrix * M
Pointer to coefficient matrix B.
Definition: EigSolver.C:92
#define Real
The floating point type to use.
Definition: ImmersedBoundaries.h:18
Real ddot(const SymmTensor &A, const SymmTensor &B)
Inner-product (:-operator) of two symmetric tensors.
Definition: Tensor.h:301
SymmTensor operator+(const SymmTensor &A, const SymmTensor &B)
Adding two symmetric tensors.
Definition: Tensor.h:289
SymmTensor operator-(const SymmTensor &A, const SymmTensor &B)
Subtracting two symmetric tensors.
Definition: Tensor.h:295
Abstract interface to problem-specific local coordinate systems.
Definition: Tensor.h:312
virtual ~LocalSystem()
Empty default destructor.
Definition: Tensor.h:319
LocalSystem()
Protected default constructor since this is an interface class.
Definition: Tensor.h:315
static int patch
Counter used to establish multi-patch local systems.
Definition: Tensor.h:324
virtual const Tensor & getTmat(const Vec3 &X) const =0
Computes the global-to-local transformation at the point X.
Simple class for representing a symmetric second-order tensor.
Definition: Tensor.h:183
std::ostream & print(std::ostream &os, int prec=0) const override
Prints out the lower triangle of the tensor to an output stream.
Definition: Tensor.C:1391
Tensor & symmetrize() override
Makes the symmetric tensor symmetric (i.e., does nothing).
Definition: Tensor.h:236
Tensor & transpose() override
Transposes the symmetric tensor (i.e., does nothing).
Definition: Tensor.h:234
Real inverse(Real tol=Real(0)) override
Inverts the symmetric tensor.
Definition: Tensor.C:955
SymmTensor & operator=(Real val)
Assignment operator.
Definition: Tensor.C:834
SymmTensor(const SymmTensor &T)
Copy constructor.
Definition: Tensor.h:222
friend SymmTensor operator+(const SymmTensor &T, Real a)
Adding a scaled unit tensor to a symmetric tensor.
Definition: Tensor.C:1419
SymmTensor & rightCauchyGreen(const Tensor &F)
Constructs the right Cauchy-Green tensor from a deformation tensor.
Definition: Tensor.C:998
bool symmetric() const override
Query whether this tensor is symmetric or not.
Definition: Tensor.h:231
Real det() const override
Returns the determinant of the symmetric tensor.
Definition: Tensor.C:935
Real L2norm(bool doSqrt=true) const
Returns the inner-product (L2-norm) of the symmetric tensor.
Definition: Tensor.C:1060
SymmTensor & outerProd(const Vec3 &u)
Dyadic (outer) product between two identical vectors.
Definition: Tensor.C:1030
Real vonMises(bool doSqrt=true) const
Returns the von Mises value of the symmetric tensor.
Definition: Tensor.C:1079
void copy(const SymmTensor &T)
Copies a symmetric tensor, possibly with dimension change.
Definition: Tensor.C:843
SymmTensor(const t_ind nsd, bool with33=false)
Constructor creating a zero tensor.
Definition: Tensor.C:802
Real trace() const override
Returns the trace of the symmetric tensor.
Definition: Tensor.C:920
friend SymmTensor operator-(const SymmTensor &T, Real a)
Subtracting a scaled unit tensor from a symmetric tensor.
Definition: Tensor.C:1437
bool principal(Vec3 &p, bool sorted=true) const
Computes the principal values of the symmetric tensor.
Definition: Tensor.C:1108
t_ind index(t_ind i, t_ind j) const override
Returns a 0-based array index for the given tensor indices.
Definition: Tensor.h:198
friend SymmTensor operator*(Real a, const SymmTensor &T)
Multiplication between a scalar and a symmetric tensor.
Definition: Tensor.C:1455
SymmTensor & transform(const Tensor &T)
Congruence transformation of a symmetric tensor.
Definition: Tensor.C:855
bool redim(const t_ind nsd, bool with33=false)
Resets the number of spatial dimensions of the tensor.
Definition: Tensor.C:808
Simple class for representing a non-symmetric second-order tensor.
Definition: Tensor.h:28
Real & operator()(t_ind i, t_ind j)
Index-1 based component access.
Definition: Tensor.h:82
Tensor & postMult(const Tensor &B)
Post-multiplication with another Tensor.
Definition: Tensor.C:366
size_t size() const
Returns the size of this tensor.
Definition: Tensor.h:124
Tensor & operator*=(Real val)
Scaling operator.
Definition: Tensor.C:357
void diag(Real value=Real(1))
Sets *this to a diagonal tensor with value on the diagonal.
Definition: Tensor.C:209
virtual std::ostream & print(std::ostream &os, int prec=0) const
Prints out the tensor to an output stream.
Definition: Tensor.C:690
Tensor & shift(short int idx=1)
Performs a cyclic permutation of the tensor columns.
Definition: Tensor.C:572
Tensor & operator=(const Tensor &T)
Assignment operator.
Definition: Tensor.C:246
Tensor & operator+=(const Tensor &T)
Incrementation operator.
Definition: Tensor.C:303
Tensor(const t_ind nsd, bool identity=false)
Constructor creating a zero or identity tesnor.
Definition: Tensor.C:30
const t_ind n
Number of spatial dimensions for the tensor.
Definition: Tensor.h:32
virtual Real inverse(Real tol=Real(0))
Inverts the tensor.
Definition: Tensor.C:650
Tensor & preMult(const Tensor &A)
Pre-multiplication with another Tensor.
Definition: Tensor.C:399
Tensor & operator-=(const Tensor &T)
Decrementation operator.
Definition: Tensor.C:330
unsigned short int t_ind
Tensor index type (for convenience)
Definition: Tensor.h:30
std::vector< Real > v
The actual tensor component values.
Definition: Tensor.h:33
Real innerProd(const Tensor &T) const
Returns the inner-product of *this and the given tensor.
Definition: Tensor.C:485
void zero()
Sets *this to the 0-tensor.
Definition: Tensor.h:64
const Real * ptr() const
Reference through a pointer.
Definition: Tensor.h:77
virtual Tensor & symmetrize()
Makes the tensor symmetric.
Definition: Tensor.C:551
bool equal(const Tensor &T, Real tol=Real(1.0e-6)) const
Query whether this tensor equals another within given tolerance.
Definition: Tensor.C:507
bool isZero(Real tol=Real(1.0e-6)) const
Query whether this tensor is zero within given tolerance.
Definition: Tensor.C:520
Tensor & operator*=(const Tensor &B)
Post-multiplication with another Tensor.
Definition: Tensor.h:106
t_ind dim() const
Returns the dimension of this tensor.
Definition: Tensor.h:121
Tensor & rotate(Real alpha, t_ind axis)
Rotates the tensor about given coordinate axis.
Definition: Tensor.C:432
Vec3 operator[](t_ind i) const
Index-0 based column reference.
Definition: Tensor.C:237
const Real & operator()(t_ind i, t_ind j) const
Index-1 based component reference.
Definition: Tensor.h:80
Vec3 rotVec() const
Returns the rotation angles corresponding to the tensor.
Definition: Tensor.C:609
Tensor & outerProd(const Vec3 &a, const Vec3 &b)
Dyadic (outer) product between two vectors.
Definition: Tensor.C:475
friend std::ostream & operator<<(std::ostream &os, const Tensor &T)
Output stream operator.
Definition: Tensor.h:171
friend Vec3 operator*(const Tensor &T, const Vec3 &v)
Multiplication between a tensor and a point vector.
Definition: Tensor.C:718
virtual Real det() const
Returns the determinant of the tensor.
Definition: Tensor.C:635
virtual bool symmetric() const
Query whether this tensor is symmetric or not.
Definition: Tensor.h:127
virtual Tensor & transpose()
Transposes the tensor.
Definition: Tensor.C:530
virtual Real trace() const
Returns the trace of the tensor.
Definition: Tensor.C:596
void define3Dtransform(const Vec3 &v1, const Vec3 &v2, const Vec3 &v3)
Creates a 3D transformation from three unit vectors.
Definition: Tensor.C:225
virtual ~Tensor()
Empty destructor.
Definition: Tensor.h:61
virtual t_ind index(t_ind i, t_ind j) const
Returns a 0-based array index for the given tensor indices.
Definition: Tensor.h:37
Simple class for representing a point in 3D space.
Definition: Vec3.h:27