59 template<
class Scalar,
int ArrayTypeId>
64 data_.assign(right.
data_.begin(),right.
data_.end());
70 data_ptr_ = data_.begin();
80 template<
class Scalar,
int ArrayTypeId>
84 using Teuchos::Ordinal;
85 #ifdef HAVE_INTREPID_DEBUG
86 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
87 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative dimension.");
92 data_.assign(as<Ordinal>(
dim0_), as<Scalar>(0));
93 data_ptr_ =
data_.begin();
98 template<
class Scalar,
int ArrayTypeId>
100 const int dim1) : dim0_(dim0), dim1_(dim1), dim2_(0), dim3_(0), dim4_(0)
103 using Teuchos::Ordinal;
104 #ifdef HAVE_INTREPID_DEBUG
105 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
106 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
107 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
108 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
115 data_ptr_ =
data_.begin();
120 template<
class Scalar,
int ArrayTypeId>
123 const int dim2) : dim0_(dim0), dim1_(dim1), dim2_(dim2), dim3_(0), dim4_(0)
126 using Teuchos::Ordinal;
127 #ifdef HAVE_INTREPID_DEBUG
128 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
129 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
130 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
131 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
132 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
133 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
140 data_ptr_ =
data_.begin();
145 template<
class Scalar,
int ArrayTypeId>
149 const int dim3) : dim0_(dim0), dim1_(dim1), dim2_(dim2), dim3_(dim3), dim4_(0)
152 using Teuchos::Ordinal;
153 #ifdef HAVE_INTREPID_DEBUG
154 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
155 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
156 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
157 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
158 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
159 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
160 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim3), std::invalid_argument,
161 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 4th dimension.");
169 data_ptr_ =
data_.begin();
174 template<
class Scalar,
int ArrayTypeId>
179 const int dim4) : dim0_(dim0), dim1_(dim1), dim2_(dim2), dim3_(dim3), dim4_(dim4)
182 using Teuchos::Ordinal;
183 #ifdef HAVE_INTREPID_DEBUG
184 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
185 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
186 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
187 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
188 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
189 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
190 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim3), std::invalid_argument,
191 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 4th dimension.");
192 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim4), std::invalid_argument,
193 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 5th dimension.");
202 data_ptr_ =
data_.begin();
207 template<
class Scalar,
int ArrayTypeId>
210 #ifdef HAVE_INTREPID_DEBUG
213 for(
int dim = 0; dim < dimensionsArray.size(); dim++) {
214 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dimensionsArray[dim] ), std::invalid_argument,
215 ">>> ERROR (FieldContainer): One or more negative dimensions");
220 dimensions_.assign(dimensionsArray.begin(),dimensionsArray.end());
223 unsigned int theRank = dimensions_.size();
226 dim0_ = dimensions_[0];
234 dim0_ = dimensions_[0];
235 dim1_ = dimensions_[1];
242 dim0_ = dimensions_[0];
243 dim1_ = dimensions_[1];
244 dim2_ = dimensions_[2];
250 dim0_ = dimensions_[0];
251 dim1_ = dimensions_[1];
252 dim2_ = dimensions_[2];
253 dim3_ = dimensions_[3];
259 dim0_ = dimensions_[0];
260 dim1_ = dimensions_[1];
261 dim2_ = dimensions_[2];
262 dim3_ = dimensions_[3];
263 dim4_ = dimensions_[4];
267 data_.assign(
this -> size(), (Scalar)0);
268 data_ptr_ = data_.begin();
274 template<
class Scalar,
int ArrayTypeId>
276 const Teuchos::ArrayView<Scalar>& data) {
279 dimensions_.assign(dimensionsArray.begin(),dimensionsArray.end());
282 unsigned int theRank = dimensions_.size();
293 dim0_ = dimensions_[0];
301 dim0_ = dimensions_[0];
302 dim1_ = dimensions_[1];
309 dim0_ = dimensions_[0];
310 dim1_ = dimensions_[1];
311 dim2_ = dimensions_[2];
317 dim0_ = dimensions_[0];
318 dim1_ = dimensions_[1];
319 dim2_ = dimensions_[2];
320 dim3_ = dimensions_[3];
326 dim0_ = dimensions_[0];
327 dim1_ = dimensions_[1];
328 dim2_ = dimensions_[2];
329 dim3_ = dimensions_[3];
330 dim4_ = dimensions_[4];
334 #ifdef HAVE_INTREPID_DEBUG
335 TEUCHOS_TEST_FOR_EXCEPTION( ( (
int)data.size() !=
this -> size() ),
336 std::invalid_argument,
337 ">>> ERROR (FieldContainer): Size of input data does not match size of this container.");
341 data_.assign(data.begin(),data.end());
342 data_ptr_ = data_.begin();
347 template<
class Scalar,
int ArrayTypeId>
349 const Teuchos::ArrayRCP<Scalar>& data) {
352 dimensions_.assign(dimensionsArray.begin(),dimensionsArray.end());
355 unsigned int theRank = dimensions_.size();
366 dim0_ = dimensions_[0];
374 dim0_ = dimensions_[0];
375 dim1_ = dimensions_[1];
382 dim0_ = dimensions_[0];
383 dim1_ = dimensions_[1];
384 dim2_ = dimensions_[2];
390 dim0_ = dimensions_[0];
391 dim1_ = dimensions_[1];
392 dim2_ = dimensions_[2];
393 dim3_ = dimensions_[3];
399 dim0_ = dimensions_[0];
400 dim1_ = dimensions_[1];
401 dim2_ = dimensions_[2];
402 dim3_ = dimensions_[3];
403 dim4_ = dimensions_[4];
407 #ifdef HAVE_INTREPID_DEBUG
408 TEUCHOS_TEST_FOR_EXCEPTION( ( (
int)data.size() !=
this -> size() ),
409 std::invalid_argument,
410 ">>> ERROR (FieldContainer): Size of input data does not match size of this container.");
415 data_ptr_ = data_.begin();
420 template<
class Scalar,
int ArrayTypeId>
423 const bool deep_copy,
424 const bool owns_mem) {
427 dimensions_.assign(dimensionsArray.begin(),dimensionsArray.end());
430 unsigned int theRank = dimensions_.size();
441 dim0_ = dimensions_[0];
449 dim0_ = dimensions_[0];
450 dim1_ = dimensions_[1];
457 dim0_ = dimensions_[0];
458 dim1_ = dimensions_[1];
459 dim2_ = dimensions_[2];
465 dim0_ = dimensions_[0];
466 dim1_ = dimensions_[1];
467 dim2_ = dimensions_[2];
468 dim3_ = dimensions_[3];
474 dim0_ = dimensions_[0];
475 dim1_ = dimensions_[1];
476 dim2_ = dimensions_[2];
477 dim3_ = dimensions_[3];
478 dim4_ = dimensions_[4];
483 Teuchos::ArrayRCP<Scalar> arrayrcp = Teuchos::arcp<Scalar>(data, 0,
this -> size(),
false);
484 data_.deepCopy(arrayrcp());
485 data_ptr_ = data_.begin();
488 data_ = Teuchos::arcp<Scalar>(data, 0,
this -> size(), owns_mem);
489 data_ptr_ = data_.begin();
495 template<
class Scalar,
int ArrayTypeId>
497 const bool deep_copy,
498 const bool owns_mem) {
501 dimensions_.resize(data.rank());
504 unsigned int theRank = dimensions_.size();
507 dimensions_[0] = data.dimension(0);
508 dim0_ = dimensions_[0];
516 dimensions_[0] = data.dimension(0);
517 dimensions_[1] = data.dimension(1);
518 dim0_ = dimensions_[0];
519 dim1_ = dimensions_[1];
526 dimensions_[0] = data.dimension(0);
527 dimensions_[1] = data.dimension(1);
528 dimensions_[2] = data.dimension(2);
529 dim0_ = dimensions_[0];
530 dim1_ = dimensions_[1];
531 dim2_ = dimensions_[2];
537 dimensions_[0] = data.dimension(0);
538 dimensions_[1] = data.dimension(1);
539 dimensions_[2] = data.dimension(2);
540 dimensions_[3] = data.dimension(3);
541 dim0_ = dimensions_[0];
542 dim1_ = dimensions_[1];
543 dim2_ = dimensions_[2];
544 dim3_ = dimensions_[3];
549 dimensions_[0] = data.dimension(0);
550 dimensions_[1] = data.dimension(1);
551 dimensions_[2] = data.dimension(2);
552 dimensions_[3] = data.dimension(3);
553 dimensions_[4] = data.dimension(4);
554 dim0_ = dimensions_[0];
555 dim1_ = dimensions_[1];
556 dim2_ = dimensions_[2];
557 dim3_ = dimensions_[3];
558 dim4_ = dimensions_[4];
562 for (
int i=0; i<data.rank(); i++) {
563 dimensions_[i] = data.dimension(i);
565 dim0_ = dimensions_[0];
566 dim1_ = dimensions_[1];
567 dim2_ = dimensions_[2];
568 dim3_ = dimensions_[3];
569 dim4_ = dimensions_[4];
574 Teuchos::ArrayRCP<Scalar> arrayrcp = Teuchos::arcp<Scalar>(data.contiguous_data(), 0,
this -> size(),
false);
575 data_.deepCopy(arrayrcp());
576 data_ptr_ = data_.begin();
579 data_ = Teuchos::arcp<Scalar>(data.contiguous_data(), 0,
this -> size(), owns_mem);
580 data_ptr_ = data_.begin();
593 template<
class Scalar,
int ArrayTypeId>
595 return dimensions_.size();
600 template<
class Scalar,
int ArrayTypeId>
607 const int theRank = dimensions_.size ();
619 theSize *= dim1_*dim2_*dim3_*dim4_;
623 theSize *= dim1_*dim2_*dim3_;
627 theSize *= dim1_*dim2_;
639 for (
int r = 1; r < theRank; ++r) {
640 theSize *= dimensions_[r];
649 template<
class Scalar,
int ArrayTypeId>
650 template<
class Vector>
652 dimVec.assign(dimensions_.begin(),dimensions_.end());
657 template<
class Scalar,
int ArrayTypeId>
659 #ifdef HAVE_INTREPID_DEBUG
660 TEUCHOS_TEST_FOR_EXCEPTION( (0 > whichDim), std::invalid_argument,
661 ">>> ERROR (FieldContainer): dimension order cannot be negative");
662 TEUCHOS_TEST_FOR_EXCEPTION( (whichDim >=
this -> rank() ), std::invalid_argument,
663 ">>> ERROR (FieldContainer): dimension order cannot exceed rank of the container");
665 return dimensions_[whichDim];
670 template<
class Scalar,
int ArrayTypeId>
672 #ifdef HAVE_INTREPID_DEBUG
673 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
674 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
675 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
676 ">>> ERROR (FieldContainer): index is out of range.");
683 template<
class Scalar,
int ArrayTypeId>
685 const int i1)
const {
686 #ifdef HAVE_INTREPID_DEBUG
687 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
688 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
689 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
690 ">>> ERROR (FieldContainer): 1st index is out of range.");
691 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
692 ">>> ERROR (FieldContainer): 2nd index is out of range.");
694 return i0*dim1_ + i1;
699 template<
class Scalar,
int ArrayTypeId>
702 const int i2)
const {
703 #ifdef HAVE_INTREPID_DEBUG
704 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
705 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
706 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
707 ">>> ERROR (FieldContainer): 1st index is out of range.");
708 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
709 ">>> ERROR (FieldContainer): 2nd index is out of range.");
710 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
711 ">>> ERROR (FieldContainer): 3rd index is out of range.");
713 return (i0*dim1_ + i1)*dim2_ + i2;
718 template<
class Scalar,
int ArrayTypeId>
722 const int i3)
const {
723 #ifdef HAVE_INTREPID_DEBUG
724 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
725 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
726 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
727 ">>> ERROR (FieldContainer): 1st index is out of range.");
728 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
729 ">>> ERROR (FieldContainer): 2nd index is out of range.");
730 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
731 ">>> ERROR (FieldContainer): 3rd index is out of range.");
732 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
733 ">>> ERROR (FieldContainer): 4th index is out of range.");
735 return ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3;
740 template<
class Scalar,
int ArrayTypeId>
745 const int i4)
const {
746 #ifdef HAVE_INTREPID_DEBUG
747 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
748 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
749 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
750 ">>> ERROR (FieldContainer): 1st index is out of range.");
751 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
752 ">>> ERROR (FieldContainer): 2nd index is out of range.");
753 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
754 ">>> ERROR (FieldContainer): 3rd index is out of range.");
755 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
756 ">>> ERROR (FieldContainer): 4th index is out of range.");
757 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
758 ">>> ERROR (FieldContainer): 5th index is out of range.");
760 return ( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4;
766 template<
class Scalar,
int ArrayTypeId>
769 #ifdef HAVE_INTREPID_DEBUG
771 TEUCHOS_TEST_FOR_EXCEPTION( ( multiIndex.size() != dimensions_.size() ),
772 std::invalid_argument,
773 ">>> ERROR (FieldContainer): Number of multi-indices does not match rank of container.");
774 TEUCHOS_TEST_FOR_EXCEPTION( ( ( multiIndex[0] < 0) || ( multiIndex[0] >= dim0_) ),
775 std::invalid_argument,
776 ">>> ERROR (FieldContainer): 1st index is out of range.");
779 int theRank = dimensions_.size();
785 #ifdef HAVE_INTREPID_DEBUG
786 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[4] < 0) || (multiIndex[4] >= dim4_) ),
787 std::invalid_argument,
788 ">>> ERROR (FieldContainer): 5th index is out of range.");
789 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[3] < 0) || (multiIndex[3] >= dim3_) ),
790 std::invalid_argument,
791 ">>> ERROR (FieldContainer): 4th index is out of range.");
792 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
793 std::invalid_argument,
794 ">>> ERROR (FieldContainer): 3rd index is out of range.");
795 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
796 std::invalid_argument,
797 ">>> ERROR (FieldContainer): 2nd index is out of range.");
799 address = (((multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2])*dim3_ + multiIndex[3])*dim4_ + multiIndex[4];
803 #ifdef HAVE_INTREPID_DEBUG
804 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[3] < 0) || (multiIndex[3] >= dim3_) ),
805 std::invalid_argument,
806 ">>> ERROR (FieldContainer): 4th index is out of range.");
807 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
808 std::invalid_argument,
809 ">>> ERROR (FieldContainer): 3rd index is out of range.");
810 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
811 std::invalid_argument,
812 ">>> ERROR (FieldContainer): 2nd index is out of range.");
814 address = ((multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2])*dim3_ + multiIndex[3];
818 #ifdef HAVE_INTREPID_DEBUG
819 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
820 std::invalid_argument,
821 ">>> ERROR (FieldContainer): 3rd index is out of range.");
822 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
823 std::invalid_argument,
824 ">>> ERROR (FieldContainer): 2nd index is out of range.");
826 address = (multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2];
830 #ifdef HAVE_INTREPID_DEBUG
831 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
832 std::invalid_argument,
833 ">>> ERROR (FieldContainer): 2nd index is out of range.");
835 address = multiIndex[0]*dim1_ + multiIndex[1];
839 address = multiIndex[0];
845 address = multiIndex[0];
846 for (
int r = 0; r < theRank - 1; r++){
847 #ifdef HAVE_INTREPID_DEBUG
848 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[r+1] < 0) || (multiIndex[r+1] >= dimensions_[r+1]) ),
849 std::invalid_argument,
850 ">>> ERROR (FieldContainer): Multi-index component out of range.");
853 address = address*dimensions_[r+1] + multiIndex[r+1];
862 template<
class Scalar,
int ArrayTypeId>
864 const int valueEnum)
const
866 #ifdef HAVE_INTREPID_DEBUG
867 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
868 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
869 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
870 std::invalid_argument,
871 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
878 template<
class Scalar,
int ArrayTypeId>
881 const int valueEnum)
const
883 #ifdef HAVE_INTREPID_DEBUG
884 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
885 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
886 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
887 std::invalid_argument,
888 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
891 i0 = valueEnum/dim1_;
892 i1 = valueEnum - i0*dim1_;
897 template<
class Scalar,
int ArrayTypeId>
901 const int valueEnum)
const
903 #ifdef HAVE_INTREPID_DEBUG
904 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
905 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
906 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
907 std::invalid_argument,
908 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
910 int tempDim = dim1_*dim2_;
911 int tempEnu = valueEnum;
912 i0 = tempEnu/tempDim;
914 tempEnu -= i0*tempDim;
916 i1 = tempEnu/tempDim;
918 tempEnu -= i1*tempDim;
920 i2 = tempEnu/tempDim;
925 template<
class Scalar,
int ArrayTypeId>
930 const int valueEnum)
const
932 #ifdef HAVE_INTREPID_DEBUG
933 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
934 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
935 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
936 std::invalid_argument,
937 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
939 int tempDim = dim1_*dim2_*dim3_;
940 int tempEnu = valueEnum;
941 i0 = tempEnu/tempDim;
943 tempEnu -= i0*tempDim;
945 i1 = tempEnu/tempDim;
947 tempEnu -= i1*tempDim;
949 i2 = tempEnu/tempDim;
951 tempEnu -= i2*tempDim;
953 i3 = tempEnu/tempDim;
959 template<
class Scalar,
int ArrayTypeId>
965 const int valueEnum)
const
967 #ifdef HAVE_INTREPID_DEBUG
968 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
969 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
970 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
971 std::invalid_argument,
972 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
974 int tempDim = dim1_*dim2_*dim3_*dim4_;
975 int tempEnu = valueEnum;
976 i0 = tempEnu/tempDim;
978 tempEnu -= i0*tempDim;
980 i1 = tempEnu/tempDim;
982 tempEnu -= i1*tempDim;
984 i2 = tempEnu/tempDim;
986 tempEnu -= i2*tempDim;
988 i3 = tempEnu/tempDim;
990 tempEnu -= i3*tempDim;
992 i4 = tempEnu/tempDim;
997 template<
class Scalar,
int ArrayTypeId>
998 template<
class Vector>
1000 const int valueEnum)
const
1004 #ifdef HAVE_INTREPID_DEBUG
1005 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
1006 std::invalid_argument,
1007 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
1011 const int theRank = dimensions_.size ();
1012 multiIndex.resize (theRank);
1015 int temp_enum = valueEnum;
1019 for (
int r = 1; r < theRank; ++r) {
1020 temp_range *= dimensions_[r];
1024 multiIndex[0] = temp_enum/temp_range;
1028 for (
int r = 1; r < theRank - 1; ++r) {
1029 temp_enum -= multiIndex[r-1]*temp_range;
1030 temp_range /= dimensions_[r];
1031 multiIndex[r] = temp_enum/temp_range;
1037 multiIndex[theRank - 1] = temp_enum - multiIndex[theRank - 2] * temp_range;
1047 template<
class Scalar,
int ArrayTypeId>
1049 dimensions_.resize(0);
1060 data_ptr_ = data_.begin();
1065 template<
class Scalar,
int ArrayTypeId>
1069 if( newDimensions.size() == 0) {
1070 dimensions_.resize(0);
1077 data_ptr_ = data_.begin();
1082 dimensions_.assign(newDimensions.begin(),newDimensions.end());
1085 unsigned int theRank = dimensions_.size();
1088 dim0_ = dimensions_[0];
1096 dim0_ = dimensions_[0];
1097 dim1_ = dimensions_[1];
1104 dim0_ = dimensions_[0];
1105 dim1_ = dimensions_[1];
1106 dim2_ = dimensions_[2];
1112 dim0_ = dimensions_[0];
1113 dim1_ = dimensions_[1];
1114 dim2_ = dimensions_[2];
1115 dim3_ = dimensions_[3];
1121 dim0_ = dimensions_[0];
1122 dim1_ = dimensions_[1];
1123 dim2_ = dimensions_[2];
1124 dim3_ = dimensions_[3];
1125 dim4_ = dimensions_[4];
1129 data_.resize(
this -> size());
1130 data_ptr_ = data_.begin();
1136 template<
class Scalar,
int ArrayTypeId>
1143 dimensions_.resize(1);
1144 dimensions_[0] = dim0_;
1145 data_.resize(dim0_);
1146 data_ptr_ = data_.begin();
1151 template<
class Scalar,
int ArrayTypeId>
1159 dimensions_.resize(2);
1160 dimensions_[0] = dim0_;
1161 dimensions_[1] = dim1_;
1162 data_.resize(dim0_*dim1_);
1163 data_ptr_ = data_.begin();
1168 template<
class Scalar,
int ArrayTypeId>
1177 dimensions_.resize(3);
1178 dimensions_[0] = dim0_;
1179 dimensions_[1] = dim1_;
1180 dimensions_[2] = dim2_;
1181 data_.resize(dim0_*dim1_*dim2_);
1182 data_ptr_ = data_.begin();
1187 template<
class Scalar,
int ArrayTypeId>
1197 dimensions_.resize(4);
1198 dimensions_[0] = dim0_;
1199 dimensions_[1] = dim1_;
1200 dimensions_[2] = dim2_;
1201 dimensions_[3] = dim3_;
1202 data_.resize(dim0_*dim1_*dim2_*dim3_);
1203 data_ptr_ = data_.begin();
1208 template<
class Scalar,
int ArrayTypeId>
1219 dimensions_.resize(5);
1220 dimensions_[0] = dim0_;
1221 dimensions_[1] = dim1_;
1222 dimensions_[2] = dim2_;
1223 dimensions_[3] = dim3_;
1224 dimensions_[4] = dim4_;
1225 data_.resize(dim0_*dim1_*dim2_*dim3_*dim4_);
1226 data_ptr_ = data_.begin();
1231 template<
class Scalar,
int ArrayTypeId>
1236 int newRank = dimensions_.size();
1241 dim0_ = dimensions_[0];
1249 dim0_ = dimensions_[0];
1250 dim1_ = dimensions_[1];
1257 dim0_ = dimensions_[0];
1258 dim1_ = dimensions_[1];
1259 dim2_ = dimensions_[2];
1265 dim0_ = dimensions_[0];
1266 dim1_ = dimensions_[1];
1267 dim2_ = dimensions_[2];
1268 dim3_ = dimensions_[3];
1274 dim0_ = dimensions_[0];
1275 dim1_ = dimensions_[1];
1276 dim2_ = dimensions_[2];
1277 dim3_ = dimensions_[3];
1278 dim4_ = dimensions_[4];
1282 data_.resize(this->size());
1283 data_ptr_ = data_.begin();
1287 template<
class Scalar,
int ArrayTypeId>
1289 const int numFields,
1290 const EFunctionSpace spaceType,
1291 const EOperator operatorType,
1292 const int spaceDim) {
1294 #ifdef HAVE_INTREPID_DEBUG
1295 TEUCHOS_TEST_FOR_EXCEPTION( ( numPoints < 0),
1296 std::invalid_argument,
1297 ">>> ERROR (FieldContainer): Number of points cannot be negative!");
1298 TEUCHOS_TEST_FOR_EXCEPTION( ( numFields < 0),
1299 std::invalid_argument,
1300 ">>> ERROR (FieldContainer): Number of fields cannot be negative!");
1301 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= spaceDim ) && ( spaceDim <= 3 ) ),
1302 std::invalid_argument,
1303 ">>> ERROR (FieldContainer): Invalid space dimension.");
1307 const int fieldRank = getFieldRank(spaceType);
1308 const int operatorRank = getOperatorRank(spaceType,operatorType,spaceDim);
1311 const int theRank = 1 + 1 + fieldRank + operatorRank;
1314 Teuchos::Array<int> newDimensions (theRank);
1317 newDimensions[0] = numPoints;
1318 newDimensions[1] = numFields;
1321 switch (operatorType) {
1323 case OPERATOR_VALUE:
1330 for (
int i = 0; i < fieldRank + operatorRank; ++i) {
1331 newDimensions[2 + i] = spaceDim;
1346 for(
int i = 0; i < fieldRank; i++){
1347 newDimensions[2 + i] = spaceDim;
1352 newDimensions[2 + fieldRank] = getDkCardinality(operatorType,spaceDim);
1356 TEUCHOS_TEST_FOR_EXCEPTION(
1357 !(Intrepid::isValidOperator(operatorType) ), std::invalid_argument,
1358 ">>> ERROR (FieldContainer): Invalid operator type");
1362 this->resize (newDimensions);
1373 template<
class Scalar,
int ArrayTypeId>
1375 for (
int i=0; i < this->size(); i++) {
1382 template<
class Scalar,
int ArrayTypeId>
1384 return data_[
this -> getEnumeration(multiIndex)];
1389 template<
class Scalar,
int ArrayTypeId>
1391 const Teuchos::Array<int>& multiIndex) {
1392 data_[
this -> getEnumeration(multiIndex)] = dataValue;
1397 template<
class Scalar,
int ArrayTypeId>
1400 data_[order] = dataValue;
1405 template<
class Scalar,
int ArrayTypeId>
1407 #ifdef HAVE_INTREPID_DEBUG
1408 TEUCHOS_TEST_FOR_EXCEPTION( (dataArray.size() != (data_.size()) ),
1409 std::invalid_argument,
1410 ">>> ERROR (FieldContainer): Size of argument does not match the size of container.");
1412 data_.assign(dataArray.begin(),dataArray.end());
1413 data_ptr_ = data_.begin();
1418 template<
class Scalar,
int ArrayTypeId>
1422 #ifdef HAVE_INTREPID_DEBUG
1423 TEUCHOS_TEST_FOR_EXCEPTION( (numData !=
this -> size() ), std::invalid_argument,
1424 ">>> ERROR (FieldContainer): Number of data does not match the size of container.");
1427 data_.assign(dataPtr, dataPtr + numData);
1428 data_ptr_ = data_.begin();
1433 template<
class Scalar,
int ArrayTypeId>
1436 #ifdef HAVE_INTREPID_DEBUG
1437 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
1438 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1439 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1440 ">>> ERROR (FieldContainer): index is out of range.");
1442 return data_ptr_[i0];
1446 template<
class Scalar,
int ArrayTypeId>
1449 #ifdef HAVE_INTREPID_DEBUG
1450 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
1451 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1452 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1453 ">>> ERROR (FieldContainer): index is out of range.");
1455 return data_ptr_[i0];
1460 template<
class Scalar,
int ArrayTypeId>
1464 #ifdef HAVE_INTREPID_DEBUG
1465 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
1466 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1467 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1468 ">>> ERROR (FieldContainer): 1st index is out of range.");
1469 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1470 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1472 return data_ptr_[i0*dim1_ + i1];
1476 template<
class Scalar,
int ArrayTypeId>
1480 #ifdef HAVE_INTREPID_DEBUG
1481 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
1482 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1483 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1484 ">>> ERROR (FieldContainer): 1st index is out of range.");
1485 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1486 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1488 return data_ptr_[i0*dim1_ + i1];
1493 template<
class Scalar,
int ArrayTypeId>
1498 #ifdef HAVE_INTREPID_DEBUG
1499 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
1500 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1501 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1502 ">>> ERROR (FieldContainer): 1st index is out of range.");
1503 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1504 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1505 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1506 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1508 return data_ptr_[(i0*dim1_ + i1)*dim2_ + i2];
1511 template<
class Scalar,
int ArrayTypeId>
1516 #ifdef HAVE_INTREPID_DEBUG
1517 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
1518 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1519 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1520 ">>> ERROR (FieldContainer): 1st index is out of range.");
1521 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1522 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1523 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1524 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1526 return data_ptr_[(i0*dim1_ + i1)*dim2_ + i2];
1531 template<
class Scalar,
int ArrayTypeId>
1535 const int i3)
const {
1536 #ifdef HAVE_INTREPID_DEBUG
1537 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
1538 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1539 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1540 ">>> ERROR (FieldContainer): 1st index is out of range.");
1541 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1542 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1543 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1544 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1545 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1546 ">>> ERROR (FieldContainer): 4th index is out of range.");
1548 return data_ptr_[( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3];
1552 template<
class Scalar,
int ArrayTypeId>
1557 #ifdef HAVE_INTREPID_DEBUG
1558 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
1559 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1560 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1561 ">>> ERROR (FieldContainer): 1st index is out of range.");
1562 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1563 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1564 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1565 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1566 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1567 ">>> ERROR (FieldContainer): 4th index is out of range.");
1569 return data_ptr_[( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3];
1574 template<
class Scalar,
int ArrayTypeId>
1579 const int i4)
const {
1580 #ifdef HAVE_INTREPID_DEBUG
1581 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
1582 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1583 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1584 ">>> ERROR (FieldContainer): 1st index is out of range.");
1585 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1586 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1587 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1588 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1589 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1590 ">>> ERROR (FieldContainer): 4th index is out of range.");
1591 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
1592 ">>> ERROR (FieldContainer): 5th index is out of range.");
1594 return data_ptr_[( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4];
1597 template<
class Scalar,
int ArrayTypeId>
1603 #ifdef HAVE_INTREPID_DEBUG
1604 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
1605 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1606 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1607 ">>> ERROR (FieldContainer): 1st index is out of range.");
1608 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1609 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1610 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1611 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1612 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1613 ">>> ERROR (FieldContainer): 4th index is out of range.");
1614 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
1615 ">>> ERROR (FieldContainer): 5th index is out of range.");
1617 return data_ptr_[( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4];
1622 template<
class Scalar,
int ArrayTypeId>
1624 #ifdef HAVE_INTREPID_DEBUG
1625 TEUCHOS_TEST_FOR_EXCEPTION( ( (address < 0) || (address >= (
int)data_.size() ) ),
1626 std::invalid_argument,
1627 ">>> ERROR (FieldContainer): Specified address is out of range.");
1629 return data_ptr_[address];
1634 template<
class Scalar,
int ArrayTypeId>
1636 #ifdef HAVE_INTREPID_DEBUG
1637 TEUCHOS_TEST_FOR_EXCEPTION( ( (address < 0) || (address >= (
int)data_.size() ) ),
1638 std::invalid_argument,
1639 ">>> ERROR (FieldContainer): Specified address is out of range.");
1641 return data_ptr_[address];
1646 template<
class Scalar,
int ArrayTypeId>
1649 #ifdef HAVE_INTREPID_DEBUG
1650 TEUCHOS_TEST_FOR_EXCEPTION( (
this == &right ),
1651 std::invalid_argument,
1652 ">>> ERROR (FieldContainer): Invalid right-hand side to '='. Self-assignment prohibited.");
1654 dim0_ = right.
dim0_;
1655 dim1_ = right.
dim1_;
1656 dim2_ = right.
dim2_;
1657 dim3_ = right.
dim3_;
1658 dim4_ = right.
dim4_;
1659 data_.deepCopy(right.
data_());
1660 data_ptr_ = data_.begin();
1673 template<
class Scalar,
int ArrayTypeId>
1674 std::ostream& operator << (std::ostream& os, const FieldContainer<Scalar, ArrayTypeId>& container) {
1677 Teuchos::oblackholestream oldFormatState;
1678 oldFormatState.copyfmt(os);
1680 os.setf(std::ios_base::scientific, std::ios_base::floatfield);
1681 os.setf(std::ios_base::right);
1682 int myprec = os.precision();
1684 int size = container.size();
1685 int rank = container.rank();
1686 Teuchos::Array<int> multiIndex(rank);
1687 Teuchos::Array<int> dimensions;
1688 container.dimensions(dimensions);
1690 os<<
"===============================================================================\n"\
1691 <<
"\t Container size = " << size <<
"\n"
1692 <<
"\t Container rank = " << rank <<
"\n" ;
1694 if( (rank == 0 ) && (size == 0) ) {
1695 os<<
"====================================================================================\n"\
1696 <<
"| *** This is an empty container **** |\n";
1699 os<<
"\t Dimensions = ";
1701 for(
int r = 0; r < rank; r++){
1702 os <<
" (" << dimensions[r] <<
") ";
1706 os<<
"====================================================================================\n"\
1707 <<
"| Multi-index Enumeration Value |\n"\
1708 <<
"====================================================================================\n";
1711 for(
int address = 0; address < size; address++){
1712 container.getMultiIndex(multiIndex,address);
1713 std::ostringstream mistring;
1714 for(
int r = 0; r < rank; r++){
1715 mistring << multiIndex[r] << std::dec <<
" ";
1717 os.setf(std::ios::right, std::ios::adjustfield);
1718 os << std::setw(27) << mistring.str();
1719 os << std::setw(20) << address;
1721 os.setf(std::ios::left, std::ios::adjustfield);
1722 os << std::setw(myprec+8) << container[address] <<
"\n";
1725 os<<
"====================================================================================\n\n";
1728 os.copyfmt(oldFormatState);
int size() const
Returns size of the FieldContainer defined as the product of its dimensions.
const Scalar & operator[](const int address) const
Overloaded [] operator. Returns value based on its enumeration. Data cannot be modified.
FieldContainer & operator=(const FieldContainer &right)
Assignment operator *this = right.
int dim3_
4th dimension of the array
Teuchos::Array< int > dimensions_
Array to store dimensions (dimensions) for the multi-indices. Admissible range (dimension) for the k-...
void clear()
Clears FieldContainer to trivial container (one with rank = 0 and size = 0)
int dim1_
2nd dimension of the array
int dimension(const int whichDim) const
Returns the specified dimension.
int dim2_
3rd dimension of the array
Teuchos::ArrayRCP< Scalar > data_
Array to store the multi-indexed quantity.
void getMultiIndex(int &i0, const int valueEnum) const
Returns the multi-index of a value, based on its enumeration, as a list, for rank-1 containers...
int rank() const
Return rank of the FieldContainer = number of indices used to tag the multi-indexed value...
int getEnumeration(const int i0) const
Returns enumeration of a value (its order relative to the container), based on its multi-index...
const Scalar & operator()(const int i0) const
Overloaded () operators for rank-1 containers. Data cannot be modified.
void setValue(const Scalar dataValue, const Teuchos::Array< int > &multiIndex)
Assign value by its multi-index.
void setValues(const Teuchos::ArrayView< Scalar > &dataArray)
Fills an existing FieldContainer with Scalars stored in a Teuchos::Array without changing rank and di...
Implementation of a templated lexicographical container for a multi-indexed scalar quantity...
void resize(const int dim0)
Resizes FieldContainer to a rank-1 container with the specified dimension, initialized by 0...
FieldContainer()
Default constructor.
void initialize(const Scalar value=0)
Initializes a field container by assigning value to all its elements.
int dim0_
1st dimension of the array
int dim4_
5th dimension of the array
Scalar getValue(const Teuchos::Array< int > &multiIndex) const
Retrieve value by its multi-index. To retrieve it by enumeration use the overloaded []...
void dimensions(Vector &dimensions) const
Returns array with the dimensions of the container.