void Intrepid2FieldPattern::buildSubcellClosure(const shards::CellTopology & cellTopo,unsigned dim,unsigned subCell,
                                               std::set<std::pair<unsigned,unsigned> > & closure)
{
   switch(dim) {
   case 0:
      closure.insert(std::make_pair(0,subCell));
      break;
   case 1:
      closure.insert(std::make_pair(0,cellTopo.getNodeMap(dim,subCell,0)));
      closure.insert(std::make_pair(0,cellTopo.getNodeMap(dim,subCell,1)));
      closure.insert(std::make_pair(1,subCell));
      break;
   case 2:
      {
      unsigned cnt = (shards::CellTopology(cellTopo.getCellTopologyData(dim,subCell))).getSubcellCount(dim-1);
      for(unsigned i=0;i<cnt;i++) {
         int edge = mapCellFaceEdge(cellTopo.getCellTopologyData(),subCell,i);
         buildSubcellClosure(cellTopo,dim-1,edge,closure);
      }
      closure.insert(std::make_pair(2,subCell));
      }
      break;
   default:
      // beyond a two dimension surface this thing crashes!
      TEUCHOS_ASSERT(false);
   };
}
예제 #2
0
    unsigned 
    getLocalSideIndexFromGlobalNodeList(const ArrayCellGIDs& cellGIDs, 
					const ArraySideGIDs& sideGIDs,
					const shards::CellTopology& cell)
  {
    unsigned cell_dim = cell.getDimension();
    //TEUCHOS_TEST_FOR_EXCEPTION(!cell.getSubcellHomogeneity(cell_dim - 1),
    //	       std::runtime_error, "Sides are not homogeneous!");
    
    unsigned local_side;
    bool found_local_side = false;
    unsigned side = 0;  
    while ( (side < cell.getSideCount()) && (!found_local_side) ) {
      
      const shards::CellTopology 
	side_topo(cell.getCellTopologyData(cell.getDimension()-1, side));
      
      unsigned num_side_nodes = 
	cell.getCellTopologyData()->side[side].topology->node_count;
 

      std::list<unsigned> tmp_side_gid_list;
      for (unsigned node = 0; node < num_side_nodes; ++node)
	tmp_side_gid_list.push_back(cellGIDs[cell.getNodeMap(cell_dim - 1, 
							     side, node)]);
     
      bool side_matches = true;
      unsigned node = 0;
      while ( side_matches && (node < num_side_nodes) ) {

	std::list<unsigned>::iterator search = 
	  std::find(tmp_side_gid_list.begin(), tmp_side_gid_list.end(),
		    sideGIDs[node]);
	
	if (search == tmp_side_gid_list.end())
	  side_matches = false;
	  
	++node;
      }
      
      if (side_matches) {
	found_local_side = true;
	local_side = side;
      }
      
      ++side;
    }
    
    TEUCHOS_TEST_FOR_EXCEPTION(!found_local_side, std::runtime_error,
		       "Failed to find side!");
    
    return local_side;
  }
예제 #3
0
   unsigned
   getLocalSubcellIndexFromGlobalNodeList(const ArrayCellGIDs& cellGIDs,
                                          const ArraySideGIDs& subcellGIDs,
                                          const shards::CellTopology& cell,unsigned subcell_dim)
 {
   unsigned local_subcell;
   bool found_local_subcell = false;
   unsigned subcell = 0;
   while ( (subcell < cell.getSubcellCount(subcell_dim)) && (!found_local_subcell) ) {
 
     unsigned num_subcell_nodes =
 	cell.getCellTopologyData()->subcell[subcell_dim][subcell].topology->node_count;
 
     std::list<unsigned> tmp_subcell_gid_list;
     for (unsigned node = 0; node < num_subcell_nodes; ++node)
       tmp_subcell_gid_list.push_back(cellGIDs[cell.getNodeMap(subcell_dim,
                                                            subcell, node)]);
 
     bool subcell_matches = true;
     unsigned node = 0;
     while ( subcell_matches && (node < num_subcell_nodes) ) {
 
       std::list<unsigned>::iterator search =
         std::find(tmp_subcell_gid_list.begin(), tmp_subcell_gid_list.end(),
                   subcellGIDs[node]);
 
       if (search == tmp_subcell_gid_list.end())
         subcell_matches = false;
 
       ++node;
     }
 
     if (subcell_matches) {
       found_local_subcell = true;
       local_subcell = subcell;
     }
 
     ++subcell;
   }
 
   TEUCHOS_TEST_FOR_EXCEPTION(!found_local_subcell, std::runtime_error,
                      "Failed to find subcell!");
 
   return local_subcell;
 }