16 #include <deal.II/base/symmetric_tensor.h> 18 DEAL_II_NAMESPACE_OPEN
36 const unsigned int N = 6;
45 double diagonal_sum = 0;
46 for (
unsigned int i=0; i<N; ++i)
47 diagonal_sum += std::fabs(tmp.
data[i][i]);
48 const double typical_diagonal_element = diagonal_sum/N;
49 (void)typical_diagonal_element;
52 for (
unsigned int i=0; i<N; ++i)
55 for (
unsigned int j=0; j<N; ++j)
61 double max = std::fabs(tmp.
data[j][j]);
63 for (
unsigned int i=j+1; i<N; ++i)
64 if (std::fabs(tmp.
data[i][j]) >
max)
66 max = std::fabs(tmp.
data[i][j]);
71 Assert(
max > 1.e-16*typical_diagonal_element,
72 ExcMessage(
"This tensor seems to be noninvertible"));
77 for (
unsigned int k=0; k<N; ++k)
78 std::swap (tmp.
data[j][k], tmp.
data[r][k]);
80 std::swap (p[j], p[r]);
84 const double hr = 1./tmp.
data[j][j];
86 for (
unsigned int k=0; k<N; ++k)
89 for (
unsigned int i=0; i<N; ++i)
95 for (
unsigned int i=0; i<N; ++i)
98 tmp.
data[j][i] *= -hr;
104 for (
unsigned int i=0; i<N; ++i)
106 for (
unsigned int k=0; k<N; ++k)
107 hv[p[k]] = tmp.
data[i][k];
108 for (
unsigned int k=0; k<N; ++k)
109 tmp.
data[i][k] = hv[k];
114 for (
unsigned int i=3; i<6; ++i)
115 for (
unsigned int j=0; j<3; ++j)
118 for (
unsigned int i=0; i<3; ++i)
119 for (
unsigned int j=3; j<6; ++j)
122 for (
unsigned int i=3; i<6; ++i)
123 for (
unsigned int j=3; j<6; ++j)
132 template <
int rank,
int dim,
typename Number>
135 template <
int rank,
int dim,
typename Number>
139 #include "symmetric_tensor.inst" 142 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
VectorizedArray< Number > max(const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y)