IFEM  90A354
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Tensor4 Class Reference

Simple class for representing a non-symmetric fourth-order tensor. More...

#include <Tensor4.h>

Inheritance diagram for Tensor4:
Inheritance graph
[legend]
Collaboration diagram for Tensor4:
Collaboration graph
[legend]

Public Member Functions

 Tensor4 (t_ind nsd=3, Real scale=Real(1), bool makeJ=false)
 The default constructor creates a (scaled) identity tensor.
 
 Tensor4 (const std::vector< Real > &x, t_ind nsd=3)
 Constructor creating a tensor from a vector of components. More...
 
void zero ()
 Sets this to the 0-tensor.
 
 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 Realptr () const
 Reference through a pointer.
 
const Realoperator() (t_ind i, t_ind j, t_ind d, t_ind l) const
 Index-1 based component reference.
 
Realoperator() (t_ind i, t_ind j, t_ind k, t_ind l)
 Index-1 based component access.
 
Tensor4operator= (const Tensor4 &T)
 Assignment operator.
 
Tensor4operator= (Real val)
 Overloaded assignment operator.
 
Tensor4operator+= (Real val)
 Incrementation operator.
 

Protected Types

typedef unsigned short int t_ind
 Tensor index type (for convenience)
 

Protected Member Functions

virtual void redim (t_ind nsd)
 Auxilliary method used by the constructors.
 
virtual std::ostream & print (std::ostream &os) const
 Prints out the tensor to an output stream.
 

Protected Attributes

t_ind n
 Number of spatial dimensions for the tensor.
 
t_ind m
 Dimension of the matrix representation.
 
std::vector< Realv
 The actual tensor component values.
 

Private Member Functions

t_ind index (t_ind i, t_ind j, t_ind k, t_ind l) const
 Returns a 0-based array index for the given tensor indices.
 

Friends

std::ostream & operator<< (std::ostream &os, const Tensor4 &T)
 Output stream operator.
 

Detailed Description

Simple class for representing a non-symmetric fourth-order tensor.

Constructor & Destructor Documentation

◆ Tensor4()

Tensor4::Tensor4 ( const std::vector< Real > &  x,
t_ind  nsd = 3 
)

Constructor creating a tensor from a vector of components.

The provided vector is assumed to contain the components of the matrix representation of the tensor, stored in a one-dimensional array.

References m, redim(), and v.


The documentation for this class was generated from the following files: