Intrepid
Intrepid_MiniTensor_Tensor3.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_Tensor3_h)
43 #define Intrepid_MiniTensor_Tensor3_h
44 
45 #include "Intrepid_MiniTensor_Tensor.h"
46 
47 namespace Intrepid {
48 
52 template<typename T>
53 class Tensor3 : public TensorBase<T>
54 {
55 public:
56 
60  static Index const
61  order = 3U;
62 
66  Tensor3();
67 
72  explicit
73  Tensor3(Index const dimension);
74 
80  explicit
81  Tensor3(Index const dimension, ComponentValue value);
82 
88  Tensor3(Index const dimension, T const & s);
89 
95  Tensor3(Index const dimension, T const * data_ptr);
96 
101  Tensor3(Tensor3<T> const & A);
102 
106  ~Tensor3();
107 
114  T const &
115  operator()(Index const i, Index const j, Index const k) const;
116 
123  T &
124  operator()(Index const i, Index const j, Index const k);
125 
129  Index
130  get_order() const {return order;}
131 
132 };
133 
140 template<typename S, typename T>
142 operator+(Tensor3<S> const & A, Tensor3<T> const & B);
143 
150 template<typename S, typename T>
152 operator-(Tensor3<S> const & A, Tensor3<T> const & B);
153 
158 template<typename T>
160 operator-(Tensor3<T> const & A);
161 
166 template<typename T>
167 bool
168 operator==(Tensor3<T> const & A, Tensor3<T> const & B);
169 
174 template<typename T>
175 bool
176 operator!=(Tensor3<T> const & A, Tensor3<T> const & B);
177 
184 template<typename S, typename T>
185 typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T> > >::type
186 operator*(S const & s, Tensor3<T> const & A);
187 
194 template<typename S, typename T>
195 typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T> > >::type
196 operator*(Tensor3<T> const & A, S const & s);
197 
204 template<typename S, typename T>
206 operator/(Tensor3<T> const & A, S const & s);
207 
214 template<typename S, typename T>
216 dot(Tensor3<T> const & A, Vector<S> const & u);
217 
224 template<typename S, typename T>
226 dot(Vector<S> const & u, Tensor3<T> const & A);
227 
234 template<typename S, typename T>
236 dot2(Tensor3<T> const & A, Vector<S> const & u);
237 
244 template<typename S, typename T>
246 dot2(Vector<S> const & u, Tensor3<T> const & A);
247 
254 template<typename S, typename T>
256 dot(Tensor3<T> const & A, Tensor<S> const & B);
257 
264 template<typename S, typename T>
266 dot(Tensor<S> const & A, Tensor3<T> const & B);
267 
274 template<typename S, typename T>
276 dot2(Tensor3<T> const & A, Tensor<S> const & B);
277 
284 template<typename S, typename T>
286 dot2(Tensor<S> const & A, Tensor3<T> const & B);
287 
294 template<typename T>
295 std::istream &
296 operator>>(std::istream & is, Tensor3<T> & A);
297 
304 template<typename T>
305 std::ostream &
306 operator<<(std::ostream & os, Tensor3<T> const & A);
307 
308 } // namespace Intrepid
309 
310 #include "Intrepid_MiniTensor_Tensor3.i.h"
311 #include "Intrepid_MiniTensor_Tensor3.t.h"
312 
313 #endif //Intrepid_MiniTensor_Tensor3_h
T const & operator()(Index const i, Index const j, Index const k) const