Intrepid
http://trilinos.sandia.gov/packages/docs/r11.2/packages/intrepid/src/Shared/MiniTensor/Intrepid_MiniTensor_Tensor3.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_Tensor3_h)
00043 #define Intrepid_MiniTensor_Tensor3_h
00044 
00045 #include "Intrepid_MiniTensor_Tensor.h"
00046 
00047 namespace Intrepid {
00048 
00052   template<typename T>
00053   class Tensor3
00054   {
00055   public:
00056 
00060     Tensor3();
00061 
00065     explicit
00066     Tensor3(Index const N);
00067 
00072     Tensor3(Index const N, T const & s);
00073 
00079     Tensor3(Tensor3<T> const & A);
00080 
00084     ~Tensor3();
00085 
00092     T const &
00093     operator()(Index const i, Index const j, Index const k) const;
00094 
00101     T &
00102     operator()(Index const i, Index const j, Index const k);
00103 
00107     Index
00108     get_dimension() const;
00109 
00113     void
00114     set_dimension(Index const N);
00115 
00119     Tensor3<T> &
00120     operator=(Tensor3<T> const & A);
00121 
00126     Tensor3<T> &
00127     operator+=(Tensor3<T> const & A);
00128 
00133     Tensor3<T> &
00134     operator-=(Tensor3<T> const & A);
00135 
00139     void
00140     clear();
00141 
00142   private:
00143 
00147     Index
00148     dimension;
00149 
00153     T *
00154     e;
00155 
00156   };
00157 
00164   template<typename T>
00165   Tensor3<T>
00166   operator+(Tensor3<T> const & A, Tensor3<T> const & B);
00167 
00174   template<typename T>
00175   Tensor3<T>
00176   operator-(Tensor3<T> const & A, Tensor3<T> const & B);
00177 
00182   template<typename T>
00183   Tensor3<T>
00184   operator-(Tensor3<T> const & A);
00185 
00190   template<typename T>
00191   bool
00192   operator==(Tensor3<T> const & A, Tensor3<T> const & B);
00193 
00198   template<typename T>
00199   bool
00200   operator!=(Tensor3<T> const & A, Tensor3<T> const & B);
00201 
00208   template<typename T, typename S>
00209   Tensor3<T>
00210   operator*(S const & s, Tensor3<T> const & A);
00211 
00218   template<typename T, typename S>
00219   Tensor3<T>
00220   operator*(Tensor3<T> const & A, S const & s);
00221 
00228   template<typename T, typename S>
00229   Tensor3<T>
00230   operator/(Tensor3<T> const & A, S const & s);
00231 
00238   template<typename T>
00239   Tensor<T>
00240   dot(Tensor3<T> const & A, Vector<T> const & u);
00241 
00248   template<typename T>
00249   Tensor<T>
00250   dot(Vector<T> const & u, Tensor3<T> const & A);
00251 
00258   template<typename T>
00259   Tensor<T>
00260   dot2(Tensor3<T> const & A, Vector<T> const & u);
00261 
00268   template<typename T>
00269   Tensor<T>
00270   dot2(Vector<T> const & u, Tensor3<T> const & A);
00271 
00278   template<typename T>
00279   Tensor3<T>
00280   dot(Tensor3<T> const & A, Tensor<T> const & B);
00281 
00288   template<typename T>
00289   Tensor3<T>
00290   dot(Tensor<T> const & A, Tensor3<T> const & B);
00291 
00298   template<typename T>
00299   Tensor3<T>
00300   dot2(Tensor3<T> const & A, Tensor<T> const & B);
00301 
00308   template<typename T>
00309   Tensor3<T>
00310   dot2(Tensor<T> const & A, Tensor3<T> const & B);
00311 
00318   template<typename T>
00319   std::istream &
00320   operator>>(std::istream & is, Tensor3<T> & A);
00321 
00328   template<typename T>
00329   std::ostream &
00330   operator<<(std::ostream & os, Tensor3<T> const & A);
00331 
00332 } // namespace Intrepid
00333 
00334 #include "Intrepid_MiniTensor_Tensor3.i.h"
00335 #include "Intrepid_MiniTensor_Tensor3.t.h"
00336 
00337 #endif //Intrepid_MiniTensor_Tensor3_h