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


C++ PhysicsBlock::getIntegrationRules方法代码示例

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


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

示例1: p

    virtual void
    buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager<panzer::Traits>& fm,
					           const panzer::PhysicsBlock& side_pb,
						   const LinearObjFactory<panzer::Traits> & lof,
						   const Teuchos::ParameterList& user_data) const
    { 
      using Teuchos::RCP;
      using Teuchos::rcp;

      side_pb.buildAndRegisterGatherAndOrientationEvaluators(fm,lof,user_data); 
      side_pb.buildAndRegisterDOFProjectionsToIPEvaluators(fm,Teuchos::ptrFromRef(lof),user_data); 

      // add in side normals
      const std::map<int,Teuchos::RCP<panzer::IntegrationRule> > & int_rules = side_pb.getIntegrationRules();
      for(std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator itr=int_rules.begin();
          itr!=int_rules.end();++itr) {
         
        std::stringstream s;
        s << "Side Normal:" << side_pb.cellData().side();
        Teuchos::ParameterList p(s.str());
        p.set<std::string>("Name","Side Normal");
        p.set<int>("Side ID",side_pb.cellData().side());
        p.set< Teuchos::RCP<panzer::IntegrationRule> >("IR", Teuchos::rcp_const_cast<panzer::IntegrationRule>(itr->second));
        p.set<bool>("Normalize",true);

        RCP< PHX::Evaluator<panzer::Traits> > op = rcp(new panzer::Normals<EvalT,panzer::Traits>(p));

        fm.template registerEvaluator<EvalT>(op);
      }

    }
开发者ID:bartlettroscoe,项目名称:Trilinos,代码行数:31,代码来源:Panzer_ResponseFactory_BCStrategyAdapter.hpp

示例2:

void Example::BCStrategy_Interface_WeakDirichletMatch<EvalT>::
setup(const panzer::PhysicsBlock& side_pb,
      const Teuchos::ParameterList& user_data)
{
  using Teuchos::RCP;
  using std::vector;
  using std::string;
  using std::pair;

  const int di = this->getDetailsIndex();

  // obtain the dof name
  const string dof_name = di == 0 ? this->m_bc.equationSetName() : this->m_bc.equationSetName2();
  other_dof_name = di == 1 ? this->m_bc.equationSetName() : this->m_bc.equationSetName2();

  // need the dof value to form the residual
  this->requireDOFGather(dof_name);

  // unique residual name
  const string residual_name = "Residual_" + this->m_bc.equationSetName();
  const string diff_name = "Difference";

  const std::map<int,RCP< panzer::IntegrationRule > >& ir = side_pb.getIntegrationRules();
  TEUCHOS_ASSERT(ir.size() == 1); 
  
  const int integration_order = ir.begin()->second->order();

  this->addResidualContribution(residual_name,dof_name,diff_name,integration_order,side_pb);
}
开发者ID:bartlettroscoe,项目名称:Trilinos,代码行数:29,代码来源:Example_BCStrategy_Interface_WeakDirichletMatch_impl.hpp

示例3: rcp

Teuchos::RCP< std::vector<panzer::Workset> > 
panzer::buildWorksets(const panzer::PhysicsBlock& pb,
		      const std::vector<std::size_t>& local_cell_ids,
		      const ArrayT& vertex_coordinates)
{
  using std::vector;
  using std::string;
  using Teuchos::RCP;
  using Teuchos::rcp;

  panzer::IntrepidFieldContainerFactory arrayFactory;

  std::size_t total_num_cells = local_cell_ids.size();

  std::size_t workset_size = pb.cellData().numCells();

  Teuchos::RCP< std::vector<panzer::Workset> > worksets_ptr = 
    Teuchos::rcp(new std::vector<panzer::Workset>);
  std::vector<panzer::Workset>& worksets = *worksets_ptr;
   
  // special case for 0 elements!
  if(total_num_cells==0) {

     // Setup integration rules and basis
     RCP<vector<int> > ir_degrees = rcp(new vector<int>(0));
     RCP<vector<string> > basis_names = rcp(new vector<string>(0));
      
     worksets.resize(1);
     std::vector<panzer::Workset>::iterator i = worksets.begin();
     i->num_cells = 0;
     i->block_id = pb.elementBlockID();
     i->ir_degrees = ir_degrees;
     i->basis_names = basis_names;

     const std::map<int,RCP<panzer::IntegrationRule> >& int_rules = pb.getIntegrationRules();
     
     for (std::map<int,RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
	  ir_itr != int_rules.end(); ++ir_itr) {
         
       RCP<panzer::IntegrationValues<double,Intrepid::FieldContainer<double> > > iv = 
	 rcp(new panzer::IntegrationValues<double,Intrepid::FieldContainer<double> >);
	 
       iv->setupArrays(ir_itr->second);

       ir_degrees->push_back(ir_itr->first);
       i->int_rules.push_back(iv);
     }

     const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >& bases= pb.getBases();

     // Need to create all combinations of basis/ir pairings 
     for (std::map<int,RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
	  ir_itr != int_rules.end(); ++ir_itr) {

       for (std::map<std::string,Teuchos::RCP<panzer::PureBasis> >::const_iterator b_itr = bases.begin();
	    b_itr != bases.end(); ++b_itr) {

	 RCP<panzer::BasisIRLayout> b_layout = rcp(new panzer::BasisIRLayout(b_itr->second,*ir_itr->second));
	 
	 RCP<panzer::BasisValues<double,Intrepid::FieldContainer<double> > > bv = 
	   rcp(new panzer::BasisValues<double,Intrepid::FieldContainer<double> >);
	 
	 bv->setupArrays(b_layout,arrayFactory);

	 basis_names->push_back(b_layout->name());
	 i->bases.push_back(bv);
       }

     }

     i->details.push_back(Teuchos::rcpFromRef(*i));

     return worksets_ptr;
  } // end special case

  {
    std::size_t num_worksets = total_num_cells / workset_size;
    bool last_set_is_full = true;
    std::size_t last_workset_size = total_num_cells % workset_size;
    if (last_workset_size != 0) {
      num_worksets += 1;
      last_set_is_full = false;
    }    

    worksets.resize(num_worksets);
    std::vector<panzer::Workset>::iterator i;
    for (i = worksets.begin(); i != worksets.end(); ++i)
      i->num_cells = workset_size;
	 
    if (!last_set_is_full) {
      worksets.back().num_cells = last_workset_size;
    }
  }

  // assign workset cell local ids
  std::vector<std::size_t>::const_iterator local_begin = local_cell_ids.begin();
  for (std::vector<panzer::Workset>::iterator wkst = worksets.begin(); wkst != worksets.end(); ++wkst) {
    std::vector<std::size_t>::const_iterator begin_iter = local_begin;
    std::vector<std::size_t>::const_iterator end_iter = begin_iter + wkst->num_cells;
    local_begin = end_iter;
//.........这里部分代码省略.........
开发者ID:00liujj,项目名称:trilinos,代码行数:101,代码来源:Panzer_Workset_Builder_impl.hpp


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