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


C++ RCP::NdetJ方法代码示例

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


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

示例1: G

  void gradient_1(Teuchos::RCP<Intrepid::FieldContainer<Real> > & grad,
                  const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & u_coeff,
                  const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & z_coeff = Teuchos::null,
                  const Teuchos::RCP<const std::vector<Real> > & z_param = Teuchos::null) {
    // Get relevant dimensions
    int c = fe_->gradN()->dimension(0);
    int f = fe_->gradN()->dimension(1);
    int p = fe_->gradN()->dimension(2);
    int d = fe_->gradN()->dimension(3);
    // Initialize output grad
    std::vector<Teuchos::RCP<Intrepid::FieldContainer<Real> > > G(d);
    for (int i=0; i<d; ++i) {
      G[i] = Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, f));
    }
    // Evaluate on FE basis
    std::vector<Teuchos::RCP<Intrepid::FieldContainer<Real> > > load_eval(d);
    for (int i=0; i<d; ++i) {
      load_eval[i] = Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, p));
    }
    load_->compute(load_eval, fe_, QoI<Real>::getParameter());
    // Build local gradient of state tracking term
    for (int i=0; i<d; ++i) {
      Intrepid::FunctionSpaceTools::integrate<Real>(*G[i],
                                                    *load_eval[i],
                                                    *(fe_->NdetJ()),
                                                    Intrepid::COMP_CPP,
                                                    false);
      Intrepid::RealSpaceTools<Real>::scale(*G[i], scale_);
    }

    fieldHelper_->combineFieldCoeff(grad, G);
  }
开发者ID:trilinos,项目名称:Trilinos,代码行数:32,代码来源:obj_topo-opt.hpp

示例2:

 void HessVec_11(Teuchos::RCP<Intrepid::FieldContainer<Real> > & hess,
                 const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & v_coeff,
                 const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & u_coeff,
                 const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & z_coeff = Teuchos::null,
                 const Teuchos::RCP<const std::vector<Real> > & z_param = Teuchos::null) {
   const int c = fe_->gradN()->dimension(0);
   const int f = fe_->gradN()->dimension(1);
   const int p = fe_->gradN()->dimension(2);
   Teuchos::RCP<Intrepid::FieldContainer<Real> > valV_eval =
     Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, p));
   hess = Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, f));
   fe_->evaluateValue(valV_eval, v_coeff);
   Intrepid::FunctionSpaceTools::integrate<Real>(*hess,
                                                 *valV_eval,
                                                 *(fe_->NdetJ()),
                                                 Intrepid::COMP_CPP, false);
 }
开发者ID:trilinos,项目名称:Trilinos,代码行数:17,代码来源:obj_stoch_adv_diff.hpp

示例3: residual

 void residual(Teuchos::RCP<Intrepid::FieldContainer<Real> > & res,
               const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & u_coeff,
               const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & z_coeff = Teuchos::null,
               const Teuchos::RCP<const std::vector<Real> > & z_param = Teuchos::null) {
   // GET DIMENSIONS
   int c = u_coeff->dimension(0);
   int p = cellCub_->getNumPoints();
   int f = basisPtr_->getCardinality();
   int d = cellCub_->getDimension();
   // INITIALIZE RESIDUAL
   res = Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, f));
   // COMPUTE STIFFNESS TERM
   Teuchos::RCP<Intrepid::FieldContainer<Real> > gradU_eval =
     Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, p, d));
   fe_vol_->evaluateGradient(gradU_eval, u_coeff);
   Intrepid::FunctionSpaceTools::integrate<Real>(*res, *gradU_eval, *(fe_vol_->gradNdetJ()), Intrepid::COMP_CPP, false);
   // ADD CONTROL TERM TO RESIDUAL
   if ( z_coeff != Teuchos::null ) {
     Teuchos::RCP<Intrepid::FieldContainer<Real> > valZ_eval =
       Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, p));
     fe_vol_->evaluateValue(valZ_eval, z_coeff);
     Intrepid::FunctionSpaceTools::integrate<Real>(*res, *valZ_eval, *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, true);
   }
   // APPLY DIRICHLET CONDITIONS
   int numSideSets = bdryCellLocIds_.size();
   if (numSideSets > 0) {
     for (int i = 0; i < numSideSets; ++i) {
       int numLocalSideIds = bdryCellLocIds_[i].size();
       for (int j = 0; j < numLocalSideIds; ++j) {
         int numCellsSide = bdryCellLocIds_[i][j].size();
         int numBdryDofs = fidx_[j].size();
         for (int k = 0; k < numCellsSide; ++k) {
           int cidx = bdryCellLocIds_[i][j][k];
           for (int l = 0; l < numBdryDofs; ++l) {
             //std::cout << "\n   j=" << j << "  l=" << l << "  " << fidx[j][l];
             (*res)(cidx,fidx_[j][l]) = (*u_coeff)(cidx,fidx_[j][l]) - (*bdryCellDofValues_[i][j])(k,fidx_[j][l]);
           }
         }
       }
     }
   }
 }
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:42,代码来源:pde_poisson.hpp

示例4: Zero

 void Jacobian_2(Teuchos::RCP<Intrepid::FieldContainer<Real> > & jac,
                 const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & u_coeff,
                 const Teuchos::RCP<const Intrepid::FieldContainer<Real> > & z_coeff = Teuchos::null,
                 const Teuchos::RCP<const std::vector<Real> > & z_param = Teuchos::null) {
   if ( z_coeff != Teuchos::null ) {
     // GET DIMENSIONS
     int c = u_coeff->dimension(0);
     int f = basisPtr_->getCardinality();
     // INITIALIZE JACOBIAN
     jac = Teuchos::rcp(new Intrepid::FieldContainer<Real>(c, f, f));
     // ADD CONTROL TERM
     Intrepid::FunctionSpaceTools::integrate<Real>(*jac, *(fe_vol_->N()), *(fe_vol_->NdetJ()), Intrepid::COMP_CPP, false);
     // APPLY DIRICHLET CONDITIONS
     int numSideSets = bdryCellLocIds_.size();
     if (numSideSets > 0) {
       for (int i = 0; i < numSideSets; ++i) {
         int numLocalSideIds = bdryCellLocIds_[i].size();
         for (int j = 0; j < numLocalSideIds; ++j) {
           int numCellsSide = bdryCellLocIds_[i][j].size();
           int numBdryDofs = fidx_[j].size();
           for (int k = 0; k < numCellsSide; ++k) {
             int cidx = bdryCellLocIds_[i][j][k];
             for (int l = 0; l < numBdryDofs; ++l) {
               //std::cout << "\n   j=" << j << "  l=" << l << "  " << fidx[j][l];
               for (int m = 0; m < f; ++m) {
                 (*jac)(cidx,fidx_[j][l],m) = static_cast<Real>(0);
               }
             }
           }
         }
       }
     }
   }
   else {
     throw Exception::Zero(">>> (PDE_Poisson::Jacobian_2): Jacobian is zero.");
   }
 }
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:37,代码来源:pde_poisson.hpp


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