49 #ifndef __INTREPID2_ARRAYTOOLS_DEF_CONTRACTIONS_HPP__ 50 #define __INTREPID2_ARRAYTOOLS_DEF_CONTRACTIONS_HPP__ 55 namespace FunctorArrayTools {
59 template <
typename outFieldViewType ,
typename leftFieldViewType ,
typename rightFieldViewType >
61 outFieldViewType _outputFields;
62 leftFieldViewType _leftFields;
63 rightFieldViewType _rightFields;
65 typedef typename outFieldViewType::value_type value_type;
67 KOKKOS_INLINE_FUNCTION
69 leftFieldViewType leftFields_,
70 rightFieldViewType rightFields_,
72 : _outputFields(outputFields_), _leftFields(leftFields_), _rightFields(rightFields_), _sumInto(sumInto_) {}
74 KOKKOS_INLINE_FUNCTION
75 void operator()(
const size_type iter)
const {
76 size_type cl, lbf, rbf;
77 unrollIndex( cl, lbf, rbf,
78 _outputFields.extent(0),
79 _outputFields.extent(1),
80 _outputFields.extent(2),
83 const size_type npts = _leftFields.extent(2);
84 const ordinal_type iend = _leftFields.extent(3);
85 const ordinal_type jend = _leftFields.extent(4);
88 for (size_type qp = 0; qp < npts; ++qp)
89 for (ordinal_type i = 0; i < iend; ++i)
90 for (ordinal_type j = 0; j < jend; ++j)
91 tmp += _leftFields(cl, lbf, qp, i, j)*_rightFields(cl, rbf, qp, i, j);
93 _outputFields( cl, lbf, rbf ) = _outputFields( cl, lbf, rbf ) + tmp;
95 _outputFields( cl, lbf, rbf ) = tmp;
100 template<
typename DeviceType>
101 template<
typename outputFieldValueType,
class ...outputFieldProperties,
102 typename leftFieldValueType,
class ...leftFieldProperties,
103 typename rightFieldValueType,
class ...rightFieldProperties>
106 contractFieldField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
107 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
108 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
109 const bool sumInto ) {
111 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outFieldViewType;
112 typedef Kokkos::DynRankView<leftFieldValueType,leftFieldProperties...> leftFieldViewType;
113 typedef Kokkos::DynRankView<rightFieldValueType,rightFieldProperties...> rightFieldViewType;
116 const size_type loopSize = leftFields.extent(0)*leftFields.extent(1)*rightFields.extent(1);
117 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
118 Kokkos::parallel_for( policy, FunctorType(outputFields, leftFields, rightFields, sumInto) );
122 namespace FunctorArrayTools {
126 template <
typename outputFieldsViewType ,
typename inputDataViewType ,
typename inputFieldsViewType >
128 outputFieldsViewType _outputFields;
129 inputDataViewType _inputData;
130 inputFieldsViewType _inputFields;
132 typedef typename outputFieldsViewType::value_type value_type;
134 KOKKOS_INLINE_FUNCTION
136 inputDataViewType inputData_,
137 inputFieldsViewType inputFields_,
139 : _outputFields(outputFields_), _inputData(inputData_), _inputFields(inputFields_), _sumInto(sumInto_) {}
141 KOKKOS_DEFAULTED_FUNCTION
144 KOKKOS_INLINE_FUNCTION
145 void operator()(
const size_type iter)
const {
148 _inputFields.extent(0),
149 _inputFields.extent(1),
152 auto result = Kokkos::subview( _outputFields, cl, bf );
154 const auto field = Kokkos::subview( _inputFields, cl, bf, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
155 const auto data = Kokkos::subview( _inputData, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
157 const size_type npts = field.extent(0);
158 const ordinal_type iend = field.extent(1);
159 const ordinal_type jend = field.extent(2);
163 if(_inputData.extent(1) != 1)
164 for (size_type qp = 0; qp < npts; ++qp)
165 for (ordinal_type i = 0; i < iend; ++i)
166 for (ordinal_type j = 0; j < jend; ++j)
167 tmp += field(qp, i, j) * data(qp, i, j);
169 for (size_type qp = 0; qp < npts; ++qp)
170 for (ordinal_type i = 0; i < iend; ++i)
171 for (ordinal_type j = 0; j < jend; ++j)
172 tmp += field(qp, i, j) * data(0, i, j);
175 result() = result() + tmp;
182 template<
typename DeviceType>
183 template<
typename outputFieldValueType,
class ...outputFieldProperties,
184 typename inputDataValueType,
class ...inputDataProperties,
185 typename inputFieldValueType,
class ...inputFieldProperties>
188 contractDataField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
189 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
190 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
191 const bool sumInto ) {
193 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFieldsViewType;
194 typedef Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputDataViewType;
195 typedef Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFieldsViewType;
198 const size_type loopSize = inputFields.extent(0)*inputFields.extent(1);
199 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
200 Kokkos::parallel_for( policy, FunctorType(outputFields, inputData, inputFields, sumInto) );
204 namespace FunctorArrayTools {
208 template <
typename outputDataViewType ,
typename inputDataLeftViewType ,
typename inputDataRightViewType >
210 outputDataViewType _outputData;
211 inputDataLeftViewType _inputDataLeft;
212 inputDataRightViewType _inputDataRight;
214 typedef typename outputDataViewType::value_type value_type;
216 KOKKOS_INLINE_FUNCTION
218 inputDataLeftViewType inputDataLeft_,
219 inputDataRightViewType inputDataRight_,
221 : _outputData(outputData_), _inputDataLeft(inputDataLeft_), _inputDataRight(inputDataRight_), _sumInto(sumInto_) {}
223 KOKKOS_DEFAULTED_FUNCTION
226 KOKKOS_INLINE_FUNCTION
227 void operator()(
const size_type iter)
const {
228 const size_type cl = iter;
230 auto result = Kokkos::subview( _outputData, cl );
231 const auto left = Kokkos::subview( _inputDataLeft, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
232 const auto right = Kokkos::subview( _inputDataRight, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
234 size_type npts = left.extent(0);
235 ordinal_type iend = left.extent(1);
236 ordinal_type jend = left.extent(2);
239 for (size_type qp = 0; qp < npts; ++qp)
240 for (ordinal_type i = 0; i < iend; ++i)
241 for (ordinal_type j = 0; j < jend; ++j)
242 tmp += left(qp, i, j)*right(qp, i, j);
245 result() = result() + tmp;
252 template<
typename DeviceType>
253 template<
typename outputDataValueType,
class ...outputDataProperties,
254 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
255 typename inputDataRightValueType,
class ...inputDataRightProperties>
258 contractDataData( Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputData,
259 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
260 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
261 const bool sumInto ) {
262 typedef Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputDataViewType;
263 typedef Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeftViewType;
264 typedef Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRightViewType;
267 const size_type loopSize = inputDataLeft.extent(0);
268 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
269 Kokkos::parallel_for( policy, FunctorType(outputData, inputDataLeft, inputDataRight, sumInto) );
274 template<
typename DeviceType>
275 template<
typename outputFieldValueType,
class ...outputFieldProperties,
276 typename leftFieldValueType,
class ...leftFieldProperties,
277 typename rightFieldValueType,
class ...rightFieldProperties>
281 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
282 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
283 const bool sumInto ) {
285 #ifdef HAVE_INTREPID2_DEBUG 287 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 3, std::invalid_argument,
288 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of the left input argument must equal 3!");
289 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 3, std::invalid_argument,
290 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of right input argument must equal 3!");
291 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
292 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of output argument must equal 3!");
293 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
294 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
295 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
296 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
297 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
298 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
299 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
300 ">>> ERROR (ArrayTools::contractFieldFieldScalar): First dimension of output container and first dimension of left input container must agree!");
301 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
302 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimension of output container and first dimension of right input container must agree!");
314 template<
typename DeviceType>
315 template<
typename outputFieldValueType,
class ...outputFieldProperties,
316 typename leftFieldValueType,
class ...leftFieldProperties,
317 typename rightFieldValueType,
class ...rightFieldProperties>
321 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
322 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
323 const bool sumInto ) {
325 #ifdef HAVE_INTREPID2_DEBUG 327 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 4, std::invalid_argument,
328 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of the left input argument must equal 4!");
329 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 4, std::invalid_argument,
330 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of right input argument must equal 4!");
331 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
332 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of output argument must equal 3!");
333 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
334 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
335 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
336 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
337 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
338 ">>> ERROR (ArrayTools::contractFieldFieldVector): Third dimensions (numbers of vector components) of the left and right input containers must agree!");
339 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
340 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
341 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
342 ">>> ERROR (ArrayTools::contractFieldFieldVector): First dimension of output container and first dimension of left input container must agree!");
343 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
344 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimension of output container and first dimension of right input container must agree!");
355 template<
typename DeviceType>
356 template<
typename outputFieldValueType,
class ...outputFieldProperties,
357 typename leftFieldValueType,
class ...leftFieldProperties,
358 typename rightFieldValueType,
class ...rightFieldProperties>
362 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
363 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
364 const bool sumInto ) {
366 #ifdef HAVE_INTREPID2_DEBUG 368 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 5, std::invalid_argument,
369 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of the left input argument must equal 5!");
370 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 5, std::invalid_argument,
371 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of right input argument must equal 5!");
372 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
373 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of output argument must equal 3!");
374 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
375 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
376 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
377 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
378 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
379 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Third dimensions (first tensor dimensions) of the left and right input containers must agree!");
380 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(4) != rightFields.extent(4), std::invalid_argument,
381 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Fourth dimensions (second tensor dimensions) of the left and right input containers must agree!");
382 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
383 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
384 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
385 ">>> ERROR (ArrayTools::contractFieldFieldTensor): First dimension of output container and first dimension of left input container must agree!");
386 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
387 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimension of output container and first dimension of right input container must agree!");
398 template<
typename DeviceType>
399 template<
typename outputFieldValueType,
class ...outputFieldProperties,
400 typename inputDataValueType,
class ...inputDataProperties,
401 typename inputFieldValueType,
class ...inputFieldProperties>
405 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
406 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
407 const bool sumInto ) {
409 #ifdef HAVE_INTREPID2_DEBUG 411 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 3, std::invalid_argument,
412 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the fields input argument must equal 3!");
413 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 2, std::invalid_argument,
414 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the data input argument must equal 2!");
415 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
416 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of output argument must equal 2!");
417 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
418 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
420 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
421 inputData.extent(1) != 1, std::invalid_argument,
422 ">>> 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!");
423 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
424 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
425 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
426 ">>> ERROR (ArrayTools::contractDataFieldScalar): First dimensions (number of fields) of the fields input and output containers must agree!");
437 template<
typename DeviceType>
438 template<
typename outputFieldValueType,
class ...outputFieldProperties,
439 typename inputDataValueType,
class ...inputDataProperties,
440 typename inputFieldValueType,
class ...inputFieldProperties>
444 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
445 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
446 const bool sumInto ) {
448 #ifdef HAVE_INTREPID2_DEBUG 450 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 4, std::invalid_argument,
451 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the fields input argument must equal 4!");
452 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 3, std::invalid_argument,
453 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the data input argument must equal 3!");
454 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
455 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of output argument must equal 2!");
456 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
457 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
458 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
459 inputData.extent(1) != 1, std::invalid_argument,
460 ">>> 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!");
461 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
462 ">>> ERROR (ArrayTools::contractDataFieldVector): Third dimension of the fields input container and second dimension of data input container (vector index) must agree!");
463 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
464 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
465 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
466 ">>> ERROR (ArrayTools::contractDataFieldVector): First dimensions of output container and fields input container (number of fields) must agree!");
478 template<
typename DeviceType>
479 template<
typename outputFieldValueType,
class ...outputFieldProperties,
480 typename inputDataValueType,
class ...inputDataProperties,
481 typename inputFieldValueType,
class ...inputFieldProperties>
485 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
486 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
487 const bool sumInto ) {
489 #ifdef HAVE_INTREPID2_DEBUG 491 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 5, std::invalid_argument,
492 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the fields input argument must equal 5!");
493 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 4, std::invalid_argument,
494 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the data input argument must equal 4!");
495 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
496 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of output argument must equal 2!");
497 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
498 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
499 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) && inputData.extent(1) != 1, std::invalid_argument,
500 ">>> 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!");
501 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
502 ">>> ERROR (ArrayTools::contractDataFieldTensor): Third dimension of the fields input container and second dimension of data input container (first tensor dimension) must agree!");
503 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(4) != inputData.extent(3), std::invalid_argument,
504 ">>> ERROR (ArrayTools::contractDataFieldTensor): Fourth dimension of the fields input container and third dimension of data input container (second tensor dimension) must agree!");
505 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
506 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
507 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
508 ">>> ERROR (ArrayTools::contractDataFieldTensor): First dimensions (number of fields) of output container and fields input container must agree!");
520 template<
typename DeviceType>
521 template<
typename outputDataValueType,
class ...outputDataProperties,
522 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
523 typename inputDataRightValueType,
class ...inputDataRightProperties>
527 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
528 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
529 const bool sumInto ) {
531 #ifdef HAVE_INTREPID2_DEBUG 533 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 2, std::invalid_argument,
534 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of the left input argument must equal 2!");
535 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 2, std::invalid_argument,
536 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of right input argument must equal 2!");
537 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
538 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of output argument must equal 1!");
539 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
540 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
541 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
542 ">>> ERROR (ArrayTools::contractDataDataScalar): First dimensions (numbers of integration points) of the left and right input containers must agree!");
543 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
544 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
555 template<
typename DeviceType>
556 template<
typename outputDataValueType,
class ...outputDataProperties,
557 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
558 typename inputDataRightValueType,
class ...inputDataRightProperties>
562 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
563 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
564 const bool sumInto ) {
566 #ifdef HAVE_INTREPID2_DEBUG 568 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 3, std::invalid_argument,
569 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of the left input argument must equal 3!");
570 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 3, std::invalid_argument,
571 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of right input argument must equal 3!");
572 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
573 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of output argument must equal 1!");
574 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
575 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
576 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
577 ">>> ERROR (ArrayTools::contractDataDataVector): First dimensions (numbers of integration points) of the left and right input containers must agree!");
578 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
579 ">>> ERROR (ArrayTools::contractDataDataVector): Second dimensions (numbers of vector components) of the left and right input containers must agree!");
580 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
581 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
592 template<
typename DeviceType>
593 template<
typename outputDataValueType,
class ...outputDataProperties,
594 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
595 typename inputDataRightValueType,
class ...inputDataRightProperties>
599 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
600 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
601 const bool sumInto ) {
603 #ifdef HAVE_INTREPID2_DEBUG 605 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 4, std::invalid_argument,
606 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of the left input argument must equal 4");
607 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 4, std::invalid_argument,
608 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of right input argument must equal 4!");
609 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
610 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of output argument must equal 1!");
611 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
612 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
613 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
614 ">>> ERROR (ArrayTools::contractDataDataTensor): First dimensions (numbers of integration points) of the left and right input containers must agree!");
615 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
616 ">>> ERROR (ArrayTools::contractDataDataTensor): Second dimensions (first tensor dimensions) of the left and right input containers must agree!");
617 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(3) != inputDataRight.extent(3), std::invalid_argument,
618 ">>> ERROR (ArrayTools::contractDataDataTensor): Third dimensions (second tensor dimensions) of the left and right input containers must agree!");
619 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
620 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");