49 #ifndef INTREPID_CUBATURE_CONTROLVOLUMESIDEDEF_HPP
50 #define INTREPID_CUBATURE_CONTROLVOLUMESIDEDEF_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 numPoints_ = primaryCellTopo_->getEdgeCount();
71 cubDimension_ = primaryCellTopo_->getDimension();
75 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
77 ArrayWeight& cubWeights)
const
79 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
80 ">>> ERROR (CubatureControlVolumeSide): Cubature defined in physical space calling method for reference space cubature.");
83 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
85 ArrayWeight& cubWeights,
86 ArrayPoint& cellCoords)
const
89 int numCells = cellCoords.dimension(0);
90 int numNodesPerCell = cellCoords.dimension(1);
91 int spaceDim = cellCoords.dimension(2);
92 int numNodesPerSubCV = subCVCellTopo_->getNodeCount();
99 int numEdgesPerCell = primaryCellTopo_->getEdgeCount();
102 for (
int icell = 0; icell < numCells; icell++){
106 int numNodesPerSide = subCVCellTopo_->getNodeCount(spaceDim-1,iside);
108 for (
int i=0; i<numNodesPerSide; i++){
109 sideNodes(i) = subCVCellTopo_->getNodeMap(spaceDim-1,iside,i);
119 for (
int inode=0; inode < numNodesPerCell; inode++){
120 for(
int idim=0; idim < spaceDim; idim++){
122 for (
int i=0; i<numNodesPerSide; i++){
123 midpt += subCVCoords(icell,inode,sideNodes(i),idim);
125 cubPoints(icell,inode,idim) = midpt/numNodesPerSide;
132 for (
int idim = 0; idim < spaceDim-1; idim++){
133 sideCenterLocal(0,idim) = 0.0;
140 spaceDim-1, iside, *(subCVCellTopo_));
144 for (
int isubcv = 0; isubcv < numNodesPerCell; isubcv++) {
145 for (
int inode = 0; inode < numNodesPerSubCV; inode++){
146 for (
int idim = 0; idim < spaceDim; idim++){
147 cellCVCoords(isubcv,inode,idim) = subCVCoords(icell,isubcv,inode,idim);
160 for (
int inode = 0; inode < numNodesPerCell; inode++) {
161 for (
int idim = 0; idim < spaceDim; idim++){
162 cubWeights(icell,inode,idim) = normals(inode,0,idim)*pow(2,spaceDim-1);
166 if (primaryCellTopo_->getKey()==shards::Hexahedron<8>::key)
176 for (
int i=0; i<numNodesPerSide; i++){
177 sideNodes(i) = subCVCellTopo_->getNodeMap(spaceDim-1,iside,i);
179 int numExtraSides = numEdgesPerCell - numNodesPerCell;
180 for (
int icount=0; icount < numExtraSides; icount++){
181 int iedge = icount + numNodesPerCell;
182 for(
int idim=0; idim < spaceDim; idim++){
184 for (
int i=0; i<numNodesPerSide; i++){
185 midpt += subCVCoords(icell,icount,sideNodes(i),idim)/numNodesPerSide;
187 cubPoints(icell,iedge,idim) = midpt;
195 spaceDim-1, iside, *(subCVCellTopo_));
203 for (
int icount = 0; icount < numExtraSides; icount++) {
204 int iedge = icount + numNodesPerCell;
205 for (
int idim = 0; idim < spaceDim; idim++){
206 cubWeights(icell,iedge,idim) = normals(icount,0,idim)*pow(2,spaceDim-1);
212 if (primaryCellTopo_->getKey()==shards::Tetrahedron<4>::key)
222 for (
int i=0; i<numNodesPerSide; i++){
223 sideNodes(i) = subCVCellTopo_->getNodeMap(spaceDim-1,iside,i);
225 for (
int icount=0; icount < 3; icount++){
226 int iedge = icount + 3;
227 for(
int idim=0; idim < spaceDim; idim++){
229 for (
int i=0; i<numNodesPerSide; i++){
230 midpt += subCVCoords(icell,icount,sideNodes(i),idim)/numNodesPerSide;
232 cubPoints(icell,iedge,idim) = midpt;
240 spaceDim-1, iside, *(subCVCellTopo_));
248 for (
int icount = 0; icount < 3; icount++) {
249 int iedge = icount + 3;
250 for (
int idim = 0; idim < spaceDim; idim++){
251 cubWeights(icell,iedge,idim) = normals(icount,0,idim)*pow(2,spaceDim-1);
262 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
267 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
269 return cubDimension_;
272 template<
class Scalar,
class ArrayPo
int,
class ArrayWeight>
274 accuracy.assign(1,degree_);
CubatureControlVolumeSide(const Teuchos::RCP< const shards::CellTopology > &cellTopology)
int getDimension() const
Returns dimension of integration domain.
void getAccuracy(std::vector< int > &accuracy) const
Returns max. degree of polynomials that are integrated exactly on each triangle. The return vector ha...
void getCubature(ArrayPoint &cubPoints, ArrayWeight &cubWeights) const
Returns cubature points and weights Method for reference space cubature - throws an exception...
int getNumPoints() const
Returns the number of cubature points.