Intrepid
/usr/src/RPM/BUILD/trilinos-11.12.1/packages/intrepid/src/Shared/MiniTensor/Intrepid_MiniTensor_Tensor4.h
00001 // @HEADER
00002 // ************************************************************************
00003 //
00004 //                           Intrepid Package
00005 //                 Copyright (2007) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions: Alejandro Mota (amota@sandia.gov)
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 
00042 #if !defined(Intrepid_MiniTensor_Tensor4_h)
00043 #define Intrepid_MiniTensor_Tensor4_h
00044 
00045 #include "Intrepid_MiniTensor_Tensor3.h"
00046 
00047 namespace Intrepid {
00048 
00049 template<typename T, Index N>
00050 struct tensor4_store
00051 {
00052   typedef Storage<T, dimension_power<N, 4>::value> type;
00053 };
00054 
00058 template<typename T, Index N = DYNAMIC>
00059 class Tensor4 : public TensorBase<T, typename tensor4_store<T, N>::type>
00060 {
00061 public:
00062 
00066   static
00067   Index const
00068   ORDER = 4;
00069 
00073   static
00074   bool const
00075   IS_DYNAMIC = N == DYNAMIC;
00076 
00080   typedef typename tensor4_store<T, N>::type
00081   Store;
00082 
00086   static
00087   Index
00088   get_order() {return ORDER;}
00089 
00094   explicit
00095   Tensor4();
00096 
00097   explicit
00098   Tensor4(Index const dimension);
00099 
00105   explicit
00106   Tensor4(ComponentValue const value);
00107 
00108   explicit
00109   Tensor4(Index const dimension, ComponentValue const value);
00110 
00116   explicit
00117   Tensor4(T const * data_ptr);
00118 
00119   explicit
00120   Tensor4(Index const dimension, T const * data_ptr);
00121 
00126   Tensor4(Tensor4<T, N> const & A);
00127 
00131   Tensor4(Tensor<T, dimension_square<N>::value> const & A);
00135   ~Tensor4();
00136 
00144   T const &
00145   operator()(
00146       Index const i,
00147       Index const j,
00148       Index const k,
00149       Index const l) const;
00150 
00158   T &
00159   operator()(
00160       Index const i,
00161       Index const j,
00162       Index const k,
00163       Index const l);
00164 
00168   Index
00169   get_dimension() const;
00170 
00174   void
00175   set_dimension(Index const dimension);
00176 
00177 };
00178 
00185 template<typename S, typename T, Index N>
00186 Tensor4<typename Promote<S, T>::type, N>
00187 operator+(Tensor4<S, N> const & A, Tensor4<T, N> const & B);
00188 
00195 template<typename S, typename T, Index N>
00196 Tensor4<typename Promote<S, T>::type, N>
00197 operator-(Tensor4<S, N> const & A, Tensor4<T, N> const & B);
00198 
00203 template<typename T, Index N>
00204 Tensor4<T, N>
00205 operator-(Tensor4<T, N> const & A);
00206 
00211 template<typename T, Index N>
00212 bool
00213 operator==(Tensor4<T, N> const & A, Tensor4<T, N> const & B);
00214 
00219 template<typename T, Index N>
00220 bool
00221 operator!=(Tensor4<T, N> const & A, Tensor4<T, N> const & B);
00222 
00229 template<typename S, typename T, Index N>
00230 typename lazy_disable_if< order_1234<S>, apply_tensor4< Promote<S,T>, N> >::type
00231 operator*(S const & s, Tensor4<T, N> const & A);
00232 
00239 template<typename S, typename T, Index N>
00240 typename lazy_disable_if< order_1234<S>, apply_tensor4< Promote<S,T>, N> >::type
00241 operator*(Tensor4<T, N> const & A, S const & s);
00242 
00249 template<typename S, typename T, Index N>
00250 Tensor4<typename Promote<S, T>::type, N>
00251 operator/(Tensor4<T, N> const & A, S const & s);
00252 
00259 template<typename S, typename T, Index N>
00260 Tensor4<typename Promote<S, T>::type, N>
00261 operator/(S const & s, Tensor4<T, N> const & A);
00262 
00266 template<typename T, Index N>
00267 Tensor4<T, N>
00268 transpose(Tensor4<T, N> const & A);
00269 
00274 template<typename T, Index N>
00275 const Tensor4<T, N>
00276 identity_1();
00277 
00278 template<typename T>
00279 const Tensor4<T, DYNAMIC>
00280 identity_1(Index const dimension);
00281 
00282 template<typename T, Index N>
00283 const Tensor4<T, N>
00284 identity_1(Index const dimension);
00285 
00290 template<typename T, Index N>
00291 const Tensor4<T, N>
00292 identity_2();
00293 
00294 template<typename T>
00295 const Tensor4<T, DYNAMIC>
00296 identity_2(Index const dimension);
00297 
00298 template<typename T, Index N>
00299 const Tensor4<T, N>
00300 identity_2(Index const dimension);
00301 
00306 template<typename T, Index N>
00307 const Tensor4<T, N>
00308 identity_3();
00309 
00310 template<typename T>
00311 const Tensor4<T, DYNAMIC>
00312 identity_3(Index const dimension);
00313 
00314 template<typename T, Index N>
00315 const Tensor4<T, N>
00316 identity_3(Index const dimension);
00317 
00322 template<typename T, Index N>
00323 Tensor4<T, N>
00324 inverse(Tensor4<T, N> const & A);
00325 
00332 template<typename S, typename T, Index N>
00333 Tensor3<typename Promote<S, T>::type, N>
00334 dot(Tensor4<T, N> const & A, Vector<S, N> const & u);
00335 
00342 template<typename S, typename T, Index N>
00343 Tensor3<typename Promote<S, T>::type, N>
00344 dot(Vector<S, N> const & u, Tensor4<T, N> const & A);
00345 
00352 template<typename S, typename T, Index N>
00353 Tensor3<typename Promote<S, T>::type, N>
00354 dot2(Tensor4<T, N> const & A, Vector<S, N> const & u);
00355 
00362 template<typename S, typename T, Index N>
00363 Tensor3<typename Promote<S, T>::type, N>
00364 dot2(Vector<S, N> const & u, Tensor4<T, N> const & A);
00365 
00372 template<typename S, typename T, Index N>
00373 Tensor<typename Promote<S, T>::type, N>
00374 dotdot(Tensor4<T, N> const & A, Tensor<S, N> const & B);
00375 
00382 template<typename S, typename T, Index N>
00383 Tensor<typename Promote<S, T>::type, N>
00384 dotdot(Tensor<S, N> const & B, Tensor4<T, N> const & A);
00385 
00392 template<typename S, typename T, Index N>
00393 Tensor4<typename Promote<S, T>::type, N>
00394 dotdot(Tensor4<S, N> const & A, Tensor4<T, N> const & B);
00395 
00402 template<typename S, typename T, Index N>
00403 Tensor4<typename Promote<S, T>::type, N>
00404 tensor(Tensor<S, N> const & A, Tensor<T, N> const & B);
00405 
00412 template<typename S, typename T, Index N>
00413 Tensor4<typename Promote<S, T>::type, N>
00414 tensor2(Tensor<S, N> const & A, Tensor<T, N> const & B);
00415 
00422 template<typename S, typename T, Index N>
00423 Tensor4<typename Promote<S, T>::type, N>
00424 tensor3(Tensor<S, N> const & A, Tensor<T, N> const & B);
00425 
00432 template<typename S, typename T, Index N>
00433 Tensor4<typename Promote<S, T>::type, N>
00434 dot(Tensor4<T, N> const & A, Tensor<S, N> const & B);
00435 
00442 template<typename S, typename T, Index N>
00443 Tensor4<typename Promote<S, T>::type, N>
00444 dot_t(Tensor4<T, N> const & A, Tensor<S, N> const & B);
00445 
00452 template<typename S, typename T, Index N>
00453 Tensor4<typename Promote<S, T>::type, N>
00454 dot(Tensor<S> const & A, Tensor4<T, N> const & B);
00455 
00462 template<typename S, typename T, Index N>
00463 Tensor4<typename Promote<S, T>::type, N>
00464 t_dot(Tensor<S, N> const & A, Tensor4<T, N> const & B);
00465 
00472 template<typename S, typename T, Index N>
00473 Tensor4<typename Promote<S, T>::type, N>
00474 dot2(Tensor4<T, N> const & A, Tensor<S, N> const & B);
00475 
00482 template<typename S, typename T, Index N>
00483 Tensor4<typename Promote<S, T>::type, N>
00484 dot2_t(Tensor4<T, N> const & A, Tensor<S, N> const & B);
00485 
00492 template<typename S, typename T, Index N>
00493 Tensor4<typename Promote<S, T>::type, N>
00494 dot2(Tensor<S, N> const & A, Tensor4<T, N> const & B);
00495 
00502 template<typename S, typename T, Index N>
00503 Tensor4<typename Promote<S, T>::type, N>
00504 t_dot2(Tensor<S, N> const & A, Tensor4<T, N> const & B);
00505 
00514 template<typename S, typename T, Index N>
00515 Tensor4<typename Promote<S, T>::type, N>
00516 odot(Tensor<S, N> const & A, Tensor<T, N> const & B);
00517 
00524 template<typename S, typename T, Index N>
00525 Tensor4<typename Promote<S, T>::type, N>
00526 kronecker(Tensor<S, N> const & A, Tensor4<T, N> const & B);
00527 
00534 template<typename T, Index N>
00535 std::istream &
00536 operator>>(std::istream & is, Tensor4<T, N> & A);
00537 
00544 template<typename T, Index N>
00545 std::ostream &
00546 operator<<(std::ostream & os, Tensor4<T, N> const & A);
00547 
00548 } // namespace Intrepid
00549 
00550 #include "Intrepid_MiniTensor_Tensor4.i.h"
00551 #include "Intrepid_MiniTensor_Tensor4.t.h"
00552 
00553 #endif //Intrepid_MiniTensor_Tensor4_h