49 #ifndef INTREPID_UTILS_HPP
50 #define INTREPID_UTILS_HPP
52 #include "Intrepid_ConfigDefs.hpp"
53 #include "Intrepid_Rank.hpp"
55 #include "Teuchos_Array.hpp"
56 #include "Teuchos_oblackholestream.hpp"
57 #include "Teuchos_RCP.hpp"
80 int getFieldRank(
const EFunctionSpace spaceType);
119 int getOperatorRank(
const EFunctionSpace spaceType,
120 const EOperator operatorType,
130 int getOperatorOrder(
const EOperator operatorType);
158 int getDkEnumeration(
const int xMult,
159 const int yMult = -1,
160 const int zMult = -1);
172 void getDkMultiplicities(Teuchos::Array<int>& partialMult,
173 const int derivativeEnum,
174 const EOperator operatorType,
197 int getDkCardinality(
const EOperator operatorType,
221 void setOrdinalTagData(std::vector<std::vector<std::vector<int> > > &tagToOrdinal,
222 std::vector<std::vector<int> > &ordinalToTag,
240 enum TypeOfExactData{
241 INTREPID_UTILS_FRACTION=0,
242 INTREPID_UTILS_SCALAR
263 template<
class Scalar>
264 int compareToAnalytic(
const Teuchos::Array< Teuchos::Array<Scalar> > testMat,
265 std::ifstream & inputFile,
268 TypeOfExactData analyticDataType = INTREPID_UTILS_FRACTION);
283 template<
class Scalar>
284 int compareToAnalytic(
const Scalar * testMat,
285 std::ifstream & inputFile,
288 TypeOfExactData analyticDataType = INTREPID_UTILS_FRACTION);
301 template<
class Scalar>
302 void getAnalytic(Teuchos::Array< Teuchos::Array<Scalar> > & testMat,
303 std::ifstream & inputFile,
304 TypeOfExactData analyticDataType = INTREPID_UTILS_FRACTION);
315 template<
class Scalar>
316 void getAnalytic(Scalar * testMat,
317 std::ifstream & inputFile,
318 TypeOfExactData analyticDataType = INTREPID_UTILS_FRACTION);
338 template<
class Array>
339 bool requireRankRange(std::string& errmsg,
341 const int lowerBound,
342 const int upperBound);
354 template<
class Array1,
class Array2>
355 bool requireRankMatch(std::string& errmsg,
356 const Array1& array1,
357 const Array2& array2);
371 template<
class Array>
372 bool requireDimensionRange(std::string& errmsg,
375 const int lowerBound,
376 const int upperBound);
390 template<
class Array1,
class Array2>
391 bool requireDimensionMatch(std::string& errmsg,
392 const Array1& array1,
394 const Array2& array2,
411 template<
class Array1,
class Array2>
412 bool requireDimensionMatch(std::string& errmsg,
413 const Array1& array1,
414 const int a1_dim0,
const int a1_dim1,
415 const Array2& array2,
416 const int a2_dim0,
const int a2_dim1);
434 template<
class Array1,
class Array2>
435 bool requireDimensionMatch(std::string& errmsg,
436 const Array1& array1,
437 const int a1_dim0,
const int a1_dim1,
const int a1_dim2,
438 const Array2& array2,
439 const int a2_dim0,
const int a2_dim1,
const int a2_dim2);
459 template<
class Array1,
class Array2>
460 bool requireDimensionMatch(std::string& errmsg,
461 const Array1& array1,
462 const int a1_dim0,
const int a1_dim1,
const int a1_dim2,
const int a1_dim3,
463 const Array2& array2,
464 const int a2_dim0,
const int a2_dim1,
const int a2_dim2,
const int a2_dim3);
486 template<
class Array1,
class Array2>
487 bool requireDimensionMatch(std::string& errmsg,
488 const Array1& array1,
489 const int a1_dim0,
const int a1_dim1,
490 const int a1_dim2,
const int a1_dim3,
const int a1_dim4,
491 const Array2& array2,
492 const int a2_dim0,
const int a2_dim1,
493 const int a2_dim2,
const int a2_dim3,
const int a2_dim4);
505 template<
class Array1,
class Array2>
506 bool requireDimensionMatch(std::string& errmsg,
507 const Array1& array1,
508 const Array2& array2);
527 template<
class Scalar>
528 int compareToAnalytic(
const Teuchos::Array< Teuchos::Array<Scalar> > testMat,
529 std::ifstream & inputFile,
532 TypeOfExactData analyticDataType ) {
536 Teuchos::RCP<std::ostream> outStream;
537 Teuchos::oblackholestream bhs;
539 outStream = Teuchos::rcp(&std::cout,
false);
541 outStream = Teuchos::rcp(&bhs,
false);
544 Teuchos::oblackholestream oldFormatState;
545 oldFormatState.copyfmt(std::cout);
554 while (! inputFile.eof() )
556 std::getline (inputFile,line);
557 std::istringstream linestream(line);
560 while( linestream >> chunk ) {
563 std::string::size_type loc = chunk.find(
"/", 0);
564 if( loc != std::string::npos ) {
565 chunk.replace( loc, 1,
" ");
566 std::istringstream chunkstream(chunk);
569 testentry = (Scalar)(num1)/(Scalar)(num2);
570 abstol = ( std::fabs(testentry) < reltol ? reltol : std::fabs(reltol*testentry) );
571 absdiff = std::fabs(testentry - testMat[i][j]);
572 if (absdiff > abstol) {
574 *outStream <<
"FAILURE --> ";
576 *outStream <<
"entry[" << i <<
"," << j <<
"]:" <<
" "
577 << testMat[i][j] <<
" " << num1 <<
"/" << num2 <<
" "
578 << absdiff <<
" " <<
"<?" <<
" " << abstol <<
"\n";
581 std::istringstream chunkstream(chunk);
582 if (analyticDataType == INTREPID_UTILS_FRACTION) {
584 testentry = (Scalar)(num1);
586 else if (analyticDataType == INTREPID_UTILS_SCALAR)
587 chunkstream >> testentry;
588 abstol = ( std::fabs(testentry) < reltol ?reltol : std::fabs(reltol*testentry) );
589 absdiff = std::fabs(testentry - testMat[i][j]);
590 if (absdiff > abstol) {
592 *outStream <<
"FAILURE --> ";
594 *outStream <<
"entry[" << i <<
"," << j <<
"]:" <<
" "
595 << testMat[i][j] <<
" " << testentry <<
" "
596 << absdiff <<
" " <<
"<?" <<
" " << abstol <<
"\n";
604 std::cout.copyfmt(oldFormatState);
611 template<
class Scalar>
612 int compareToAnalytic(
const Scalar * testMat,
613 std::ifstream & inputFile,
616 TypeOfExactData analyticDataType ) {
620 Teuchos::RCP<std::ostream> outStream;
621 Teuchos::oblackholestream bhs;
623 outStream = Teuchos::rcp(&std::cout,
false);
625 outStream = Teuchos::rcp(&bhs,
false);
628 Teuchos::oblackholestream oldFormatState;
629 oldFormatState.copyfmt(std::cout);
635 int i=0, j=0, offset=0;
638 while (! inputFile.eof() )
640 std::getline (inputFile,line);
641 std::istringstream linestream(line);
644 while( linestream >> chunk ) {
647 std::string::size_type loc = chunk.find(
"/", 0);
648 if( loc != std::string::npos ) {
649 chunk.replace( loc, 1,
" ");
650 std::istringstream chunkstream(chunk);
653 testentry = (Scalar)(num1)/(Scalar)(num2);
654 abstol = ( std::fabs(testentry) < reltol ? reltol : std::fabs(reltol*testentry) );
655 absdiff = std::fabs(testentry - testMat[i*offset+j]);
656 if (absdiff > abstol) {
658 *outStream <<
"FAILURE --> ";
660 *outStream <<
"entry[" << i <<
"," << j <<
"]:" <<
" "
661 << testMat[i*offset+j] <<
" " << num1 <<
"/" << num2 <<
" "
662 << absdiff <<
" " <<
"<?" <<
" " << abstol <<
"\n";
665 std::istringstream chunkstream(chunk);
666 if (analyticDataType == INTREPID_UTILS_FRACTION) {
668 testentry = (Scalar)(num1);
670 else if (analyticDataType == INTREPID_UTILS_SCALAR)
671 chunkstream >> testentry;
672 abstol = ( std::fabs(testentry) < reltol ?reltol : std::fabs(reltol*testentry) );
673 absdiff = std::fabs(testentry - testMat[i*offset+j]);
674 if (absdiff > abstol) {
676 *outStream <<
"FAILURE --> ";
678 *outStream <<
"entry[" << i <<
"," << j <<
"]:" <<
" "
679 << testMat[i*offset+j] <<
" " << testentry <<
" "
680 << absdiff <<
" " <<
"<?" <<
" " << abstol <<
"\n";
689 std::cout.copyfmt(oldFormatState);
696 template<
class Scalar>
697 void getAnalytic(Teuchos::Array< Teuchos::Array<Scalar> > & testMat,
698 std::ifstream & inputFile,
699 TypeOfExactData analyticDataType ) {
702 Teuchos::oblackholestream oldFormatState;
703 oldFormatState.copyfmt(std::cout);
709 while (! inputFile.eof() )
711 std::getline (inputFile,line);
712 std::istringstream linestream(line);
715 while( linestream >> chunk ) {
718 std::string::size_type loc = chunk.find(
"/", 0);
719 if( loc != std::string::npos ) {
720 chunk.replace( loc, 1,
" ");
721 std::istringstream chunkstream(chunk);
724 testentry = (Scalar)(num1)/(Scalar)(num2);
725 testMat[i][j] = testentry;
728 std::istringstream chunkstream(chunk);
729 if (analyticDataType == INTREPID_UTILS_FRACTION) {
731 testentry = (Scalar)(num1);
733 else if (analyticDataType == INTREPID_UTILS_SCALAR)
734 chunkstream >> testentry;
735 testMat[i][j] = testentry;
743 std::cout.copyfmt(oldFormatState);
748 template<
class Scalar>
749 void getAnalytic(Scalar * testMat,
750 std::ifstream & inputFile,
751 TypeOfExactData analyticDataType) {
754 Teuchos::oblackholestream oldFormatState;
755 oldFormatState.copyfmt(std::cout);
759 int i=0, j=0, offset=0;
761 while (! inputFile.eof() )
763 std::getline (inputFile,line);
764 std::istringstream linestream(line);
767 while( linestream >> chunk ) {
770 std::string::size_type loc = chunk.find(
"/", 0);
771 if( loc != std::string::npos ) {
772 chunk.replace( loc, 1,
" ");
773 std::istringstream chunkstream(chunk);
776 testentry = (Scalar)(num1)/(Scalar)(num2);
777 testMat[i*offset+j] = testentry;
780 std::istringstream chunkstream(chunk);
781 if (analyticDataType == INTREPID_UTILS_FRACTION) {
783 testentry = (Scalar)(num1);
785 else if (analyticDataType == INTREPID_UTILS_SCALAR)
786 chunkstream >> testentry;
787 testMat[i*offset+j] = testentry;
796 std::cout.copyfmt(oldFormatState);
807 template<
class Array>
808 bool requireRankRange(std::string& errmsg,
810 const int lowerBound,
811 const int upperBound){
813 TEUCHOS_TEST_FOR_EXCEPTION( (lowerBound > upperBound) , std::invalid_argument,
814 ">>> ERROR (Intrepid_Utils::requireRankRange): lowerBound <= upperBound required!");
817 if( (lowerBound == upperBound) && !(getrank(array) == (
size_t)lowerBound) ) {
818 errmsg +=
"\n>>> Array rank = ";
819 errmsg += (char)(48 + getrank(array) );
820 errmsg +=
" while rank-";
821 errmsg += (char) (48 + lowerBound);
822 errmsg +=
" array required.";
825 else if ( (lowerBound < upperBound) && !( ((size_t)lowerBound <= getrank(array) ) && (getrank(array) <= (size_t)upperBound) ) ){
826 errmsg +=
"\n>>> Array rank = ";
827 errmsg += (char)(48 + getrank(array) );
828 errmsg +=
" while a rank between ";
829 errmsg += (char) (48 + lowerBound);
831 errmsg += (char) (48 + upperBound);
832 errmsg +=
" is required.";
839 template<
class Array1,
class Array2>
840 bool requireRankMatch(std::string& errmsg,
841 const Array1& array1,
842 const Array2& array2){
844 if(getrank(array1) != getrank(array2) ) {
845 errmsg +=
"\n>>> Array ranks are required to match.";
852 template<
class Array>
853 bool requireDimensionRange(std::string& errmsg,
856 const int lowerBound,
857 const int upperBound){
859 TEUCHOS_TEST_FOR_EXCEPTION( (lowerBound > upperBound) , std::invalid_argument,
860 ">>> ERROR (Intrepid_Utils::requireDimensionRange): lowerBound <= upperBound required!");
861 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= dim) && ((
size_t)dim < getrank(array) ) ),
862 std::invalid_argument,
863 ">>> ERROR (Intrepid_Utils::requireDimensionRange): 0 <= dim < array.rank() required!");
866 if( (lowerBound > upperBound) || ( (
size_t)dim >= getrank(array) ) ) {
867 errmsg +=
"\n>>> Unexpected error: ";
870 if( (lowerBound == upperBound) && !(static_cast<int>(array.dimension(dim)) == lowerBound) ) {
871 errmsg +=
"\n>>> dimension(";
872 errmsg += (char)(48 + dim);
874 errmsg += (char)(48 + array.dimension(dim) );
875 errmsg +=
" while dimension(";
876 errmsg += (char)(48 + dim);
878 errmsg += (char)(48 + lowerBound);
879 errmsg +=
" required.";
882 else if( (lowerBound < upperBound) &&
883 !( ((size_t)lowerBound <= (
size_t)array.dimension(dim) ) && (static_cast<size_t>(array.dimension(dim)) <= (
size_t)upperBound) ) ){
884 errmsg +=
"\n>>> dimension(";
885 errmsg += (char)(48 + dim);
887 errmsg += (char)(48 + array.dimension(dim) );
889 errmsg += (char)(48 + lowerBound);
890 errmsg +=
" <= dimension(";
891 errmsg += (char)(48 + dim);
893 errmsg +=(char)(48 + upperBound);
894 errmsg +=
" required.";
902 template<
class Array1,
class Array2>
903 bool requireDimensionMatch(std::string& errmsg,
904 const Array1& array1,
906 const Array2& array2,
909 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim0) && ((
size_t)a1_dim0 < getrank(array1) ) ),
910 std::invalid_argument,
911 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim0 < array1.rank() required!");
912 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim0) && ((
size_t)a2_dim0 < getrank(array2) ) ),
913 std::invalid_argument,
914 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim0 < array2.rank() required!");
917 if(static_cast<int>(array1.dimension(a1_dim0)) != static_cast<int>(array2.dimension(a2_dim0)) ){
918 errmsg +=
"\n>>> dimension(";
919 errmsg += (char)(48 + a1_dim0);
920 errmsg +=
") of 1st array and dimension(";
921 errmsg += (char)(48 + a2_dim0);
922 errmsg +=
") of 2nd array are required to match.";
930 template<
class Array1,
class Array2>
931 bool requireDimensionMatch(std::string& errmsg,
932 const Array1& array1,
933 const int a1_dim0,
const int a1_dim1,
934 const Array2& array2,
935 const int a2_dim0,
const int a2_dim1){
937 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim0) && ((
size_t)a1_dim0 < getrank(array1) ) ),
938 std::invalid_argument,
939 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim0 < array1.rank() required!");
940 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim1) && ((
size_t)a1_dim1 < getrank(array1) ) ),
941 std::invalid_argument,
942 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim1 < array1.rank() required!");
943 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim0) && ((
size_t)a2_dim0 < getrank(array2) ) ),
944 std::invalid_argument,
945 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim0 < array2.rank() required!");
946 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim1) && ((
size_t)a2_dim1 < getrank(array2) ) ),
947 std::invalid_argument,
948 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim1 < array2.rank() required!");
951 if( !requireDimensionMatch(errmsg, array1, a1_dim0, array2, a2_dim0) ){
954 if( !requireDimensionMatch(errmsg, array1, a1_dim1, array2, a2_dim1) ){
962 template<
class Array1,
class Array2>
963 bool requireDimensionMatch(std::string& errmsg,
964 const Array1& array1,
965 const int a1_dim0,
const int a1_dim1,
const int a1_dim2,
966 const Array2& array2,
967 const int a2_dim0,
const int a2_dim1,
const int a2_dim2){
969 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim0) && ((
size_t)a1_dim0 < getrank(array1) ) ),
970 std::invalid_argument,
971 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim0 < array1.rank() required!");
972 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim1) && ((
size_t)a1_dim1 < getrank(array1) ) ),
973 std::invalid_argument,
974 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim1 < array1.rank() required!");
975 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim2) && ((
size_t)a1_dim2 < getrank(array1) ) ),
976 std::invalid_argument,
977 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim2 < array1.rank() required!");
978 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim0) && ((
size_t)a2_dim0 < getrank(array2) ) ),
979 std::invalid_argument,
980 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim0 < array2.rank() required!");
981 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim1) && ((
size_t)a2_dim1 < getrank(array2) ) ),
982 std::invalid_argument,
983 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim1 < array2.rank() required!");
984 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim2) && ((
size_t)a2_dim2 < getrank(array2) ) ),
985 std::invalid_argument,
986 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim2 < array2.rank() required!");
990 if( !requireDimensionMatch(errmsg, array1, a1_dim0, array2, a2_dim0) ){
993 if( !requireDimensionMatch(errmsg, array1, a1_dim1, array2, a2_dim1) ){
996 if( !requireDimensionMatch(errmsg, array1, a1_dim2, array2, a2_dim2) ){
1004 template<
class Array1,
class Array2>
1005 bool requireDimensionMatch(std::string& errmsg,
1006 const Array1& array1,
1007 const int a1_dim0,
const int a1_dim1,
const int a1_dim2,
const int a1_dim3,
1008 const Array2& array2,
1009 const int a2_dim0,
const int a2_dim1,
const int a2_dim2,
const int a2_dim3){
1011 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim0) && ((
size_t)a1_dim0 < getrank(array1) ) ),
1012 std::invalid_argument,
1013 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim0 < array1.rank() required!");
1014 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim1) && ((
size_t)a1_dim1 < getrank(array1) ) ),
1015 std::invalid_argument,
1016 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim1 < array1.rank() required!");
1017 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim2) && ((
size_t)a1_dim2 < getrank(array1) ) ),
1018 std::invalid_argument,
1019 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim2 < array1.rank() required!");
1020 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim3) && ((
size_t)a1_dim3 < getrank(array1) ) ),
1021 std::invalid_argument,
1022 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim3 < array1.rank() required!");
1023 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim0) && ((
size_t)a2_dim0 < getrank(array2) ) ),
1024 std::invalid_argument,
1025 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim0 < array2.rank() required!");
1026 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim1) && ((
size_t)a2_dim1 < getrank(array2) ) ),
1027 std::invalid_argument,
1028 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim1 < array2.rank() required!");
1029 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim2) && ((
size_t)a2_dim2 < getrank(array2) ) ),
1030 std::invalid_argument,
1031 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim2 < array2.rank() required!");
1032 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim3) && ((
size_t)a2_dim3 < getrank(array2) ) ),
1033 std::invalid_argument,
1034 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim3 < array2.rank() required!");
1036 if( !requireDimensionMatch(errmsg, array1, static_cast<int>(a1_dim0), array2, static_cast<int>(a2_dim0)) ){
1039 if( !requireDimensionMatch(errmsg, array1, a1_dim1, array2, a2_dim1) ){
1042 if( !requireDimensionMatch(errmsg, array1, a1_dim2, array2, a2_dim2) ){
1045 if( !requireDimensionMatch(errmsg, array1, a1_dim3, array2, a2_dim3) ){
1053 template<
class Array1,
class Array2>
1054 bool requireDimensionMatch(std::string& errmsg,
1055 const Array1& array1,
1056 const int a1_dim0,
const int a1_dim1,
const int a1_dim2,
1057 const int a1_dim3,
const int a1_dim4,
1058 const Array2& array2,
1059 const int a2_dim0,
const int a2_dim1,
const int a2_dim2,
1060 const int a2_dim3,
const int a2_dim4){
1062 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim0) && ((
size_t)a1_dim0 < getrank(array1) ) ),
1063 std::invalid_argument,
1064 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim0 < array1.rank() required!");
1065 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim1) && ((
size_t)a1_dim1 < getrank(array1) ) ),
1066 std::invalid_argument,
1067 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim1 < array1.rank() required!");
1068 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim2) && ((
size_t)a1_dim2 < getrank(array1) ) ),
1069 std::invalid_argument,
1070 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim2 < array1.rank() required!");
1071 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim3) && ((
size_t)a1_dim3 < getrank(array1) ) ),
1072 std::invalid_argument,
1073 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim3 < array1.rank() required!");
1074 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a1_dim4) && ((
size_t)a1_dim4 < getrank(array1) ) ),
1075 std::invalid_argument,
1076 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a1_dim4 < array1.rank() required!");
1077 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim0) && ((
size_t)a2_dim0 < getrank(array2) ) ),
1078 std::invalid_argument,
1079 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim0 < array2.rank() required!");
1080 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim1) && ((
size_t)a2_dim1 < getrank(array2) ) ),
1081 std::invalid_argument,
1082 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim1 < array2.rank() required!");
1083 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim2) && ((
size_t)a2_dim2 < getrank(array2) ) ),
1084 std::invalid_argument,
1085 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim2 < array2.rank() required!");
1086 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim3) && ((
size_t)a2_dim3 < getrank(array2) ) ),
1087 std::invalid_argument,
1088 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim3 < array2.rank() required!");
1089 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= a2_dim4) && ((
size_t)a2_dim4 < getrank(array2) ) ),
1090 std::invalid_argument,
1091 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): 0 <= a2_dim4 < array2.rank() required!");
1094 if( !requireDimensionMatch(errmsg, array1, a1_dim0, array2, a2_dim0) ){
1097 if( !requireDimensionMatch(errmsg, array1, a1_dim1, array2, a2_dim1) ){
1100 if( !requireDimensionMatch(errmsg, array1, a1_dim2, array2, a2_dim2) ){
1103 if( !requireDimensionMatch(errmsg, array1, a1_dim3, array2, a2_dim3) ){
1106 if( !requireDimensionMatch(errmsg, array1, a1_dim4, array2, a2_dim4) ){
1114 template<
class Array1,
class Array2>
1115 bool requireDimensionMatch(std::string& errmsg,
1116 const Array1& array1,
1117 const Array2& array2){
1119 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankMatch(errmsg, array1, array2 ), std::invalid_argument,
1120 ">>> ERROR (Intrepid_Utils::requireDimensionMatch): Arrays with equal ranks are required to test for all dimensions match." )
1123 for(
size_t dim = 0; dim < getrank(array1); dim++){
1124 if( !requireDimensionMatch(errmsg, array1, dim, array2, dim) ){
1137 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
1139 #warning "The Intrepid package is deprecated"
Contains definitions of custom data types in Intrepid.