www.mooseframework.org
PermutationTensor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "PermutationTensor.h"
16 
17 int
18 PermutationTensor::eps(unsigned int i, unsigned int j)
19 {
20  if (i == 0 && j == 1)
21  return 1;
22  else if (i == 1 && j == 0)
23  return -1;
24  return 0;
25 }
26 
27 int
28 PermutationTensor::eps(unsigned int i, unsigned int j, unsigned int k)
29 {
30  if (i == 0 && j > 0 && k > 0)
31  return eps(j - 1, k - 1);
32  else if (j == 0 && i > 0 && k > 0)
33  return -eps(i - 1, k - 1);
34  else if (k == 0 && i > 0 && j > 0)
35  return eps(i - 1, j - 1);
36  return 0;
37 }
38 
39 int
40 PermutationTensor::eps(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
41 {
42  if (i == 0 && j > 0 && k > 0 && l > 0)
43  return eps(j - 1, k - 1, l - 1);
44  else if (j == 0 && i > 0 && k > 0 && l > 0)
45  return -eps(i - 1, k - 1, l - 1);
46  else if (k == 0 && i > 0 && j > 0 && l > 0)
47  return eps(i - 1, j - 1, l - 1);
48  else if (l == 0 && i > 0 && j > 0 && k > 0)
49  return -eps(i - 1, j - 1, k - 1);
50  return 0;
51 }
int eps(unsigned int i, unsigned int j)
2D version