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)
125 #ifdef HAVE_INTREPID_DEBUG
126 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
127 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
128 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
129 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
130 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
131 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
138 data_ptr_ =
data_.begin();
143 template<
class Scalar,
int ArrayTypeId>
147 const int dim3) : dim0_(dim0), dim1_(dim1), dim2_(dim2), dim3_(dim3), dim4_(0)
149 #ifdef HAVE_INTREPID_DEBUG
150 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
151 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
152 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
153 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
154 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
155 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
156 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim3), std::invalid_argument,
157 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 4th dimension.");
165 data_ptr_ =
data_.begin();
170 template<
class Scalar,
int ArrayTypeId>
175 const int dim4) : dim0_(dim0), dim1_(dim1), dim2_(dim2), dim3_(dim3), dim4_(dim4)
177 #ifdef HAVE_INTREPID_DEBUG
178 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim0), std::invalid_argument,
179 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 1st dimension.");
180 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim1), std::invalid_argument,
181 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 2nd dimension.");
182 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim2), std::invalid_argument,
183 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 3rd dimension.");
184 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim3), std::invalid_argument,
185 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 4th dimension.");
186 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dim4), std::invalid_argument,
187 ">>> ERROR (FieldContainer): FieldContainer cannot have a negative 5th dimension.");
196 data_ptr_ =
data_.begin();
201 template<
class Scalar,
int ArrayTypeId>
204 #ifdef HAVE_INTREPID_DEBUG
207 for(
int dim = 0; dim < dimensions.size(); dim++) {
208 TEUCHOS_TEST_FOR_EXCEPTION( (0 > dimensions[dim] ), std::invalid_argument,
209 ">>> ERROR (FieldContainer): One or more negative dimensions");
214 dimensions_.assign(dimensions.begin(),dimensions.end());
217 unsigned int rank = dimensions_.size();
220 dim0_ = dimensions_[0];
228 dim0_ = dimensions_[0];
229 dim1_ = dimensions_[1];
236 dim0_ = dimensions_[0];
237 dim1_ = dimensions_[1];
238 dim2_ = dimensions_[2];
244 dim0_ = dimensions_[0];
245 dim1_ = dimensions_[1];
246 dim2_ = dimensions_[2];
247 dim3_ = dimensions_[3];
253 dim0_ = dimensions_[0];
254 dim1_ = dimensions_[1];
255 dim2_ = dimensions_[2];
256 dim3_ = dimensions_[3];
257 dim4_ = dimensions_[4];
261 data_.assign(
this -> size(), (Scalar)0);
262 data_ptr_ = data_.begin();
268 template<
class Scalar,
int ArrayTypeId>
270 const Teuchos::ArrayView<Scalar>& data) {
273 dimensions_.assign(dimensions.begin(),dimensions.end());
276 unsigned int rank = dimensions_.size();
287 dim0_ = dimensions_[0];
295 dim0_ = dimensions_[0];
296 dim1_ = dimensions_[1];
303 dim0_ = dimensions_[0];
304 dim1_ = dimensions_[1];
305 dim2_ = dimensions_[2];
311 dim0_ = dimensions_[0];
312 dim1_ = dimensions_[1];
313 dim2_ = dimensions_[2];
314 dim3_ = dimensions_[3];
320 dim0_ = dimensions_[0];
321 dim1_ = dimensions_[1];
322 dim2_ = dimensions_[2];
323 dim3_ = dimensions_[3];
324 dim4_ = dimensions_[4];
328 #ifdef HAVE_INTREPID_DEBUG
329 TEUCHOS_TEST_FOR_EXCEPTION( ( (
int)data.size() !=
this -> size() ),
330 std::invalid_argument,
331 ">>> ERROR (FieldContainer): Size of input data does not match size of this container.");
335 data_.assign(data.begin(),data.end());
336 data_ptr_ = data_.begin();
341 template<
class Scalar,
int ArrayTypeId>
343 const Teuchos::ArrayRCP<Scalar>& data) {
346 dimensions_.assign(dimensions.begin(),dimensions.end());
349 unsigned int rank = dimensions_.size();
360 dim0_ = dimensions_[0];
368 dim0_ = dimensions_[0];
369 dim1_ = dimensions_[1];
376 dim0_ = dimensions_[0];
377 dim1_ = dimensions_[1];
378 dim2_ = dimensions_[2];
384 dim0_ = dimensions_[0];
385 dim1_ = dimensions_[1];
386 dim2_ = dimensions_[2];
387 dim3_ = dimensions_[3];
393 dim0_ = dimensions_[0];
394 dim1_ = dimensions_[1];
395 dim2_ = dimensions_[2];
396 dim3_ = dimensions_[3];
397 dim4_ = dimensions_[4];
401 #ifdef HAVE_INTREPID_DEBUG
402 TEUCHOS_TEST_FOR_EXCEPTION( ( (
int)data.size() !=
this -> size() ),
403 std::invalid_argument,
404 ">>> ERROR (FieldContainer): Size of input data does not match size of this container.");
409 data_ptr_ = data_.begin();
414 template<
class Scalar,
int ArrayTypeId>
417 const bool deep_copy,
418 const bool owns_mem) {
421 dimensions_.assign(dimensions.begin(),dimensions.end());
424 unsigned int rank = dimensions_.size();
435 dim0_ = dimensions_[0];
443 dim0_ = dimensions_[0];
444 dim1_ = dimensions_[1];
451 dim0_ = dimensions_[0];
452 dim1_ = dimensions_[1];
453 dim2_ = dimensions_[2];
459 dim0_ = dimensions_[0];
460 dim1_ = dimensions_[1];
461 dim2_ = dimensions_[2];
462 dim3_ = dimensions_[3];
468 dim0_ = dimensions_[0];
469 dim1_ = dimensions_[1];
470 dim2_ = dimensions_[2];
471 dim3_ = dimensions_[3];
472 dim4_ = dimensions_[4];
477 Teuchos::ArrayRCP<Scalar> arrayrcp = Teuchos::arcp<Scalar>(data, 0,
this -> size(),
false);
478 data_.deepCopy(arrayrcp());
479 data_ptr_ = data_.begin();
482 data_ = Teuchos::arcp<Scalar>(data, 0,
this -> size(), owns_mem);
483 data_ptr_ = data_.begin();
489 template<
class Scalar,
int ArrayTypeId>
491 const bool deep_copy,
492 const bool owns_mem) {
495 dimensions_.resize(data.rank());
498 unsigned int rank = dimensions_.size();
501 dimensions_[0] = data.dimension(0);
502 dim0_ = dimensions_[0];
510 dimensions_[0] = data.dimension(0);
511 dimensions_[1] = data.dimension(1);
512 dim0_ = dimensions_[0];
513 dim1_ = dimensions_[1];
520 dimensions_[0] = data.dimension(0);
521 dimensions_[1] = data.dimension(1);
522 dimensions_[2] = data.dimension(2);
523 dim0_ = dimensions_[0];
524 dim1_ = dimensions_[1];
525 dim2_ = dimensions_[2];
531 dimensions_[0] = data.dimension(0);
532 dimensions_[1] = data.dimension(1);
533 dimensions_[2] = data.dimension(2);
534 dimensions_[3] = data.dimension(3);
535 dim0_ = dimensions_[0];
536 dim1_ = dimensions_[1];
537 dim2_ = dimensions_[2];
538 dim3_ = dimensions_[3];
543 dimensions_[0] = data.dimension(0);
544 dimensions_[1] = data.dimension(1);
545 dimensions_[2] = data.dimension(2);
546 dimensions_[3] = data.dimension(3);
547 dimensions_[4] = data.dimension(4);
548 dim0_ = dimensions_[0];
549 dim1_ = dimensions_[1];
550 dim2_ = dimensions_[2];
551 dim3_ = dimensions_[3];
552 dim4_ = dimensions_[4];
556 for (
int i=0; i<data.rank(); i++) {
557 dimensions_[i] = data.dimension(i);
559 dim0_ = dimensions_[0];
560 dim1_ = dimensions_[1];
561 dim2_ = dimensions_[2];
562 dim3_ = dimensions_[3];
563 dim4_ = dimensions_[4];
568 Teuchos::ArrayRCP<Scalar> arrayrcp = Teuchos::arcp<Scalar>(data.contiguous_data(), 0,
this -> size(),
false);
569 data_.deepCopy(arrayrcp());
570 data_ptr_ = data_.begin();
573 data_ = Teuchos::arcp<Scalar>(data.contiguous_data(), 0,
this -> size(), owns_mem);
574 data_ptr_ = data_.begin();
587 template<
class Scalar,
int ArrayTypeId>
589 return dimensions_.size();
594 template<
class Scalar,
int ArrayTypeId>
601 int rank = dimensions_.size();
613 size *= dim1_*dim2_*dim3_*dim4_;
617 size *= dim1_*dim2_*dim3_;
633 for(
int r = 1; r < rank ; r++){
634 size *= dimensions_[r];
643 template<
class Scalar,
int ArrayTypeId>
644 template<
class Vector>
646 dimensions.assign(dimensions_.begin(),dimensions_.end());
651 template<
class Scalar,
int ArrayTypeId>
653 #ifdef HAVE_INTREPID_DEBUG
654 TEUCHOS_TEST_FOR_EXCEPTION( (0 > whichDim), std::invalid_argument,
655 ">>> ERROR (FieldContainer): dimension order cannot be negative");
656 TEUCHOS_TEST_FOR_EXCEPTION( (whichDim >=
this -> rank() ), std::invalid_argument,
657 ">>> ERROR (FieldContainer): dimension order cannot exceed rank of the container");
659 return dimensions_[whichDim];
664 template<
class Scalar,
int ArrayTypeId>
666 #ifdef HAVE_INTREPID_DEBUG
667 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
668 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
669 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
670 ">>> ERROR (FieldContainer): index is out of range.");
677 template<
class Scalar,
int ArrayTypeId>
679 const int i1)
const {
680 #ifdef HAVE_INTREPID_DEBUG
681 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
682 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
683 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
684 ">>> ERROR (FieldContainer): 1st index is out of range.");
685 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
686 ">>> ERROR (FieldContainer): 2nd index is out of range.");
688 return i0*dim1_ + i1;
693 template<
class Scalar,
int ArrayTypeId>
696 const int i2)
const {
697 #ifdef HAVE_INTREPID_DEBUG
698 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
699 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
700 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
701 ">>> ERROR (FieldContainer): 1st index is out of range.");
702 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
703 ">>> ERROR (FieldContainer): 2nd index is out of range.");
704 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
705 ">>> ERROR (FieldContainer): 3rd index is out of range.");
707 return (i0*dim1_ + i1)*dim2_ + i2;
712 template<
class Scalar,
int ArrayTypeId>
716 const int i3)
const {
717 #ifdef HAVE_INTREPID_DEBUG
718 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
719 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
720 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
721 ">>> ERROR (FieldContainer): 1st index is out of range.");
722 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
723 ">>> ERROR (FieldContainer): 2nd index is out of range.");
724 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
725 ">>> ERROR (FieldContainer): 3rd index is out of range.");
726 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
727 ">>> ERROR (FieldContainer): 4th index is out of range.");
729 return ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3;
734 template<
class Scalar,
int ArrayTypeId>
739 const int i4)
const {
740 #ifdef HAVE_INTREPID_DEBUG
741 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
742 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
743 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || ( i0 >= dim0_) ), std::invalid_argument,
744 ">>> ERROR (FieldContainer): 1st index is out of range.");
745 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
746 ">>> ERROR (FieldContainer): 2nd index is out of range.");
747 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
748 ">>> ERROR (FieldContainer): 3rd index is out of range.");
749 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
750 ">>> ERROR (FieldContainer): 4th index is out of range.");
751 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
752 ">>> ERROR (FieldContainer): 5th index is out of range.");
754 return ( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4;
760 template<
class Scalar,
int ArrayTypeId>
763 #ifdef HAVE_INTREPID_DEBUG
765 TEUCHOS_TEST_FOR_EXCEPTION( ( multiIndex.size() != dimensions_.size() ),
766 std::invalid_argument,
767 ">>> ERROR (FieldContainer): Number of multi-indices does not match rank of container.");
768 TEUCHOS_TEST_FOR_EXCEPTION( ( ( multiIndex[0] < 0) || ( multiIndex[0] >= dim0_) ),
769 std::invalid_argument,
770 ">>> ERROR (FieldContainer): 1st index is out of range.");
773 int rank = dimensions_.size();
779 #ifdef HAVE_INTREPID_DEBUG
780 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[4] < 0) || (multiIndex[4] >= dim4_) ),
781 std::invalid_argument,
782 ">>> ERROR (FieldContainer): 5th index is out of range.");
783 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[3] < 0) || (multiIndex[3] >= dim3_) ),
784 std::invalid_argument,
785 ">>> ERROR (FieldContainer): 4th index is out of range.");
786 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
787 std::invalid_argument,
788 ">>> ERROR (FieldContainer): 3rd index is out of range.");
789 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
790 std::invalid_argument,
791 ">>> ERROR (FieldContainer): 2nd index is out of range.");
793 address = (((multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2])*dim3_ + multiIndex[3])*dim4_ + multiIndex[4];
797 #ifdef HAVE_INTREPID_DEBUG
798 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[3] < 0) || (multiIndex[3] >= dim3_) ),
799 std::invalid_argument,
800 ">>> ERROR (FieldContainer): 4th index is out of range.");
801 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
802 std::invalid_argument,
803 ">>> ERROR (FieldContainer): 3rd index is out of range.");
804 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
805 std::invalid_argument,
806 ">>> ERROR (FieldContainer): 2nd index is out of range.");
808 address = ((multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2])*dim3_ + multiIndex[3];
812 #ifdef HAVE_INTREPID_DEBUG
813 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[2] < 0) || (multiIndex[2] >= dim2_) ),
814 std::invalid_argument,
815 ">>> ERROR (FieldContainer): 3rd index is out of range.");
816 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
817 std::invalid_argument,
818 ">>> ERROR (FieldContainer): 2nd index is out of range.");
820 address = (multiIndex[0]*dim1_ + multiIndex[1])*dim2_ + multiIndex[2];
824 #ifdef HAVE_INTREPID_DEBUG
825 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[1] < 0) || (multiIndex[1] >= dim1_) ),
826 std::invalid_argument,
827 ">>> ERROR (FieldContainer): 2nd index is out of range.");
829 address = multiIndex[0]*dim1_ + multiIndex[1];
833 address = multiIndex[0];
839 address = multiIndex[0];
840 for (
int r = 0; r < rank - 1; r++){
841 #ifdef HAVE_INTREPID_DEBUG
842 TEUCHOS_TEST_FOR_EXCEPTION( ( (multiIndex[r+1] < 0) || (multiIndex[r+1] >= dimensions_[r+1]) ),
843 std::invalid_argument,
844 ">>> ERROR (FieldContainer): Multi-index component out of range.");
847 address = address*dimensions_[r+1] + multiIndex[r+1];
856 template<
class Scalar,
int ArrayTypeId>
858 const int valueEnum)
const
860 #ifdef HAVE_INTREPID_DEBUG
861 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
862 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
863 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
864 std::invalid_argument,
865 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
872 template<
class Scalar,
int ArrayTypeId>
875 const int valueEnum)
const
877 #ifdef HAVE_INTREPID_DEBUG
878 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
879 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
880 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
881 std::invalid_argument,
882 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
885 i0 = valueEnum/dim1_;
886 i1 = valueEnum - i0*dim1_;
891 template<
class Scalar,
int ArrayTypeId>
895 const int valueEnum)
const
897 #ifdef HAVE_INTREPID_DEBUG
898 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
899 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
900 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
901 std::invalid_argument,
902 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
904 int tempDim = dim1_*dim2_;
905 int tempEnu = valueEnum;
906 i0 = tempEnu/tempDim;
908 tempEnu -= i0*tempDim;
910 i1 = tempEnu/tempDim;
912 tempEnu -= i1*tempDim;
914 i2 = tempEnu/tempDim;
919 template<
class Scalar,
int ArrayTypeId>
924 const int valueEnum)
const
926 #ifdef HAVE_INTREPID_DEBUG
927 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
928 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
929 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
930 std::invalid_argument,
931 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
933 int tempDim = dim1_*dim2_*dim3_;
934 int tempEnu = valueEnum;
935 i0 = tempEnu/tempDim;
937 tempEnu -= i0*tempDim;
939 i1 = tempEnu/tempDim;
941 tempEnu -= i1*tempDim;
943 i2 = tempEnu/tempDim;
945 tempEnu -= i2*tempDim;
947 i3 = tempEnu/tempDim;
953 template<
class Scalar,
int ArrayTypeId>
959 const int valueEnum)
const
961 #ifdef HAVE_INTREPID_DEBUG
962 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
963 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
964 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
965 std::invalid_argument,
966 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
968 int tempDim = dim1_*dim2_*dim3_*dim4_;
969 int tempEnu = valueEnum;
970 i0 = tempEnu/tempDim;
972 tempEnu -= i0*tempDim;
974 i1 = tempEnu/tempDim;
976 tempEnu -= i1*tempDim;
978 i2 = tempEnu/tempDim;
980 tempEnu -= i2*tempDim;
982 i3 = tempEnu/tempDim;
984 tempEnu -= i3*tempDim;
986 i4 = tempEnu/tempDim;
991 template<
class Scalar,
int ArrayTypeId>
992 template<
class Vector>
994 const int valueEnum)
const
998 #ifdef HAVE_INTREPID_DEBUG
999 TEUCHOS_TEST_FOR_EXCEPTION( ( (valueEnum < 0) || (valueEnum >= (
int)data_.size()) ),
1000 std::invalid_argument,
1001 ">>> ERROR (FieldContainer): Value enumeration is out of range.");
1005 int rank = dimensions_.size();
1006 multiIndex.resize(rank);
1009 int temp_enum = valueEnum;
1013 for(
int r = 1; r < rank ; r++){
1014 temp_range *=dimensions_[r];
1018 multiIndex[0] = temp_enum/temp_range;
1021 for(
int r = 1; r < rank - 1; r++){
1022 temp_enum -= multiIndex[r-1]*temp_range;
1023 temp_range /= dimensions_[r];
1024 multiIndex[r] = temp_enum/temp_range;
1029 multiIndex[rank - 1] = temp_enum - multiIndex[rank - 2]*temp_range;
1039 template<
class Scalar,
int ArrayTypeId>
1041 dimensions_.resize(0);
1052 data_ptr_ = data_.begin();
1057 template<
class Scalar,
int ArrayTypeId>
1061 if( newDimensions.size() == 0) {
1062 dimensions_.resize(0);
1069 data_ptr_ = data_.begin();
1074 dimensions_.assign(newDimensions.begin(),newDimensions.end());
1077 unsigned int rank = dimensions_.size();
1080 dim0_ = dimensions_[0];
1088 dim0_ = dimensions_[0];
1089 dim1_ = dimensions_[1];
1096 dim0_ = dimensions_[0];
1097 dim1_ = dimensions_[1];
1098 dim2_ = dimensions_[2];
1104 dim0_ = dimensions_[0];
1105 dim1_ = dimensions_[1];
1106 dim2_ = dimensions_[2];
1107 dim3_ = dimensions_[3];
1113 dim0_ = dimensions_[0];
1114 dim1_ = dimensions_[1];
1115 dim2_ = dimensions_[2];
1116 dim3_ = dimensions_[3];
1117 dim4_ = dimensions_[4];
1121 data_.resize(
this -> size());
1122 data_ptr_ = data_.begin();
1128 template<
class Scalar,
int ArrayTypeId>
1135 dimensions_.resize(1);
1136 dimensions_[0] = dim0_;
1137 data_.resize(dim0_);
1138 data_ptr_ = data_.begin();
1143 template<
class Scalar,
int ArrayTypeId>
1151 dimensions_.resize(2);
1152 dimensions_[0] = dim0_;
1153 dimensions_[1] = dim1_;
1154 data_.resize(dim0_*dim1_);
1155 data_ptr_ = data_.begin();
1160 template<
class Scalar,
int ArrayTypeId>
1169 dimensions_.resize(3);
1170 dimensions_[0] = dim0_;
1171 dimensions_[1] = dim1_;
1172 dimensions_[2] = dim2_;
1173 data_.resize(dim0_*dim1_*dim2_);
1174 data_ptr_ = data_.begin();
1179 template<
class Scalar,
int ArrayTypeId>
1189 dimensions_.resize(4);
1190 dimensions_[0] = dim0_;
1191 dimensions_[1] = dim1_;
1192 dimensions_[2] = dim2_;
1193 dimensions_[3] = dim3_;
1194 data_.resize(dim0_*dim1_*dim2_*dim3_);
1195 data_ptr_ = data_.begin();
1200 template<
class Scalar,
int ArrayTypeId>
1211 dimensions_.resize(5);
1212 dimensions_[0] = dim0_;
1213 dimensions_[1] = dim1_;
1214 dimensions_[2] = dim2_;
1215 dimensions_[3] = dim3_;
1216 dimensions_[4] = dim4_;
1217 data_.resize(dim0_*dim1_*dim2_*dim3_*dim4_);
1218 data_ptr_ = data_.begin();
1223 template<
class Scalar,
int ArrayTypeId>
1228 int newRank = dimensions_.size();
1233 dim0_ = dimensions_[0];
1241 dim0_ = dimensions_[0];
1242 dim1_ = dimensions_[1];
1249 dim0_ = dimensions_[0];
1250 dim1_ = dimensions_[1];
1251 dim2_ = dimensions_[2];
1257 dim0_ = dimensions_[0];
1258 dim1_ = dimensions_[1];
1259 dim2_ = dimensions_[2];
1260 dim3_ = dimensions_[3];
1266 dim0_ = dimensions_[0];
1267 dim1_ = dimensions_[1];
1268 dim2_ = dimensions_[2];
1269 dim3_ = dimensions_[3];
1270 dim4_ = dimensions_[4];
1274 data_.resize(this->size());
1275 data_ptr_ = data_.begin();
1279 template<
class Scalar,
int ArrayTypeId>
1281 const int numFields,
1282 const EFunctionSpace spaceType,
1283 const EOperator operatorType,
1284 const int spaceDim) {
1286 #ifdef HAVE_INTREPID_DEBUG
1287 TEUCHOS_TEST_FOR_EXCEPTION( ( numPoints < 0),
1288 std::invalid_argument,
1289 ">>> ERROR (FieldContainer): Number of points cannot be negative!");
1290 TEUCHOS_TEST_FOR_EXCEPTION( ( numFields < 0),
1291 std::invalid_argument,
1292 ">>> ERROR (FieldContainer): Number of fields cannot be negative!");
1293 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= spaceDim ) && ( spaceDim <= 3 ) ),
1294 std::invalid_argument,
1295 ">>> ERROR (FieldContainer): Invalid space dimension.");
1299 int fieldRank = getFieldRank(spaceType);
1300 int operatorRank = getOperatorRank(spaceType,operatorType,spaceDim);
1303 int rank = 1 + 1 + fieldRank + operatorRank;
1306 Teuchos::Array<int> newDimensions(rank);
1309 newDimensions[0] = numPoints;
1310 newDimensions[1] = numFields;
1313 switch(operatorType) {
1315 case OPERATOR_VALUE:
1322 for(
int i = 0; i < fieldRank + operatorRank; i++){
1323 newDimensions[2 + i] = spaceDim;
1338 for(
int i = 0; i < fieldRank; i++){
1339 newDimensions[2 + i] = spaceDim;
1344 newDimensions[2 + fieldRank] = getDkCardinality(operatorType,spaceDim);
1348 TEUCHOS_TEST_FOR_EXCEPTION( !(Intrepid::isValidOperator(operatorType) ), std::invalid_argument,
1349 ">>> ERROR (FieldContainer): Invalid operator type");
1353 this -> resize(newDimensions);
1364 template<
class Scalar,
int ArrayTypeId>
1366 for (
int i=0; i < this->size(); i++) {
1373 template<
class Scalar,
int ArrayTypeId>
1375 return data_[
this -> getEnumeration(multiIndex)];
1380 template<
class Scalar,
int ArrayTypeId>
1382 const Teuchos::Array<int>& multiIndex) {
1383 data_[
this -> getEnumeration(multiIndex)] = dataValue;
1388 template<
class Scalar,
int ArrayTypeId>
1391 data_[order] = dataValue;
1396 template<
class Scalar,
int ArrayTypeId>
1398 #ifdef HAVE_INTREPID_DEBUG
1399 TEUCHOS_TEST_FOR_EXCEPTION( (dataArray.size() != (data_.size()) ),
1400 std::invalid_argument,
1401 ">>> ERROR (FieldContainer): Size of argument does not match the size of container.");
1403 data_.assign(dataArray.begin(),dataArray.end());
1404 data_ptr_ = data_.begin();
1409 template<
class Scalar,
int ArrayTypeId>
1413 #ifdef HAVE_INTREPID_DEBUG
1414 TEUCHOS_TEST_FOR_EXCEPTION( (numData !=
this -> size() ), std::invalid_argument,
1415 ">>> ERROR (FieldContainer): Number of data does not match the size of container.");
1418 data_.assign(dataPtr, dataPtr + numData);
1419 data_ptr_ = data_.begin();
1424 template<
class Scalar,
int ArrayTypeId>
1427 #ifdef HAVE_INTREPID_DEBUG
1428 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
1429 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1430 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1431 ">>> ERROR (FieldContainer): index is out of range.");
1433 return data_ptr_[i0];
1437 template<
class Scalar,
int ArrayTypeId>
1440 #ifdef HAVE_INTREPID_DEBUG
1441 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 1), std::invalid_argument,
1442 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1443 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1444 ">>> ERROR (FieldContainer): index is out of range.");
1446 return data_ptr_[i0];
1451 template<
class Scalar,
int ArrayTypeId>
1455 #ifdef HAVE_INTREPID_DEBUG
1456 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
1457 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1458 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1459 ">>> ERROR (FieldContainer): 1st index is out of range.");
1460 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1461 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1463 return data_ptr_[i0*dim1_ + i1];
1467 template<
class Scalar,
int ArrayTypeId>
1471 #ifdef HAVE_INTREPID_DEBUG
1472 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 2), std::invalid_argument,
1473 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1474 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1475 ">>> ERROR (FieldContainer): 1st index is out of range.");
1476 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1477 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1479 return data_ptr_[i0*dim1_ + i1];
1484 template<
class Scalar,
int ArrayTypeId>
1489 #ifdef HAVE_INTREPID_DEBUG
1490 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
1491 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1492 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1493 ">>> ERROR (FieldContainer): 1st index is out of range.");
1494 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1495 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1496 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1497 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1499 return data_ptr_[(i0*dim1_ + i1)*dim2_ + i2];
1502 template<
class Scalar,
int ArrayTypeId>
1507 #ifdef HAVE_INTREPID_DEBUG
1508 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 3), std::invalid_argument,
1509 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1510 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1511 ">>> ERROR (FieldContainer): 1st index is out of range.");
1512 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1513 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1514 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1515 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1517 return data_ptr_[(i0*dim1_ + i1)*dim2_ + i2];
1522 template<
class Scalar,
int ArrayTypeId>
1526 const int i3)
const {
1527 #ifdef HAVE_INTREPID_DEBUG
1528 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
1529 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1530 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1531 ">>> ERROR (FieldContainer): 1st index is out of range.");
1532 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1533 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1534 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1535 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1536 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1537 ">>> ERROR (FieldContainer): 4th index is out of range.");
1539 return data_ptr_[( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3];
1543 template<
class Scalar,
int ArrayTypeId>
1548 #ifdef HAVE_INTREPID_DEBUG
1549 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 4), std::invalid_argument,
1550 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1551 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1552 ">>> ERROR (FieldContainer): 1st index is out of range.");
1553 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1554 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1555 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1556 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1557 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1558 ">>> ERROR (FieldContainer): 4th index is out of range.");
1560 return data_ptr_[( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3];
1565 template<
class Scalar,
int ArrayTypeId>
1570 const int i4)
const {
1571 #ifdef HAVE_INTREPID_DEBUG
1572 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
1573 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1574 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1575 ">>> ERROR (FieldContainer): 1st index is out of range.");
1576 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1577 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1578 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1579 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1580 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1581 ">>> ERROR (FieldContainer): 4th index is out of range.");
1582 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
1583 ">>> ERROR (FieldContainer): 5th index is out of range.");
1585 return data_ptr_[( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4];
1588 template<
class Scalar,
int ArrayTypeId>
1594 #ifdef HAVE_INTREPID_DEBUG
1595 TEUCHOS_TEST_FOR_EXCEPTION( (
this -> rank() != 5), std::invalid_argument,
1596 ">>> ERROR (FieldContainer): Number of indices does not match rank of the container.");
1597 TEUCHOS_TEST_FOR_EXCEPTION( ( (i0 < 0) || (i0 >= dim0_) ), std::invalid_argument,
1598 ">>> ERROR (FieldContainer): 1st index is out of range.");
1599 TEUCHOS_TEST_FOR_EXCEPTION( ( (i1 < 0) || (i1 >= dim1_) ), std::invalid_argument,
1600 ">>> ERROR (FieldContainer): 2nd index is out of range.");
1601 TEUCHOS_TEST_FOR_EXCEPTION( ( (i2 < 0) || (i2 >= dim2_) ), std::invalid_argument,
1602 ">>> ERROR (FieldContainer): 3rd index is out of range.");
1603 TEUCHOS_TEST_FOR_EXCEPTION( ( (i3 < 0) || (i3 >= dim3_) ), std::invalid_argument,
1604 ">>> ERROR (FieldContainer): 4th index is out of range.");
1605 TEUCHOS_TEST_FOR_EXCEPTION( ( (i4 < 0) || (i4 >= dim4_) ), std::invalid_argument,
1606 ">>> ERROR (FieldContainer): 5th index is out of range.");
1608 return data_ptr_[( ( (i0*dim1_ + i1 )*dim2_ + i2 )*dim3_ + i3 )*dim4_ + i4];
1613 template<
class Scalar,
int ArrayTypeId>
1615 #ifdef HAVE_INTREPID_DEBUG
1616 TEUCHOS_TEST_FOR_EXCEPTION( ( (address < 0) || (address >= (
int)data_.size() ) ),
1617 std::invalid_argument,
1618 ">>> ERROR (FieldContainer): Specified address is out of range.");
1620 return data_ptr_[address];
1625 template<
class Scalar,
int ArrayTypeId>
1627 #ifdef HAVE_INTREPID_DEBUG
1628 TEUCHOS_TEST_FOR_EXCEPTION( ( (address < 0) || (address >= (
int)data_.size() ) ),
1629 std::invalid_argument,
1630 ">>> ERROR (FieldContainer): Specified address is out of range.");
1632 return data_ptr_[address];
1637 template<
class Scalar,
int ArrayTypeId>
1640 #ifdef HAVE_INTREPID_DEBUG
1641 TEUCHOS_TEST_FOR_EXCEPTION( (
this == &right ),
1642 std::invalid_argument,
1643 ">>> ERROR (FieldContainer): Invalid right-hand side to '='. Self-assignment prohibited.");
1645 dim0_ = right.
dim0_;
1646 dim1_ = right.
dim1_;
1647 dim2_ = right.
dim2_;
1648 dim3_ = right.
dim3_;
1649 dim4_ = right.
dim4_;
1650 data_.deepCopy(right.
data_());
1651 data_ptr_ = data_.begin();
1664 template<
class Scalar,
int ArrayTypeId>
1665 std::ostream& operator << (std::ostream& os, const FieldContainer<Scalar, ArrayTypeId>& container) {
1668 Teuchos::oblackholestream oldFormatState;
1669 oldFormatState.copyfmt(os);
1671 os.setf(std::ios_base::scientific, std::ios_base::floatfield);
1672 os.setf(std::ios_base::right);
1673 int myprec = os.precision();
1675 int size = container.size();
1676 int rank = container.rank();
1677 Teuchos::Array<int> multiIndex(rank);
1678 Teuchos::Array<int> dimensions;
1679 container.dimensions(dimensions);
1681 os<<
"===============================================================================\n"\
1682 <<
"\t Container size = " << size <<
"\n"
1683 <<
"\t Container rank = " << rank <<
"\n" ;
1685 if( (rank == 0 ) && (size == 0) ) {
1686 os<<
"====================================================================================\n"\
1687 <<
"| *** This is an empty container **** |\n";
1690 os<<
"\t Dimensions = ";
1692 for(
int r = 0; r < rank; r++){
1693 os <<
" (" << dimensions[r] <<
") ";
1697 os<<
"====================================================================================\n"\
1698 <<
"| Multi-index Enumeration Value |\n"\
1699 <<
"====================================================================================\n";
1702 for(
int address = 0; address < size; address++){
1703 container.getMultiIndex(multiIndex,address);
1704 std::ostringstream mistring;
1705 for(
int r = 0; r < rank; r++){
1706 mistring << multiIndex[r] << std::dec <<
" ";
1708 os.setf(std::ios::right, std::ios::adjustfield);
1709 os << std::setw(27) << mistring.str();
1710 os << std::setw(20) << address;
1712 os.setf(std::ios::left, std::ios::adjustfield);
1713 os << std::setw(myprec+8) << container[address] <<
"\n";
1716 os<<
"====================================================================================\n\n";
1719 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.