Intrepid
http://trilinos.sandia.gov/packages/docs/r10.10/packages/intrepid/src/Shared/Intrepid_ArrayTools.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 // 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? Contact Pavel Bochev  (pbboche@sandia.gov)
00038 //                    Denis Ridzal  (dridzal@sandia.gov), or
00039 //                    Kara Peterson (kjpeter@sandia.gov)
00040 //
00041 // ************************************************************************
00042 // @HEADER
00043 
00050 #ifndef INTREPID_ARRAYTOOLS_HPP
00051 #define INTREPID_ARRAYTOOLS_HPP
00052 
00053 #include "Intrepid_ConfigDefs.hpp"
00054 #include "Intrepid_Types.hpp"
00055 #include "Teuchos_BLAS.hpp"
00056 #include "Teuchos_Assert.hpp"
00057 
00058 namespace Intrepid {
00059   
00065   class ArrayTools {
00066   public:
00067 
00088     template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
00089     static void contractFieldFieldScalar(ArrayOutFields &            outputFields,
00090                                          const ArrayInFieldsLeft &   leftFields,
00091                                          const ArrayInFieldsRight &  rightFields,
00092                                          const ECompEngine           compEngine,
00093                                          const bool                  sumInto = false);
00094 
00095 
00117     template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
00118     static void contractFieldFieldVector(ArrayOutFields &            outputFields,
00119                                          const ArrayInFieldsLeft &   leftFields,
00120                                          const ArrayInFieldsRight &  rightFields,
00121                                          const ECompEngine           compEngine,
00122                                          const bool                  sumInto = false);
00123 
00124     
00147     template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
00148     static void contractFieldFieldTensor(ArrayOutFields &            outputFields,
00149                                          const ArrayInFieldsLeft &   leftFields,
00150                                          const ArrayInFieldsRight &  rightFields,
00151                                          const ECompEngine           compEngine,
00152                                          const bool                  sumInto = false);
00153     
00154     
00173     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00174     static void contractDataFieldScalar(ArrayOutFields &       outputFields,
00175                                         const ArrayInData &    inputData,
00176                                         const ArrayInFields &  inputFields,
00177                                         const ECompEngine      compEngine,
00178                                         const bool             sumInto = false);
00179 
00180 
00200     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00201     static void contractDataFieldVector(ArrayOutFields &       outputFields,
00202                                         const ArrayInData &    inputData,
00203                                         const ArrayInFields &  inputFields,
00204                                         const ECompEngine      compEngine,
00205                                         const bool             sumInto = false);
00206 
00207     
00228     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00229     static void contractDataFieldTensor(ArrayOutFields &       outputFields,
00230                                         const ArrayInData &    inputData,
00231                                         const ArrayInFields &  inputFields,
00232                                         const ECompEngine      compEngine,
00233                                         const bool             sumInto = false);
00234 
00235 
00252     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00253     static void contractDataDataScalar(ArrayOutData &            outputData,
00254                                        const ArrayInDataLeft &   inputDataLeft,
00255                                        const ArrayInDataRight &  inputDataRight,
00256                                        const ECompEngine         compEngine,
00257                                        const bool                sumInto = false);
00258 
00259 
00276     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00277     static void contractDataDataVector(ArrayOutData &            outputData,
00278                                        const ArrayInDataLeft &   inputDataLeft,
00279                                        const ArrayInDataRight &  inputDataRight,
00280                                        const ECompEngine         compEngine,
00281                                        const bool                sumInto = false);
00282 
00283 
00301     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00302     static void contractDataDataTensor(ArrayOutData &            outputData,
00303                                        const ArrayInDataLeft &   inputDataLeft,
00304                                        const ArrayInDataRight &  inputDataRight,
00305                                        const ECompEngine         compEngine,
00306                                        const bool                sumInto = false);
00307 
00308 
00338     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00339     static void scalarMultiplyDataField(ArrayOutFields &     outputFields,
00340                                         const ArrayInData &  inputData,
00341                                         ArrayInFields &      inputFields,
00342                                         const bool           reciprocal = false);
00343 
00344 
00373     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00374     static void scalarMultiplyDataData(ArrayOutData &           outputData,
00375                                        ArrayInDataLeft &        inputDataLeft,
00376                                        ArrayInDataRight &       inputDataRight,
00377                                        const bool               reciprocal = false);
00378 
00379 
00407     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00408     static void dotMultiplyDataField(ArrayOutFields &       outputFields,
00409                                      const ArrayInData &    inputData,
00410                                      const ArrayInFields &  inputFields);
00411 
00412 
00439     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00440     static void dotMultiplyDataData(ArrayOutData &            outputData,
00441                                     const ArrayInDataLeft &   inputDataLeft,
00442                                     const ArrayInDataRight &  inputDataRight);
00443 
00444 
00466     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00467     static void crossProductDataField(ArrayOutFields &       outputFields,
00468                                       const ArrayInData &    inputData,
00469                                       const ArrayInFields &  inputFields);
00470 
00471 
00492     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00493     static void crossProductDataData(ArrayOutData &            outputData,
00494                                      const ArrayInDataLeft &   inputDataLeft,
00495                                      const ArrayInDataRight &  inputDataRight);
00496 
00497 
00520     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00521     static void outerProductDataField(ArrayOutFields &       outputFields,
00522                                       const ArrayInData &    inputData,
00523                                       const ArrayInFields &  inputFields);
00524 
00525 
00547     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00548     static void outerProductDataData(ArrayOutData &            outputData,
00549                                      const ArrayInDataLeft &   inputDataLeft,
00550                                      const ArrayInDataRight &  inputDataRight);
00551 
00552 
00588     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00589     static void matvecProductDataField(ArrayOutFields &       outputFields,
00590                                        const ArrayInData &    inputData,
00591                                        const ArrayInFields &  inputFields,
00592                                        const char             transpose = 'N');
00593 
00594     
00595 
00628     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00629     static void matvecProductDataData(ArrayOutData &            outputData,
00630                                       const ArrayInDataLeft &   inputDataLeft,
00631                                       const ArrayInDataRight &  inputDataRight,
00632                                       const char                transpose = 'N');
00633     
00634     
00635     
00670     template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
00671     static void matmatProductDataField(ArrayOutFields &       outputFields,
00672                                        const ArrayInData &    inputData,
00673                                        const ArrayInFields &  inputFields,
00674                                        const char             transpose = 'N');
00675 
00676     
00677 
00711     template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
00712     static void matmatProductDataData(ArrayOutData &            outputData,
00713                                       const ArrayInDataLeft &   inputDataLeft,
00714                                       const ArrayInDataRight &  inputDataRight,
00715                                       const char                transpose = 'N');
00716 
00717 
00718     
00735     template<class Scalar, class ArrayOutFields, class ArrayInFields>
00736     static void cloneFields(ArrayOutFields &       outputFields,
00737                             const ArrayInFields &  inputFields);
00738 
00739 
00758     template<class Scalar, class ArrayOutFields, class ArrayInFactors, class ArrayInFields>
00759     static void cloneScaleFields(ArrayOutFields &        outputFields,
00760                                  const ArrayInFactors &  inputFactors,
00761                                  const ArrayInFields &   inputFields);
00762 
00763 
00779     template<class Scalar, class ArrayInOutFields, class ArrayInFactors>
00780     static void scaleFields(ArrayInOutFields &      inoutFields,
00781                             const ArrayInFactors &  inputFactors);
00782 
00783 
00784   }; // end class ArrayTools
00785 
00786 } // end namespace Intrepid
00787 
00788 // include templated definitions
00789 #include <Intrepid_ArrayToolsDefContractions.hpp>
00790 #include <Intrepid_ArrayToolsDefScalar.hpp>
00791 #include <Intrepid_ArrayToolsDefDot.hpp>
00792 #include <Intrepid_ArrayToolsDefTensor.hpp>
00793 #include <Intrepid_ArrayToolsDefCloneScale.hpp>
00794 
00795 #endif