Intrepid
/usr/src/RPM/BUILD/trilinos10-10.6.4/packages/intrepid/src/Shared/Intrepid_RealSpaceTools.hpp
Go to the documentation of this file.
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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) or
00025 //                    Denis Ridzal (dridzal@sandia.gov).
00026 //
00027 // ************************************************************************
00028 // @HEADER
00029 
00035 #ifndef INTREPID_REALSPACETOOLS_HPP
00036 #define INTREPID_REALSPACETOOLS_HPP
00037 
00038 #include "Intrepid_ConfigDefs.hpp"
00039 #include "Intrepid_Types.hpp"
00040 #include "Teuchos_oblackholestream.hpp"
00041 #include "Teuchos_TestForException.hpp"
00042 
00043 namespace Intrepid {
00044   
00048 template<class Scalar>
00049 class RealSpaceTools {
00050     
00051   public:
00052 
00060     static void absval(Scalar* absArray, const Scalar* inArray, const int size);
00061 
00062 
00069     static void absval(Scalar* inoutArray, const int size);
00070 
00071 
00081     template<class ArrayAbs, class ArrayIn>
00082     static void absval(ArrayAbs & absArray, const ArrayIn & inArray);
00083 
00084 
00089     template<class ArrayInOut>
00090     static void absval(ArrayInOut & inoutAbsArray);
00091 
00092 
00100     static Scalar vectorNorm(const Scalar* inVec, const int dim, const ENorm normType);
00101 
00102 
00112     template<class ArrayIn>
00113     static Scalar vectorNorm(const ArrayIn & inVec, const ENorm normType);
00114 
00115 
00129     template<class ArrayNorm, class ArrayIn>
00130     static void vectorNorm(ArrayNorm & normArray, const ArrayIn & inVecs, const ENorm normType);
00131 
00132 
00140     static void transpose(Scalar* transposeMat, const Scalar* inMat, const int dim);
00141 
00142 
00157     template<class ArrayTranspose, class ArrayIn>
00158     static void transpose(ArrayTranspose & transposeMats, const ArrayIn & inMats);
00159 
00160 
00168     static void inverse(Scalar* inverseMat, const Scalar* inMat, const int dim);
00169 
00170 
00186     template<class ArrayInverse, class ArrayIn>
00187     static void inverse(ArrayInverse & inverseMats, const ArrayIn & inMats);
00188 
00189 
00196     static Scalar det(const Scalar* inMat, const int dim);
00197 
00198 
00208     template<class ArrayIn>
00209     static Scalar det(const ArrayIn & inMat);
00210 
00211 
00226     template<class ArrayDet, class ArrayIn>
00227     static void det(ArrayDet & detArray, const ArrayIn & inMats);
00228 
00229 
00239     static void add(Scalar* sumArray, const Scalar* inArray1, const Scalar* inArray2, const int size);
00240 
00241 
00250     static void add(Scalar* inoutSumArray, const Scalar* inArray, const int size);
00251 
00252 
00264     template<class ArraySum, class ArrayIn1, class ArrayIn2>
00265     static void add(ArraySum & sumArray, const ArrayIn1 & inArray1, const ArrayIn2 & inArray2);
00266 
00267 
00278     template<class ArraySum, class ArrayIn>
00279     static void add(ArraySum & inoutSumArray, const ArrayIn & inArray);
00280 
00281 
00291     static void subtract(Scalar* diffArray, const Scalar* inArray1, const Scalar* inArray2, const int size);
00292 
00293 
00302     static void subtract(Scalar* inoutDiffArray, const Scalar* inArray, const int size);
00303 
00304 
00316     template<class ArrayDiff, class ArrayIn1, class ArrayIn2>
00317     static void subtract(ArrayDiff & diffArray, const ArrayIn1 & inArray1, const ArrayIn2 & inArray2);
00318 
00319 
00330     template<class ArrayDiff, class ArrayIn>
00331     static void subtract(ArrayDiff & inoutDiffArray, const ArrayIn & inArray);
00332 
00333 
00343     static void scale(Scalar* scaledArray, const Scalar* inArray, const int size, const Scalar scalar);
00344 
00345 
00354     static void scale(Scalar* inoutScaledArray, const int size, const Scalar scalar);
00355 
00356 
00368     template<class ArrayScaled, class ArrayIn>
00369     static void scale(ArrayScaled & scaledArray, const ArrayIn & inArray, const Scalar scalar);
00370 
00371 
00378     template<class ArrayScaled>
00379     static void scale(ArrayScaled & inoutScaledArray, const Scalar scalar);
00380 
00381 
00389     static Scalar dot(const Scalar* inArray1, const Scalar* inArray2, const int size);
00390 
00391 
00402     template<class ArrayVec1, class ArrayVec2>
00403     static Scalar dot(const ArrayVec1 & inVec1, const ArrayVec2 & inVec2);
00404 
00405 
00419     template<class ArrayDot, class ArrayVec1, class ArrayVec2>
00420     static void dot(ArrayDot & dotArray, const ArrayVec1 & inVecs1, const ArrayVec2 & inVecs2);
00421 
00422 
00435     static void matvec(Scalar* matVec, const Scalar* inMat, const Scalar* inVec, const int dim);
00436 
00437 
00456     template<class ArrayMatVec, class ArrayMat, class ArrayVec>
00457     static void matvec(ArrayMatVec & matVecs, const ArrayMat & inMats, const ArrayVec & inVecs);
00458 
00459     
00473     template<class ArrayVecProd, class ArrayIn1, class ArrayIn2>
00474     static void vecprod(ArrayVecProd & vecProd, const ArrayIn1 & inLeft, const ArrayIn2 & inRight);
00475     
00476     
00477     
00478 }; // class RealSpaceTools
00479 
00480 } // end namespace Intrepid
00481 
00482 // include templated definitions
00483 #include <Intrepid_RealSpaceToolsDef.hpp>
00484 
00485 #endif