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);
87 _outputFields( cl, lbf, rbf ) *= (_sumInto ? 1 : 0);
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 _outputFields( cl, lbf, rbf ) += _leftFields(cl, lbf, qp, i, j)*_rightFields(cl, rbf, qp, i, j);
96 template<
typename DeviceType>
97 template<
typename outputFieldValueType,
class ...outputFieldProperties,
98 typename leftFieldValueType,
class ...leftFieldProperties,
99 typename rightFieldValueType,
class ...rightFieldProperties>
102 contractFieldField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
103 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
104 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
105 const bool sumInto ) {
107 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outFieldViewType;
108 typedef Kokkos::DynRankView<leftFieldValueType,leftFieldProperties...> leftFieldViewType;
109 typedef Kokkos::DynRankView<rightFieldValueType,rightFieldProperties...> rightFieldViewType;
112 const size_type loopSize = leftFields.extent(0)*leftFields.extent(1)*rightFields.extent(1);
113 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
114 Kokkos::parallel_for( policy, FunctorType(outputFields, leftFields, rightFields, sumInto) );
118 namespace FunctorArrayTools {
122 template <
typename outputFieldsViewType ,
typename inputDataViewType ,
typename inputFieldsViewType >
124 outputFieldsViewType _outputFields;
125 inputDataViewType _inputData;
126 inputFieldsViewType _inputFields;
128 typedef typename outputFieldsViewType::value_type value_type;
130 KOKKOS_INLINE_FUNCTION
132 inputDataViewType inputData_,
133 inputFieldsViewType inputFields_,
135 : _outputFields(outputFields_), _inputData(inputData_), _inputFields(inputFields_), _sumInto(sumInto_) {}
137 KOKKOS_DEFAULTED_FUNCTION
138 ~F_contractDataField() =
default;
140 KOKKOS_INLINE_FUNCTION
141 void operator()(
const size_type iter)
const {
144 _inputFields.extent(0),
145 _inputFields.extent(1),
148 auto result = Kokkos::subview( _outputFields, cl, bf );
150 const auto field = Kokkos::subview( _inputFields, cl, bf, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
151 const auto data = Kokkos::subview( _inputData, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
153 const size_type npts = field.extent(0);
154 const ordinal_type iend = field.extent(1);
155 const ordinal_type jend = field.extent(2);
157 result() *= (_sumInto ? 1 : 0);
159 if(_inputData.extent(1) != 1)
160 for (size_type qp = 0; qp < npts; ++qp)
161 for (ordinal_type i = 0; i < iend; ++i)
162 for (ordinal_type j = 0; j < jend; ++j)
163 result() += field(qp, i, j) * data(qp, i, j);
165 for (size_type qp = 0; qp < npts; ++qp)
166 for (ordinal_type i = 0; i < iend; ++i)
167 for (ordinal_type j = 0; j < jend; ++j)
168 result() += field(qp, i, j) * data(0, i, j);
173 template<
typename DeviceType>
174 template<
typename outputFieldValueType,
class ...outputFieldProperties,
175 typename inputDataValueType,
class ...inputDataProperties,
176 typename inputFieldValueType,
class ...inputFieldProperties>
179 contractDataField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
180 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
181 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
182 const bool sumInto ) {
184 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFieldsViewType;
185 typedef Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputDataViewType;
186 typedef Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFieldsViewType;
189 const size_type loopSize = inputFields.extent(0)*inputFields.extent(1);
190 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
191 Kokkos::parallel_for( policy, FunctorType(outputFields, inputData, inputFields, sumInto) );
195 namespace FunctorArrayTools {
199 template <
typename outputDataViewType ,
typename inputDataLeftViewType ,
typename inputDataRightViewType >
201 outputDataViewType _outputData;
202 inputDataLeftViewType _inputDataLeft;
203 inputDataRightViewType _inputDataRight;
205 typedef typename outputDataViewType::value_type value_type;
207 KOKKOS_INLINE_FUNCTION
209 inputDataLeftViewType inputDataLeft_,
210 inputDataRightViewType inputDataRight_,
212 : _outputData(outputData_), _inputDataLeft(inputDataLeft_), _inputDataRight(inputDataRight_), _sumInto(sumInto_) {}
214 KOKKOS_DEFAULTED_FUNCTION
215 ~F_contractDataData() =
default;
217 KOKKOS_INLINE_FUNCTION
218 void operator()(
const size_type iter)
const {
219 const size_type cl = iter;
221 auto result = Kokkos::subview( _outputData, cl );
222 const auto left = Kokkos::subview( _inputDataLeft, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
223 const auto right = Kokkos::subview( _inputDataRight, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
225 size_type npts = left.extent(0);
226 ordinal_type iend = left.extent(1);
227 ordinal_type jend = left.extent(2);
229 result() *= (_sumInto ? 1 : 0);
230 for (size_type qp = 0; qp < npts; ++qp)
231 for (ordinal_type i = 0; i < iend; ++i)
232 for (ordinal_type j = 0; j < jend; ++j)
233 result() += left(qp, i, j)*right(qp, i, j);
238 template<
typename DeviceType>
239 template<
typename outputDataValueType,
class ...outputDataProperties,
240 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
241 typename inputDataRightValueType,
class ...inputDataRightProperties>
244 contractDataData( Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputData,
245 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
246 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
247 const bool sumInto ) {
248 typedef Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputDataViewType;
249 typedef Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeftViewType;
250 typedef Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRightViewType;
253 const size_type loopSize = inputDataLeft.extent(0);
254 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
255 Kokkos::parallel_for( policy, FunctorType(outputData, inputDataLeft, inputDataRight, sumInto) );
260 template<
typename DeviceType>
261 template<
typename outputFieldValueType,
class ...outputFieldProperties,
262 typename leftFieldValueType,
class ...leftFieldProperties,
263 typename rightFieldValueType,
class ...rightFieldProperties>
267 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
268 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
269 const bool sumInto ) {
271 #ifdef HAVE_INTREPID2_DEBUG
273 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 3, std::invalid_argument,
274 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of the left input argument must equal 3!");
275 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 3, std::invalid_argument,
276 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of right input argument must equal 3!");
277 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
278 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of output argument must equal 3!");
279 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
280 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
281 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
282 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
283 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
284 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
285 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
286 ">>> ERROR (ArrayTools::contractFieldFieldScalar): First dimension of output container and first dimension of left input container must agree!");
287 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
288 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimension of output container and first dimension of right input container must agree!");
300 template<
typename DeviceType>
301 template<
typename outputFieldValueType,
class ...outputFieldProperties,
302 typename leftFieldValueType,
class ...leftFieldProperties,
303 typename rightFieldValueType,
class ...rightFieldProperties>
307 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
308 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
309 const bool sumInto ) {
311 #ifdef HAVE_INTREPID2_DEBUG
313 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 4, std::invalid_argument,
314 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of the left input argument must equal 4!");
315 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 4, std::invalid_argument,
316 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of right input argument must equal 4!");
317 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
318 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of output argument must equal 3!");
319 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
320 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
321 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
322 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
323 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
324 ">>> ERROR (ArrayTools::contractFieldFieldVector): Third dimensions (numbers of vector components) of the left and right input containers must agree!");
325 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
326 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
327 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
328 ">>> ERROR (ArrayTools::contractFieldFieldVector): First dimension of output container and first dimension of left input container must agree!");
329 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
330 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimension of output container and first dimension of right input container must agree!");
341 template<
typename DeviceType>
342 template<
typename outputFieldValueType,
class ...outputFieldProperties,
343 typename leftFieldValueType,
class ...leftFieldProperties,
344 typename rightFieldValueType,
class ...rightFieldProperties>
348 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
349 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
350 const bool sumInto ) {
352 #ifdef HAVE_INTREPID2_DEBUG
354 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 5, std::invalid_argument,
355 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of the left input argument must equal 5!");
356 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 5, std::invalid_argument,
357 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of right input argument must equal 5!");
358 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
359 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of output argument must equal 3!");
360 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
361 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
362 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
363 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
364 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
365 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Third dimensions (first tensor dimensions) of the left and right input containers must agree!");
366 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(4) != rightFields.extent(4), std::invalid_argument,
367 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Fourth dimensions (second tensor dimensions) of the left and right input containers must agree!");
368 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
369 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
370 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
371 ">>> ERROR (ArrayTools::contractFieldFieldTensor): First dimension of output container and first dimension of left input container must agree!");
372 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
373 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimension of output container and first dimension of right input container must agree!");
384 template<
typename DeviceType>
385 template<
typename outputFieldValueType,
class ...outputFieldProperties,
386 typename inputDataValueType,
class ...inputDataProperties,
387 typename inputFieldValueType,
class ...inputFieldProperties>
391 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
392 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
393 const bool sumInto ) {
395 #ifdef HAVE_INTREPID2_DEBUG
397 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 3, std::invalid_argument,
398 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the fields input argument must equal 3!");
399 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 2, std::invalid_argument,
400 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the data input argument must equal 2!");
401 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
402 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of output argument must equal 2!");
403 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
404 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
406 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
407 inputData.extent(1) != 1, std::invalid_argument,
408 ">>> 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!");
409 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
410 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
411 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
412 ">>> ERROR (ArrayTools::contractDataFieldScalar): First dimensions (number of fields) of the fields input and output containers must agree!");
423 template<
typename DeviceType>
424 template<
typename outputFieldValueType,
class ...outputFieldProperties,
425 typename inputDataValueType,
class ...inputDataProperties,
426 typename inputFieldValueType,
class ...inputFieldProperties>
430 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
431 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
432 const bool sumInto ) {
434 #ifdef HAVE_INTREPID2_DEBUG
436 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 4, std::invalid_argument,
437 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the fields input argument must equal 4!");
438 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 3, std::invalid_argument,
439 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the data input argument must equal 3!");
440 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
441 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of output argument must equal 2!");
442 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
443 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
444 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
445 inputData.extent(1) != 1, std::invalid_argument,
446 ">>> 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!");
447 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
448 ">>> ERROR (ArrayTools::contractDataFieldVector): Third dimension of the fields input container and second dimension of data input container (vector index) must agree!");
449 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
450 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
451 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
452 ">>> ERROR (ArrayTools::contractDataFieldVector): First dimensions of output container and fields input container (number of fields) must agree!");
464 template<
typename DeviceType>
465 template<
typename outputFieldValueType,
class ...outputFieldProperties,
466 typename inputDataValueType,
class ...inputDataProperties,
467 typename inputFieldValueType,
class ...inputFieldProperties>
471 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
472 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
473 const bool sumInto ) {
475 #ifdef HAVE_INTREPID2_DEBUG
477 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 5, std::invalid_argument,
478 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the fields input argument must equal 5!");
479 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 4, std::invalid_argument,
480 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the data input argument must equal 4!");
481 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
482 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of output argument must equal 2!");
483 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
484 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
485 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) && inputData.extent(1) != 1, std::invalid_argument,
486 ">>> 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!");
487 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
488 ">>> ERROR (ArrayTools::contractDataFieldTensor): Third dimension of the fields input container and second dimension of data input container (first tensor dimension) must agree!");
489 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(4) != inputData.extent(3), std::invalid_argument,
490 ">>> ERROR (ArrayTools::contractDataFieldTensor): Fourth dimension of the fields input container and third dimension of data input container (second tensor dimension) must agree!");
491 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
492 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
493 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
494 ">>> ERROR (ArrayTools::contractDataFieldTensor): First dimensions (number of fields) of output container and fields input container must agree!");
506 template<
typename DeviceType>
507 template<
typename outputDataValueType,
class ...outputDataProperties,
508 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
509 typename inputDataRightValueType,
class ...inputDataRightProperties>
513 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
514 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
515 const bool sumInto ) {
517 #ifdef HAVE_INTREPID2_DEBUG
519 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 2, std::invalid_argument,
520 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of the left input argument must equal 2!");
521 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 2, std::invalid_argument,
522 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of right input argument must equal 2!");
523 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
524 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of output argument must equal 1!");
525 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
526 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
527 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
528 ">>> ERROR (ArrayTools::contractDataDataScalar): First dimensions (numbers of integration points) of the left and right input containers must agree!");
529 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
530 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
541 template<
typename DeviceType>
542 template<
typename outputDataValueType,
class ...outputDataProperties,
543 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
544 typename inputDataRightValueType,
class ...inputDataRightProperties>
548 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
549 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
550 const bool sumInto ) {
552 #ifdef HAVE_INTREPID2_DEBUG
554 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 3, std::invalid_argument,
555 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of the left input argument must equal 3!");
556 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 3, std::invalid_argument,
557 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of right input argument must equal 3!");
558 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
559 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of output argument must equal 1!");
560 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
561 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
562 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
563 ">>> ERROR (ArrayTools::contractDataDataVector): First dimensions (numbers of integration points) of the left and right input containers must agree!");
564 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
565 ">>> ERROR (ArrayTools::contractDataDataVector): Second dimensions (numbers of vector components) of the left and right input containers must agree!");
566 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
567 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
578 template<
typename DeviceType>
579 template<
typename outputDataValueType,
class ...outputDataProperties,
580 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
581 typename inputDataRightValueType,
class ...inputDataRightProperties>
585 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
586 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
587 const bool sumInto ) {
589 #ifdef HAVE_INTREPID2_DEBUG
591 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 4, std::invalid_argument,
592 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of the left input argument must equal 4");
593 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 4, std::invalid_argument,
594 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of right input argument must equal 4!");
595 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
596 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of output argument must equal 1!");
597 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
598 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
599 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
600 ">>> ERROR (ArrayTools::contractDataDataTensor): First dimensions (numbers of integration points) of the left and right input containers must agree!");
601 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
602 ">>> ERROR (ArrayTools::contractDataDataTensor): Second dimensions (first tensor dimensions) of the left and right input containers must agree!");
603 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(3) != inputDataRight.extent(3), std::invalid_argument,
604 ">>> ERROR (ArrayTools::contractDataDataTensor): Third dimensions (second tensor dimensions) of the left and right input containers must agree!");
605 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
606 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");