本文整理汇总了C++中MeshPtr::cellIDsOfTypeGlobal方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::cellIDsOfTypeGlobal方法的具体用法?C++ MeshPtr::cellIDsOfTypeGlobal怎么用?C++ MeshPtr::cellIDsOfTypeGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::cellIDsOfTypeGlobal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRieszInversionAsProjection
bool LinearTermTests::testRieszInversionAsProjection()
{
bool success = true;
//////////////////// DECLARE VARIABLES ///////////////////////
// define test variables
VarFactoryPtr varFactory = VarFactory::varFactory();
VarPtr tau = varFactory->testVar("\\tau", HDIV);
VarPtr v = varFactory->testVar("v", HGRAD);
// define trial variables
VarPtr uhat = varFactory->traceVar("\\widehat{u}");
VarPtr beta_n_u_minus_sigma_n = varFactory->fluxVar("\\widehat{\\beta \\cdot n u - \\sigma_{n}}");
VarPtr u = varFactory->fieldVar("u");
VarPtr sigma1 = varFactory->fieldVar("\\sigma_1");
VarPtr sigma2 = varFactory->fieldVar("\\sigma_2");
vector<double> beta;
beta.push_back(1.0);
beta.push_back(0.0);
double eps = .01;
//////////////////// DEFINE BILINEAR FORM ///////////////////////
BFPtr confusionBF = Teuchos::rcp( new BF(varFactory) );
// tau terms:
confusionBF->addTerm(sigma1 / eps, tau->x());
confusionBF->addTerm(sigma2 / eps, tau->y());
confusionBF->addTerm(u, tau->div());
confusionBF->addTerm(uhat, -tau->dot_normal());
// v terms:
confusionBF->addTerm( sigma1, v->dx() );
confusionBF->addTerm( sigma2, v->dy() );
confusionBF->addTerm( -u, beta * v->grad() );
confusionBF->addTerm( beta_n_u_minus_sigma_n, v);
//////////////////// BUILD MESH ///////////////////////
// define nodes for mesh
int H1Order = 2;
int pToAdd = 2;
FieldContainer<double> quadPoints(4,2);
quadPoints(0,0) = 0.0; // x1
quadPoints(0,1) = 0.0; // y1
quadPoints(1,0) = 1.0;
quadPoints(1,1) = 0.0;
quadPoints(2,0) = 1.0;
quadPoints(2,1) = 1.0;
quadPoints(3,0) = 0.0;
quadPoints(3,1) = 1.0;
int nCells = 2;
int horizontalCells = nCells, verticalCells = nCells;
// create a new mesh:
MeshPtr myMesh = MeshFactory::buildQuadMesh(quadPoints, horizontalCells, verticalCells, confusionBF, H1Order, H1Order+pToAdd);
ElementTypePtr elemType = myMesh->getElement(0)->elementType();
BasisCachePtr basisCache = Teuchos::rcp(new BasisCache(elemType, myMesh));
vector<GlobalIndexType> cellIDs = myMesh->cellIDsOfTypeGlobal(elemType);
bool createSideCacheToo = true;
basisCache->setPhysicalCellNodes(myMesh->physicalCellNodesGlobal(elemType), cellIDs, createSideCacheToo);
LinearTermPtr integrand = Teuchos::rcp(new LinearTerm); // residual
FunctionPtr x = Function::xn(1);
FunctionPtr y = Function::yn(1);
FunctionPtr testFxn1 = x;
FunctionPtr testFxn2 = y;
FunctionPtr fxnToProject = x * y + 1.0;
integrand->addTerm(fxnToProject * v);
IPPtr ip_L2 = Teuchos::rcp(new IP);
ip_L2->addTerm(v);
ip_L2->addTerm(tau);
Teuchos::RCP<RieszRep> riesz = Teuchos::rcp(new RieszRep(myMesh, ip_L2, integrand));
riesz->computeRieszRep();
FunctionPtr rieszFxn = RieszRep::repFunction(v,riesz);
int numCells = basisCache->getPhysicalCubaturePoints().dimension(0);
int numPts = basisCache->getPhysicalCubaturePoints().dimension(1);
FieldContainer<double> valProject( numCells, numPts );
FieldContainer<double> valExpected( numCells, numPts );
rieszFxn->values(valProject,basisCache);
fxnToProject->values(valExpected,basisCache);
// int rank = Teuchos::GlobalMPISession::getRank();
// if (rank==0) cout << "physicalCubaturePoints:\n" << basisCache->getPhysicalCubaturePoints();
double maxDiff;
double tol = 1e-12;
success = TestSuite::fcsAgree(valProject,valExpected,tol,maxDiff);
if (success==false)
//.........这里部分代码省略.........