51 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
54 const ArrayTypeCoeffs &coeffs ,
55 const Array<RCP<ArrayTypeBasis> > &bases )
57 const unsigned space_dim = bases.size();
59 #ifdef HAVE_INTREPID_DEBUG
60 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
61 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
63 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.rank() != 3 , std::invalid_argument ,
64 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 3 array." );
66 for (
unsigned d=0;d<space_dim;d++)
68 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->rank() != 2 , std::invalid_argument ,
69 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
72 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != coeffs.dimension(0) , std::invalid_argument,
73 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
75 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != coeffs.dimension(1) , std::invalid_argument,
76 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of fields for vals and coeffs must match." );
78 int product_of_basis_dimensions = 1;
79 int product_of_basis_points = 1;
80 for (
unsigned d=0;d<space_dim;d++)
82 product_of_basis_dimensions *= bases[d]->dimension(0);
83 product_of_basis_points *= bases[d]->dimension(1);
86 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_points , std::invalid_argument,
87 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
89 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
90 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in coeffs and bases ." );
97 evaluate2D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases );
100 evaluate3D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases );
106 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
107 class ArrayTypeBasis>
109 const ArrayTypeCoeffs &coeffs ,
110 const Array<RCP<ArrayTypeBasis> > &bases )
112 const unsigned space_dim = bases.size();
114 #ifdef HAVE_INTREPID_DEBUG
115 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
116 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): vals must be rank 3 array." );
118 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.rank() != 3 , std::invalid_argument ,
119 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): coeffs must be rank 3 array." );
121 for (
unsigned d=0;d<space_dim;d++)
123 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->rank() != 2 , std::invalid_argument ,
124 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): each tabulated basis must be rank 2 array." );
127 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != coeffs.dimension(0) , std::invalid_argument,
128 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): Number of cells for vals and coeffs must match." );
130 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != coeffs.dimension(1) , std::invalid_argument,
131 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): Number of fields for vals and coeffs must match." );
133 int product_of_basis_dimensions = 1;
134 int product_of_basis_points = 1;
135 for (
unsigned d=0;d<space_dim;d++)
137 product_of_basis_dimensions *= bases[d]->dimension(0);
138 product_of_basis_points *= bases[d]->dimension(1);
141 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_points , std::invalid_argument,
142 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): Incompatible number of points in vals and bases ." );
144 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
145 ">>> ERROR (TensorProductSpaceTools::evaluateCollocated): Incompatible number of basis functions in coeffs and bases ." );
152 evaluateCollocated2D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases );
155 evaluateCollocated3D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases );
222 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
223 class ArrayTypeBasis>
225 const ArrayTypeCoeffs &coeffs ,
226 const Array<RCP<ArrayTypeBasis> > &bases ,
227 const Array<RCP<ArrayTypeBasis> > &Dbases )
229 const unsigned space_dim = bases.size();
231 #ifdef HAVE_INTREPID_DEBUG
232 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 4 , std::invalid_argument ,
233 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
235 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.rank() != 3 , std::invalid_argument ,
236 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 3 array." );
238 TEUCHOS_TEST_FOR_EXCEPTION( Dbases.size() != (int)space_dim , std::invalid_argument ,
239 ">>> ERROR (TensorProductSpaceTools::evaluate): bases and Dbases must be same size." );
241 for (
unsigned d=0;d<space_dim;d++)
243 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->rank() != 2 , std::invalid_argument ,
244 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
246 TEUCHOS_TEST_FOR_EXCEPTION( Dbases[d]->rank() != 3 , std::invalid_argument ,
247 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 3 array." );
250 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != coeffs.dimension(0) , std::invalid_argument,
251 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
253 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != coeffs.dimension(1) , std::invalid_argument,
254 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of fields for vals and coeffs must match." );
256 int product_of_basis_dimensions = 1;
257 int product_of_basis_points = 1;
258 for (
unsigned d=0;d<space_dim;d++)
260 product_of_basis_dimensions *= bases[d]->dimension(0);
261 product_of_basis_points *= bases[d]->dimension(1);
264 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_points , std::invalid_argument,
265 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
267 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
268 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in coeffs and bases ." );
270 for (
unsigned d=0;d<space_dim;d++)
272 for (
unsigned i=0;i<2;i++)
274 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->dimension(i) != Dbases[d]->dimension(i) , std::invalid_argument ,
275 ">>>ERROR (TensorProductSpaceTools::evaluate): bases and Dbases have incompatible shape." );
283 TensorProductSpaceTools::evaluateGradient2D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases , Dbases );
286 TensorProductSpaceTools::evaluateGradient3D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases , Dbases );
292 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
293 class ArrayTypeBasis>
295 const ArrayTypeCoeffs &coeffs ,
296 const Array<RCP<ArrayTypeBasis> > &bases ,
297 const Array<RCP<ArrayTypeBasis> > &Dbases )
299 const unsigned space_dim = bases.size();
301 #ifdef HAVE_INTREPID_DEBUG
302 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 4 , std::invalid_argument ,
303 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
305 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.rank() != 3 , std::invalid_argument ,
306 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 3 array." );
308 TEUCHOS_TEST_FOR_EXCEPTION( Dbases.size() != (int)space_dim , std::invalid_argument ,
309 ">>> ERROR (TensorProductSpaceTools::evaluate): bases and Dbases must be same size." );
311 for (
unsigned d=0;d<space_dim;d++)
313 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->rank() != 2 , std::invalid_argument ,
314 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
316 TEUCHOS_TEST_FOR_EXCEPTION( Dbases[d]->rank() != 3 , std::invalid_argument ,
317 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 3 array." );
320 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != coeffs.dimension(0) , std::invalid_argument,
321 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
323 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != coeffs.dimension(1) , std::invalid_argument,
324 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of fields for vals and coeffs must match." );
326 int product_of_basis_dimensions = 1;
327 int product_of_basis_points = 1;
328 for (
unsigned d=0;d<space_dim;d++)
330 product_of_basis_dimensions *= bases[d]->dimension(0);
331 product_of_basis_points *= bases[d]->dimension(1);
334 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_points , std::invalid_argument,
335 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
337 TEUCHOS_TEST_FOR_EXCEPTION( coeffs.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
338 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in coeffs and bases ." );
340 for (
unsigned d=0;d<space_dim;d++)
342 for (
unsigned i=0;i<2;i++)
344 TEUCHOS_TEST_FOR_EXCEPTION( bases[d]->dimension(i) != Dbases[d]->dimension(i) , std::invalid_argument ,
345 ">>>ERROR (TensorProductSpaceTools::evaluate): bases and Dbases have incompatible shape." );
353 evaluateGradientCollocated2D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases , Dbases );
356 evaluateGradientCollocated3D<Scalar,ArrayTypeOut,ArrayTypeCoeffs,ArrayTypeBasis>( vals , coeffs , bases , Dbases );
362 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
363 class ArrayTypeBasis,
class ArrayTypeWeights>
365 const ArrayTypeData &data ,
366 const Array<RCP<ArrayTypeBasis> > &basisVals ,
367 const Array<RCP<ArrayTypeWeights> > &wts )
369 const unsigned space_dim = basisVals.size();
371 #ifdef HAVE_INTREPID_DEBUG
372 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
373 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
375 TEUCHOS_TEST_FOR_EXCEPTION( data.rank() != 3 , std::invalid_argument ,
376 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 3 array." );
378 TEUCHOS_TEST_FOR_EXCEPTION( basisVals.size() != (int)space_dim , std::invalid_argument ,
379 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
381 TEUCHOS_TEST_FOR_EXCEPTION( wts.size() != (int)space_dim , std::invalid_argument ,
382 ">>> ERROR (TensorProductSpaceTools::evaluate): quadrature weights ill-sized." );
384 for (
unsigned d=0;d<space_dim;d++)
386 TEUCHOS_TEST_FOR_EXCEPTION( basisVals[d]->rank() != 2 , std::invalid_argument ,
387 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
389 TEUCHOS_TEST_FOR_EXCEPTION( wts[d]->rank() != 1 , std::invalid_argument ,
390 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 2 array." );
393 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != data.dimension(0) , std::invalid_argument,
394 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
396 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != data.dimension(1) , std::invalid_argument,
397 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of fields for vals and coeffs must match." );
399 int product_of_basis_dimensions = 1;
400 int product_of_basis_points = 1;
401 for (
unsigned d=0;d<space_dim;d++)
403 product_of_basis_dimensions *= basisVals[d]->dimension(0);
404 product_of_basis_points *= basisVals[d]->dimension(1);
407 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
408 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
410 TEUCHOS_TEST_FOR_EXCEPTION( data.dimension(2) != product_of_basis_points , std::invalid_argument,
411 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in data and bases ." );
418 moments2D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , wts );
421 moments3D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , wts );
427 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
428 class ArrayTypeBasis,
class ArrayTypeWeights>
430 const ArrayTypeData &data ,
431 const Array<RCP<ArrayTypeBasis> > &basisVals ,
432 const Array<RCP<ArrayTypeWeights> > &wts )
434 const unsigned space_dim = basisVals.size();
436 #ifdef HAVE_INTREPID_DEBUG
437 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
438 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
440 TEUCHOS_TEST_FOR_EXCEPTION( data.rank() != 3 , std::invalid_argument ,
441 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 3 array." );
443 TEUCHOS_TEST_FOR_EXCEPTION( basisVals.size() != (int)space_dim , std::invalid_argument ,
444 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
446 TEUCHOS_TEST_FOR_EXCEPTION( wts.size() != (int)space_dim , std::invalid_argument ,
447 ">>> ERROR (TensorProductSpaceTools::evaluate): quadrature weights ill-sized." );
449 for (
unsigned d=0;d<space_dim;d++)
451 TEUCHOS_TEST_FOR_EXCEPTION( basisVals[d]->rank() != 2 , std::invalid_argument ,
452 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
454 TEUCHOS_TEST_FOR_EXCEPTION( wts[d]->rank() != 1 , std::invalid_argument ,
455 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 2 array." );
458 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != data.dimension(0) , std::invalid_argument,
459 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
461 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(1) != data.dimension(1) , std::invalid_argument,
462 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of fields for vals and coeffs must match." );
464 int product_of_basis_dimensions = 1;
465 int product_of_basis_points = 1;
466 for (
unsigned d=0;d<space_dim;d++)
468 product_of_basis_dimensions *= basisVals[d]->dimension(0);
469 product_of_basis_points *= basisVals[d]->dimension(1);
472 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
473 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
475 TEUCHOS_TEST_FOR_EXCEPTION( data.dimension(2) != product_of_basis_points , std::invalid_argument,
476 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in data and bases ." );
483 moments2D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , wts );
486 moments3D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , wts );
492 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
493 class ArrayTypeBasis,
class ArrayTypeWeights>
495 const ArrayTypeData &data ,
496 const Array<RCP<ArrayTypeBasis> > &basisVals ,
497 const Array<RCP<ArrayTypeBasis> > &basisDVals ,
498 const Array<RCP<ArrayTypeWeights> > &wts )
500 const unsigned space_dim = basisVals.size();
502 #ifdef HAVE_INTREPID_DEBUG
503 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
504 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
506 TEUCHOS_TEST_FOR_EXCEPTION( data.rank() != 4 , std::invalid_argument ,
507 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 4 array." );
509 TEUCHOS_TEST_FOR_EXCEPTION( basisVals.size() != (int)space_dim , std::invalid_argument ,
510 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
512 TEUCHOS_TEST_FOR_EXCEPTION( basisDVals.size() != (int)space_dim , std::invalid_argument ,
513 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
515 TEUCHOS_TEST_FOR_EXCEPTION( wts.size() != (int)space_dim , std::invalid_argument ,
516 ">>> ERROR (TensorProductSpaceTools::evaluate): quadrature weights ill-sized." );
518 for (
unsigned d=0;d<space_dim;d++)
520 TEUCHOS_TEST_FOR_EXCEPTION( basisVals[d]->rank() != 2 , std::invalid_argument ,
521 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
523 TEUCHOS_TEST_FOR_EXCEPTION( basisDVals[d]->rank() != 3 , std::invalid_argument ,
524 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated derivative basis must be rank 3 array." );
526 TEUCHOS_TEST_FOR_EXCEPTION( wts[d]->rank() != 1 , std::invalid_argument ,
527 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 2 array." );
530 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != data.dimension(0) , std::invalid_argument,
531 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
533 int product_of_basis_dimensions = 1;
534 int product_of_basis_points = 1;
535 for (
unsigned d=0;d<space_dim;d++)
537 product_of_basis_dimensions *= basisVals[d]->dimension(0);
538 product_of_basis_points *= basisVals[d]->dimension(1);
541 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
542 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
544 TEUCHOS_TEST_FOR_EXCEPTION( data.dimension(2) != product_of_basis_points , std::invalid_argument,
545 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in data and bases ." );
552 momentsGrad2D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , basisDVals , wts );
555 momentsGrad3D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , basisDVals , wts );
561 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
562 class ArrayTypeBasis,
class ArrayTypeWeights>
564 const ArrayTypeData &data ,
565 const Array<RCP<ArrayTypeBasis> > &basisVals ,
566 const Array<RCP<ArrayTypeBasis> > &basisDVals ,
567 const Array<RCP<ArrayTypeWeights> > &wts )
569 const unsigned space_dim = basisVals.size();
571 #ifdef HAVE_INTREPID_DEBUG
572 TEUCHOS_TEST_FOR_EXCEPTION( vals.rank() != 3 , std::invalid_argument ,
573 ">>> ERROR (TensorProductSpaceTools::evaluate): vals must be rank 3 array." );
575 TEUCHOS_TEST_FOR_EXCEPTION( data.rank() != 4 , std::invalid_argument ,
576 ">>> ERROR (TensorProductSpaceTools::evaluate): coeffs must be rank 4 array." );
578 TEUCHOS_TEST_FOR_EXCEPTION( basisVals.size() != (int)space_dim , std::invalid_argument ,
579 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
581 TEUCHOS_TEST_FOR_EXCEPTION( basisDVals.size() != (int)space_dim , std::invalid_argument ,
582 ">>> ERROR (TensorProductSpaceTools::evaluate): bases ill-sized." );
584 TEUCHOS_TEST_FOR_EXCEPTION( wts.size() != (int)space_dim , std::invalid_argument ,
585 ">>> ERROR (TensorProductSpaceTools::evaluate): quadrature weights ill-sized." );
587 for (
unsigned d=0;d<space_dim;d++)
589 TEUCHOS_TEST_FOR_EXCEPTION( basisVals[d]->rank() != 2 , std::invalid_argument ,
590 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated basis must be rank 2 array." );
592 TEUCHOS_TEST_FOR_EXCEPTION( basisDVals[d]->rank() != 3 , std::invalid_argument ,
593 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated derivative basis must be rank 3 array." );
595 TEUCHOS_TEST_FOR_EXCEPTION( wts[d]->rank() != 1 , std::invalid_argument ,
596 ">>> ERROR (TensorProductSpaceTools::evaluate): each tabulated Dbasis must be rank 2 array." );
599 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(0) != data.dimension(0) , std::invalid_argument,
600 ">>> ERROR (TensorProductSpaceTools::evaluate): Number of cells for vals and coeffs must match." );
602 int product_of_basis_dimensions = 1;
603 int product_of_basis_points = 1;
604 for (
unsigned d=0;d<space_dim;d++)
606 product_of_basis_dimensions *= basisVals[d]->dimension(0);
607 product_of_basis_points *= basisVals[d]->dimension(1);
610 TEUCHOS_TEST_FOR_EXCEPTION( vals.dimension(2) != product_of_basis_dimensions , std::invalid_argument,
611 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of points in vals and bases ." );
613 TEUCHOS_TEST_FOR_EXCEPTION( data.dimension(2) != product_of_basis_points , std::invalid_argument,
614 ">>> ERROR (TensorProductSpaceTools::evaluate): Incompatible number of basis functions in data and bases ." );
621 momentsGradCollocated2D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , basisDVals , wts );
624 momentsGradCollocated3D<Scalar, ArrayTypeOut, ArrayTypeData, ArrayTypeBasis, ArrayTypeWeights>( vals , data , basisVals , basisDVals , wts );
631 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
632 class ArrayTypeBasis>
633 void TensorProductSpaceTools::evaluate2D( ArrayTypeOut &vals ,
634 const ArrayTypeCoeffs &coeffs ,
635 const Array<RCP<ArrayTypeBasis> > &bases )
637 const int numBfx = bases[0]->dimension(0);
638 const int numBfy = bases[1]->dimension(0);
640 const int numPtsx = bases[0]->dimension(1);
641 const int numPtsy = bases[1]->dimension(1);
643 const int numCells = vals.dimension(0);
644 const int numFields = vals.dimension(1);
646 const ArrayTypeBasis &Phix = *bases[0];
647 const ArrayTypeBasis &Phiy = *bases[1];
653 for (
int f=0;f<numFields;f++)
655 for (
int cell=0;cell<numCells;cell++)
657 for (
int j=0;j<numBfy;j++)
659 for (
int i=0;i<numBfx;i++)
661 const int I = j * numBfx + i;
662 for (
int k=0;k<numPtsx;k++)
664 Xi(cell,j,k) += coeffs(cell,f,I) * Phix(i,k);
670 for (
int cell=0;cell<numCells;cell++)
672 for (
int kpty=0;kpty<numPtsy;kpty++)
674 for (
int kptx=0;kptx<numPtsx;kptx++)
676 vals(cell,f,kptx+numPtsx*kpty) = 0.0;
681 for (
int kpty=0;kpty<numPtsy;kpty++)
683 for (
int kptx=0;kptx<numPtsx;kptx++)
685 const int I=kptx+numPtsx*kpty;
687 for (
int j=0;j<numBfy;j++)
689 vals(cell,f,I) += Phiy(j,kpty) * Xi(cell,j,kptx);
699 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
700 class ArrayTypeBasis>
701 void TensorProductSpaceTools::evaluateCollocated2D( ArrayTypeOut &vals ,
702 const ArrayTypeCoeffs &coeffs ,
703 const Array<RCP<ArrayTypeBasis> > &bases )
707 const int numBfx = bases[0]->dimension(0);
708 const int numBfy = bases[1]->dimension(0);
710 const int numCells = vals.dimension(0);
711 const int numFields = vals.dimension(1);
713 for (
int cell=0;cell<numCells;cell++)
715 for (
int f=0;f<numFields;f++)
717 for (
int j=0;j<numBfy;j++)
719 for (
int i=0;i<numBfx;i++)
721 const int I = j * numBfx + i;
722 vals(cell,f,I) = coeffs(cell,f,I);
762 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
763 class ArrayTypeBasis>
764 void TensorProductSpaceTools::evaluate3D( ArrayTypeOut &vals ,
765 const ArrayTypeCoeffs &coeffs ,
766 const Array<RCP<ArrayTypeBasis> > &bases )
773 const int numBfx = bases[0]->dimension(0);
774 const int numBfy = bases[1]->dimension(0);
775 const int numBfz = bases[2]->dimension(0);
777 const int numPtsx = bases[0]->dimension(1);
778 const int numPtsy = bases[1]->dimension(1);
779 const int numPtsz = bases[2]->dimension(1);
781 const int numCells = vals.dimension(0);
782 const int numFields = vals.dimension(1);
784 const ArrayTypeBasis &Phix = *bases[0];
785 const ArrayTypeBasis &Phiy = *bases[1];
786 const FieldContainer<double> &Phiz = *bases[2];
788 FieldContainer<double> Xi(numCells,
789 numBfz, numBfy , numPtsx);
791 FieldContainer<double> Theta(numCells,
792 numBfz , numPtsy, numPtsx );
795 for (
int f=0;f<numFields;f++)
799 for (
int c=0;c<numCells;c++)
801 for (
int k=0;k<numBfz;k++)
803 for (
int j=0;j<numBfy;j++)
805 for (
int l=0;l<numPtsx;l++)
807 for (
int i=0;i<numBfx;i++)
809 const int coeffIndex = k*numBfy*numBfx + j * numBfx + i;
810 Xi(c,k,j,l) += Phix(i,l) * coeffs(c,f,coeffIndex);
818 for (
int c=0;c<numCells;c++)
820 for (
int k=0;k<numBfz;k++)
822 for (
int m=0;m<numPtsy;m++)
824 for (
int l=0;l<numPtsx;l++)
826 for (
int j=0;j<numBfy;j++)
828 Theta(c,k,m,l) += Phiy(j,m) * Xi(c,k,j,l);
836 for (
int c=0;c<numCells;c++)
838 for (
int n=0;n<numPtsz;n++)
840 for (
int m=0;m<numPtsy;m++)
842 for (
int l=0;l<numPtsx;l++)
844 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l) = 0.0;
845 for (
int k=0;k<numBfz;k++)
847 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l) += Theta(c,k,m,l) * Phiz(k,n);
859 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
860 class ArrayTypeBasis>
861 void TensorProductSpaceTools::evaluateCollocated3D( ArrayTypeOut &vals ,
862 const ArrayTypeCoeffs &coeffs ,
863 const Array<RCP<ArrayTypeBasis> > &bases )
868 const int numBfx = bases[0]->dimension(0);
869 const int numBfy = bases[1]->dimension(0);
870 const int numBfz = bases[2]->dimension(0);
872 const int numCells = vals.dimension(0);
873 const int numFields = vals.dimension(1);
875 for (
int cell=0;cell<numCells;cell++)
877 for (
int field=0;field<numFields;field++)
879 for (
int k=0;k<numBfz;k++)
881 for (
int j=0;j<numBfy;j++)
883 for (
int i=0;i<numBfx;i++)
885 const int I = k*numBfy*numBfx + j * numBfx + i;
886 vals(cell,field,I) = coeffs(cell,field,I);
898 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
899 class ArrayTypeBasis>
900 void TensorProductSpaceTools::evaluateGradient2D( ArrayTypeOut &vals ,
901 const ArrayTypeCoeffs &coeffs ,
902 const Array<RCP<ArrayTypeBasis> > &bases ,
903 const Array<RCP<ArrayTypeBasis> > &Dbases )
906 const int numBfx = bases[0]->dimension(0);
907 const int numBfy = bases[1]->dimension(0);
908 const int numPtsx = bases[0]->dimension(1);
909 const int numPtsy = bases[1]->dimension(1);
910 const int numCells = vals.dimension(0);
911 const int numFields = vals.dimension(1);
912 const ArrayTypeBasis &Phix = *bases[0];
913 const ArrayTypeBasis &Phiy = *bases[1];
914 const ArrayTypeBasis &DPhix = *Dbases[0];
915 const ArrayTypeBasis &DPhiy = *Dbases[1];
917 FieldContainer<double> Xi(numBfy,numPtsx);
919 for (
int f=0;f<numFields;f++)
922 for (
int cell=0;cell<numCells;cell++)
927 for (
int j=0;j<numBfy;j++)
929 for (
int k=0;k<numPtsx;k++)
935 for (
int j=0;j<numBfy;j++)
937 for (
int i=0;i<numBfx;i++)
939 const int I = j * numBfx + i;
940 for (
int k=0;k<numPtsx;k++)
942 Xi(j,k) += coeffs(cell,f,I) * DPhix(i,k,0);
947 for (
int kpty=0;kpty<numPtsy;kpty++)
949 for (
int kptx=0;kptx<numPtsx;kptx++)
951 vals(cell,f,kptx+numPtsx*kpty,0) = 0.0;
956 for (
int kpty=0;kpty<numPtsy;kpty++)
958 for (
int kptx=0;kptx<numPtsx;kptx++)
960 const int I=kptx+numPtsx*kpty;
962 for (
int j=0;j<numBfy;j++)
964 vals(cell,f,I,0) += Phiy(j,kpty) * Xi(j,kptx);
972 for (
int j=0;j<numBfy;j++)
974 for (
int k=0;k<numPtsx;k++)
980 for (
int j=0;j<numBfy;j++)
982 for (
int i=0;i<numBfx;i++)
984 const int I = j * numBfx + i;
985 for (
int k=0;k<numPtsx;k++)
987 Xi(j,k) += coeffs(cell,f,I) * Phix(i,k);
992 for (
int kpty=0;kpty<numPtsy;kpty++)
994 for (
int kptx=0;kptx<numPtsx;kptx++)
996 vals(cell,f,kptx+numPtsx*kpty,1) = 0.0;
1001 for (
int kpty=0;kpty<numPtsy;kpty++)
1003 for (
int kptx=0;kptx<numPtsx;kptx++)
1005 const int I=kptx+numPtsx*kpty;
1007 for (
int j=0;j<numBfy;j++)
1009 vals(cell,f,I,1) += DPhiy(j,kpty,0) * Xi(j,kptx);
1018 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
1019 class ArrayTypeBasis>
1020 void TensorProductSpaceTools::evaluateGradientCollocated2D( ArrayTypeOut &vals ,
1021 const ArrayTypeCoeffs &coeffs ,
1022 const Array<RCP<ArrayTypeBasis> > &bases ,
1023 const Array<RCP<ArrayTypeBasis> > &Dbases )
1026 const int numBfx = bases[0]->dimension(0);
1027 const int numBfy = bases[1]->dimension(0);
1028 const int numPtsx = bases[0]->dimension(1);
1029 const int numPtsy = bases[1]->dimension(1);
1030 const int numCells = vals.dimension(0);
1031 const int numFields = vals.dimension(1);
1032 const ArrayTypeBasis &DPhix = *Dbases[0];
1033 const ArrayTypeBasis &DPhiy = *Dbases[1];
1035 for (
int cell=0;cell<numCells;cell++)
1037 for (
int field=0;field<numFields;field++)
1039 for (
int j=0;j<numPtsy;j++)
1041 for (
int i=0;i<numPtsx;i++)
1043 const int I = j * numPtsx + i;
1044 vals(cell,field,I,0) = 0.0;
1045 vals(cell,field,I,1) = 0.0;
1052 for (
int cell=0;cell<numCells;cell++)
1054 for (
int field=0;field<numFields;field++)
1056 for (
int j=0;j<numPtsy;j++)
1058 for (
int i=0;i<numPtsx;i++)
1060 const int I = j * numPtsx + i;
1061 for (
int ell=0;ell<numBfx;ell++)
1063 const int Itmp = j*numPtsx + ell;
1064 vals(cell,field,I,0) += coeffs(cell,field,Itmp) * DPhix( ell , i );
1072 for (
int cell=0;cell<numCells;cell++)
1074 for (
int field=0;field<numFields;field++)
1076 for (
int j=0;j<numPtsy;j++)
1078 for (
int i=0;i<numPtsx;i++)
1080 const int I = j * numPtsx + i;
1081 for (
int m=0;m<numBfy;m++)
1083 const int Itmp = m*numPtsx + i;
1084 vals(cell,field,I,1) += coeffs(cell,field,Itmp) * DPhiy( m , j );
1093 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
1094 class ArrayTypeBasis>
1095 void TensorProductSpaceTools::evaluateGradient3D( ArrayTypeOut &vals ,
1096 const ArrayTypeCoeffs &coeffs ,
1097 const Array<RCP<ArrayTypeBasis> > &bases ,
1098 const Array<RCP<ArrayTypeBasis> > &Dbases )
1105 const int numBfx = bases[0]->dimension(0);
1106 const int numBfy = bases[1]->dimension(0);
1107 const int numBfz = bases[2]->dimension(0);
1108 const int numPtsx = bases[0]->dimension(1);
1109 const int numPtsy = bases[1]->dimension(1);
1110 const int numPtsz = bases[2]->dimension(1);
1111 const int numCells = vals.dimension(0);
1112 const int numFields = vals.dimension(1);
1113 const ArrayTypeBasis &Phix = *bases[0];
1114 const ArrayTypeBasis &Phiy = *bases[1];
1115 const ArrayTypeBasis &Phiz = *bases[2];
1116 const ArrayTypeBasis &DPhix = *Dbases[0];
1117 const ArrayTypeBasis &DPhiy = *Dbases[1];
1118 const ArrayTypeBasis &DPhiz = *Dbases[2];
1120 FieldContainer<double> Xi(numCells,
1121 numBfz, numBfy , numPtsx , 3) ;
1123 FieldContainer<double> Theta(numCells,
1124 numBfz , numPtsy, numPtsx , 3);
1126 for (
int f=0;f<numFields;f++)
1130 for (
int c=0;c<numCells;c++)
1132 for (
int k=0;k<numBfz;k++)
1134 for (
int j=0;j<numBfy;j++)
1136 for (
int l=0;l<numPtsx;l++)
1138 for (
int i=0;i<numBfx;i++)
1140 const int coeffIndex = k*numBfz*numBfx + j * numBfx + i;
1141 Xi(c,k,j,l,0) += DPhix(i,l,0) * coeffs(c,f,coeffIndex);
1142 Xi(c,k,j,l,1) += Phix(i,l) * coeffs(c,f,coeffIndex);
1143 Xi(c,k,j,l,2) += Phix(i,l) * coeffs(c,f,coeffIndex);
1151 for (
int c=0;c<numCells;c++)
1153 for (
int k=0;k<numBfz;k++)
1155 for (
int m=0;m<numPtsy;m++)
1157 for (
int l=0;l<numPtsx;l++)
1159 for (
int j=0;j<numBfy;j++)
1161 Theta(c,k,m,l,0) += Phiy(j,m) * Xi(c,k,j,l,0);
1162 Theta(c,k,m,l,1) += DPhiy(j,m,0) * Xi(c,k,j,l,1);
1163 Theta(c,k,m,l,2) += Phiy(j,m) * Xi(c,k,j,l,2);
1171 for (
int c=0;c<numCells;c++)
1173 for (
int n=0;n<numPtsz;n++)
1175 for (
int m=0;m<numPtsy;m++)
1177 for (
int l=0;l<numPtsx;l++)
1179 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,0) = 0.0;
1180 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,1) = 0.0;
1181 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,2) = 0.0;
1182 for (
int k=0;k<numBfz;k++)
1184 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,0) += Theta(c,k,m,l,0) * Phiz(k,n);
1185 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,1) += Theta(c,k,m,l,1) * Phiz(k,n);
1186 vals(c,f,n*numPtsx*numPtsy+m*numPtsx+l,2) += Theta(c,k,m,l,2) * DPhiz(k,n,0);
1197 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeCoeffs,
1198 class ArrayTypeBasis>
1199 void TensorProductSpaceTools::evaluateGradientCollocated3D( ArrayTypeOut &vals ,
1200 const ArrayTypeCoeffs &coeffs ,
1201 const Array<RCP<ArrayTypeBasis> > &bases ,
1202 const Array<RCP<ArrayTypeBasis> > &Dbases )
1205 const int numBfx = bases[0]->dimension(0);
1206 const int numBfy = bases[1]->dimension(0);
1207 const int numBfz = bases[2]->dimension(0);
1208 const int numPtsx = bases[0]->dimension(1);
1209 const int numPtsy = bases[1]->dimension(1);
1210 const int numPtsz = bases[2]->dimension(1);
1211 const int numCells = vals.dimension(0);
1212 const int numFields = vals.dimension(1);
1213 const ArrayTypeBasis &Phix = *bases[0];
1214 const ArrayTypeBasis &Phiy = *bases[1];
1215 const ArrayTypeBasis &Phiz = *bases[2];
1216 const ArrayTypeBasis &DPhix = *Dbases[0];
1217 const ArrayTypeBasis &DPhiy = *Dbases[1];
1218 const ArrayTypeBasis &DPhiz = *Dbases[2];
1220 for (
int cell=0;cell<numCells;cell++)
1222 for (
int field=0;field<numFields;field++)
1224 for (
int k=0;k<numPtsz;k++)
1226 for (
int j=0;j<numPtsy;j++)
1228 for (
int i=0;i<numPtsx;i++)
1230 const int I = k * numPtsx * numPtsy + j * numPtsx + i;
1231 vals(cell,field,I,0) = 0.0;
1232 vals(cell,field,I,1) = 0.0;
1233 vals(cell,field,I,2) = 0.0;
1241 for (
int cell=0;cell<numCells;cell++)
1243 for (
int field=0;field<numFields;field++)
1245 for (
int k=0;k<numPtsz;k++)
1247 for (
int j=0;j<numPtsy;j++)
1249 for (
int i=0;i<numPtsx;i++)
1251 const int I = k * numPtsx * numPtsy + j * numPtsx + i;
1252 for (
int ell=0;ell<numBfx;ell++)
1254 const int Itmp = k * numPtsx * numPtsy + j*numPtsx + ell;
1255 vals(cell,field,I,0) += coeffs(cell,field,Itmp) * DPhix( ell , i );
1264 for (
int cell=0;cell<numCells;cell++)
1266 for (
int field=0;field<numFields;field++)
1268 for (
int k=0;k<numPtsz;k++)
1270 for (
int j=0;j<numPtsy;j++)
1272 for (
int i=0;i<numPtsx;i++)
1274 const int I = k * numPtsx * numPtsy + j * numPtsx + i;
1275 for (
int m=0;m<numBfy;m++)
1277 const int Itmp = k * numPtsx * numPtsy + m * numPtsx + i;
1278 vals(cell,field,I,1) += coeffs(cell,field,Itmp) * DPhiy( m , j );
1288 for (
int cell=0;cell<numCells;cell++)
1290 for (
int field=0;field<numFields;field++)
1292 for (
int k=0;k<numPtsz;k++)
1294 for (
int j=0;j<numPtsy;j++)
1296 for (
int i=0;i<numPtsx;i++)
1298 const int I = k * numPtsx * numPtsy + j * numPtsx + i;
1299 for (
int n=0;n<numBfz;n++)
1301 const int Itmp = n * numPtsx * numPtsy + j * numPtsx + i;
1302 vals(cell,field,I,2) += coeffs(cell,field,Itmp) * DPhiz( n , k );
1315 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1316 class ArrayTypeBasis,
class ArrayTypeWeights>
1317 void TensorProductSpaceTools::moments2D( ArrayTypeOut &vals ,
1318 const ArrayTypeData &data ,
1319 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1320 const Array<RCP<ArrayTypeWeights> > &wts )
1322 const int numBfx = basisVals[0]->dimension(0);
1323 const int numBfy = basisVals[1]->dimension(0);
1324 const int numPtsx = basisVals[0]->dimension(1);
1325 const int numPtsy = basisVals[1]->dimension(1);
1326 const int numCells = vals.dimension(0);
1327 const int numFields = vals.dimension(1);
1328 const ArrayTypeBasis &Phix = *basisVals[0];
1329 const ArrayTypeBasis &Phiy = *basisVals[1];
1331 FieldContainer<double> Xi(numBfx,numPtsy);
1333 const ArrayTypeWeights &wtsx = *wts[0];
1334 const ArrayTypeWeights &wtsy = *wts[1];
1336 for (
int f=0;f<numFields;f++)
1338 for (
int cell=0;cell<numCells;cell++)
1341 for (
int i=0;i<numBfx;i++)
1343 for (
int k=0;k<numPtsy;k++)
1349 for (
int i=0;i<numBfx;i++)
1351 for (
int l=0;l<numPtsy;l++)
1353 for (
int k=0;k<numPtsx;k++)
1355 Xi(i,l) += wtsx(k) * data(cell,f,l*numPtsx+k) * Phix(i,k);
1360 for (
int j=0;j<numBfy;j++)
1362 for (
int i=0;i<numBfx;i++)
1364 vals(cell,f,j*numBfx+i) = 0.0;
1369 for (
int j=0;j<numBfy;j++)
1371 for (
int i=0;i<numBfx;i++)
1373 for (
int l=0;l<numPtsy;l++)
1375 vals(cell,f,j*numBfx+i) += wtsy(l) * Phiy(j,l) * Xi(i,l);
1385 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1386 class ArrayTypeBasis,
class ArrayTypeWeights>
1387 void TensorProductSpaceTools::momentsCollocated2D( ArrayTypeOut &vals ,
1388 const ArrayTypeData &data ,
1389 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1390 const Array<RCP<ArrayTypeWeights> > &wts )
1392 const int numBfx = basisVals[0]->dimension(0);
1393 const int numBfy = basisVals[1]->dimension(0);
1394 const int numPtsy = basisVals[1]->dimension(1);
1395 const int numCells = vals.dimension(0);
1396 const int numFields = vals.dimension(1);
1398 FieldContainer<double> Xi(numBfx,numPtsy);
1400 const ArrayTypeWeights &wtsx = *wts[0];
1401 const ArrayTypeWeights &wtsy = *wts[1];
1403 for (
int cell=0;cell<numCells;cell++)
1405 for (
int field=0;field<numFields;field++)
1407 for (
int i=0;i<numBfx;i++)
1409 for (
int j=0;j<numBfy;j++)
1411 const int I = numBfy * i + j;
1412 vals(cell,field,I) = wtsx(i) * wtsy(j) * data(cell,field,I);
1422 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1423 class ArrayTypeBasis,
class ArrayTypeWeights>
1424 void TensorProductSpaceTools::moments3D( ArrayTypeOut &vals ,
1425 const ArrayTypeData &data ,
1426 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1427 const Array<RCP<ArrayTypeWeights> > &wts )
1429 const int numBfx = basisVals[0]->dimension(0);
1430 const int numBfy = basisVals[1]->dimension(0);
1431 const int numBfz = basisVals[2]->dimension(0);
1433 const int numPtsx = basisVals[0]->dimension(1);
1434 const int numPtsy = basisVals[1]->dimension(1);
1435 const int numPtsz = basisVals[2]->dimension(1);
1437 const int numCells = vals.dimension(0);
1438 const int numFields = vals.dimension(1);
1440 const ArrayTypeBasis &Phix = *basisVals[0];
1441 const ArrayTypeBasis &Phiy = *basisVals[1];
1442 const ArrayTypeBasis &Phiz = *basisVals[2];
1444 const ArrayTypeWeights &Wtx = *wts[0];
1445 const ArrayTypeWeights &Wty = *wts[1];
1446 const ArrayTypeWeights &Wtz = *wts[2];
1448 FieldContainer<double> Xi(numCells,numBfx,numPtsz,numPtsy);
1449 FieldContainer<double> Theta(numCells,numBfy,numBfx,numPtsz);
1451 for (
int f=0;f<numFields;f++)
1454 for (
int c=0;c<numCells;c++)
1456 for (
int i=0;i<numBfx;i++)
1458 for (
int n=0;n<numPtsz;n++)
1460 for (
int m=0;m<numPtsy;m++)
1462 for (
int l=0;l<numPtsx;l++)
1464 Xi(c,i,n,m) += Wtx(l) * Phix(i,l) * data(c,f,n*numPtsy*numPtsx+m*numPtsx+l);
1472 for (
int c=0;c<numCells;c++)
1474 for (
int j=0;j<numBfy;j++)
1476 for (
int i=0;i<numBfx;i++)
1478 for (
int n=0;n<numPtsz;n++)
1480 for (
int m=0;m<numPtsy;m++)
1482 Theta(c,j,i,n) += Wty(m) * Phiy(j,m) * Xi(c,i,n,m);
1490 for (
int c=0;c<numCells;c++)
1492 for (
int k=0;k<numBfz;k++)
1494 for (
int j=0;j<numBfy;j++)
1496 for (
int i=0;i<numBfx;i++)
1498 const int momIdx = k*numBfx*numBfy+j*numBfx+i;
1499 for (
int n=0;n<numPtsz;n++)
1501 vals(c,f,momIdx) += Wtz(n) * Phiz(k,n) * Theta(c,j,i,n);
1513 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1514 class ArrayTypeBasis,
class ArrayTypeWeights>
1515 void TensorProductSpaceTools::momentsCollocated3D( ArrayTypeOut &vals ,
1516 const ArrayTypeData &data ,
1517 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1518 const Array<RCP<ArrayTypeWeights> > &wts )
1520 const int numBfx = basisVals[0]->dimension(0);
1521 const int numBfy = basisVals[1]->dimension(0);
1522 const int numBfz = basisVals[2]->dimension(0);
1524 const int numCells = vals.dimension(0);
1525 const int numFields = vals.dimension(1);
1527 const ArrayTypeWeights &Wtx = *wts[0];
1528 const ArrayTypeWeights &Wty = *wts[1];
1529 const ArrayTypeWeights &Wtz = *wts[2];
1531 for (
int cell=0;cell<numCells;cell++)
1533 for (
int field=0;field<numFields;field++)
1535 for (
int k=0;k<numBfz;k++)
1537 for (
int j=0;j<numBfy;j++)
1539 for (
int i=0;i<numBfx;i++)
1541 const int I = k * numBfy * numBfx + j * numBfx + i;
1542 vals(cell,field,I) = Wtx(i) * Wty(j) * Wtz(k) * data(cell,field,I);
1557 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1558 class ArrayTypeBasis,
class ArrayTypeWeights>
1559 void TensorProductSpaceTools::momentsGrad2D( ArrayTypeOut &vals ,
1560 const ArrayTypeData &data ,
1561 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1562 const Array<RCP<ArrayTypeBasis> > &Dbases ,
1563 const Array<RCP<ArrayTypeWeights> > &wts )
1566 const int numBfx = basisVals[0]->dimension(0);
1567 const int numBfy = basisVals[1]->dimension(0);
1568 const int numPtsx = basisVals[0]->dimension(1);
1569 const int numPtsy = basisVals[1]->dimension(1);
1570 const int numCells = vals.dimension(0);
1571 const int numFields = vals.dimension(1);
1572 const ArrayTypeBasis &Phix = *basisVals[0];
1573 const ArrayTypeBasis &Phiy = *basisVals[1];
1574 const ArrayTypeBasis &DPhix = *Dbases[0];
1575 const ArrayTypeBasis &DPhiy = *Dbases[1];
1576 const ArrayTypeWeights &wtsx = *wts[0];
1577 const ArrayTypeWeights &wtsy = *wts[1];
1579 FieldContainer<double> Xi(numBfx,numPtsy,2);
1581 for (
int f=0;f<numFields;f++)
1584 for (
int c=0;c<numCells;c++)
1586 for (
int i=0;i<numBfx;i++)
1588 for (
int m=0;m<numPtsy;m++)
1590 for (
int l=0;l<numPtsx;l++)
1592 Xi(i,m,0) += wtsx(l) * data(c,f,m*numPtsy+l,0) * DPhix(i,l);
1593 Xi(i,m,1) += wtsx(l) * data(c,f,m*numPtsy+l,1) * Phix(i,l);
1600 for (
int c=0;c<numCells;c++)
1602 for (
int j=0;j<numBfy;j++)
1604 for (
int i=0;i<numBfx;i++)
1606 const int bfIdx = j*numBfx+i;
1607 vals(c,f,bfIdx) = 0.0;
1608 for (
int m=0;m<numPtsy;m++)
1610 vals(c,f,bfIdx) += wtsy(m) * Xi(i,m,0) * Phiy(j,m);
1611 vals(c,f,bfIdx) += wtsy(m) * Xi(i,m,1) * DPhiy(j,m);
1621 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1622 class ArrayTypeBasis,
class ArrayTypeWeights>
1623 void TensorProductSpaceTools::momentsGradCollocated2D( ArrayTypeOut &vals ,
1624 const ArrayTypeData &data ,
1625 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1626 const Array<RCP<ArrayTypeBasis> > &Dbases ,
1627 const Array<RCP<ArrayTypeWeights> > &wts )
1630 const int numBfx = basisVals[0]->dimension(0);
1631 const int numBfy = basisVals[1]->dimension(0);
1632 const int numPtsx = basisVals[0]->dimension(1);
1633 const int numPtsy = basisVals[1]->dimension(1);
1634 const int numCells = vals.dimension(0);
1635 const int numFields = vals.dimension(1);
1636 const ArrayTypeBasis &Phix = *basisVals[0];
1637 const ArrayTypeBasis &Phiy = *basisVals[1];
1638 const ArrayTypeBasis &DPhix = *Dbases[0];
1639 const ArrayTypeBasis &DPhiy = *Dbases[1];
1640 const ArrayTypeWeights &wtsx = *wts[0];
1641 const ArrayTypeWeights &wtsy = *wts[1];
1643 for (
int cell=0;cell<numCells;cell++)
1645 for (
int field=0;field<numFields;field++)
1647 for (
int j=0;j<numBfy;j++)
1649 for (
int i=0;i<numBfx;i++)
1651 const int I=j*numBfx+i;
1652 vals(cell,field,I) = 0.0;
1658 for (
int cell=0;cell<numCells;cell++)
1660 for (
int field=0;field<numFields;field++)
1662 for (
int j=0;j<numBfy;j++)
1664 for (
int i=0;i<numBfx;i++)
1666 for (
int m=0;m<numPtsx;m++)
1668 const int Itmp = j * numBfy + m;
1669 vals(cell,field,Itmp) += wtsx(m) * wtsy(j) * DPhix(i,m);
1676 for (
int cell=0;cell<numCells;cell++)
1678 for (
int field=0;field<numFields;field++)
1680 for (
int j=0;j<numBfy;j++)
1682 for (
int i=0;i<numBfx;i++)
1684 for (
int n=0;n<numPtsy;n++)
1686 const int Itmp = n * numBfy + i;
1687 vals(cell,field,Itmp) += wtsx(i) * wtsy(n) * DPhiy(j,n);
1696 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1697 class ArrayTypeBasis,
class ArrayTypeWeights>
1698 void TensorProductSpaceTools::momentsGrad3D( ArrayTypeOut &vals ,
1699 const ArrayTypeData &data ,
1700 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1701 const Array<RCP<ArrayTypeBasis> > &basisDVals ,
1702 const Array<RCP<ArrayTypeWeights> > &wts )
1705 const int numBfx = basisVals[0]->dimension(0);
1706 const int numBfy = basisVals[1]->dimension(0);
1707 const int numBfz = basisVals[2]->dimension(0);
1708 const int numPtsx = basisVals[0]->dimension(1);
1709 const int numPtsy = basisVals[1]->dimension(1);
1710 const int numPtsz = basisVals[2]->dimension(1);
1711 const int numCells = vals.dimension(0);
1712 const int numFields = vals.dimension(1);
1713 const ArrayTypeBasis &Phix = *basisVals[0];
1714 const ArrayTypeBasis &Phiy = *basisVals[1];
1715 const ArrayTypeBasis &Phiz = *basisVals[2];
1716 const ArrayTypeBasis &DPhix = *basisDVals[0];
1717 const ArrayTypeBasis &DPhiy = *basisDVals[1];
1718 const ArrayTypeBasis &DPhiz = *basisDVals[2];
1719 const ArrayTypeWeights &wtsx = *wts[0];
1720 const ArrayTypeWeights &wtsy = *wts[1];
1721 const ArrayTypeWeights &wtsz = *wts[2];
1723 FieldContainer<double> Xi(numCells,numBfx,numPtsz,numPtsy,3);
1724 FieldContainer<double> Theta(numCells,numBfy,numBfx,numPtsz,3);
1727 for (
int f=0;f<numFields;f++)
1729 for (
int c=0;c<numCells;c++)
1731 for (
int i=0;i<numBfx;i++)
1733 for (
int n=0;n<numPtsz;n++)
1735 for (
int m=0;m<numPtsy;m++)
1737 for (
int l=0;l<numPtsx;l++)
1739 const int dataIdx = n * numPtsy * numPtsx + m * numPtsx + l;
1740 Xi(c,i,n,m,0) += wtsx(l) * DPhix(i,l,0) * data(c,f,dataIdx,0);
1741 Xi(c,i,n,m,1) += wtsx(l) * Phix(i,l) * data(c,f,dataIdx,1);
1742 Xi(c,i,n,m,2) += wtsx(l) * Phix(i,l) * data(c,f,dataIdx,2);
1750 for (
int c=0;c<numCells;c++)
1752 for (
int j=0;j<numBfy;j++)
1754 for (
int i=0;i<numBfx;i++)
1756 for (
int n=0;n<numPtsz;n++)
1758 for (
int m=0;m<numPtsy;m++)
1760 Theta(c,j,i,n,0) += wtsy(j) * Phiy(j,m) * Xi(c,i,n,m,0);
1761 Theta(c,j,i,n,1) += wtsy(j) * DPhiy(j,m,0) * Xi(c,i,n,m,1);
1762 Theta(c,j,i,n,2) += wtsy(j) * Phiy(j,m) * Xi(c,i,n,m,2);
1770 for (
int c=0;c<numCells;c++)
1772 for (
int k=0;k<numBfz;k++)
1774 for (
int j=0;j<numBfy;j++)
1776 for (
int i=0;i<numBfx;i++)
1778 const int momIdx = k * numBfx * numBfy + j * numBfx + i;
1779 for (
int n=0;n<numPtsz;n++)
1781 vals(c,f,momIdx) += wtsz(n) * Theta(c,j,i,n,0) * Phiz(k,n);
1782 vals(c,f,momIdx) += wtsz(n) * Theta(c,j,i,n,1) * Phiz(k,n);
1783 vals(c,f,momIdx) += wtsz(n) * Theta(c,j,i,n,2) * DPhiz(k,n,0);
1793 template<
class Scalar,
class ArrayTypeOut,
class ArrayTypeData,
1794 class ArrayTypeBasis,
class ArrayTypeWeights>
1795 void TensorProductSpaceTools::momentsGradCollocated3D( ArrayTypeOut &vals ,
1796 const ArrayTypeData &data ,
1797 const Array<RCP<ArrayTypeBasis> > &basisVals ,
1798 const Array<RCP<ArrayTypeBasis> > &basisDVals ,
1799 const Array<RCP<ArrayTypeWeights> > &wts )
1802 const int numBfx = basisVals[0]->dimension(0);
1803 const int numBfy = basisVals[1]->dimension(0);
1804 const int numBfz = basisVals[2]->dimension(0);
1805 const int numPtsx = basisVals[0]->dimension(1);
1806 const int numPtsy = basisVals[1]->dimension(1);
1807 const int numPtsz = basisVals[2]->dimension(1);
1808 const int numCells = vals.dimension(0);
1809 const int numFields = vals.dimension(1);
1810 const ArrayTypeBasis &Phix = *basisVals[0];
1811 const ArrayTypeBasis &Phiy = *basisVals[1];
1812 const ArrayTypeBasis &Phiz = *basisVals[2];
1813 const ArrayTypeBasis &DPhix = *basisDVals[0];
1814 const ArrayTypeBasis &DPhiy = *basisDVals[1];
1815 const ArrayTypeBasis &DPhiz = *basisDVals[2];
1816 const ArrayTypeWeights &wtsx = *wts[0];
1817 const ArrayTypeWeights &wtsy = *wts[1];
1818 const ArrayTypeWeights &wtsz = *wts[2];
1820 for (
int cell=0;cell<numCells;cell++)
1822 for (
int field=0;field<numFields;field++)
1825 for (
int k=0;k<numBfz;k++)
1827 for (
int j=0;j<numBfy;j++)
1829 for (
int i=0;i<numBfx;i++)
1831 const int I = numBfy * numBfx * k + numBfy * j + i;
1832 for (
int ell=0;ell<numPtsx;ell++)
1833 vals(cell,field,I) += wtsx(ell) * wtsy(j) * wtsz(k) * DPhix( i , ell );
1838 for (
int k=0;k<numBfz;k++)
1840 for (
int j=0;j<numBfy;j++)
1842 for (
int i=0;i<numBfx;i++)
1844 const int I = numBfy * numBfx * k + numBfy * j + i;
1845 for (
int m=0;m<numPtsy;m++)
1846 vals(cell,field,I) += wtsx(i) * wtsy(m) * wtsz(k) * DPhiy( j , m );
1851 for (
int k=0;k<numBfz;k++)
1853 for (
int j=0;j<numBfy;j++)
1855 for (
int i=0;i<numBfx;i++)
1857 const int I = numBfy * numBfx * k + numBfy * j + i;
1858 for (
int n=0;n<numPtsz;n++)
1859 vals(cell,field,I) += wtsx(i) * wtsy(j) * wtsz(n) * DPhiz( k , n );