https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PermutationTensor.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "PermutationTensor.h"
11
12int
13PermutationTensor::eps(unsigned int i, unsigned int j)
14{
15 if (i == 0 && j == 1)
16 return 1;
17 else if (i == 1 && j == 0)
18 return -1;
19 return 0;
20}
21
22int
23PermutationTensor::eps(unsigned int i, unsigned int j, unsigned int k)
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}
33
34int
35PermutationTensor::eps(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
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}
int eps(unsigned int i, unsigned int j)
2D version