50 template<
class Scalar,
class ArrayOutFields,
class ArrayInFields>
52 const ArrayInFields & inputFields) {
54 #ifdef HAVE_INTREPID_DEBUG
55 TEUCHOS_TEST_FOR_EXCEPTION( ( (getrank(inputFields) < 2) || (getrank(inputFields) > 4) ), std::invalid_argument,
56 ">>> ERROR (ArrayTools::cloneFields): Input fields container must have rank 2, 3, or 4.");
57 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != getrank(inputFields)+1), std::invalid_argument,
58 ">>> ERROR (ArrayTools::cloneFields): The rank of the input fields container must be one less than the rank of the output fields container.");
59 for (
size_t i=0; i<getrank(inputFields); i++) {
60 std::string errmsg =
">>> ERROR (ArrayTools::cloneFields): Dimensions ";
61 errmsg += (char)(48+i);
63 errmsg += (char)(48+i+1);
64 errmsg +=
" of the input and output fields containers must agree!";
65 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(i) != outputFields.dimension(i+1)), std::invalid_argument, errmsg );
73 size_t invalRank = getrank(inputFields);
74 size_t outvalRank = getrank(outputFields);
75 int numCells = outputFields.dimension(0);
76 int numFields = outputFields.dimension(1);
77 int numPoints = outputFields.dimension(2);
81 dim1Tens = outputFields.dimension(3);
83 dim2Tens = outputFields.dimension(4);
89 for(
int cl = 0; cl < numCells; cl++) {
90 for(
int bf = 0; bf < numFields; bf++) {
91 for(
int pt = 0; pt < numPoints; pt++) {
92 outputFieldsWrap(cl, bf, pt) = inputFieldswrap(bf, pt);
100 for(
int cl = 0; cl < numCells; cl++) {
101 for(
int bf = 0; bf < numFields; bf++) {
102 for(
int pt = 0; pt < numPoints; pt++) {
103 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
104 outputFieldsWrap(cl, bf, pt, iVec) = inputFieldswrap(bf, pt, iVec);
113 for(
int cl = 0; cl < numCells; cl++) {
114 for(
int bf = 0; bf < numFields; bf++) {
115 for(
int pt = 0; pt < numPoints; pt++) {
116 for(
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
117 for(
int iTens2 = 0; iTens2 < dim2Tens; iTens2++) {
118 outputFieldsWrap(cl, bf, pt, iTens1, iTens2) = inputFieldswrap(bf, pt, iTens1, iTens2);
128 TEUCHOS_TEST_FOR_EXCEPTION( !( (invalRank == 2) || (invalRank == 3) || (invalRank == 4) ), std::invalid_argument,
129 ">>> ERROR (ArrayTools::cloneFields): This method is defined only for rank-2, 3 or 4 input containers.");
135 template<
class Scalar,
class ArrayOutFields,
class ArrayInFactors,
class ArrayInFields>
137 const ArrayInFactors & inputFactors,
138 const ArrayInFields & inputFields) {
140 #ifdef HAVE_INTREPID_DEBUG
141 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputFactors) != 2), std::invalid_argument,
142 ">>> ERROR (ArrayTools::cloneScaleFields): The rank of the input factors container must be 2.");
143 TEUCHOS_TEST_FOR_EXCEPTION( ( (getrank(inputFields) < 2) || (getrank(inputFields) > 4) ), std::invalid_argument,
144 ">>> ERROR (ArrayTools::cloneScaleFields): Input fields container must have rank 2, 3, or 4.");
145 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(outputFields) != getrank(inputFields)+1), std::invalid_argument,
146 ">>> ERROR (ArrayTools::cloneScaleFields): The rank of the input fields container must be one less than the rank of the output fields container.");
147 TEUCHOS_TEST_FOR_EXCEPTION( ( inputFactors.dimension(0) != outputFields.dimension(0) ), std::invalid_argument,
148 ">>> ERROR (ArrayTools::cloneScaleFields): Zeroth dimensions of input factors container and output fields container (numbers of integration domains) must agree!");
149 TEUCHOS_TEST_FOR_EXCEPTION( ( inputFactors.dimension(1) != outputFields.dimension(1) ), std::invalid_argument,
150 ">>> ERROR (ArrayTools::cloneScaleFields): First dimensions of input factors container and output fields container (numbers of fields) must agree!");
151 for (
size_t i=0; i<getrank(inputFields); i++) {
152 std::string errmsg =
">>> ERROR (ArrayTools::cloneScaleFields): Dimensions ";
153 errmsg += (char)(48+i);
155 errmsg += (char)(48+i+1);
156 errmsg +=
" of the input and output fields containers must agree!";
157 TEUCHOS_TEST_FOR_EXCEPTION( (inputFields.dimension(i) != outputFields.dimension(i+1)), std::invalid_argument, errmsg );
165 size_t invalRank = getrank(inputFields);
166 size_t outvalRank = getrank(outputFields);
167 int numCells = outputFields.dimension(0);
168 int numFields = outputFields.dimension(1);
169 int numPoints = outputFields.dimension(2);
172 if (outvalRank > 3) {
173 dim1Tens = outputFields.dimension(3);
174 if (outvalRank > 4) {
175 dim2Tens = outputFields.dimension(4);
181 for(
int cl = 0; cl < numCells; cl++) {
182 for(
int bf = 0; bf < numFields; bf++) {
183 for(
int pt = 0; pt < numPoints; pt++) {
184 outputFieldsWrap(cl, bf, pt) = inputFieldsWrap(bf, pt) * inputFactorswrap(cl, bf);
192 for(
int cl = 0; cl < numCells; cl++) {
193 for(
int bf = 0; bf < numFields; bf++) {
194 for(
int pt = 0; pt < numPoints; pt++) {
195 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
196 outputFieldsWrap(cl, bf, pt, iVec) = inputFieldsWrap(bf, pt, iVec) * inputFactorswrap(cl, bf);
205 for(
int cl = 0; cl < numCells; cl++) {
206 for(
int bf = 0; bf < numFields; bf++) {
207 for(
int pt = 0; pt < numPoints; pt++) {
208 for(
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
209 for(
int iTens2 = 0; iTens2 < dim2Tens; iTens2++) {
210 outputFieldsWrap(cl, bf, pt, iTens1, iTens2) = inputFieldsWrap(bf, pt, iTens1, iTens2) * inputFactorswrap(cl, bf);
220 TEUCHOS_TEST_FOR_EXCEPTION( !( (invalRank == 2) || (invalRank == 3) || (invalRank == 4) ), std::invalid_argument,
221 ">>> ERROR (ArrayTools::cloneScaleFields): This method is defined only for rank-2, 3 or 4 input containers.");
227 template<
class Scalar,
class ArrayInOutFields,
class ArrayInFactors>
229 const ArrayInFactors & inputFactors) {
231 #ifdef HAVE_INTREPID_DEBUG
232 TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inputFactors) != 2), std::invalid_argument,
233 ">>> ERROR (ArrayTools::scaleFields): The rank of the input factors container must be 2.");
234 TEUCHOS_TEST_FOR_EXCEPTION( ( (getrank(inoutFields) < 3) || (getrank(inoutFields) > 5) ), std::invalid_argument,
235 ">>> ERROR (ArrayTools::scaleFields): Input/output fields container must have rank 3, 4, or 5.");
236 TEUCHOS_TEST_FOR_EXCEPTION( ( inputFactors.dimension(0) != inoutFields.dimension(0) ), std::invalid_argument,
237 ">>> ERROR (ArrayTools::scaleFields): Zeroth dimensions of input factors container and input/output fields container (numbers of integration domains) must agree!");
238 TEUCHOS_TEST_FOR_EXCEPTION( ( inputFactors.dimension(1) != inoutFields.dimension(1) ), std::invalid_argument,
239 ">>> ERROR (ArrayTools::scaleFields): First dimensions (number of fields) of input factors and input/output fields containers must agree!");
244 size_t inoutRank = getrank(inoutFields);
245 int numCells = inoutFields.dimension(0);
246 int numFields = inoutFields.dimension(1);
247 int numPoints = inoutFields.dimension(2);
251 dim1Tens = inoutFields.dimension(3);
253 dim2Tens = inoutFields.dimension(4);
259 for(
int cl = 0; cl < numCells; cl++) {
260 for(
int bf = 0; bf < numFields; bf++) {
261 for(
int pt = 0; pt < numPoints; pt++) {
262 inoutFieldsWrap(cl, bf, pt) = inoutFieldsWrap(cl, bf, pt) * inputFactorsWrap(cl, bf);
270 for(
int cl = 0; cl < numCells; cl++) {
271 for(
int bf = 0; bf < numFields; bf++) {
272 for(
int pt = 0; pt < numPoints; pt++) {
273 for(
int iVec = 0; iVec < dim1Tens; iVec++) {
274 inoutFieldsWrap(cl, bf, pt, iVec) = inoutFieldsWrap(cl, bf, pt, iVec) * inputFactorsWrap(cl, bf);
283 for(
int cl = 0; cl < numCells; cl++) {
284 for(
int bf = 0; bf < numFields; bf++) {
285 for(
int pt = 0; pt < numPoints; pt++) {
286 for(
int iTens1 = 0; iTens1 < dim1Tens; iTens1++) {
287 for(
int iTens2 = 0; iTens2 < dim2Tens; iTens2++) {
288 inoutFieldsWrap(cl, bf, pt, iTens1, iTens2) = inoutFieldsWrap(cl, bf, pt, iTens1, iTens2) * inputFactorsWrap(cl, bf);
298 TEUCHOS_TEST_FOR_EXCEPTION( !( (inoutRank == 3) || (inoutRank == 4) || (inoutRank == 5) ), std::invalid_argument,
299 ">>> ERROR (ArrayTools::cloneScaleFields): This method is defined only for rank-3, 4 or 5 input/output containers.");