2 namespace ArrayToolsKokkos{
3 template<
class Scalar,
class ArrayOutData,
class ArrayInDataLeft,
class ArrayInDataRight>
4 void ArrayTools::scalarMultiplyDataData2(ArrayOutData & outputData,
5 ArrayInDataLeft & inputDataLeft,
6 ArrayInDataRight & inputDataRight,
7 const bool reciprocal) {
9 #ifdef HAVE_INTREPID_DEBUG
10 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.rank() != 2), std::invalid_argument,
11 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Left input data container must have rank 2.");
12 if (outputData.rank() <= inputDataRight.rank()) {
13 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputDataRight.rank() < 2) || (inputDataRight.rank() > 4) ), std::invalid_argument,
14 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Right input data container must have rank 2, 3, or 4.");
15 TEUCHOS_TEST_FOR_EXCEPTION( (outputData.rank() != inputDataRight.rank()), std::invalid_argument,
16 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Right input and output data containers must have the same rank.");
17 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataRight.dimension(0) != inputDataLeft.dimension(0) ), std::invalid_argument,
18 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Zeroth dimensions (number of integration domains) of the left and right data input containers must agree!");
19 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputDataRight.dimension(1) != inputDataLeft.dimension(1)) && (inputDataLeft.dimension(1) != 1) ), std::invalid_argument,
20 ">>> ERROR (ArrayTools::scalarMultiplyDataData): First dimensions of the left and right data input containers (number of integration points) must agree or first dimension of the left data input container must be 1!");
21 for (
int i=0; i<inputDataRight.rank(); i++) {
22 std::string errmsg =
">>> ERROR (ArrayTools::scalarMultiplyDataData): Dimension ";
23 errmsg += (char)(48+i);
24 errmsg +=
" of the right input and output data containers must agree!";
25 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataRight.dimension(i) != outputData.dimension(i)), std::invalid_argument, errmsg );
29 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputDataRight.rank() < 1) || (inputDataRight.rank() > 3) ), std::invalid_argument,
30 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Right input data container must have rank 1, 2, or 3.");
31 TEUCHOS_TEST_FOR_EXCEPTION( (outputData.rank() != inputDataRight.rank()+1), std::invalid_argument,
32 ">>> ERROR (ArrayTools::scalarMultiplyDataData): The rank of the right input data container must be one less than the rank of the output data container.");
33 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputDataRight.dimension(0) != inputDataLeft.dimension(1)) && (inputDataLeft.dimension(1) != 1) ), std::invalid_argument,
34 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Zeroth dimension of the right input data container and first dimension of the left data input container (number of integration points) must agree or first dimension of the left data input container must be 1!");
35 TEUCHOS_TEST_FOR_EXCEPTION( ( inputDataLeft.dimension(0) != outputData.dimension(0) ), std::invalid_argument,
36 ">>> ERROR (ArrayTools::scalarMultiplyDataData): Zeroth dimensions of data output and left data input containers (number of integration domains) must agree!");
37 for (
int i=0; i<inputDataRight.rank(); i++) {
38 std::string errmsg =
">>> ERROR (ArrayTools::scalarMultiplyDataData): Dimensions ";
39 errmsg += (char)(48+i);
41 errmsg += (char)(48+i+1);
42 errmsg +=
" of the right input and output data containers must agree!";
43 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataRight.dimension(i) != outputData.dimension(i+1)), std::invalid_argument, errmsg );
49 int invalRank = inputDataRight.rank();
50 int outvalRank = outputData.rank();
51 int numCells = outputData.dimension(0);
52 int numPoints = outputData.dimension(1);
53 int numDataPoints = inputDataLeft.dimension(1);
57 dim1Tens = outputData.dimension(2);
59 dim2Tens = outputData.dimension(3);
63 if (outvalRank == invalRank) {
65 if (numDataPoints != 1) {
68 for(
int cl = 0; cl < numCells; cl++) {
69 for(
int pt = 0; pt < numPoints; pt++) {
70 outputData(cl, pt) = inputDataRight(cl, pt)/inputDataLeft(cl, pt);
75 for(
int cl = 0; cl < numCells; cl++) {
76 for(
int pt = 0; pt < numPoints; pt++) {
77 outputData(cl, pt) = inputDataRight(cl, pt)*inputDataLeft(cl, pt);
93 for(
int cl = 0; cl < numCells; cl++) {
94 for(
int pt = 0; pt < numPoints; pt++) {
95 outputData(cl, pt) = inputDataRight(cl, pt)/inputDataLeft(cl, 0);
100 for(
int cl = 0; cl < numCells; cl++) {
101 for(
int pt = 0; pt < numPoints; pt++) {
102 outputData(cl, pt) = inputDataRight(cl, pt)*inputDataLeft(cl, 0);
121 if (numDataPoints != 1) {
124 for(
int cl = 0; cl < numCells; cl++) {
125 for(
int pt = 0; pt < numPoints; pt++) {
126 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
127 outputData(cl, pt, iVec) = inputDataRight(pt, iVec)/inputDataLeft(cl, pt);
133 for(
int cl = 0; cl < numCells; cl++) {
134 for(
int pt = 0; pt < numPoints; pt++) {
135 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
136 outputData(cl, pt, iVec) = inputDataRight(pt, iVec)*inputDataLeft(cl, pt);
154 for(
int cl = 0; cl < numCells; cl++) {
155 for(
int pt = 0; pt < numPoints; pt++) {
156 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
157 outputData(cl, pt, iVec) = inputDataRight(pt, iVec)/inputDataLeft(cl, 0);
163 for(
int cl = 0; cl < numCells; cl++) {
164 for(
int pt = 0; pt < numPoints; pt++) {
165 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
166 outputData(cl, pt, iVec) = inputDataRight(pt, iVec)*inputDataLeft(cl, 0);