https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
PermutationTensor Namespace Reference

Utility functions to return the permutation pseudo tensor in 2D, 3D or 4D. More...

Functions

int eps (unsigned int i, unsigned int j)
 2D version
 
int eps (unsigned int i, unsigned int j, unsigned int k)
 3D version
 
int eps (unsigned int i, unsigned int j, unsigned int k, unsigned int l)
 4D version
 

Detailed Description

Utility functions to return the permutation pseudo tensor in 2D, 3D or 4D.

eps(i1, i2, ..., iD) = +1 if (i1, i2, ..., iD) is an even permutation of (0, 1, ..., D) -1 if (i1, i2, ..., iD) is an odd permutation of (0, 1, ..., D) 0 otherwise The permutation tensor is also known as the Levi-Civita symbol

Function Documentation

◆ eps() [1/3]

int PermutationTensor::eps ( unsigned int  i,
unsigned int  j 
)

2D version

Definition at line 13 of file PermutationTensor.C.

14{
15 if (i == 0 && j == 1)
16 return 1;
17 else if (i == 1 && j == 0)
18 return -1;
19 return 0;
20}

Referenced by eps(), eps(), and RankFourTensorTempl< T >::fillGeneralIsotropic().

◆ eps() [2/3]

int PermutationTensor::eps ( unsigned int  i,
unsigned int  j,
unsigned int  k 
)

3D version

Definition at line 23 of file PermutationTensor.C.

24{
25 if (i == 0 && j > 0 && k > 0)
26 return eps(j - 1, k - 1);
27 else if (j == 0 && i > 0 && k > 0)
28 return -eps(i - 1, k - 1);
29 else if (k == 0 && i > 0 && j > 0)
30 return eps(i - 1, j - 1);
31 return 0;
32}
int eps(unsigned int i, unsigned int j)
2D version

◆ eps() [3/3]

int PermutationTensor::eps ( unsigned int  i,
unsigned int  j,
unsigned int  k,
unsigned int  l 
)

4D version

Definition at line 35 of file PermutationTensor.C.

36{
37 if (i == 0 && j > 0 && k > 0 && l > 0)
38 return eps(j - 1, k - 1, l - 1);
39 else if (j == 0 && i > 0 && k > 0 && l > 0)
40 return -eps(i - 1, k - 1, l - 1);
41 else if (k == 0 && i > 0 && j > 0 && l > 0)
42 return eps(i - 1, j - 1, l - 1);
43 else if (l == 0 && i > 0 && j > 0 && k > 0)
44 return -eps(i - 1, j - 1, k - 1);
45 return 0;
46}