Intrepid
/usr/src/RPM/BUILD/trilinos-11.12.1/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 
00049 template<typename T, Index N>
00050 struct tensor3_store
00051 {
00052   typedef Storage<T, dimension_power<N, 3>::value> type;
00053 };
00054 
00058 template<typename T, Index N = DYNAMIC>
00059 class Tensor3 : public TensorBase<T, typename tensor3_store<T, N>::type>
00060 {
00061 public:
00062 
00066   static
00067   Index const
00068   ORDER = 3;
00069 
00073   static
00074   bool const
00075   IS_DYNAMIC = N == DYNAMIC;
00076 
00080   typedef typename tensor3_store<T, N>::type
00081   Store;
00082 
00086   static
00087   Index
00088   get_order() {return ORDER;}
00089 
00094   explicit
00095   Tensor3();
00096 
00097   explicit
00098   Tensor3(Index const dimension);
00099 
00105   explicit
00106   Tensor3(ComponentValue const value);
00107 
00108   explicit
00109   Tensor3(Index const dimension, ComponentValue const value);
00110 
00116   explicit
00117   Tensor3(T const * data_ptr);
00118 
00119   explicit
00120   Tensor3(Index const dimension, T const * data_ptr);
00121 
00126   Tensor3(Tensor3<T, N> const & A);
00127 
00131   ~Tensor3();
00132 
00139   T const &
00140   operator()(Index const i, Index const j, Index const k) const;
00141 
00148   T &
00149   operator()(Index const i, Index const j, Index const k);
00150 
00154   Index
00155   get_dimension() const;
00156 
00160   void
00161   set_dimension(Index const dimension);
00162 
00163 };
00164 
00171 template<typename S, typename T, Index N>
00172 Tensor3<typename Promote<S, T>::type, N>
00173 operator+(Tensor3<S, N> const & A, Tensor3<T, N> const & B);
00174 
00181 template<typename S, typename T, Index N>
00182 Tensor3<typename Promote<S, T>::type, N>
00183 operator-(Tensor3<S, N> const & A, Tensor3<T, N> const & B);
00184 
00189 template<typename T, Index N>
00190 Tensor3<T, N>
00191 operator-(Tensor3<T, N> const & A);
00192 
00197 template<typename T, Index N>
00198 bool
00199 operator==(Tensor3<T, N> const & A, Tensor3<T, N> const & B);
00200 
00205 template<typename T, Index N>
00206 bool
00207 operator!=(Tensor3<T, N> const & A, Tensor3<T, N> const & B);
00208 
00215 template<typename S, typename T, Index N>
00216 typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T>, N> >::type
00217 operator*(S const & s, Tensor3<T, N> const & A);
00218 
00225 template<typename S, typename T, Index N>
00226 typename lazy_disable_if< order_1234<S>, apply_tensor3< Promote<S,T>, N> >::type
00227 operator*(Tensor3<T, N> const & A, S const & s);
00228 
00235 template<typename S, typename T, Index N>
00236 Tensor3<typename Promote<S, T>::type, N>
00237 operator/(Tensor3<T, N> const & A, S const & s);
00238 
00245 template<typename S, typename T, Index N>
00246 Tensor3<typename Promote<S, T>::type, N>
00247 operator/(S const & s, Tensor3<T, N> const & A);
00248 
00255 template<typename S, typename T, Index N>
00256 Tensor<typename Promote<S, T>::type, N>
00257 dot(Tensor3<T, N> const & A, Vector<S, N> const & u);
00258 
00265 template<typename S, typename T, Index N>
00266 Tensor<typename Promote<S, T>::type, N>
00267 dot(Vector<S, N> const & u, Tensor3<T, N> const & A);
00268 
00275 template<typename S, typename T, Index N>
00276 Tensor<typename Promote<S, T>::type, N>
00277 dot2(Tensor3<T, N> const & A, Vector<S> const & u);
00278 
00285 template<typename S, typename T, Index N>
00286 Tensor<typename Promote<S, T>::type, N>
00287 dot2(Vector<S, N> const & u, Tensor3<T, N> const & A);
00288 
00295 template<typename S, typename T, Index N>
00296 Tensor3<typename Promote<S, T>::type, N>
00297 dot(Tensor3<T, N> const & A, Tensor<S, N> const & B);
00298 
00305 template<typename S, typename T, Index N>
00306 Tensor3<typename Promote<S, T>::type, N>
00307 dot(Tensor<S, N> const & A, Tensor3<T, N> const & B);
00308 
00315 template<typename S, typename T, Index N>
00316 Tensor3<typename Promote<S, T>::type, N>
00317 dot2(Tensor3<T, N> const & A, Tensor<S, N> const & B);
00318 
00325 template<typename S, typename T, Index N>
00326 Tensor3<typename Promote<S, T>::type, N>
00327 dot2(Tensor<S, N> const & A, Tensor3<T, N> const & B);
00328 
00335 template<typename T, Index N>
00336 std::istream &
00337 operator>>(std::istream & is, Tensor3<T, N> & A);
00338 
00345 template<typename T, Index N>
00346 std::ostream &
00347 operator<<(std::ostream & os, Tensor3<T, N> const & A);
00348 
00349 } // namespace Intrepid
00350 
00351 #include "Intrepid_MiniTensor_Tensor3.i.h"
00352 #include "Intrepid_MiniTensor_Tensor3.t.h"
00353 
00354 #endif //Intrepid_MiniTensor_Tensor3_h