16 #ifndef __INTREPID2_ARRAYTOOLS_DEF_CONTRACTIONS_HPP__
17 #define __INTREPID2_ARRAYTOOLS_DEF_CONTRACTIONS_HPP__
22 namespace FunctorArrayTools {
26 template <
typename outFieldViewType ,
typename leftFieldViewType ,
typename rightFieldViewType >
28 outFieldViewType _outputFields;
29 leftFieldViewType _leftFields;
30 rightFieldViewType _rightFields;
32 typedef typename outFieldViewType::value_type value_type;
34 KOKKOS_INLINE_FUNCTION
36 leftFieldViewType leftFields_,
37 rightFieldViewType rightFields_,
39 : _outputFields(outputFields_), _leftFields(leftFields_), _rightFields(rightFields_), _sumInto(sumInto_) {}
41 KOKKOS_INLINE_FUNCTION
42 void operator()(
const size_type iter)
const {
43 size_type cl, lbf, rbf;
44 unrollIndex( cl, lbf, rbf,
45 _outputFields.extent(0),
46 _outputFields.extent(1),
47 _outputFields.extent(2),
50 const size_type npts = _leftFields.extent(2);
51 const ordinal_type iend = _leftFields.extent(3);
52 const ordinal_type jend = _leftFields.extent(4);
54 _outputFields( cl, lbf, rbf ) *= (_sumInto ? 1 : 0);
55 for (size_type qp = 0; qp < npts; ++qp)
56 for (ordinal_type i = 0; i < iend; ++i)
57 for (ordinal_type j = 0; j < jend; ++j)
58 _outputFields( cl, lbf, rbf ) += _leftFields(cl, lbf, qp, i, j)*_rightFields(cl, rbf, qp, i, j);
63 template<
typename DeviceType>
64 template<
typename outputFieldValueType,
class ...outputFieldProperties,
65 typename leftFieldValueType,
class ...leftFieldProperties,
66 typename rightFieldValueType,
class ...rightFieldProperties>
69 contractFieldField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
70 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
71 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
72 const bool sumInto ) {
74 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outFieldViewType;
75 typedef Kokkos::DynRankView<leftFieldValueType,leftFieldProperties...> leftFieldViewType;
76 typedef Kokkos::DynRankView<rightFieldValueType,rightFieldProperties...> rightFieldViewType;
79 const size_type loopSize = leftFields.extent(0)*leftFields.extent(1)*rightFields.extent(1);
80 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
81 Kokkos::parallel_for( policy, FunctorType(outputFields, leftFields, rightFields, sumInto) );
85 namespace FunctorArrayTools {
89 template <
typename outputFieldsViewType ,
typename inputDataViewType ,
typename inputFieldsViewType >
91 outputFieldsViewType _outputFields;
92 inputDataViewType _inputData;
93 inputFieldsViewType _inputFields;
95 typedef typename outputFieldsViewType::value_type value_type;
97 KOKKOS_INLINE_FUNCTION
99 inputDataViewType inputData_,
100 inputFieldsViewType inputFields_,
102 : _outputFields(outputFields_), _inputData(inputData_), _inputFields(inputFields_), _sumInto(sumInto_) {}
104 KOKKOS_DEFAULTED_FUNCTION
105 ~F_contractDataField() =
default;
107 KOKKOS_INLINE_FUNCTION
108 void operator()(
const size_type iter)
const {
111 _inputFields.extent(0),
112 _inputFields.extent(1),
115 auto result = Kokkos::subview( _outputFields, cl, bf );
117 const auto field = Kokkos::subview( _inputFields, cl, bf, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
118 const auto data = Kokkos::subview( _inputData, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
120 const size_type npts = field.extent(0);
121 const ordinal_type iend = field.extent(1);
122 const ordinal_type jend = field.extent(2);
124 result() *= (_sumInto ? 1 : 0);
126 if(_inputData.extent(1) != 1)
127 for (size_type qp = 0; qp < npts; ++qp)
128 for (ordinal_type i = 0; i < iend; ++i)
129 for (ordinal_type j = 0; j < jend; ++j)
130 result() += field(qp, i, j) * data(qp, i, j);
132 for (size_type qp = 0; qp < npts; ++qp)
133 for (ordinal_type i = 0; i < iend; ++i)
134 for (ordinal_type j = 0; j < jend; ++j)
135 result() += field(qp, i, j) * data(0, i, j);
140 template<
typename DeviceType>
141 template<
typename outputFieldValueType,
class ...outputFieldProperties,
142 typename inputDataValueType,
class ...inputDataProperties,
143 typename inputFieldValueType,
class ...inputFieldProperties>
146 contractDataField( Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFields,
147 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
148 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
149 const bool sumInto ) {
151 typedef Kokkos::DynRankView<outputFieldValueType,outputFieldProperties...> outputFieldsViewType;
152 typedef Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputDataViewType;
153 typedef Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFieldsViewType;
156 const size_type loopSize = inputFields.extent(0)*inputFields.extent(1);
157 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
158 Kokkos::parallel_for( policy, FunctorType(outputFields, inputData, inputFields, sumInto) );
162 namespace FunctorArrayTools {
166 template <
typename outputDataViewType ,
typename inputDataLeftViewType ,
typename inputDataRightViewType >
168 outputDataViewType _outputData;
169 inputDataLeftViewType _inputDataLeft;
170 inputDataRightViewType _inputDataRight;
172 typedef typename outputDataViewType::value_type value_type;
174 KOKKOS_INLINE_FUNCTION
176 inputDataLeftViewType inputDataLeft_,
177 inputDataRightViewType inputDataRight_,
179 : _outputData(outputData_), _inputDataLeft(inputDataLeft_), _inputDataRight(inputDataRight_), _sumInto(sumInto_) {}
181 KOKKOS_DEFAULTED_FUNCTION
182 ~F_contractDataData() =
default;
184 KOKKOS_INLINE_FUNCTION
185 void operator()(
const size_type iter)
const {
186 const size_type cl = iter;
188 auto result = Kokkos::subview( _outputData, cl );
189 const auto left = Kokkos::subview( _inputDataLeft, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
190 const auto right = Kokkos::subview( _inputDataRight, cl, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL() );
192 size_type npts = left.extent(0);
193 ordinal_type iend = left.extent(1);
194 ordinal_type jend = left.extent(2);
196 result() *= (_sumInto ? 1 : 0);
197 for (size_type qp = 0; qp < npts; ++qp)
198 for (ordinal_type i = 0; i < iend; ++i)
199 for (ordinal_type j = 0; j < jend; ++j)
200 result() += left(qp, i, j)*right(qp, i, j);
205 template<
typename DeviceType>
206 template<
typename outputDataValueType,
class ...outputDataProperties,
207 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
208 typename inputDataRightValueType,
class ...inputDataRightProperties>
211 contractDataData( Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputData,
212 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
213 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
214 const bool sumInto ) {
215 typedef Kokkos::DynRankView<outputDataValueType, outputDataProperties...> outputDataViewType;
216 typedef Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeftViewType;
217 typedef Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRightViewType;
220 const size_type loopSize = inputDataLeft.extent(0);
221 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
222 Kokkos::parallel_for( policy, FunctorType(outputData, inputDataLeft, inputDataRight, sumInto) );
227 template<
typename DeviceType>
228 template<
typename outputFieldValueType,
class ...outputFieldProperties,
229 typename leftFieldValueType,
class ...leftFieldProperties,
230 typename rightFieldValueType,
class ...rightFieldProperties>
234 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
235 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
236 const bool sumInto ) {
238 #ifdef HAVE_INTREPID2_DEBUG
240 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 3, std::invalid_argument,
241 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of the left input argument must equal 3!");
242 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 3, std::invalid_argument,
243 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of right input argument must equal 3!");
244 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
245 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Rank of output argument must equal 3!");
246 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
247 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
248 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
249 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
250 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
251 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
252 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
253 ">>> ERROR (ArrayTools::contractFieldFieldScalar): First dimension of output container and first dimension of left input container must agree!");
254 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
255 ">>> ERROR (ArrayTools::contractFieldFieldScalar): Second dimension of output container and first dimension of right input container must agree!");
267 template<
typename DeviceType>
268 template<
typename outputFieldValueType,
class ...outputFieldProperties,
269 typename leftFieldValueType,
class ...leftFieldProperties,
270 typename rightFieldValueType,
class ...rightFieldProperties>
274 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
275 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
276 const bool sumInto ) {
278 #ifdef HAVE_INTREPID2_DEBUG
280 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 4, std::invalid_argument,
281 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of the left input argument must equal 4!");
282 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 4, std::invalid_argument,
283 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of right input argument must equal 4!");
284 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
285 ">>> ERROR (ArrayTools::contractFieldFieldVector): Rank of output argument must equal 3!");
286 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
287 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
288 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
289 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
290 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
291 ">>> ERROR (ArrayTools::contractFieldFieldVector): Third dimensions (numbers of vector components) of the left and right input containers must agree!");
292 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
293 ">>> ERROR (ArrayTools::contractFieldFieldVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
294 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
295 ">>> ERROR (ArrayTools::contractFieldFieldVector): First dimension of output container and first dimension of left input container must agree!");
296 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
297 ">>> ERROR (ArrayTools::contractFieldFieldVector): Second dimension of output container and first dimension of right input container must agree!");
308 template<
typename DeviceType>
309 template<
typename outputFieldValueType,
class ...outputFieldProperties,
310 typename leftFieldValueType,
class ...leftFieldProperties,
311 typename rightFieldValueType,
class ...rightFieldProperties>
315 const Kokkos::DynRankView<leftFieldValueType, leftFieldProperties...> leftFields,
316 const Kokkos::DynRankView<rightFieldValueType, rightFieldProperties...> rightFields,
317 const bool sumInto ) {
319 #ifdef HAVE_INTREPID2_DEBUG
321 INTREPID2_TEST_FOR_EXCEPTION( leftFields.rank() != 5, std::invalid_argument,
322 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of the left input argument must equal 5!");
323 INTREPID2_TEST_FOR_EXCEPTION( rightFields.rank() != 5, std::invalid_argument,
324 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of right input argument must equal 5!");
325 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 3, std::invalid_argument,
326 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Rank of output argument must equal 3!");
327 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(0) != rightFields.extent(0), std::invalid_argument,
328 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
329 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(2) != rightFields.extent(2), std::invalid_argument,
330 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimensions (numbers of integration points) of the left and right input containers must agree!");
331 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(3) != rightFields.extent(3), std::invalid_argument,
332 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Third dimensions (first tensor dimensions) of the left and right input containers must agree!");
333 INTREPID2_TEST_FOR_EXCEPTION( leftFields.extent(4) != rightFields.extent(4), std::invalid_argument,
334 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Fourth dimensions (second tensor dimensions) of the left and right input containers must agree!");
335 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != rightFields.extent(0), std::invalid_argument,
336 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
337 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != leftFields.extent(1), std::invalid_argument,
338 ">>> ERROR (ArrayTools::contractFieldFieldTensor): First dimension of output container and first dimension of left input container must agree!");
339 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(2) != rightFields.extent(1), std::invalid_argument,
340 ">>> ERROR (ArrayTools::contractFieldFieldTensor): Second dimension of output container and first dimension of right input container must agree!");
351 template<
typename DeviceType>
352 template<
typename outputFieldValueType,
class ...outputFieldProperties,
353 typename inputDataValueType,
class ...inputDataProperties,
354 typename inputFieldValueType,
class ...inputFieldProperties>
358 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
359 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
360 const bool sumInto ) {
362 #ifdef HAVE_INTREPID2_DEBUG
364 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 3, std::invalid_argument,
365 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the fields input argument must equal 3!");
366 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 2, std::invalid_argument,
367 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of the data input argument must equal 2!");
368 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
369 ">>> ERROR (ArrayTools::contractDataFieldScalar): Rank of output argument must equal 2!");
370 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
371 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
373 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
374 inputData.extent(1) != 1, std::invalid_argument,
375 ">>> 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!");
376 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
377 ">>> ERROR (ArrayTools::contractDataFieldScalar): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
378 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
379 ">>> ERROR (ArrayTools::contractDataFieldScalar): First dimensions (number of fields) of the fields input and output containers must agree!");
390 template<
typename DeviceType>
391 template<
typename outputFieldValueType,
class ...outputFieldProperties,
392 typename inputDataValueType,
class ...inputDataProperties,
393 typename inputFieldValueType,
class ...inputFieldProperties>
397 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
398 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
399 const bool sumInto ) {
401 #ifdef HAVE_INTREPID2_DEBUG
403 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 4, std::invalid_argument,
404 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the fields input argument must equal 4!");
405 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 3, std::invalid_argument,
406 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of the data input argument must equal 3!");
407 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
408 ">>> ERROR (ArrayTools::contractDataFieldVector): Rank of output argument must equal 2!");
409 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
410 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
411 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) &&
412 inputData.extent(1) != 1, std::invalid_argument,
413 ">>> 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!");
414 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
415 ">>> ERROR (ArrayTools::contractDataFieldVector): Third dimension of the fields input container and second dimension of data input container (vector index) must agree!");
416 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
417 ">>> ERROR (ArrayTools::contractDataFieldVector): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
418 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
419 ">>> ERROR (ArrayTools::contractDataFieldVector): First dimensions of output container and fields input container (number of fields) must agree!");
431 template<
typename DeviceType>
432 template<
typename outputFieldValueType,
class ...outputFieldProperties,
433 typename inputDataValueType,
class ...inputDataProperties,
434 typename inputFieldValueType,
class ...inputFieldProperties>
438 const Kokkos::DynRankView<inputDataValueType, inputDataProperties...> inputData,
439 const Kokkos::DynRankView<inputFieldValueType, inputFieldProperties...> inputFields,
440 const bool sumInto ) {
442 #ifdef HAVE_INTREPID2_DEBUG
444 INTREPID2_TEST_FOR_EXCEPTION( inputFields.rank() != 5, std::invalid_argument,
445 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the fields input argument must equal 5!");
446 INTREPID2_TEST_FOR_EXCEPTION( inputData.rank() != 4, std::invalid_argument,
447 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of the data input argument must equal 4!");
448 INTREPID2_TEST_FOR_EXCEPTION( outputFields.rank() != 2, std::invalid_argument,
449 ">>> ERROR (ArrayTools::contractDataFieldTensor): Rank of output argument must equal 2!");
450 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(0) != inputData.extent(0), std::invalid_argument,
451 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (number of integration domains) of the fields and data input containers must agree!");
452 INTREPID2_TEST_FOR_EXCEPTION( inputData.extent(1) != inputFields.extent(2) && inputData.extent(1) != 1, std::invalid_argument,
453 ">>> 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!");
454 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(3) != inputData.extent(2), std::invalid_argument,
455 ">>> ERROR (ArrayTools::contractDataFieldTensor): Third dimension of the fields input container and second dimension of data input container (first tensor dimension) must agree!");
456 INTREPID2_TEST_FOR_EXCEPTION( inputFields.extent(4) != inputData.extent(3), std::invalid_argument,
457 ">>> ERROR (ArrayTools::contractDataFieldTensor): Fourth dimension of the fields input container and third dimension of data input container (second tensor dimension) must agree!");
458 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(0) != inputFields.extent(0), std::invalid_argument,
459 ">>> ERROR (ArrayTools::contractDataFieldTensor): Zeroth dimensions (numbers of integration domains) of the fields input and output containers must agree!");
460 INTREPID2_TEST_FOR_EXCEPTION( outputFields.extent(1) != inputFields.extent(1), std::invalid_argument,
461 ">>> ERROR (ArrayTools::contractDataFieldTensor): First dimensions (number of fields) of output container and fields input container must agree!");
473 template<
typename DeviceType>
474 template<
typename outputDataValueType,
class ...outputDataProperties,
475 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
476 typename inputDataRightValueType,
class ...inputDataRightProperties>
480 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
481 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
482 const bool sumInto ) {
484 #ifdef HAVE_INTREPID2_DEBUG
486 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 2, std::invalid_argument,
487 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of the left input argument must equal 2!");
488 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 2, std::invalid_argument,
489 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of right input argument must equal 2!");
490 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
491 ">>> ERROR (ArrayTools::contractDataDataScalar): Rank of output argument must equal 1!");
492 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
493 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
494 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
495 ">>> ERROR (ArrayTools::contractDataDataScalar): First dimensions (numbers of integration points) of the left and right input containers must agree!");
496 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
497 ">>> ERROR (ArrayTools::contractDataDataScalar): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
508 template<
typename DeviceType>
509 template<
typename outputDataValueType,
class ...outputDataProperties,
510 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
511 typename inputDataRightValueType,
class ...inputDataRightProperties>
515 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
516 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
517 const bool sumInto ) {
519 #ifdef HAVE_INTREPID2_DEBUG
521 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 3, std::invalid_argument,
522 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of the left input argument must equal 3!");
523 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 3, std::invalid_argument,
524 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of right input argument must equal 3!");
525 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
526 ">>> ERROR (ArrayTools::contractDataDataVector): Rank of output argument must equal 1!");
527 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
528 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
529 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
530 ">>> ERROR (ArrayTools::contractDataDataVector): First dimensions (numbers of integration points) of the left and right input containers must agree!");
531 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
532 ">>> ERROR (ArrayTools::contractDataDataVector): Second dimensions (numbers of vector components) of the left and right input containers must agree!");
533 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
534 ">>> ERROR (ArrayTools::contractDataDataVector): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");
545 template<
typename DeviceType>
546 template<
typename outputDataValueType,
class ...outputDataProperties,
547 typename inputDataLeftValueType,
class ...inputDataLeftProperties,
548 typename inputDataRightValueType,
class ...inputDataRightProperties>
552 const Kokkos::DynRankView<inputDataLeftValueType, inputDataLeftProperties...> inputDataLeft,
553 const Kokkos::DynRankView<inputDataRightValueType,inputDataRightProperties...> inputDataRight,
554 const bool sumInto ) {
556 #ifdef HAVE_INTREPID2_DEBUG
558 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.rank() != 4, std::invalid_argument,
559 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of the left input argument must equal 4");
560 INTREPID2_TEST_FOR_EXCEPTION( inputDataRight.rank() != 4, std::invalid_argument,
561 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of right input argument must equal 4!");
562 INTREPID2_TEST_FOR_EXCEPTION( outputData.rank() != 1, std::invalid_argument,
563 ">>> ERROR (ArrayTools::contractDataDataTensor): Rank of output argument must equal 1!");
564 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(0) != inputDataRight.extent(0), std::invalid_argument,
565 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (number of integration domains) of the left and right input containers must agree!");
566 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(1) != inputDataRight.extent(1), std::invalid_argument,
567 ">>> ERROR (ArrayTools::contractDataDataTensor): First dimensions (numbers of integration points) of the left and right input containers must agree!");
568 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(2) != inputDataRight.extent(2), std::invalid_argument,
569 ">>> ERROR (ArrayTools::contractDataDataTensor): Second dimensions (first tensor dimensions) of the left and right input containers must agree!");
570 INTREPID2_TEST_FOR_EXCEPTION( inputDataLeft.extent(3) != inputDataRight.extent(3), std::invalid_argument,
571 ">>> ERROR (ArrayTools::contractDataDataTensor): Third dimensions (second tensor dimensions) of the left and right input containers must agree!");
572 INTREPID2_TEST_FOR_EXCEPTION( outputData.extent(0) != inputDataRight.extent(0), std::invalid_argument,
573 ">>> ERROR (ArrayTools::contractDataDataTensor): Zeroth dimensions (numbers of integration domains) of the input and output containers must agree!");