Intrepid
Intrepid_MiniTensor_Tensor4.h
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions: Alejandro Mota (amota@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #if !defined(Intrepid_MiniTensor_Tensor4_h)
43 #define Intrepid_MiniTensor_Tensor4_h
44 
45 #include "Intrepid_MiniTensor_Tensor3.h"
46 
47 namespace Intrepid {
48 
52 template<typename T>
53 class Tensor4 : public TensorBase<T>
54 {
55 public:
56 
60  static Index const
61  order = 4U;
62 
66  Tensor4();
67 
72  explicit
73  Tensor4(Index const dimension);
74 
80  explicit
81  Tensor4(Index const dimension, ComponentValue value);
82 
88  Tensor4(Index const dimension, T const & s);
89 
95  Tensor4(Index const dimension, T const * data_ptr);
96 
101  Tensor4(Tensor4<T> const & A);
102 
106  ~Tensor4();
107 
115  T const &
116  operator()(
117  Index const i,
118  Index const j,
119  Index const k,
120  Index const l) const;
121 
129  T &
130  operator()(
131  Index const i,
132  Index const j,
133  Index const k,
134  Index const l);
135 
139  Index
140  get_order() const {return order;}
141 
142 };
143 
150 template<typename S, typename T>
151 Tensor4<typename Promote<S, T>::type>
152 operator+(Tensor4<S> const & A, Tensor4<T> const & B);
153 
160 template<typename S, typename T>
161 Tensor4<typename Promote<S, T>::type>
162 operator-(Tensor4<S> const & A, Tensor4<T> const & B);
163 
168 template<typename T>
169 Tensor4<T>
170 operator-(Tensor4<T> const & A);
171 
176 template<typename T>
177 bool
178 operator==(Tensor4<T> const & A, Tensor4<T> const & B);
179 
184 template<typename T>
185 bool
186 operator!=(Tensor4<T> const & A, Tensor4<T> const & B);
187 
194 template<typename S, typename T>
195 typename lazy_disable_if< order_1234<S>, apply_tensor4< Promote<S,T> > >::type
196 operator*(S const & s, Tensor4<T> const & A);
197 
204 template<typename S, typename T>
205 typename lazy_disable_if< order_1234<S>, apply_tensor4< Promote<S,T> > >::type
206 operator*(Tensor4<T> const & A, S const & s);
207 
214 template<typename S, typename T>
215 Tensor4<typename Promote<S, T>::type>
216 operator/(Tensor4<T> const & A, S const & s);
217 
221 template<typename T>
222 Tensor4<T>
223 transpose(Tensor4<T> const & A);
224 
229 template<typename T>
230 const Tensor4<T>
231 identity_1(Index const N);
232 
237 template<typename T>
238 const Tensor4<T>
239 identity_2(Index const N);
240 
245 template<typename T>
246 const Tensor4<T>
247 identity_3(Index const N);
248 
255 template<typename S, typename T>
256 Tensor3<typename Promote<S, T>::type>
257 dot(Tensor4<T> const & A, Vector<S> const & u);
258 
265 template<typename S, typename T>
266 Tensor3<typename Promote<S, T>::type>
267 dot(Vector<S> const & u, Tensor4<T> const & A);
268 
275 template<typename S, typename T>
276 Tensor3<typename Promote<S, T>::type>
277 dot2(Tensor4<T> const & A, Vector<S> const & u);
278 
285 template<typename S, typename T>
286 Tensor3<typename Promote<S, T>::type>
287 dot2(Vector<S> const & u, Tensor4<T> const & A);
288 
295 template<typename S, typename T>
296 Tensor<typename Promote<S, T>::type>
297 dotdot(Tensor4<T> const & A, Tensor<S> const & B);
298 
305 template<typename S, typename T>
306 Tensor<typename Promote<S, T>::type>
307 dotdot(Tensor<S> const & B, Tensor4<T> const & A);
308 
315 template<typename S, typename T>
316 Tensor4<typename Promote<S, T>::type>
317 dotdot(Tensor4<S> const & A, Tensor4<T> const & B);
318 
325 template<typename S, typename T>
326 Tensor4<typename Promote<S, T>::type>
327 tensor(Tensor<S> const & A, Tensor<T> const & B);
328 
335 template<typename S, typename T>
336 Tensor4<typename Promote<S, T>::type>
337 tensor2(Tensor<S> const & A, Tensor<T> const & B);
338 
345 template<typename S, typename T>
346 Tensor4<typename Promote<S, T>::type>
347 tensor3(Tensor<S> const & A, Tensor<T> const & B);
348 
355 template<typename S, typename T>
356 Tensor4<typename Promote<S, T>::type>
357 dot(Tensor4<T> const & A, Tensor<S> const & B);
358 
365 template<typename S, typename T>
366 Tensor4<typename Promote<S, T>::type>
367 dot_t(Tensor4<T> const & A, Tensor<S> const & B);
368 
375 template<typename S, typename T>
376 Tensor4<typename Promote<S, T>::type>
377 dot(Tensor<S> const & A, Tensor4<T> const & B);
378 
385 template<typename S, typename T>
386 Tensor4<typename Promote<S, T>::type>
387 t_dot(Tensor<S> const & A, Tensor4<T> const & B);
388 
395 template<typename S, typename T>
396 Tensor4<typename Promote<S, T>::type>
397 dot2(Tensor4<T> const & A, Tensor<S> const & B);
398 
405 template<typename S, typename T>
406 Tensor4<typename Promote<S, T>::type>
407 dot2_t(Tensor4<T> const & A, Tensor<S> const & B);
408 
415 template<typename S, typename T>
416 Tensor4<typename Promote<S, T>::type>
417 dot2(Tensor<S> const & A, Tensor4<T> const & B);
418 
425 template<typename S, typename T>
426 Tensor4<typename Promote<S, T>::type>
427 t_dot2(Tensor<S> const & A, Tensor4<T> const & B);
428 
437 template<typename S, typename T>
438 Tensor4<typename Promote<S, T>::type>
439 odot(Tensor<S> const & A, Tensor<T> const & B);
440 
447 template<typename T>
448 std::istream &
449 operator>>(std::istream & is, Tensor4<T> & A);
450 
457 template<typename T>
458 std::ostream &
459 operator<<(std::ostream & os, Tensor4<T> const & A);
460 
461 } // namespace Intrepid
462 
463 #include "Intrepid_MiniTensor_Tensor4.i.h"
464 #include "Intrepid_MiniTensor_Tensor4.t.h"
465 
466 #endif //Intrepid_MiniTensor_Tensor4_h
T const & operator()(Index const i, Index const j, Index const k, Index const l) const