本文整理汇总了C++中BasisPtr::getDofTag方法的典型用法代码示例。如果您正苦于以下问题:C++ BasisPtr::getDofTag方法的具体用法?C++ BasisPtr::getDofTag怎么用?C++ BasisPtr::getDofTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasisPtr
的用法示例。
在下文中一共展示了BasisPtr::getDofTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: basisWeightsForEdgeInterpolant
void ParametricSurface::basisWeightsForEdgeInterpolant(FieldContainer<double> &edgeInterpolationCoefficients,
VectorBasisPtr basis,
MeshPtr mesh, int cellID)
{
vector< ParametricCurvePtr > curves = mesh->parametricEdgesForCell(cellID);
Teuchos::RCP<TransfiniteInterpolatingSurface> exactSurface = Teuchos::rcp( new TransfiniteInterpolatingSurface(curves) );
exactSurface->setNeglectVertices(false);
int basisDegree = basis->getDegree();
shards::CellTopology line_2(shards::getCellTopologyData<shards::Line<2> >() );
BasisPtr basis1D = BasisFactory::basisFactory()->getBasis(basisDegree, line_2.getKey(),
Camellia::FUNCTION_SPACE_HGRAD);
BasisPtr compBasis = basis->getComponentBasis();
int numComponents = basis->getNumComponents();
if (numComponents != 2)
{
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Only 2D surfaces supported right now");
}
edgeInterpolationCoefficients.resize(basis->getCardinality());
set<int> edgeNodeFieldIndices = BasisFactory::basisFactory()->sideFieldIndices(basis,true); // true: include vertex dofs
FieldContainer<double> dofCoords(compBasis->getCardinality(),2);
IntrepidBasisWrapper< double, Intrepid::FieldContainer<double> >* intrepidBasisWrapper = dynamic_cast< IntrepidBasisWrapper< double, Intrepid::FieldContainer<double> >* >(compBasis.get());
if (!intrepidBasisWrapper)
{
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, "compBasis does not appear to be an instance of IntrepidBasisWrapper");
}
Basis_HGRAD_QUAD_Cn_FEM<double, Intrepid::FieldContainer<double> >* intrepidBasis = dynamic_cast< Basis_HGRAD_QUAD_Cn_FEM<double, Intrepid::FieldContainer<double> >* >(intrepidBasisWrapper->intrepidBasis().get());
if (!intrepidBasis)
{
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, "IntrepidBasisWrapper does not appear to wrap Basis_HGRAD_QUAD_Cn_FEM.");
}
intrepidBasis->getDofCoords(dofCoords);
int edgeDim = 1;
int vertexDim = 0;
// set vertex dofs:
for (int vertexIndex=0; vertexIndex<curves.size(); vertexIndex++)
{
double x = exactSurface->vertices()[vertexIndex].first;
double y = exactSurface->vertices()[vertexIndex].second;
int compDofOrdinal = compBasis->getDofOrdinal(vertexDim, vertexIndex, 0);
int basisDofOrdinal_x = basis->getDofOrdinalFromComponentDofOrdinal(compDofOrdinal, 0);
int basisDofOrdinal_y = basis->getDofOrdinalFromComponentDofOrdinal(compDofOrdinal, 1);
edgeInterpolationCoefficients[basisDofOrdinal_x] = x;
edgeInterpolationCoefficients[basisDofOrdinal_y] = y;
}
for (int edgeIndex=0; edgeIndex<curves.size(); edgeIndex++)
{
bool edgeDofsFlipped = edgeIndex >= 2; // because Intrepid's ordering of dofs on the quad is not CCW but tensor-product, we need to flip for the opposite edges
// (what makes things worse is that the vertex/edge numbering *is* CCW)
if (curves.size() != 4)
{
cout << "WARNING: have not worked out the rule for flipping or not flipping edge dofs for anything but quads.\n";
}
double edgeLength = curves[edgeIndex]->linearLength();
// cout << "edgeIndex " << edgeIndex << endl;
for (int comp=0; comp<numComponents; comp++)
{
FieldContainer<double> basisCoefficients_comp;
bool useH1ForEdgeInterpolant = true; // an experiment
curves[edgeIndex]->projectionBasedInterpolant(basisCoefficients_comp, basis1D, comp, edgeLength, useH1ForEdgeInterpolant);
// cout << "for edge " << edgeIndex << " and comp " << comp << ", projection-based interpolant dofs:\n";
// cout << basisCoefficients_comp;
//// cout << "basis dof coords:\n" << dofCoords;
// int basisDofOrdinal = basis->getDofOrdinalFromComponentDofOrdinal(v0_dofOrdinal_comp, comp);
// edgeInterpolationCoefficients[basisDofOrdinal] = basisCoefficients_comp[v0_dofOrdinal_1D];
if (compBasis->getDegree() >= 2) // then there are some "middle" nodes on the edge
{
// get the first dofOrdinal for the edge, so we can check the number of edge basis functions
int firstEdgeDofOrdinal = compBasis->getDofOrdinal(edgeDim, edgeIndex, 0);
// cout << "first edge dofOrdinal: " << firstEdgeDofOrdinal << endl;
int numEdgeDofs = compBasis->getDofTag(firstEdgeDofOrdinal)[3];
if (numEdgeDofs != basis1D->getCardinality() - 2)
{
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, "numEdgeDofs does not match 1D basis cardinality");
}
for (int edgeDofOrdinal=0; edgeDofOrdinal<numEdgeDofs; edgeDofOrdinal++)
{
// determine the index into basisCoefficients_comp:
int edgeDofOrdinalIn1DBasis = edgeDofsFlipped ? numEdgeDofs - 1 - edgeDofOrdinal : edgeDofOrdinal;
int dofOrdinal1D = basis1D->getDofOrdinal(edgeDim, 0, edgeDofOrdinalIn1DBasis);
// determine the ordinal of the edge dof in the component basis:
int compDofOrdinal = compBasis->getDofOrdinal(edgeDim, edgeIndex, edgeDofOrdinal);
// now, determine its ordinal in the vector basis
int basisDofOrdinal = basis->getDofOrdinalFromComponentDofOrdinal(compDofOrdinal, comp);
// cout << "edge dof ordinal " << edgeDofOrdinal << " has basis weight " << basisCoefficients_comp[dofOrdinal1D] << " for component " << comp << endl;
// cout << "node on cell is at (" << dofCoords(compDofOrdinal,0) << ", " << dofCoords(compDofOrdinal,1) << ")\n";
// cout << "mapping to basisDofOrdinal " << basisDofOrdinal << endl;
//.........这里部分代码省略.........