|
| v0.14.0
|
Go to the documentation of this file.
16 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
class Tensor2
18 T
data[Tensor_Dim0][Tensor_Dim1];
24 static_assert(
sizeof...(
d) ==
sizeof(
data) /
sizeof(T),
25 "Incorrect number of Arguments. Constructor should "
26 "initialize the entire Tensor");
33 T *
ptr(
const int N1,
const int N2)
const {
35 if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
37 s <<
"Bad index in Tensor2<T*," << Tensor_Dim0 <<
"," << Tensor_Dim1
38 <<
">.ptr(" << N1 <<
"," << N2 <<
")" << std::endl;
39 throw std::out_of_range(s.str());
51 if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
54 s <<
"Bad index in Tensor2<T," << Tensor_Dim0 <<
"," << Tensor_Dim1
55 <<
">.operator(" << N1 <<
"," << N2 <<
")" << std::endl;
56 throw std::out_of_range(s.str());
65 if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
68 s <<
"Bad index in Tensor2<T," << Tensor_Dim0 <<
"," << Tensor_Dim1
69 <<
">.operator(" << N1 <<
"," << N2 <<
") const" << std::endl;
70 throw std::out_of_range(s.str());
81 template <
char i,
char j,
int Dim0,
int Dim1>
82 typename std::enable_if<(Tensor_Dim0 >= Dim0 && Tensor_Dim1 >= Dim1),
84 T, Dim0, Dim1,
i,
j>>::
type
91 template <
char i,
char j,
int Dim0,
int Dim1>
93 (Tensor_Dim0 >= Dim0 && Tensor_Dim1 >= Dim1),
109 template <
char i,
int Dim,
int N>
111 (Tensor_Dim0 >= Dim && Tensor_Dim1 >
N),
122 template <
char i,
int Dim,
int N>
124 (Tensor_Dim0 >
N && Tensor_Dim1 >= Dim),
135 template <
char i,
int Dim,
int N>
137 (Tensor_Dim0 >= Dim && Tensor_Dim1 >
N),
148 template <
char i,
int Dim,
int N>
150 (Tensor_Dim0 >
N && Tensor_Dim1 >= Dim),
169 template <
char i,
int Dim>
171 (Tensor_Dim0 >= Dim),
182 template <
char i,
int Dim>
184 (Tensor_Dim1 >= Dim),
200 template <
char i,
int Dim>
207 template <
char i,
int Dim>
228 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
235 for(
int j = 0;
j + 1 < Tensor_Dim1; ++
j)
237 os <<
t(
i,
j) <<
',';
241 os <<
t(
i, Tensor_Dim1 - 1);
247 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
252 for (
int i = 0;
i + 1 < Tensor_Dim0; ++
i) {
256 if (Tensor_Dim0 > 0) {
266 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
274 for(
int j = 0;
j + 1 < Tensor_Dim1; ++
j)
280 is >>
t(
i, Tensor_Dim1 - 1);
286 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
291 for (
int i = 0;
i + 1 < Tensor_Dim0; ++
i) {
295 if (Tensor_Dim0 > 0) {
T operator()(const int N1, const int N2) const
std::istream & operator>>(std::istream &is, FTensor::Tensor1< T, Tensor_Dim > &t)
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)
T data[Tensor_Dim0][Tensor_Dim1]
const double c
speed of light (cm/ns)
std::ostream & Tensor2_ostream_row(std::ostream &os, const FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 > &t, const int &i)
T & operator()(const int N1, const int N2)
std::istream & Tensor2_istream_row(std::istream &is, FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 > &t, const int &i)
std::ostream & operator<<(std::ostream &os, const FTensor::Tensor1< T, Tensor_Dim > &t)
constexpr double t
plate stiffness
FTensor::Index< 'i', SPACE_DIM > i
T internal_contract(Number< N >) const
T * ptr(const int N1, const int N2) const
FTensor::Index< 'j', 3 > j
T internal_contract(Number< 1 >) const