示例#1
0
void panzer::PointRule::
setup(const std::string & ptName,
      int np, 
      const panzer::CellData& cell_data)
{
  point_name = ptName;
  num_points = np;
  spatial_dimension = cell_data.baseCellDimension();
  workset_size = cell_data.numCells();
  
  topology = cell_data.getCellTopology();
  TEUCHOS_TEST_FOR_EXCEPTION(topology==Teuchos::null,std::runtime_error,
                     "PointRule::setup - Base topology from cell_data cannot be null!");
  TEUCHOS_TEST_FOR_EXCEPTION(spatial_dimension!=(int) topology->getDimension(), std::runtime_error,
		     "PointRule::setup - Spatial dimension from cell_data does not match the cell topology.");
  
  TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::is_null(topology), std::runtime_error,
		     "PointRule::setup - Failed to allocate cell topology!");
  
  // handle side issues : first veryify the 0D side follows the rules
  if(cell_data.isSide() && spatial_dimension==1) {
     TEUCHOS_ASSERT(num_points==1); // only one point on a node 
  }

  // now extract side topology
  side_topology = getSideTopology(cell_data);
  if (side_topology!=Teuchos::null)
    side = cell_data.side();

  TEUCHOS_TEST_FOR_EXCEPTION(side >= 0 && Teuchos::is_null(side_topology), 
		     std::runtime_error,
		     "Failed to allocate side topology!");

  // allocate data layout objects
  using Teuchos::rcp;
  using PHX::MDALayout;
  
  dl_scalar = 
    rcp(new MDALayout<Cell,IP>(workset_size,num_points));
  
  dl_vector = 
    rcp(new MDALayout<Cell,IP,Dim>(workset_size, num_points,
				   spatial_dimension));
  
  dl_tensor = 
    rcp(new MDALayout<Cell,IP,Dim,Dim>(workset_size, num_points,
				       spatial_dimension,
				       spatial_dimension));

  dl_vector3 =
      rcp(new MDALayout<Cell,IP,Dim>(workset_size, num_points,3));
  dl_tensor3x3 =
      rcp(new MDALayout<Cell,IP,Dim,Dim>(workset_size, num_points,3,3));

}
user_app::EquationSet_MeshCoords<EvalT>::
EquationSet_MeshCoords(const Teuchos::RCP<Teuchos::ParameterList>& params,
		   const int& default_integration_order,
		   const panzer::CellData& cell_data,
		   const Teuchos::RCP<panzer::GlobalData>& global_data,
		   const bool build_transient_support) :
  panzer::EquationSet_DefaultImpl<EvalT>(params,default_integration_order,cell_data,global_data,build_transient_support )
{
  // ********************
  // Validate and parse parameter list
  // ********************
  {    
    Teuchos::ParameterList valid_parameters;
    this->setDefaultValidParameters(valid_parameters);

    valid_parameters.set("Model ID","","Closure model id associated with this equaiton set");
    valid_parameters.set("Integration Order",-1,"Order of the integration rule");

    params->validateParametersAndSetDefaults(valid_parameters);
  }

  std::string basis_type = "HGrad"; // use nodal linears
  int basis_order = 1;
  std::string model_id = params->get<std::string>("Model ID");
  int integration_order = params->get<int>("Integration Order");

  dimension_ = cell_data.baseCellDimension();

  // ********************
  // Setup DOFs and closure models
  // ********************
  std::string dof_names[3] = {"COORDX","COORDY","COORDZ"};
  std::vector<std::string> coord;
  for(int i=0;i<dimension_;i++) {
    std::string dof_name = dof_names[i];
    coord.push_back(dof_name);

    this->addDOF(dof_name,basis_type,basis_order,integration_order);
    if (this->buildTransientSupport())
      this->addDOFTimeDerivative(dof_name);
    else {
      TEUCHOS_ASSERT(false); // what does this even mean?
    }
  }

  this->setCoordinateDOFs(coord);

  this->addClosureModel(model_id);

  this->setupDOFs();
}
示例#3
0
  EquationSet_MeshCoords(const Teuchos::RCP<Teuchos::ParameterList>& params,
      const int& default_integration_order,
      const panzer::CellData& cell_data,
      const Teuchos::RCP<panzer::GlobalData>& gd,
      const bool build_transient_support) :
        panzer::EquationSet_DefaultImpl<EvalT>(params,default_integration_order,cell_data,gd,build_transient_support ) {
    std::string basis_type = "HGrad"; // use nodal linears
    int basis_order = 1;
    std::string model_id = params->get<std::string>("Model ID");
    int integration_order = params->get<int>("Integration Order");

    dimension_ = cell_data.baseCellDimension();
    std::string dof_names[3] = {"COORDX","COORDY","COORDZ"};
    std::vector<std::string> coord;
    for(int i=0;i<dimension_;i++) {
      std::string dof_name = dof_names[i];
      coord.push_back(dof_name);

      this->addDOF(dof_name,basis_type,basis_order,integration_order);
    }
    this->setupDOFs();

  }