CellModules
Tensor Struct Reference

Represents a 3x3 tensor for stress calculations. More...

#include <Tensor.hpp>

Public Member Functions

 Tensor ()
 Default constructor. More...
 
 Tensor (const MecaCell::Vec &f, const MecaCell::Vec &r)
 Constructor with force and position vectors. More...
 
double get (int i, int j) const
 Gets the value at the specified position in the tensor. More...
 
Tensoroperator/= (double div)
 Divides the tensor by a scalar value. More...
 
Tensoroperator+= (Tensor t)
 Adds another tensor to this tensor. More...
 
string to_string ()
 Converts the tensor to a string representation. More...
 

Private Attributes

double matrix [3][3] = {{0.,0.,0.},{0.,0.,0.},{0.,0.,0.}}
 

Detailed Description

Represents a 3x3 tensor for stress calculations.

Definition at line 10 of file Tensor.hpp.

Constructor & Destructor Documentation

◆ Tensor() [1/2]

Tensor::Tensor ( )
inline

Default constructor.

Definition at line 18 of file Tensor.hpp.

◆ Tensor() [2/2]

Tensor::Tensor ( const MecaCell::Vec f,
const MecaCell::Vec r 
)
inline

Constructor with force and position vectors.

Parameters
fForce vector.
rPosition vector.

Definition at line 26 of file Tensor.hpp.

Member Function Documentation

◆ get()

double Tensor::get ( int  i,
int  j 
) const
inline

Gets the value at the specified position in the tensor.

Parameters
iRow index.
jColumn index.
Returns
Value at the specified position.

Definition at line 42 of file Tensor.hpp.

◆ operator+=()

Tensor & Tensor::operator+= ( Tensor  t)
inline

Adds another tensor to this tensor.

Parameters
tTensor to add.
Returns
Reference to the updated tensor.

Definition at line 69 of file Tensor.hpp.

◆ operator/=()

Tensor & Tensor::operator/= ( double  div)
inline

Divides the tensor by a scalar value.

Parameters
divScalar value to divide by.
Returns
Reference to the updated tensor.

Definition at line 53 of file Tensor.hpp.

◆ to_string()

string Tensor::to_string ( )
inline

Converts the tensor to a string representation.

Returns
String representation of the tensor.

Definition at line 84 of file Tensor.hpp.

Member Data Documentation

◆ matrix

double Tensor::matrix[3][3] = {{0.,0.,0.},{0.,0.,0.},{0.,0.,0.}}
private

3x3 matrix representing the tensor

Definition at line 12 of file Tensor.hpp.


The documentation for this struct was generated from the following file: