当前位置: 首页>>代码示例>>C++>>正文


C++ BFPtr::varFactory方法代码示例

本文整理汇总了C++中BFPtr::varFactory方法的典型用法代码示例。如果您正苦于以下问题:C++ BFPtr::varFactory方法的具体用法?C++ BFPtr::varFactory怎么用?C++ BFPtr::varFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BFPtr的用法示例。


在下文中一共展示了BFPtr::varFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

void RHSTests::setup()
{
    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 H1Order = 3;
    int delta_p = 3; // for test functions
    int horizontalCells = 2;
    int verticalCells = 2;

    double eps = 1.0; // not really testing for sharp gradients right now--just want to see if things basically work
    double beta_x = 1.0;
    double beta_y = 1.0;

    BFPtr confusionBF = ConfusionBilinearForm::confusionBF(eps,beta_x,beta_y);
    Teuchos::RCP<ConfusionProblemLegacy> confusionProblem = Teuchos::rcp( new ConfusionProblemLegacy(confusionBF, beta_x, beta_y) );
    _rhs = confusionProblem;
    _mesh = MeshFactory::buildQuadMesh(quadPoints, horizontalCells, verticalCells, confusionBF, H1Order, H1Order+delta_p);
    _mesh->setUsePatchBasis(false);

    VarFactoryPtr varFactory = confusionBF->varFactory(); // Create test IDs that match the enum in ConfusionBilinearForm
    _tau = varFactory->testVar(ConfusionBilinearForm::S_TAU,HDIV);
    _v = varFactory->testVar(ConfusionBilinearForm::S_V,HGRAD);

    _rhsEasy = RHS::rhs();
    _rhsEasy->addTerm( _v );
}
开发者ID:vijaysm,项目名称:Camellia,代码行数:35,代码来源:RHSTests.cpp

示例2:

ConfusionManufacturedSolution::ConfusionManufacturedSolution(double epsilon, double beta_x, double beta_y)
{
  _epsilon = epsilon;
  _beta_x  = beta_x;
  _beta_y  = beta_y;

  // set the class variables from ExactSolution:
//  _bc = Teuchos::rcp(this,false);  // false: don't let the RCP own the memory
//  _rhs = Teuchos::rcp(this,false);

  BFPtr bf = ConfusionBilinearForm::confusionBF(epsilon,beta_x,beta_y);

  _bilinearForm = bf;

  VarFactoryPtr vf = bf->varFactory();

  VarPtr u = vf->fieldVar(ConfusionBilinearForm::S_U);
  VarPtr sigma1 = vf->fieldVar(ConfusionBilinearForm::S_SIGMA_1);
  VarPtr sigma2 = vf->fieldVar(ConfusionBilinearForm::S_SIGMA_2);

  _u_hat = vf->traceVar(ConfusionBilinearForm::S_U_HAT);
  _beta_n_u_minus_sigma_hat = vf->fluxVar(ConfusionBilinearForm::S_BETA_N_U_MINUS_SIGMA_HAT);

  _v = vf->testVar(ConfusionBilinearForm::S_V, HGRAD);

  FunctionPtr u_exact = this->u();
  FunctionPtr sigma_exact = epsilon * u_exact->grad();

  FunctionPtr u_exact_laplacian = u_exact->dx()->dx() + u_exact->dy()->dy();

  _rhs = RHS::rhs();
  FunctionPtr f = - _epsilon * u_exact_laplacian + _beta_x * u_exact->dx() + _beta_y * u_exact->dy();
  _rhs->addTerm( f * _v );

  _bc = BC::bc();
  _bc->addDirichlet(_u_hat, SpatialFilter::allSpace(), u_exact);

  FunctionPtr beta = Function::vectorize(Function::constant(_beta_x), Function::constant(_beta_y));
  FunctionPtr n = Function::normal();
  FunctionPtr one_skeleton = Function::meshSkeletonCharacteristic(); // allows restriction to skeleton
  FunctionPtr sigma_flux_exact = beta * ( n * u_exact - sigma_exact * one_skeleton);

  this->setSolutionFunction(u, u_exact);
  this->setSolutionFunction(sigma1, sigma_exact->x());
  this->setSolutionFunction(sigma2, sigma_exact->y());
  this->setSolutionFunction(_u_hat, u_exact);
  this->setSolutionFunction(_beta_n_u_minus_sigma_hat, sigma_flux_exact);
}
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:48,代码来源:ConfusionManufacturedSolution.cpp


注:本文中的BFPtr::varFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。