49 #ifndef INTREPID_CUBATURE_CONTROLVOLUMEBOUNDARYDEF_HPP
50 #define INTREPID_CUBATURE_CONTROLVOLUMEBOUNDARYDEF_HPP
54 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
58 primaryCellTopo_ = cellTopology;
61 const CellTopologyData &myCellData =
62 (primaryCellTopo_->getDimension() > 2) ? *shards::getCellTopologyData<shards::Hexahedron<8> >() :
63 *shards::getCellTopologyData<shards::Quadrilateral<4> >();
65 subCVCellTopo_ = Teuchos::rcp(
new shards::CellTopology(&myCellData));
69 cubDimension_ = primaryCellTopo_->getDimension();
71 sideIndex_ = cellSide;
74 numPoints_ = primaryCellTopo_->getNodeCount(primaryCellTopo_->getDimension()-1,cellSide);
78 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
80 ArrayWeight& cubWeights)
const
82 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
83 ">>> ERROR (CubatureControlVolumeBoundary): Cubature defined in physical space calling method for reference space cubature.");
86 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
88 ArrayWeight& cubWeights,
89 ArrayPoint& cellCoords)
const
92 int numCells = cellCoords.dimension(0);
93 int numNodesPerCell = cellCoords.dimension(1);
94 int spaceDim = cellCoords.dimension(2);
95 int numNodesPerSubCV = subCVCellTopo_->getNodeCount();
102 int numPrimarySideNodes = primaryCellTopo_->getNodeCount(spaceDim-1,sideIndex_);
103 int numCVSideNodes = subCVCellTopo_->getNodeCount(spaceDim-1,0);
104 int numPrimarySides = primaryCellTopo_->getSubcellCount(spaceDim-1);
107 switch(primaryCellTopo_->getKey() ) {
109 case shards::Triangle<3>::key:
110 case shards::Quadrilateral<4>::key:
112 for (
int iside=0; iside<numPrimarySides; iside++) {
113 CVSideonBoundary(iside,0) = 0; CVSideonBoundary(iside,1) = 3;
118 case shards::Hexahedron<8>::key:
121 for (
int iside=0; iside<4; iside++) {
122 CVSideonBoundary(iside,0) = 0; CVSideonBoundary(iside,1) = 3;
123 CVSideonBoundary(iside,2) = 3; CVSideonBoundary(iside,3) = 0;
126 CVSideonBoundary(4,0) = 4; CVSideonBoundary(4,1) = 4;
127 CVSideonBoundary(4,2) = 4; CVSideonBoundary(4,3) = 4;
130 CVSideonBoundary(5,0) = 5; CVSideonBoundary(5,1) = 5;
131 CVSideonBoundary(5,2) = 5; CVSideonBoundary(5,3) = 5;
135 case shards::Tetrahedron<4>::key:
137 CVSideonBoundary(0,0) = 0; CVSideonBoundary(0,1) = 3; CVSideonBoundary(0,2) = 0;
138 CVSideonBoundary(1,0) = 0; CVSideonBoundary(1,1) = 3; CVSideonBoundary(1,2) = 3;
139 CVSideonBoundary(2,0) = 3; CVSideonBoundary(2,1) = 4; CVSideonBoundary(2,2) = 0;
140 CVSideonBoundary(3,0) = 4; CVSideonBoundary(3,1) = 4; CVSideonBoundary(3,2) = 4;
145 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
146 ">>> ERROR (CubatureControlVolumeBoundary: invalid cell topology.");
150 for (
int idim = 0; idim < spaceDim-1; idim++){
151 sideCenterLocal(0,idim) = 0.0;
155 for (
int icell = 0; icell < numCells; icell++)
158 for (
int inode=0; inode<numPrimarySideNodes; inode++){
160 int cvind = primaryCellTopo_->getNodeMap(spaceDim-1,sideIndex_,inode);
161 int cvside = CVSideonBoundary(sideIndex_,inode);
164 for (
int idim=0; idim<spaceDim; idim++) {
165 for (
int icvnode=0; icvnode<numCVSideNodes; icvnode++) {
166 int cvnode = subCVCellTopo_->getNodeMap(spaceDim-1,cvside,icvnode);
167 cubpoint(idim) = cubpoint(idim) + subCVCoords(icell,cvind,cvnode,idim);
169 cubPoints(icell,inode,idim) = cubpoint(idim)/numCVSideNodes;
176 spaceDim-1, cvside, *(subCVCellTopo_));
180 for (
int icvnode = 0; icvnode < numNodesPerSubCV; icvnode++){
181 for (
int idim = 0; idim < spaceDim; idim++){
182 cellCVCoords(0,icvnode,idim) = subCVCoords(icell,cvind,icvnode,idim);
197 Intrepid::FunctionSpaceTools::computeFaceMeasure<Scalar>(measure,subCVsideJacobian,weights,cvside,*(subCVCellTopo_));
199 else if (spaceDim == 2){
201 Intrepid::FunctionSpaceTools::computeEdgeMeasure<Scalar>(measure,subCVsideJacobian,weights,cvside,*(subCVCellTopo_));
204 cubWeights(icell,inode) = measure(0,0);
213 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
218 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
220 return cubDimension_;
223 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
225 accuracy.assign(1,degree_);
void getAccuracy(std::vector< int > &accuracy) const
Returns max. degree of polynomials that are integrated exactly. The return vector has size 1...
CubatureControlVolumeBoundary(const Teuchos::RCP< const shards::CellTopology > &cellTopology, int cellSide=0)
int getDimension() const
Returns dimension of integration domain.
int getNumPoints() const
Returns the number of cubature points.
void getCubature(ArrayPoint &cubPoints, ArrayWeight &cubWeights) const
Returns cubature points and weights Method for reference space cubature - throws an exception...