Intrepid
Intrepid_ArrayTools.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Pavel Bochev (pbboche@sandia.gov)
38 // Denis Ridzal (dridzal@sandia.gov), or
39 // Kara Peterson (kjpeter@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
50 #ifndef INTREPID_ARRAYTOOLS_HPP
51 #define INTREPID_ARRAYTOOLS_HPP
52 
53 #include "Intrepid_ConfigDefs.hpp"
54 #include "Intrepid_Types.hpp"
55 #include "Teuchos_BLAS.hpp"
56 #include "Teuchos_Assert.hpp"
57 #include <Intrepid_Rank.hpp>
58 
59 namespace Intrepid {
60 
67  class ArrayTools {
68  public:
69 
90  /* template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
91  static void contractFieldFieldScalarTemp(ArrayOutFields & outputFields,
92  const ArrayInFieldsLeft & leftFields,
93  const ArrayInFieldsRight & rightFields,
94  const ECompEngine compEngine,
95  const bool sumInto = false);
96 
97 */
119  /* template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
120  static void contractFieldFieldVectorTemp(ArrayOutFields & outputFields,
121  const ArrayInFieldsLeft & leftFields,
122  const ArrayInFieldsRight & rightFields,
123  const ECompEngine compEngine,
124  const bool sumInto = false);
125 */
126 
149  /*
150  template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
151  static void contractFieldFieldTensorTemp(ArrayOutFields & outputFields,
152  const ArrayInFieldsLeft & leftFields,
153  const ArrayInFieldsRight & rightFields,
154  const ECompEngine compEngine,
155  const bool sumInto = false);
156  */
157 
177  /*
178  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
179  static void contractDataFieldScalarTemp(ArrayOutFields & outputFields,
180  const ArrayInData & inputData,
181  const ArrayInFields & inputFields,
182  const ECompEngine compEngine,
183  const bool sumInto = false);
184 */
185 
205  /*
206  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
207  static void contractDataFieldVectorTemp(ArrayOutFields & outputFields,
208  const ArrayInData & inputData,
209  const ArrayInFields & inputFields,
210  const ECompEngine compEngine,
211  const bool sumInto = false);
212 */
213 
234  /*
235  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
236  static void contractDataFieldTensorTemp(ArrayOutFields & outputFields,
237  const ArrayInData & inputData,
238  const ArrayInFields & inputFields,
239  const ECompEngine compEngine,
240  const bool sumInto = false);
241 
242 */
259  /*
260  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
261  static void contractDataDataScalarTemp(ArrayOutData & outputData,
262  const ArrayInDataLeft & inputDataLeft,
263  const ArrayInDataRight & inputDataRight,
264  const ECompEngine compEngine,
265  const bool sumInto = false);
266 */
267 
284  /* template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
285  static void contractDataDataVectorTemp(ArrayOutData & outputData,
286  const ArrayInDataLeft & inputDataLeft,
287  const ArrayInDataRight & inputDataRight,
288  const ECompEngine compEngine,
289  const bool sumInto = false);
290 
291 */
309  /* template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
310  static void contractDataDataTensorTemp(ArrayOutData & outputData,
311  const ArrayInDataLeft & inputDataLeft,
312  const ArrayInDataRight & inputDataRight,
313  const ECompEngine compEngine,
314  const bool sumInto = false);
315 */
316 
346  template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
347  static void contractFieldFieldScalar(ArrayOutFields & outputFields,
348  const ArrayInFieldsLeft & leftFields,
349  const ArrayInFieldsRight & rightFields,
350  const ECompEngine compEngine,
351  const bool sumInto = false);
352 
353 
375  template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
376  static void contractFieldFieldVector(ArrayOutFields & outputFields,
377  const ArrayInFieldsLeft & leftFields,
378  const ArrayInFieldsRight & rightFields,
379  const ECompEngine compEngine,
380  const bool sumInto = false);
381 
382 
405  template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
406  static void contractFieldFieldTensor(ArrayOutFields & outputFields,
407  const ArrayInFieldsLeft & leftFields,
408  const ArrayInFieldsRight & rightFields,
409  const ECompEngine compEngine,
410  const bool sumInto = false);
411 
412 
431  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
432  static void contractDataFieldScalar(ArrayOutFields & outputFields,
433  const ArrayInData & inputData,
434  const ArrayInFields & inputFields,
435  const ECompEngine compEngine,
436  const bool sumInto = false);
437 
438 
458  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
459  static void contractDataFieldVector(ArrayOutFields & outputFields,
460  const ArrayInData & inputData,
461  const ArrayInFields & inputFields,
462  const ECompEngine compEngine,
463  const bool sumInto = false);
464 
465 
486  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
487  static void contractDataFieldTensor(ArrayOutFields & outputFields,
488  const ArrayInData & inputData,
489  const ArrayInFields & inputFields,
490  const ECompEngine compEngine,
491  const bool sumInto = false);
492 
493 
510  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
511  static void contractDataDataScalar(ArrayOutData & outputData,
512  const ArrayInDataLeft & inputDataLeft,
513  const ArrayInDataRight & inputDataRight,
514  const ECompEngine compEngine,
515  const bool sumInto = false);
516 
517 
534  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
535  static void contractDataDataVector(ArrayOutData & outputData,
536  const ArrayInDataLeft & inputDataLeft,
537  const ArrayInDataRight & inputDataRight,
538  const ECompEngine compEngine,
539  const bool sumInto = false);
540 
541 
559  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
560  static void contractDataDataTensor(ArrayOutData & outputData,
561  const ArrayInDataLeft & inputDataLeft,
562  const ArrayInDataRight & inputDataRight,
563  const ECompEngine compEngine,
564  const bool sumInto = false);
565 
566 
596  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
597  static void scalarMultiplyDataField(ArrayOutFields & outputFields,
598  const ArrayInData & inputData,
599  const ArrayInFields & inputFields,
600  const bool reciprocal = false);
601 
602  template<class ArrayOutFields, class ArrayInData, class ArrayInFields, class Layout, class MemorySpace,int infieldRank,int outfieldRank>
604  /*
605 
606  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
607  static void scalarMultiplyDataFieldTemp(ArrayOutFields & outputFields,
608  const ArrayInData & inputData,
609  ArrayInFields & inputFields,
610  const bool reciprocal=false);*/
639  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
640  static void scalarMultiplyDataData(ArrayOutData & outputData,
641  const ArrayInDataLeft & inputDataLeft,
642  const ArrayInDataRight & inputDataRight,
643  const bool reciprocal = false);
644 
673  template<class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight, class Layout, class MemorySpace,int invalRank,int outvalRank>
675  /*
676  template<class Scalar,class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
677  static void scalarMultiplyDataDataTemp(ArrayOutData & outputData,
678  ArrayInDataLeft & inputDataLeft,
679  ArrayInDataRight & inputDataRight,
680  const bool reciprocal=false);*/
681 
711  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
712  static void dotMultiplyDataField(ArrayOutFields & outputFields,
713  const ArrayInData & inputDataLeft,
714  const ArrayInFields & inputFields);
715 
716 
743  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
744  static void dotMultiplyDataData(ArrayOutData & outputData,
745  const ArrayInDataLeft & inputDataLeft,
746  const ArrayInDataRight & inputDataRight);
747 
748 
770  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
771  static void crossProductDataField(ArrayOutFields & outputFields,
772  const ArrayInData & inputData,
773  const ArrayInFields & inputFields);
774 
775 
796  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
797  static void crossProductDataData(ArrayOutData & outputData,
798  const ArrayInDataLeft & inputDataLeft,
799  const ArrayInDataRight & inputDataRight);
800 
801 
824  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
825  static void outerProductDataField(ArrayOutFields & outputFields,
826  const ArrayInData & inputData,
827  const ArrayInFields & inputFields);
828 
829 
851  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
852  static void outerProductDataData(ArrayOutData & outputData,
853  const ArrayInDataLeft & inputDataLeft,
854  const ArrayInDataRight & inputDataRight);
855 
856 
892  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
893  static void matvecProductDataField(ArrayOutFields & outputFields,
894  const ArrayInData & inputData,
895  const ArrayInFields & inputFields,
896  const char transpose = 'N');
897  /*
898  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
899  static void matvecProductDataFieldTemp(ArrayOutFields & outputFields,
900  const ArrayInData & inputData,
901  const ArrayInFields & inputFields,
902  const char transpose = 'N');
903  */
904 
937  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
938  static void matvecProductDataData(ArrayOutData & outputData,
939  const ArrayInDataLeft & inputDataLeft,
940  const ArrayInDataRight & inputDataRight,
941  const char transpose = 'N');
942  /*
943  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
944  static void matvecProductDataDataTemp(ArrayOutData & outputData,
945  const ArrayInDataLeft & inputDataLeft,
946  const ArrayInDataRight & inputDataRight,
947  const char transpose = 'N');
948  */
949 
984  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
985  static void matmatProductDataField(ArrayOutFields & outputFields,
986  const ArrayInData & inputData,
987  const ArrayInFields & inputFields,
988  const char transpose = 'N');
989 
990 
991 
1025  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
1026  static void matmatProductDataData(ArrayOutData & outputData,
1027  const ArrayInDataLeft & inputDataLeft,
1028  const ArrayInDataRight & inputDataRight,
1029  const char transpose = 'N');
1030 
1031  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight,int inleftrank,int inrankright>
1033 
1034  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight,int inrightrank>
1036  /*
1037  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
1038  static void matmatProductDataDataTemp(ArrayOutData & outputData,
1039  const ArrayInDataLeft & inputDataLeft,
1040  const ArrayInDataRight & inputDataRight,
1041  const char transpose = 'N'); */
1058  template<class Scalar, class ArrayOutFields, class ArrayInFields>
1059  static void cloneFields(ArrayOutFields & outputFields,
1060  const ArrayInFields & inputFields);
1061 
1062 
1063  template<class ArrayOutFields, class ArrayInFields, class Layout, class MemorySpace,int invalRank,int outvalRank>
1065  /*
1066  template<class Scalar,class ArrayOutFields, class ArrayInFields>
1067  static void cloneFieldsTemp(ArrayOutFields & outputFields,
1068  const ArrayInFields & inputFields);
1069 */
1088  template<class Scalar, class ArrayOutFields, class ArrayInFactors, class ArrayInFields>
1089  static void cloneScaleFields(ArrayOutFields & outputFields,
1090  const ArrayInFactors & inputFactors,
1091  const ArrayInFields & inputFields);
1092 
1093 
1109  template<class Scalar, class ArrayInOutFields, class ArrayInFactors>
1110  static void scaleFields(ArrayInOutFields & inoutFields,
1111  const ArrayInFactors & inputFactors);
1112 
1113 
1114  }; // end class ArrayTools
1115 
1116 } // end namespace Intrepid
1117 
1123 
1124 #endif
1125 
1126 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
1127 #ifdef __GNUC__
1128 #warning "The Intrepid package is deprecated"
1129 #endif
1130 #endif
1131 
static void contractDataDataVector(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P and D of rank-3 containers with dimensions (C...
static void contractDataDataScalar(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; dimensions P of rank-2 containers with dimensions (C,P), and returns the result...
static void contractDataDataTensor(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P, D1 and D2 of rank-4 containers with dimensions (C...
static void contractFieldFieldTensor(ArrayOutFields &outputFields, const ArrayInFieldsLeft &leftFields, const ArrayInFieldsRight &rightFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P, D1, and D2 of two rank-5 containers with dimensions (...
static void contractFieldFieldScalar(ArrayOutFields &outputFields, const ArrayInFieldsLeft &leftFields, const ArrayInFieldsRight &rightFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; dimension P of two rank-3 containers with dimensions (C,L,P) and (C...
static void contractFieldFieldVector(ArrayOutFields &outputFields, const ArrayInFieldsLeft &leftFields, const ArrayInFieldsRight &rightFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P and D1 of two rank-4 containers with dimensions (C...
static void contractDataFieldVector(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P and D of a rank-4 container and a rank-3 container wit...
static void matmatProductDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const char transpose= 'N')
There are two use cases: (1) matrix-matrix product of a rank-4 container inputDataRight with dimensio...
static void cloneScaleFields(ArrayOutFields &outputFields, const ArrayInFactors &inputFactors, const ArrayInFields &inputFields)
Multiplies a rank-2, 3, or 4 container with dimensions (F,P), (F,P,D1) or (F,P,D1,D2), representing the values of a scalar, vector or a tensor field, F-componentwise with a scalar container indexed by (C,F), and stores the result in an output value container of size (C,F,P), (C,F,P,D1) or (C,F,P,D1,D2).
Definition file for clone / scale operations of the array tools interface.
Contains definitions of custom data types in Intrepid.
static void crossProductDataField(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields)
There are two use cases: (1) cross product of a rank-4 container inputFields with dimensions (C...
static void contractDataFieldScalar(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; dimensions P of a rank-3 containers and a rank-2 container with dimensions (C...
Definition file for tensor multiply operations of the array tools interface.
static void contractDataFieldTensor(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const ECompEngine compEngine, const bool sumInto=false)
Contracts the &quot;point&quot; and &quot;space&quot; dimensions P, D1 and D2 of a rank-5 container and a rank-4 containe...
static void dotMultiplyDataField(ArrayOutFields &outputFields, const ArrayInData &inputDataLeft, const ArrayInFields &inputFields)
There are two use cases: (1) dot product of a rank-3, 4 or 5 container inputFields with dimensions (C...
Definition file for scalar multiply operations of the array tools interface.
Definition file for dot-multiply operations of the array tools interface.
There are two use cases: (1) dot product of a rank-3, 4 or 5 container inputFields with dimensions (C...
static void dotMultiplyDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight)
There are two use cases: (1) dot product of a rank-2, 3 or 4 container inputDataRight with dimensions...
static void scalarMultiplyDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const bool reciprocal=false)
There are two use cases: (1) multiplies a rank-2, 3, or 4 container inputDataRight with dimensions (C...
Utility class that provides methods for higher-order algebraic manipulation of user-defined arrays...
static void crossProductDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight)
There are two use cases: (1) cross product of a rank-3 container inputDataRight with dimensions (C...
static void matmatProductDataField(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const char transpose= 'N')
There are two use cases: (1) matrix-matrix product of a rank-5 container inputFields with dimensions ...
static void scalarMultiplyDataField(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const bool reciprocal=false)
There are two use cases: (1) multiplies a rank-3, 4, or 5 container inputFields with dimensions (C...
static void outerProductDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight)
There are two use cases: (1) outer product of a rank-3 container inputDataRight with dimensions (C...
static void outerProductDataField(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields)
There are two use cases: (1) outer product of a rank-4 container inputFields with dimensions (C...
static void matvecProductDataData(ArrayOutData &outputData, const ArrayInDataLeft &inputDataLeft, const ArrayInDataRight &inputDataRight, const char transpose= 'N')
There are two use cases: (1) matrix-vector product of a rank-3 container inputDataRight with dimensio...
Definition file for contraction (integration) operations of the array tools class.
static void matvecProductDataField(ArrayOutFields &outputFields, const ArrayInData &inputData, const ArrayInFields &inputFields, const char transpose= 'N')
There are two use cases: (1) matrix-vector product of a rank-4 container inputFields with dimensions ...
static void cloneFields(ArrayOutFields &outputFields, const ArrayInFields &inputFields)
Replicates a rank-2, 3, or 4 container with dimensions (F,P), (F,P,D1) or (F,P,D1,D2), representing the values of a scalar, vector or a tensor field, into an output value container of size (C,F,P), (C,F,P,D1) or (C,F,P,D1,D2).
static void scaleFields(ArrayInOutFields &inoutFields, const ArrayInFactors &inputFactors)
Multiplies, in place, a rank-2, 3, or 4 container with dimensions (C,F,P), (C,F,P,D1) or (C,F,P,D1,D2), representing the values of a scalar, vector or a tensor field, F-componentwise with a scalar container indexed by (C,F).