Skip to content

Commit

Permalink
Intrepid: remove ArrayWrapper as it is not needed any longer
Browse files Browse the repository at this point in the history
  • Loading branch information
mperego committed Jan 31, 2020
1 parent def4247 commit 6b9ad4f
Show file tree
Hide file tree
Showing 14 changed files with 1,696 additions and 2,001 deletions.
1 change: 0 additions & 1 deletion packages/intrepid/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ APPEND_SET(HEADERS
Shared/Intrepid_PointTools.hpp
Shared/Intrepid_PolylibDef.hpp
Shared/Intrepid_Polylib.hpp
Shared/Intrepid_Rank.hpp
Shared/Intrepid_RealSpaceToolsDef.hpp
Shared/Intrepid_RealSpaceTools.hpp
Shared/Intrepid_Types.hpp
Expand Down
2 changes: 0 additions & 2 deletions packages/intrepid/src/Cell/Intrepid_CellTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
#include "Teuchos_Assert.hpp"
#include "Teuchos_RCP.hpp"

#include <Intrepid_Rank.hpp>

namespace Intrepid {

//nn
Expand Down
634 changes: 305 additions & 329 deletions packages/intrepid/src/Cell/Intrepid_CellToolsDef.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
#include "Intrepid_FieldContainer.hpp"
#include "Intrepid_CellTools.hpp"

#include <Intrepid_Rank.hpp>


namespace Intrepid {

Expand Down Expand Up @@ -1034,14 +1032,8 @@ class FunctionSpaceTools {
const ArrayInDataRight & inputDataRight,
const char transpose = 'N');

/* template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
static void tensorMultiplyDataDataTemp(ArrayOutData & outputData,
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight,
const char transpose = 'N');
*/
template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight,int outvalRank>
struct tensorMultiplyDataDataTempSpec;


/** \brief Applies left (row) signs, stored in the user-provided container
<var><b>fieldSigns</b></var> and indexed by (C,L), to the operator
<var><b>inoutOperator</b></var> indexed by (C,L,R).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ void FunctionSpaceTools::integrate(Intrepid::FieldContainer<Scalar> &
const Intrepid::FieldContainer<Scalar> & rightValues,
const ECompEngine compEngine,
const bool sumInto) {
int outRank = getrank(outputValues);
int lRank = getrank(leftValues);
int outRank = outputValues.rank();
int lRank = leftValues.rank();
switch (outRank) {
case 1:{
switch (lRank){
Expand Down Expand Up @@ -1217,19 +1217,16 @@ void FunctionSpaceTools::integrate(ArrayOut & outputValues,
const ArrayInRight & rightValues,
const ECompEngine compEngine,
const bool sumInto) {
ArrayWrapper<Scalar,ArrayOut, Rank<ArrayOut >::value, false>outputValuesWrap(outputValues);
ArrayWrapper<Scalar,ArrayInLeft, Rank<ArrayInLeft >::value, true>leftValuesWrap(leftValues);
ArrayWrapper<Scalar,ArrayInRight, Rank<ArrayInRight >::value, true>rightValuesWrap(rightValues);
int outRank = getrank(outputValues);
int outRank = outputValues.rank();
switch (outRank) {
case 1:
dataIntegral<Scalar>(outputValuesWrap, leftValuesWrap, rightValuesWrap, compEngine, sumInto);
dataIntegral<Scalar>(outputValues, leftValues, rightValues, compEngine, sumInto);
break;
case 2:
functionalIntegral<Scalar>(outputValuesWrap, leftValuesWrap, rightValuesWrap, compEngine, sumInto);
functionalIntegral<Scalar>(outputValues, leftValues, rightValues, compEngine, sumInto);
break;
case 3:
operatorIntegral<Scalar>(outputValuesWrap, leftValuesWrap, rightValuesWrap, compEngine, sumInto);
operatorIntegral<Scalar>(outputValues, leftValues, rightValues, compEngine, sumInto);
break;
default:
#ifdef HAVE_INTREPID_DEBUG
Expand All @@ -1248,7 +1245,7 @@ void FunctionSpaceTools::operatorIntegral(ArrayOutFields & outputFiel
const ArrayInFieldsRight & rightFields,
const ECompEngine compEngine,
const bool sumInto) {
int lRank = getrank(leftFields);
int lRank = leftFields.rank();

switch (lRank) {
case 3:
Expand Down Expand Up @@ -1279,7 +1276,7 @@ void FunctionSpaceTools::functionalIntegral(ArrayOutFields & outputFields,
const ArrayInFields & inputFields,
const ECompEngine compEngine,
const bool sumInto) {
int dRank = getrank(inputData);
int dRank = inputData.rank();

switch (dRank) {
case 2:
Expand Down Expand Up @@ -1309,7 +1306,7 @@ void FunctionSpaceTools::dataIntegral(ArrayOutData & outputData,
const ArrayInDataRight & inputDataRight,
const ECompEngine compEngine,
const bool sumInto) {
int lRank = getrank(inputDataLeft);
int lRank = inputDataLeft.rank();

switch (lRank) {
case 2:
Expand Down Expand Up @@ -1472,7 +1469,7 @@ void FunctionSpaceTools::vectorMultiplyDataField(ArrayOutFields & outputFi
const ArrayInData & inputData,
const ArrayInFields & inputFields) {

int outRank = getrank(outputFields);
int outRank = outputFields.rank();

switch (outRank) {
case 3:
Expand All @@ -1495,7 +1492,7 @@ void FunctionSpaceTools::vectorMultiplyDataData(ArrayOutData & output
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight) {

int outRank = getrank(outputData);
int outRank = outputData.rank();

switch (outRank) {
case 2:
Expand Down Expand Up @@ -1535,52 +1532,27 @@ void FunctionSpaceTools::tensorMultiplyDataField(ArrayOutFields & outputFi

} // tensorMultiplyDataField

template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
struct FunctionSpaceTools::tensorMultiplyDataDataTempSpec<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,-1>{
tensorMultiplyDataDataTempSpec(ArrayOutData & outputData,
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight,
const char transpose) {
int outRank = getrank(outputData);

switch (outRank) {
case 3:
ArrayTools::matvecProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);
break;
case 4:
ArrayTools::matmatProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);
break;
}
}
};
template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
struct FunctionSpaceTools::tensorMultiplyDataDataTempSpec<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,3>{
tensorMultiplyDataDataTempSpec(ArrayOutData & outputData,
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight,
const char transpose) {
ArrayTools::matvecProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);

}
};
template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
struct FunctionSpaceTools::tensorMultiplyDataDataTempSpec<Scalar, ArrayOutData, ArrayInDataLeft, ArrayInDataRight,4>{
tensorMultiplyDataDataTempSpec(ArrayOutData & outputData,
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight,
const char transpose) {
ArrayTools::matmatProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);
}

};
template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
void FunctionSpaceTools::tensorMultiplyDataData(ArrayOutData & outputData,
const ArrayInDataLeft & inputDataLeft,
const ArrayInDataRight & inputDataRight,
const char transpose){
FunctionSpaceTools::tensorMultiplyDataDataTempSpec<Scalar,ArrayOutData,ArrayInDataLeft,ArrayInDataRight,Rank<ArrayOutData>::value>(outputData,inputDataLeft,inputDataRight,transpose);

int outRank = outputData.rank();

switch (outRank) {
case 3:
ArrayTools::matvecProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);
break;
case 4:
ArrayTools::matmatProductDataData<Scalar>(outputData, inputDataLeft, inputDataRight, transpose);
break;
}
}

// FunctionSpaceTools::tensorMultiplyDataDataTempSpec<Scalar,ArrayOutData,ArrayInDataLeft,ArrayInDataRight>(outputData,inputDataLeft,inputDataRight,transpose);

}
//}
template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
void FunctionSpaceTools::applyLeftFieldSigns(ArrayTypeInOut & inoutOperator,
const ArrayTypeSign & fieldSigns) {
Expand Down Expand Up @@ -1610,9 +1582,9 @@ template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
void FunctionSpaceTools::applyRightFieldSigns(ArrayTypeInOut & inoutOperator,
const ArrayTypeSign & fieldSigns) {
#ifdef HAVE_INTREPID_DEBUG
TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inoutOperator) != 3), std::invalid_argument,
TEUCHOS_TEST_FOR_EXCEPTION( (inoutOperator.rank() != 3), std::invalid_argument,
">>> ERROR (FunctionSpaceTools::applyRightFieldSigns): Input operator container must have rank 3.");
TEUCHOS_TEST_FOR_EXCEPTION( (getrank(fieldSigns) != 2), std::invalid_argument,
TEUCHOS_TEST_FOR_EXCEPTION( (fieldSigns.rank() != 2), std::invalid_argument,
">>> ERROR (FunctionSpaceTools::applyRightFieldSigns): Input field signs container must have rank 2.");
TEUCHOS_TEST_FOR_EXCEPTION( (inoutOperator.dimension(0) != fieldSigns.dimension(0) ), std::invalid_argument,
">>> ERROR (FunctionSpaceTools::applyRightFieldSigns): Zeroth dimensions (number of cells) of the operator and field signs containers must agree!");
Expand Down Expand Up @@ -1649,19 +1621,16 @@ void FunctionSpaceTools::applyFieldSigns(ArrayTypeInOut & inoutFunction,

#endif

ArrayWrapper<Scalar,ArrayTypeInOut, Rank<ArrayTypeInOut >::value, false>inoutFunctionWrap(inoutFunction);
ArrayWrapper<Scalar,ArrayTypeSign, Rank<ArrayTypeSign >::value, true>fieldSignsWrap(fieldSigns);


int numCells = inoutFunction.dimension(0);
int numFields = inoutFunction.dimension(1);
int fRank = getrank(inoutFunction);
int fRank = inoutFunction.rank();

switch (fRank) {
case 2: {
for (int cell=0; cell<numCells; cell++) {
for (int bf=0; bf<numFields; bf++) {
inoutFunctionWrap(cell, bf) *= fieldSignsWrap(cell, bf);
inoutFunction(cell, bf) *= fieldSigns(cell, bf);
}
}
}
Expand All @@ -1672,7 +1641,7 @@ void FunctionSpaceTools::applyFieldSigns(ArrayTypeInOut & inoutFunction,
for (int cell=0; cell<numCells; cell++) {
for (int bf=0; bf<numFields; bf++) {
for (int pt=0; pt<numPoints; pt++) {
inoutFunctionWrap(cell, bf, pt) *= fieldSignsWrap(cell, bf);
inoutFunction(cell, bf, pt) *= fieldSigns(cell, bf);
}
}
}
Expand All @@ -1686,7 +1655,7 @@ void FunctionSpaceTools::applyFieldSigns(ArrayTypeInOut & inoutFunction,
for (int bf=0; bf<numFields; bf++) {
for (int pt=0; pt<numPoints; pt++) {
for (int d1=0; d1<spaceDim1; d1++) {
inoutFunctionWrap(cell, bf, pt, d1) *= fieldSignsWrap(cell, bf);
inoutFunction(cell, bf, pt, d1) *= fieldSigns(cell, bf);
}
}
}
Expand All @@ -1703,7 +1672,7 @@ void FunctionSpaceTools::applyFieldSigns(ArrayTypeInOut & inoutFunction,
for (int pt=0; pt<numPoints; pt++) {
for (int d1=0; d1<spaceDim1; d1++) {
for (int d2=0; d2<spaceDim2; d2++) {
inoutFunctionWrap(cell, bf, pt, d1, d2) *= fieldSignsWrap(cell, bf);
inoutFunction(cell, bf, pt, d1, d2) *= fieldSigns(cell, bf);
}
}
}
Expand Down Expand Up @@ -1754,21 +1723,18 @@ void FunctionSpaceTools::evaluate(ArrayOutPointVals & outPointVals,
}

#endif
ArrayWrapper<Scalar,ArrayOutPointVals, Rank<ArrayOutPointVals >::value, false>outPointValsWrap(outPointVals);
ArrayWrapper<Scalar,ArrayInCoeffs, Rank<ArrayInCoeffs>::value, true>inCoeffsWrap(inCoeffs);
ArrayWrapper<Scalar,ArrayInFields, Rank<ArrayInFields>::value, true>inFieldsWrap(inFields);

int numCells = inFields.dimension(0);
int numFields = inFields.dimension(1);
int numPoints = inFields.dimension(2);
int fRank = getrank(inFields);
int fRank = inFields.rank();

switch (fRank) {
case 3: {
for (int cell=0; cell<numCells; cell++) {
for (int pt=0; pt<numPoints; pt++) {
for (int bf=0; bf<numFields; bf++) {
outPointValsWrap(cell, pt) += inCoeffsWrap(cell, bf) * inFieldsWrap(cell, bf, pt);
outPointVals(cell, pt) += inCoeffs(cell, bf) * inFields(cell, bf, pt);
}
}
}
Expand All @@ -1781,7 +1747,7 @@ void FunctionSpaceTools::evaluate(ArrayOutPointVals & outPointVals,
for (int pt=0; pt<numPoints; pt++) {
for (int d1=0; d1<spaceDim1; d1++) {
for (int bf=0; bf<numFields; bf++) {
outPointValsWrap(cell, pt, d1) += inCoeffsWrap(cell, bf) * inFieldsWrap(cell, bf, pt, d1);
outPointVals(cell, pt, d1) += inCoeffs(cell, bf) * inFields(cell, bf, pt, d1);
}
}
}
Expand All @@ -1797,7 +1763,7 @@ void FunctionSpaceTools::evaluate(ArrayOutPointVals & outPointVals,
for (int d1=0; d1<spaceDim1; d1++) {
for (int d2=0; d2<spaceDim2; d2++) {
for (int bf=0; bf<numFields; bf++) {
outPointValsWrap(cell, pt, d1, d2) += inCoeffsWrap(cell, bf) * inFieldsWrap(cell, bf, pt, d1, d2);
outPointVals(cell, pt, d1, d2) += inCoeffs(cell, bf) * inFields(cell, bf, pt, d1, d2);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/intrepid/src/Shared/Intrepid_ArrayTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include "Intrepid_Types.hpp"
#include "Teuchos_BLAS.hpp"
#include "Teuchos_Assert.hpp"
#include <Intrepid_Rank.hpp>

namespace Intrepid {

Expand Down
Loading

0 comments on commit 6b9ad4f

Please sign in to comment.