Exemplo n.º 1
0
BlockNamesType RefinerUtil::correctBlockNamesForPartPartConsistency(percept::PerceptMesh& eMesh, BlockNamesType& blocks)
{
  if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "RefinerUtil::correctBlockNamesForPartPartConsistency..." << std::endl;

  if (blocks[eMesh.element_rank()].size() == 0)
    return blocks;

  stk_classic::mesh::EntityRank subDimRank = (eMesh.get_spatial_dim() == 3 ? eMesh.face_rank() : eMesh.edge_rank());

  mesh::PartVector all_parts = eMesh.get_fem_meta_data()->get_parts();
  for (mesh::PartVector::iterator i_part = all_parts.begin(); i_part != all_parts.end(); ++i_part)
  {
    mesh::Part *  part = *i_part ;

    for (mesh::PartVector::iterator i_surfacePart = all_parts.begin(); i_surfacePart != all_parts.end(); ++i_surfacePart)
    {
      mesh::Part *  surfacePart = *i_surfacePart ;
      if ( stk_classic::mesh::is_auto_declared_part(*surfacePart) )
        continue;

      const CellTopologyData * part_cell_topo_data = stk_classic::percept::PerceptMesh::get_cell_topology(*surfacePart);
      CellTopology surf_topo(part_cell_topo_data);
      //if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk surfacePart= " << surfacePart->name() << " topo= " << (part_cell_topo_data?surf_topo.getName() : "NULL") << std::endl;

      if (part_cell_topo_data && part->primary_entity_rank() == eMesh.element_rank() && surfacePart->primary_entity_rank() == subDimRank)
      {
        std::string partNamePlus = "+" + part->name();
        std::vector<std::string>::iterator partInBlocks = std::find(blocks[eMesh.element_rank()].begin(), blocks[eMesh.element_rank()].end(), partNamePlus);
        // if this part is not in the blocks list, skip it
        if (partInBlocks == blocks[eMesh.element_rank()].end())
        {
          //if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk skipping part= " << partNamePlus << std::endl;
          continue;
        }
        std::string surfacePartNamePlus = "+" + surfacePart->name();
        std::vector<std::string>::iterator surfacePartInBlocks = std::find(blocks[subDimRank].begin(), blocks[subDimRank].end(), surfacePartNamePlus);
        // if this surface is already in the list, skip it
        if (surfacePartInBlocks != blocks[subDimRank].end())
        {
          //if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk skipping surf= " << surfacePartNamePlus << std::endl;
          continue;
        }
        bool isBoundarySurface= eMesh.isBoundarySurface(*part, *surfacePart);
        
        if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk isBoundarySurface for part/surf= " << part->name() << " / " << surfacePart->name() << " = " << isBoundarySurface << std::endl;
        if (isBoundarySurface)
        {
          if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp part [" << part->name() << "] shares sideset [" << surfacePart->name() << "]" << std::endl;
          blocks[subDimRank].push_back(std::string("+"+surfacePart->name()));
        }
        else
        {
          //std::cout << "tmp part [" << part->name() << "] doesn't shares sideset [" << surfacePart->name() << "]" << std::endl;
        }
      }
    }
  }
  if (0) std::cout << "tmp RefinerUtil::correctBlockNamesForPartPartConsistency: blocks = " << blocks << std::endl;
  return blocks;
}  
//       UniformRefinerPattern(percept::PerceptMesh& eMesh, std::string fromTopoPartName="block_1", std::string toTopoPartName="block_quad_4")
//       {
//         setNeededParts(eMesh, fromTopoPartName, toTopoPartName);
//       }
      UniformRefinerPattern(percept::PerceptMesh& eMesh, BlockNamesType block_names = BlockNamesType()) : URP<shards::Quadrilateral<4>, shards::Quadrilateral<4>  >(eMesh)
      {
        m_primaryEntityRank = eMesh.face_rank(); 
        if (m_eMesh.get_spatial_dim() == 2)
          m_primaryEntityRank = eMesh.element_rank();

        setNeededParts(eMesh, block_names, true);
      }
      UniformRefinerPattern(percept::PerceptMesh& eMesh, BlockNamesType block_names = BlockNamesType()) :  URP<shards::Quadrilateral<4>, shards::Quadrilateral<4>  >(eMesh)
      {
        m_primaryEntityRank = eMesh.face_rank(); 
        if (m_eMesh.get_spatial_dim() == 2)
          m_primaryEntityRank = eMesh.element_rank();

        setNeededParts(eMesh, block_names, true);
        Elem::StdMeshObjTopologies::bootstrap();

#if EDGE_BREAKER_Q4_Q4_4_S
        if (m_eMesh.get_spatial_dim() == 2)
          m_edge_breaker =  new UniformRefinerPattern<shards::Line<2>, shards::Line<2>, 2, SierraPort > (eMesh, block_names) ;
        else
          m_edge_breaker = 0;
#endif

      }