8 template <
class T,
int Tensor_Dim>
class Tensor1
16 static_assert(
sizeof...(d) ==
sizeof(
data) /
sizeof(
T),
17 "Incorrect number of Arguments. Constructor should "
18 "initialize the entire Tensor");
29 if(
N >= Tensor_Dim ||
N < 0)
32 s <<
"Bad index in Tensor1<T," << Tensor_Dim <<
">.operator(" <<
N
34 throw std::out_of_range(s.str());
42 if(
N >= Tensor_Dim ||
N < 0)
45 s <<
"Bad index in Tensor1<T," << Tensor_Dim <<
">.operator(" <<
N
46 <<
") const" << std::endl;
47 throw std::out_of_range(s.str());
58 template <
char i,
int Dim>
66 template <
char i,
int Dim>
88 return data[Current_Dim - 1] *
data[Current_Dim - 1]
94 template <
class T,
int Tensor_Dim>
95 std::ostream &operator<<(std::ostream &os,
98 for (
int i = 0;
i + 1 < Tensor_Dim; ++
i) {
101 if (Tensor_Dim > 0) {
102 os <<
t(Tensor_Dim - 1);
108 template <
class T,
int Tensor_Dim>
113 for (
int i = 0;
i + 1 < Tensor_Dim; ++
i) {
116 if (Tensor_Dim > 0) {
117 is >>
t(Tensor_Dim - 1);
T & operator()(const int N)
T l2_squared(const Number< Current_Dim > &) const
T operator()(const int N) const
T l2_squared(const Number< 1 > &) const
constexpr Tensor1(U... d)
Tensor1< T, Tensor_Dim > normalize()
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
Tensors class implemented by Walter Landry.
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
std::istream & operator>>(std::istream &is, FTensor::Tensor1< T, Tensor_Dim > &t)
constexpr double t
plate stiffness