50 template<
class Scalar,
class ArrayOutFields,
class ArrayInFieldsLeft,
class ArrayInFieldsRight>
52 const ArrayInFieldsLeft & leftFields,
53 const ArrayInFieldsRight & rightFields,
54 const ECompEngine compEngine,
58 #ifdef HAVE_INTREPID_DEBUG
59 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(leftFields) != 3 ), std::invalid_argument,
60 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of the left input argument must equal 3!");
61 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(rightFields) != 3 ), std::invalid_argument,
62 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of right input argument must equal 3!");
63 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 3 ), std::invalid_argument,
64 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of output argument must equal 3!");
65 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
66 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
67 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(2) != rightFields.dimension(2) ), std::invalid_argument,
68 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
69 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
70 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
71 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != leftFields.dimension(1) ), std::invalid_argument,
72 ">>> ERROR (ArrayTools::contractFieldFieldScalar): First dimension of output container and first dimension of left input container must agree!");
73 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(2) != rightFields.dimension(1) ), std::invalid_argument,
74 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimension of output container and first dimension of right input container must agree!");
76 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
77 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
81 int numCells = leftFields.dimension(0);
82 int numLeftFields = leftFields.dimension(1);
83 int numRightFields = rightFields.dimension(1);
84 int numPoints = leftFields.dimension(2);
88 for (
int cl = 0; cl < numCells; cl++) {
89 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
90 for (
int rbf = 0; rbf < numRightFields; rbf++) {
92 for (
int qp = 0; qp < numPoints; qp++) {
93 tmpVal += leftFields(cl, lbf, qp)*rightFields(cl, rbf, qp);
95 outputFields(cl, lbf, rbf) += tmpVal;
101 for (
int cl = 0; cl < numCells; cl++) {
102 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
103 for (
int rbf = 0; rbf < numRightFields; rbf++) {
105 for (
int qp = 0; qp < numPoints; qp++) {
106 tmpVal += leftFields(cl, lbf, qp)*rightFields(cl, rbf, qp);
108 outputFields(cl, lbf, rbf) = tmpVal;
116 template<
class Scalar,
class ArrayOutFields,
class ArrayInFieldsLeft,
class ArrayInFieldsRight>
118 const ArrayInFieldsLeft & leftFields,
119 const ArrayInFieldsRight & rightFields,
120 const ECompEngine compEngine,
121 const bool sumInto) {
123 #ifdef HAVE_INTREPID_DEBUG
124 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(leftFields) != 4 ), std::invalid_argument,
125 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of the left input argument must equal 4!");
126 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(rightFields) != 4 ), std::invalid_argument,
127 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of right input argument must equal 4!");
128 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 3 ), std::invalid_argument,
129 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of output argument must equal 3!");
130 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
131 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
132 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(2) != rightFields.dimension(2) ), std::invalid_argument,
133 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
134 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(3) != rightFields.dimension(3) ), std::invalid_argument,
135 ">>> ERROR (ArrayTools::contractFieldFieldVector): Third dimensions (numbers of vector components) of the left and right input containers must agree!");
136 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
137 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
138 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != leftFields.dimension(1) ), std::invalid_argument,
139 ">>> ERROR (ArrayTools::contractFieldFieldVector): First dimension of output container and first dimension of left input container must agree!");
140 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(2) != rightFields.dimension(1) ), std::invalid_argument,
141 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimension of output container and first dimension of right input container must agree!");
142 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
143 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
148 int numCells = leftFields.dimension(0);
149 int numLeftFields = leftFields.dimension(1);
150 int numRightFields = rightFields.dimension(1);
151 int numPoints = leftFields.dimension(2);
152 int dimVec = leftFields.dimension(3);
156 for (
int cl = 0; cl < numCells; cl++) {
157 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
158 for (
int rbf = 0; rbf < numRightFields; rbf++) {
160 for (
int qp = 0; qp < numPoints; qp++) {
161 for (
int iVec = 0; iVec < dimVec; iVec++) {
162 tmpVal += leftFields(cl, lbf, qp, iVec)*rightFields(cl, rbf, qp, iVec);
165 outputFields(cl, lbf, rbf) += tmpVal;
171 for (
int cl = 0; cl < numCells; cl++) {
172 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
173 for (
int rbf = 0; rbf < numRightFields; rbf++) {
175 for (
int qp = 0; qp < numPoints; qp++) {
176 for (
int iVec = 0; iVec < dimVec; iVec++) {
177 tmpVal += leftFields(cl, lbf, qp, iVec)*rightFields(cl, rbf, qp, iVec);
180 outputFields(cl, lbf, rbf) = tmpVal;
188 template<
class Scalar,
class ArrayOutFields,
class ArrayInFieldsLeft,
class ArrayInFieldsRight>
190 const ArrayInFieldsLeft & leftFields,
191 const ArrayInFieldsRight & rightFields,
192 const ECompEngine compEngine,
193 const bool sumInto) {
195 #ifdef HAVE_INTREPID_DEBUG
196 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(leftFields) != 5 ), std::invalid_argument,
197 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of the left input argument must equal 5!");
198 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(rightFields) != 5 ), std::invalid_argument,
199 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of right input argument must equal 5!");
200 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 3 ), std::invalid_argument,
201 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of output argument must equal 3!");
202 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
203 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
204 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(2) != rightFields.dimension(2) ), std::invalid_argument,
205 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
206 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(3) != rightFields.dimension(3) ), std::invalid_argument,
207 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Third dimensions (first tensor dimensions) of the left and right input containers must agree!");
208 TEUCHOS_TEST_FOR_EXCEPTION( (leftFields.dimension(4) != rightFields.dimension(4) ), std::invalid_argument,
209 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Fourth dimensions (second tensor dimensions) of the left and right input containers must agree!");
210 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != rightFields.dimension(0) ), std::invalid_argument,
211 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
212 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != leftFields.dimension(1) ), std::invalid_argument,
213 ">>> ERROR (ArrayTools::contractFieldFieldTensor): First dimension of output container and first dimension of left input container must agree!");
214 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(2) != rightFields.dimension(1) ), std::invalid_argument,
215 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimension of output container and first dimension of right input container must agree!");
216 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
217 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
222 int numCells = leftFields.dimension(0);
223 int numLeftFields = leftFields.dimension(1);
224 int numRightFields = rightFields.dimension(1);
225 int numPoints = leftFields.dimension(2);
226 int dim1Tensor = leftFields.dimension(3);
227 int dim2Tensor = leftFields.dimension(4);
230 for (
int cl = 0; cl < numCells; cl++) {
231 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
232 for (
int rbf = 0; rbf < numRightFields; rbf++) {
234 for (
int qp = 0; qp < numPoints; qp++) {
235 for (
int iTens1 = 0; iTens1 < dim1Tensor; iTens1++) {
236 for (
int iTens2 = 0; iTens2 < dim2Tensor; iTens2++) {
237 tmpVal += leftFields(cl, lbf, qp, iTens1, iTens2)*rightFields(cl, rbf, qp, iTens1, iTens2);
241 outputFields(cl, lbf, rbf) += tmpVal;
247 for (
int cl = 0; cl < numCells; cl++) {
248 for (
int lbf = 0; lbf < numLeftFields; lbf++) {
249 for (
int rbf = 0; rbf < numRightFields; rbf++) {
251 for (
int qp = 0; qp < numPoints; qp++) {
252 for (
int iTens1 = 0; iTens1 < dim1Tensor; iTens1++) {
253 for (
int iTens2 = 0; iTens2 < dim2Tensor; iTens2++) {
254 tmpVal += leftFields(cl, lbf, qp, iTens1, iTens2)*rightFields(cl, rbf, qp, iTens1, iTens2);
258 outputFields(cl, lbf, rbf) = tmpVal;
266 template<
class Scalar,
class ArrayOutFields,
class ArrayInData,
class ArrayInFields>
268 const ArrayInData & inputData,
269 const ArrayInFields & inputFields,
270 const ECompEngine compEngine,
271 const bool sumInto) {
274 #ifdef HAVE_INTREPID_DEBUG
275 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputFields) != 3 ), std::invalid_argument,
276 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the fields input argument must equal 3!");
277 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputData) != 2 ), std::invalid_argument,
278 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the data input argument must equal 2!");
279 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 2 ), std::invalid_argument,
280 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of output argument must equal 2!");
281 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(0) != inputData.dimension(0) ), std::invalid_argument,
282 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
283 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputFields.dimension(2) != inputData.dimension(1)) && (inputData.dimension(1) != 1) ), std::invalid_argument,
284 ">>> ERROR (ArrayTools::contractDataFieldScalar): Second dimension of fields input container and first dimension of data input container (number of integration points) must agree or first data dimension must be 1!");
285 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != inputFields.dimension(0) ), std::invalid_argument,
286 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
287 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != inputFields.dimension(1) ), std::invalid_argument,
288 ">>> ERROR (ArrayTools::contractDataFieldScalar): First dimensions (number of fields) of the fields input and output containers must agree!");
289 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
290 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
295 int numCells = inputFields.dimension(0);
296 int numFields = inputFields.dimension(1);
297 int numPoints = inputFields.dimension(2);
298 int numDataPoints = inputData.dimension(1);
302 if (numDataPoints != 1) {
303 for (
int cl = 0; cl < numCells; cl++) {
304 for (
int lbf = 0; lbf < numFields; lbf++) {
306 for (
int qp = 0; qp < numPoints; qp++) {
307 tmpVal += inputFields(cl, lbf, qp)*inputData(cl, qp);
309 outputFields(cl, lbf) += tmpVal;
314 for (
int cl = 0; cl < numCells; cl++) {
315 for (
int lbf = 0; lbf < numFields; lbf++) {
317 for (
int qp = 0; qp < numPoints; qp++) {
318 tmpVal += inputFields(cl, lbf, qp)*inputData(cl, 0);
320 outputFields(cl, lbf) += tmpVal;
326 if (numDataPoints != 1) {
327 for (
int cl = 0; cl < numCells; cl++) {
328 for (
int lbf = 0; lbf < numFields; lbf++) {
330 for (
int qp = 0; qp < numPoints; qp++) {
331 tmpVal += inputFields(cl, lbf, qp)*inputData(cl, qp);
333 outputFields(cl, lbf) = tmpVal;
338 for (
int cl = 0; cl < numCells; cl++) {
339 for (
int lbf = 0; lbf < numFields; lbf++) {
341 for (
int qp = 0; qp < numPoints; qp++) {
342 tmpVal += inputFields(cl, lbf, qp)*inputData(cl, 0);
344 outputFields(cl, lbf) = tmpVal;
353 template<
class Scalar,
class ArrayOutFields,
class ArrayInData,
class ArrayInFields>
355 const ArrayInData & inputData,
356 const ArrayInFields & inputFields,
357 const ECompEngine compEngine,
358 const bool sumInto) {
360 #ifdef HAVE_INTREPID_DEBUG
361 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputFields) != 4 ), std::invalid_argument,
362 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the fields input argument must equal 4!");
363 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputData) != 3 ), std::invalid_argument,
364 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the data input argument must equal 3!");
365 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 2 ), std::invalid_argument,
366 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of output argument must equal 2!");
367 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(0) != inputData.dimension(0) ), std::invalid_argument,
368 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
369 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputFields.dimension(2) != inputData.dimension(1)) && (inputData.dimension(1) != 1) ), std::invalid_argument,
370 ">>> ERROR (ArrayTools::contractDataFieldVector): Second dimension of the fields input container and first dimension of data input container (number of integration points) must agree or first data dimension must be 1!");
371 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(3) != inputData.dimension(2) ), std::invalid_argument,
372 ">>> ERROR (ArrayTools::contractDataFieldVector): Third dimension of the fields input container and second dimension of data input container (vector index) must agree!");
373 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != inputFields.dimension(0) ), std::invalid_argument,
374 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
375 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != inputFields.dimension(1) ), std::invalid_argument,
376 ">>> ERROR (ArrayTools::contractDataFieldVector): First dimensions of output container and fields input container (number of fields) must agree!");
377 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
378 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
384 int numCells = inputFields.dimension(0);
385 int numFields = inputFields.dimension(1);
386 int numPoints = inputFields.dimension(2);
387 int dimVec = inputFields.dimension(3);
388 int numDataPoints = inputData.dimension(1);
391 if (numDataPoints != 1) {
392 for (
int cl = 0; cl < numCells; cl++) {
393 for (
int lbf = 0; lbf < numFields; lbf++) {
395 for (
int qp = 0; qp < numPoints; qp++) {
396 for (
int iVec = 0; iVec < dimVec; iVec++) {
397 tmpVal += inputFields(cl, lbf, qp, iVec)*inputData(cl, qp, iVec);
400 outputFields(cl, lbf) += tmpVal;
405 for (
int cl = 0; cl < numCells; cl++) {
406 for (
int lbf = 0; lbf < numFields; lbf++) {
408 for (
int qp = 0; qp < numPoints; qp++) {
409 for (
int iVec = 0; iVec < dimVec; iVec++) {
410 tmpVal += inputFields(cl, lbf, qp, iVec)*inputData(cl, 0, iVec);
413 outputFields(cl, lbf) += tmpVal;
419 if (numDataPoints != 1) {
420 for (
int cl = 0; cl < numCells; cl++) {
421 for (
int lbf = 0; lbf < numFields; lbf++) {
423 for (
int qp = 0; qp < numPoints; qp++) {
424 for (
int iVec = 0; iVec < dimVec; iVec++) {
425 tmpVal += inputFields(cl, lbf, qp, iVec)*inputData(cl, qp, iVec);
428 outputFields(cl, lbf) = tmpVal;
433 for (
int cl = 0; cl < numCells; cl++) {
434 for (
int lbf = 0; lbf < numFields; lbf++) {
436 for (
int qp = 0; qp < numPoints; qp++) {
437 for (
int iVec = 0; iVec < dimVec; iVec++) {
438 tmpVal += inputFields(cl, lbf, qp, iVec)*inputData(cl, 0, iVec);
441 outputFields(cl, lbf) = tmpVal;
449 template<
class Scalar,
class ArrayOutFields,
class ArrayInData,
class ArrayInFields>
451 const ArrayInData & inputData,
452 const ArrayInFields & inputFields,
453 const ECompEngine compEngine,
454 const bool sumInto) {
456 #ifdef HAVE_INTREPID_DEBUG
457 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputFields) != 5 ), std::invalid_argument,
458 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the fields input argument must equal 5!");
459 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputData) != 4 ), std::invalid_argument,
460 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the data input argument must equal 4!");
461 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != 2 ), std::invalid_argument,
462 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of output argument must equal 2!");
463 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(0) != inputData.dimension(0) ), std::invalid_argument,
464 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
465 TEUCHOS_TEST_FOR_EXCEPTION( ( (inputFields.dimension(2) != inputData.dimension(1)) && (inputData.dimension(1) != 1) ), std::invalid_argument,
466 ">>> ERROR (ArrayTools::contractDataFieldTensor): Second dimension of the fields input container and first dimension of data input container (number of integration points) must agree or first data dimension must be 1!");
467 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(3) != inputData.dimension(2) ), std::invalid_argument,
468 ">>> ERROR (ArrayTools::contractDataFieldTensor): Third dimension of the fields input container and second dimension of data input container (first tensor dimension) must agree!");
469 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(4) != inputData.dimension(3) ), std::invalid_argument,
470 ">>> ERROR (ArrayTools::contractDataFieldTensor): Fourth dimension of the fields input container and third dimension of data input container (second tensor dimension) must agree!");
471 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(0) != inputFields.dimension(0) ), std::invalid_argument,
472 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
473 TEUCHOS_TEST_FOR_EXCEPTION( (outputFields.dimension(1) != inputFields.dimension(1) ), std::invalid_argument,
474 ">>> ERROR (ArrayTools::contractDataFieldTensor): First dimensions (number of fields) of output container and fields input container must agree!");
475 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
476 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
481 int numCells = inputFields.dimension(0);
482 int numFields = inputFields.dimension(1);
483 int numPoints = inputFields.dimension(2);
484 int dim1Tens = inputFields.dimension(3);
485 int dim2Tens = inputFields.dimension(4);
486 int numDataPoints = inputData.dimension(1);
490 if (numDataPoints != 1) {
491 for (
int cl = 0; cl < numCells; cl++) {
492 for (
int lbf = 0; lbf < numFields; lbf++) {
494 for (
int qp = 0; qp < numPoints; qp++) {
495 for (
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
496 for (
int iTens2 =0; iTens2 < dim2Tens; iTens2++) {
497 tmpVal += inputFields(cl, lbf, qp, iTens1, iTens2)*inputData(cl, qp, iTens1, iTens2);
501 outputFields(cl, lbf) += tmpVal;
506 for (
int cl = 0; cl < numCells; cl++) {
507 for (
int lbf = 0; lbf < numFields; lbf++) {
509 for (
int qp = 0; qp < numPoints; qp++) {
510 for (
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
511 for (
int iTens2 = 0; iTens2 < dim2Tens; iTens2++) {
512 tmpVal += inputFields(cl, lbf, qp, iTens1, iTens2)*inputData(cl, 0, iTens1, iTens2);
516 outputFields(cl, lbf) += tmpVal;
522 if (numDataPoints != 1) {
523 for (
int cl = 0; cl < numCells; cl++) {
524 for (
int lbf = 0; lbf < numFields; lbf++) {
526 for (
int qp = 0; qp < numPoints; qp++) {
527 for (
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
528 for (
int iTens2 =0; iTens2 < dim2Tens; iTens2++) {
529 tmpVal += inputFields(cl, lbf, qp, iTens1, iTens2)*inputData(cl, qp, iTens1, iTens2);
533 outputFields(cl, lbf) = tmpVal;
538 for (
int cl = 0; cl < numCells; cl++) {
539 for (
int lbf = 0; lbf < numFields; lbf++) {
541 for (
int qp = 0; qp < numPoints; qp++) {
542 for (
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
543 for (
int iTens2 = 0; iTens2 < dim2Tens; iTens2++) {
544 tmpVal += inputFields(cl, lbf, qp, iTens1, iTens2)*inputData(cl, 0, iTens1, iTens2);
548 outputFields(cl, lbf) = tmpVal;
556 template<
class Scalar,
class ArrayOutData,
class ArrayInDataLeft,
class ArrayInDataRight>
558 const ArrayInDataLeft & inputDataLeft,
559 const ArrayInDataRight & inputDataRight,
560 const ECompEngine compEngine,
561 const bool sumInto) {
562 #ifdef HAVE_INTREPID_DEBUG
563 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataLeft) != 2 ), std::invalid_argument,
564 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of the left input argument must equal 2!");
565 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataRight) != 2 ), std::invalid_argument,
566 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of right input argument must equal 2!");
567 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputData) != 1 ), std::invalid_argument,
568 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of output argument must equal 1!");
569 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
570 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
571 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(1) != inputDataRight.dimension(1) ), std::invalid_argument,
572 ">>> ERROR (ArrayTools::contractDataDataScalar): First dimensions (numbers of integration points) of the left and right input containers must agree!");
573 TEUCHOS_TEST_FOR_EXCEPTION( (outputData.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
574 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
575 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
576 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
580 int numCells = inputDataLeft.dimension(0);
581 int numPoints = inputDataLeft.dimension(1);
584 for (
int cl = 0; cl < numCells; cl++) {
586 for (
int qp = 0; qp < numPoints; qp++) {
587 tmpVal += inputDataLeft(cl, qp)*inputDataRight(cl, qp);
589 outputData(cl) += tmpVal;
593 for (
int cl = 0; cl < numCells; cl++) {
595 for (
int qp = 0; qp < numPoints; qp++) {
596 tmpVal += inputDataLeft(cl, qp)*inputDataRight(cl, qp);
598 outputData(cl) = tmpVal;
606 template<
class Scalar,
class ArrayOutData,
class ArrayInDataLeft,
class ArrayInDataRight>
608 const ArrayInDataLeft & inputDataLeft,
609 const ArrayInDataRight & inputDataRight,
610 const ECompEngine compEngine,
611 const bool sumInto) {
613 #ifdef HAVE_INTREPID_DEBUG
614 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataLeft) != 3 ), std::invalid_argument,
615 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of the left input argument must equal 3!");
616 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataRight) != 3 ), std::invalid_argument,
617 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of right input argument must equal 3!");
618 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputData) != 1 ), std::invalid_argument,
619 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of output argument must equal 1!");
620 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
621 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
622 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(1) != inputDataRight.dimension(1) ), std::invalid_argument,
623 ">>> ERROR (ArrayTools::contractDataDataVector): First dimensions (numbers of integration points) of the left and right input containers must agree!");
624 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(2) != inputDataRight.dimension(2) ), std::invalid_argument,
625 ">>> ERROR (ArrayTools::contractDataDataVector): Second dimensions (numbers of vector components) of the left and right input containers must agree!");
626 TEUCHOS_TEST_FOR_EXCEPTION( (outputData.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
627 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
628 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
629 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
634 int numCells = inputDataLeft.dimension(0);
635 int numPoints = inputDataLeft.dimension(1);
636 int dimVec = inputDataLeft.dimension(2);
640 for (
int cl = 0; cl < numCells; cl++) {
642 for (
int qp = 0; qp < numPoints; qp++) {
643 for (
int iVec = 0; iVec < dimVec; iVec++) {
644 tmpVal += inputDataLeft(cl, qp, iVec)*inputDataRight(cl, qp, iVec);
647 outputData(cl) += tmpVal;
651 for (
int cl = 0; cl < numCells; cl++) {
653 for (
int qp = 0; qp < numPoints; qp++) {
654 for (
int iVec = 0; iVec < dimVec; iVec++) {
655 tmpVal += inputDataLeft(cl, qp, iVec)*inputDataRight(cl, qp, iVec);
658 outputData(cl) = tmpVal;
664 template<
class Scalar,
class ArrayOutData,
class ArrayInDataLeft,
class ArrayInDataRight>
666 const ArrayInDataLeft & inputDataLeft,
667 const ArrayInDataRight & inputDataRight,
668 const ECompEngine compEngine,
669 const bool sumInto) {
671 #ifdef HAVE_INTREPID_DEBUG
672 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataLeft) != 4 ), std::invalid_argument,
673 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of the left input argument must equal 4");
674 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputDataRight) != 4 ), std::invalid_argument,
675 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of right input argument must equal 4!");
676 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputData) != 1 ), std::invalid_argument,
677 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of output argument must equal 1!");
678 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
679 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
680 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(1) != inputDataRight.dimension(1) ), std::invalid_argument,
681 ">>> ERROR (ArrayTools::contractDataDataTensor): First dimensions (numbers of integration points) of the left and right input containers must agree!");
682 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(2) != inputDataRight.dimension(2) ), std::invalid_argument,
683 ">>> ERROR (ArrayTools::contractDataDataTensor): Second dimensions (first tensor dimensions) of the left and right input containers must agree!");
684 TEUCHOS_TEST_FOR_EXCEPTION( (inputDataLeft.dimension(3) != inputDataRight.dimension(3) ), std::invalid_argument,
685 ">>> ERROR (ArrayTools::contractDataDataTensor): Third dimensions (second tensor dimensions) of the left and right input containers must agree!");
686 TEUCHOS_TEST_FOR_EXCEPTION( (outputData.dimension(0) != inputDataRight.dimension(0) ), std::invalid_argument,
687 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
688 TEUCHOS_TEST_FOR_EXCEPTION( ( compEngine!=COMP_CPP && compEngine!=COMP_BLAS ), std::invalid_argument,
689 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Computational engine not defined!");
694 int numCells = inputDataLeft.dimension(0);
695 int numPoints = inputDataLeft.dimension(1);
696 int dim1Tensor = inputDataLeft.dimension(2);
697 int dim2Tensor = inputDataLeft.dimension(3);
701 for (
int cl = 0; cl < numCells; cl++) {
703 for (
int qp = 0; qp < numPoints; qp++) {
704 for (
int iTens1 = 0; iTens1 < dim1Tensor; iTens1++) {
705 for (
int iTens2 = 0; iTens2 < dim2Tensor; iTens2++) {
706 tmpVal += inputDataLeft(cl, qp, iTens1, iTens2)*inputDataRight(cl, qp, iTens1, iTens2);
710 outputData(cl) += tmpVal;
714 for (
int cl = 0; cl < numCells; cl++) {
716 for (
int qp = 0; qp < numPoints; qp++) {
717 for (
int iTens1 = 0; iTens1 < dim1Tensor; iTens1++) {
718 for (
int iTens2 = 0; iTens2 < dim2Tensor; iTens2++) {
719 tmpVal += inputDataLeft(cl, qp, iTens1, iTens2)*inputDataRight(cl, qp, iTens1, iTens2);
723 outputData(cl) = tmpVal;
732 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
734 #warning "The Intrepid package is deprecated"