Back to index

salome-med  6.5.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes
MEDPARTITIONER::ParallelTopology Class Reference

#include <MEDPARTITIONER_ParallelTopology.hxx>

Inheritance diagram for MEDPARTITIONER::ParallelTopology:
Inheritance graph
[legend]
Collaboration diagram for MEDPARTITIONER::ParallelTopology:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ParallelTopology ()
 ParallelTopology (const std::vector< ParaMEDMEM::MEDCouplingUMesh * > &)
 ParallelTopology (const std::vector< ParaMEDMEM::MEDCouplingUMesh * > &, const std::vector< MEDPARTITIONER::ConnectZone * > &, std::vector< int * > &, std::vector< int * > &, std::vector< int * > &)
 ParallelTopology (Graph *graph, Topology *oldTopology, int nbdomain, int mesh_dimension)
 ~ParallelTopology ()
void setGlobalNumerotationDefault (ParaDomainSelector *domainSelector)
void convertGlobalNodeList (const int *, int, int *, int *)
 converts a list of global cell numbers to a distributed array with local cell numbers
void convertGlobalNodeList (const int *, int, int *, int)
 Converts a list of global node numbers on domain ip to a distributed array with local cell numbers.
void convertGlobalNodeListWithTwins (const int *face_list, int nbnode, int *&local, int *&ip, int *&full_array, int &size)
 Converts a list of global node numbers to a distributed array with local cell numbers.
void convertGlobalCellList (const int *, int, int *, int *)
 converts a list of global node numbers to a distributed array with local cell numbers
void convertGlobalFaceList (const int *, int, int *, int *)
 converts a list of global face numbers to a distributed array with local face numbers
void convertGlobalFaceList (const int *, int, int *, int)
 Converts a list of global node numbers on domain ip to a distributed array with local cell numbers.
void convertGlobalFaceListWithTwins (const int *face_list, int nbface, int *&local, int *&ip, int *&full_array, int &size)
 Converts a list of global face numbers to a distributed array with local face numbers.
void convertToLocal2ndVersion (int *nodes, int nbnodes, int idomain)
 converting node global numberings to local numberings
int convertNodeToGlobal (int ip, int icell) const
 converting node local numbering to global
int convertFaceToGlobal (int ip, int iface) const
 converting face local numbering to global
int convertCellToGlobal (int ip, int icell) const
 converting cell global numbering to local
void convertNodeToGlobal (int ip, const int *local, int n, int *global) const
void convertCellToGlobal (int ip, const int *local, int n, int *global) const
void convertFaceToGlobal (int ip, const int *local, int n, int *global) const
int nbDomain () const
 number of doamins
int nbCells () const
 number of cells
int nbNodes () const
 number of nodes
int nbCells (int idomain) const
 number of cells on a specific domain
int getNodeNumber (int idomain) const
 retrieving number of nodes
int getNodeNumber () const
void getNodeList (int idomain, int *list) const
 retrieving list of nodes in global numbers
std::vector< int > & getFusedCellNumbers (int idomain)
 retrieving cell numbers after merging in parallel mode
const std::vector< int > & getFusedCellNumbers (int idomain) const
std::vector< int > & getFusedFaceNumbers (int idomain)
 retrieving face numbers after merging in parallel mode
const std::vector< int > & getFusedFaceNumbers (int idomain) const
int getCellNumber (int idomain) const
 retrieving number of nodes
int getCellDomainNumber (int global) const
void getCellList (int idomain, int *list) const
 retrieving list of nodes in global numbers
int getFaceNumber (int idomain) const
 retrieving number of faces
int getFaceNumber () const
void getFaceList (int idomain, int *list) const
 retrieving list of faces in global numbers
std::pair< int, int > convertGlobalCell (int iglobal) const
 converting a global cell number to a local representation (domain + local number)
int convertGlobalFace (int iglobal, int idomain)
 converting a global face number to a local representation
int convertGlobalNode (int iglobal, int idomain)
 converting a global node number to a local representation
void appendFace (int idomain, int ilocal, int iglobal)
 adding a face to the topology
int getMaxGlobalFace () const
 Return max global face number.

Private Types

typedef
INTERP_KERNEL::HashMultiMap
< int, std::pair< int, int > > 
TGlob2DomainLoc
typedef
INTERP_KERNEL::HashMultiMap
< int, std::pair< int, int > > 
TGlob2LocsMap

Private Member Functions

bool hasCellWithNodes (const MeshCollection &, int dom, const std::set< int > &nodes)

Private Attributes

TGlob2DomainLoc _glob_to_loc
std::vector< std::vector< int > > _loc_to_glob
INTERP_KERNEL::HashMultiMap
< int, std::pair< int, int > > 
_node_glob_to_loc
std::vector< std::vector< int > > _node_loc_to_glob
std::vector< std::vector< int > > _cell_loc_to_glob_fuse
std::vector< std::vector< int > > _face_loc_to_glob_fuse
TGlob2LocsMap _face_glob_to_loc
std::vector< std::vector< int > > _face_loc_to_glob
std::vector< int > _nb_cells
std::vector< int > _nb_nodes
std::vector< int > _nb_faces
int _nb_total_cells
int _nb_total_nodes
int _nb_total_faces
int _nb_domain
int _mesh_dimension

Detailed Description

Definition at line 37 of file MEDPARTITIONER_ParallelTopology.hxx.


Member Typedef Documentation

Definition at line 159 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 173 of file MEDPARTITIONER_ParallelTopology.hxx.


Constructor & Destructor Documentation

Definition at line 41 of file MEDPARTITIONER_ParallelTopology.cxx.

Definition at line 46 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  _nb_domain=meshes.size();
  _nb_cells.resize(_nb_domain);
  _nb_nodes.resize(_nb_domain);
  //  _nb_faces.resize(_nb_domain);
  
  if (MyGlobals::_Is0verbose>100)
    std::cout << "new ParallelTopology\n";
  _loc_to_glob.resize(0);      //precaution, need gatherNbOf() setGlobalNumerotation()
  _node_loc_to_glob.resize(0); //precaution, need gatherNbOf() setGlobalNumerotation()
  //_face_loc_to_glob.resize(_nb_domain);
  _mesh_dimension = -1;
  bool parallel_mode = false;
  for (int idomain=0; !parallel_mode && idomain<_nb_domain; idomain++)
    parallel_mode = (!meshes[idomain]);

  if (MyGlobals::_Is0verbose>20 && !parallel_mode)
    std::cout << "WARNING : ParallelTopology contructor without parallel_mode" << std::endl;
  for (int idomain=0; idomain<_nb_domain; idomain++)
    {
      if ( !meshes[idomain] ) continue;
      if (_mesh_dimension==-1)
        {
          _mesh_dimension = meshes[idomain]->getMeshDimension();
        }
      else
        {
          if (_mesh_dimension!=meshes[idomain]->getMeshDimension())
            throw INTERP_KERNEL::Exception("meshes dimensions incompatible");
        }
      _nb_cells[idomain]=meshes[idomain]->getNumberOfCells();
      _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
      //note: in parallel mode _nb_cells and _nb_nodes are not complete now, needs gatherNbOf()
    }
}
ParallelTopology::ParallelTopology ( const std::vector< ParaMEDMEM::MEDCouplingUMesh * > &  meshes,
const std::vector< MEDPARTITIONER::ConnectZone * > &  cz,
std::vector< int * > &  cellglobal,
std::vector< int * > &  nodeglobal,
std::vector< int * > &  faceglobal 
)

Definition at line 141 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  _nb_domain=meshes.size();
  int index_global=0;
  int index_node_global=0;
  int index_face_global=0;

  _nb_cells.resize(_nb_domain);
  _nb_nodes.resize(_nb_domain);
  //  _nb_faces.resize(_nb_domain);
  
  _loc_to_glob.resize(_nb_domain);
  _node_loc_to_glob.resize(_nb_domain);
  //  _face_loc_to_glob.resize(_nb_domain);

  bool parallel_mode = false;
  for (int idomain=0; !parallel_mode && idomain<_nb_domain; idomain++)
    parallel_mode = (!meshes[idomain]);

  for (int idomain=0; idomain<_nb_domain; idomain++)
    {
      if ( !meshes[idomain] ) continue;
      _mesh_dimension = meshes[idomain]->getMeshDimension();
    
      //creating cell maps
      _nb_cells[idomain]=meshes[idomain]->getNumberOfCells();
      //    cout << "Nb cells (domain "<<idomain<<") = "<<_nb_cells[idomain];
      _loc_to_glob[idomain].resize(_nb_cells[idomain]);

      if (cellglobal[idomain]==0 || parallel_mode)
        {
          //int cellDomainShift=_cell_shift_by_domain[idomain];
          //creating global numbering from scratch
          for (int i=0; i<_nb_cells[idomain]; i++)
            {
              int global=i ;//cellDomainShift+i;
              _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
              _loc_to_glob[idomain][i]=global;
              index_global++;
            }
        }
      //using global numbering coming from a previous numbering
      else
        {
          for (int i=0; i<_nb_cells[idomain]; i++)
            {
              int global=cellglobal[idomain][i];
              _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
              //_loc_to_glob[make_pair(idomain,i+1)]=global;
              _loc_to_glob[idomain][i]=global;
              index_global++;
            }
        }

      //cas sequentiel
      if (_nb_domain==1)
        {
          _nb_total_cells=index_global;
          _nb_cells[0]=index_global;
          _node_loc_to_glob[idomain].resize(meshes[idomain]->getNumberOfNodes());
          for (int i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
            {
              _node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i)));
              _node_loc_to_glob[0][i]=i;
            }
          _nb_total_nodes=meshes[idomain]->getNumberOfNodes();   
          _nb_nodes[0]=_nb_total_nodes; 
          return;
        }

      //creating node maps
      _nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
      INTERP_KERNEL::HashMap <int,std::pair<int,int> > local2distant;
      _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
      for (std::size_t icz=0; icz<cz.size(); icz++)
        {
          if (cz[icz]->getLocalDomainNumber() == idomain && 
              cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber())
            {
              int nb_node= cz[icz]->getNodeNumber();
              const int* node_corresp=cz[icz]->getNodeCorrespValue();
              int distant_ip = cz[icz]->getDistantDomainNumber();
              for (int i=0; i< nb_node; i++)
                {
                  int local= node_corresp[i*2];
                  int distant = node_corresp[i*2+1];
                  local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant)));    
                }
            }
        }
      // setting mappings for all nodes
      if (nodeglobal[idomain]==0)
        {
          for (int inode=0; inode<_nb_nodes[idomain]; inode++)
            {
              if (local2distant.find(inode)==local2distant.end())
                {
                  index_node_global++;
                  _node_glob_to_loc.insert(std::make_pair(index_node_global,std::make_pair(idomain,inode)));
                  //_node_loc_to_glob[make_pair(idomain,inode+1)]=index_node_global;
                  _node_loc_to_glob[idomain][inode]=index_node_global;
                }   
              else
                {
                  int ip = (local2distant.find(inode)->second).first;
                  int distant = (local2distant.find(inode)->second).second;
                  int global_number=_loc_to_glob[ip][distant];
                  _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
                  _node_loc_to_glob[idomain][inode]=global_number;
                } 
            }
        }
      //using former node numbering
      else
        {
          for (int inode=0; inode<_nb_nodes[idomain]; inode++)
            {
              int global_number=nodeglobal[idomain][inode];
              _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
              _node_loc_to_glob[idomain][inode]=global_number;
            }
        }
    }

  _nb_total_cells=index_global;
  _nb_total_nodes=index_node_global;   
  _nb_total_faces=index_face_global;
}

Here is the call graph for this function:

ParallelTopology::ParallelTopology ( Graph *  graph,
Topology oldTopology,
int  nbdomain,
int  mesh_dimension 
)

Definition at line 276 of file MEDPARTITIONER_ParallelTopology.cxx.

{

  _nb_domain=nb_domain;
  _mesh_dimension=mesh_dimension;
  
  if (MyGlobals::_Verbose>200)
    std::cout << "proc " << MyGlobals::_Rank << " : new topology oldNbDomain " <<
      oldTopology->nbDomain() << " newNbDomain " << _nb_domain << std::endl;
  _nb_cells.resize(_nb_domain,0);
  _nb_nodes.resize(_nb_domain,0);
  _nb_faces.resize(_nb_domain,0);

  _loc_to_glob.resize(_nb_domain);
  _node_loc_to_glob.resize(_nb_domain);
  _face_loc_to_glob.resize(_nb_domain);
  
  const int* part=graph->getPart(); //all cells for this proc (may be more domains)
  _nb_total_cells=graph->nbVertices(); //all cells for this proc (may be more domains)
  if (MyGlobals::_Verbose>300)
    std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl;
  
  int icellProc=0; //all cells of my domains are concatenated in part
  for (int iold=0; iold<oldTopology->nbDomain(); iold++)
    {
      int ioldNbCell=oldTopology->getCellNumber(iold);
      //std::cout<<"proc "<<MyGlobals::_Rank<<" : cell number old domain "<<iold<<" : "<<ioldNbCell<<std::endl;
      //if not my old domains getCellNumber is 0
      std::vector<int> globalids(ioldNbCell);
      oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation
      for (int icell=0; icell<ioldNbCell; icell++)
        {
          int idomain=part[icellProc];
          _nb_cells[idomain]++;
          icellProc++;
          int iGlobalCell=globalids[icell];
          _loc_to_glob[idomain].push_back(iGlobalCell);
          _glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain])));
        }
    }

  if (MyGlobals::_Verbose>300)
    for (int idomain=0; idomain<_nb_domain; idomain++)
      std::cout << "proc " << MyGlobals::_Rank << " : nbCells in new domain " << idomain << " : " << _nb_cells[idomain] << std::endl; 
}

Here is the call graph for this function:

Definition at line 322 of file MEDPARTITIONER_ParallelTopology.cxx.

{
} 

Member Function Documentation

void ParallelTopology::appendFace ( int  idomain,
int  ilocal,
int  iglobal 
) [virtual]

adding a face to the topology

Implements MEDPARTITIONER::Topology.

Definition at line 606 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  _face_loc_to_glob[idomain].push_back(iglobal);
  _face_glob_to_loc.insert(std::make_pair(iglobal,std::make_pair(idomain,ilocal)));
}

Here is the call graph for this function:

int MEDPARTITIONER::ParallelTopology::convertCellToGlobal ( int  ip,
int  icell 
) const [inline, virtual]

converting cell global numbering to local

Implements MEDPARTITIONER::Topology.

Definition at line 83 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _loc_to_glob[ip][icell]; }
void MEDPARTITIONER::ParallelTopology::convertCellToGlobal ( int  ip,
const int *  local,
int  n,
int *  global 
) const [inline, virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 91 of file MEDPARTITIONER_ParallelTopology.hxx.

    {
      for (int i=0; i<n; i++)
        global[i]=_loc_to_glob[ip][local[i]];  
    }
int MEDPARTITIONER::ParallelTopology::convertFaceToGlobal ( int  ip,
int  iface 
) const [inline, virtual]

converting face local numbering to global

Implements MEDPARTITIONER::Topology.

Definition at line 80 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _face_loc_to_glob[ip][iface]; }
void MEDPARTITIONER::ParallelTopology::convertFaceToGlobal ( int  ip,
const int *  local,
int  n,
int *  global 
) const [inline, virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 97 of file MEDPARTITIONER_ParallelTopology.hxx.

    {
      for (int i=0; i<n; i++) 
        global[i]=_face_loc_to_glob[ip][local[i]];
    }
std::pair<int,int> MEDPARTITIONER::ParallelTopology::convertGlobalCell ( int  iglobal) const [inline, virtual]

converting a global cell number to a local representation (domain + local number)

Implements MEDPARTITIONER::Topology.

Definition at line 142 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _glob_to_loc.find(iglobal)->second; }

Here is the call graph for this function:

void ParallelTopology::convertGlobalCellList ( const int *  cell_list,
int  nbcell,
int *  local,
int *  ip 
) [virtual]

converts a list of global node numbers to a distributed array with local cell numbers

converts a list of global cell numbers to a distributed array with local cell numbers

Implements MEDPARTITIONER::Topology.

Definition at line 441 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i<nbcell; i++)
    {
      INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
      if (iter == _glob_to_loc.end())
        {
          std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl;
          throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalCellList : Cell not found");
        }
      else
        {
          ip[i]=(iter->second).first;     //no domain
          local[i]=(iter->second).second; //no local cell
        }
    }
}

Here is the call graph for this function:

int ParallelTopology::convertGlobalFace ( int  iglobal,
int  idomain 
) [virtual]

converting a global face number to a local representation

Implements MEDPARTITIONER::Topology.

Definition at line 581 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
  std::pair<MMiter,MMiter> eq = _face_glob_to_loc.equal_range(iglobal);
  for (MMiter it=eq.first; it != eq.second; it++) 
    if (it->second.first == idomain)
      return it->second.second;   
  return -1;
}

Here is the call graph for this function:

void ParallelTopology::convertGlobalFaceList ( const int *  face_list,
int  nbface,
int *  local,
int *  ip 
) [virtual]

converts a list of global face numbers to a distributed array with local face numbers

Converts a list of global face numbers to a distributed array with local face numbers.

Implements MEDPARTITIONER::Topology.

Definition at line 462 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i< nbface; i++)
    {
      INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
      if (iter == _face_glob_to_loc.end())
        {
          throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found");
        }
      ip[i]=(iter->second).first;
      local[i]=(iter->second).second;
    }
}

Here is the call graph for this function:

void ParallelTopology::convertGlobalFaceList ( const int *  face_list,
int  nbface,
int *  local,
int  ip 
) [virtual]

Converts a list of global node numbers on domain ip to a distributed array with local cell numbers.

If a node in the list is represented on several domains, only the value with domain ip is returned

Implements MEDPARTITIONER::Topology.

Definition at line 483 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i< nbface; i++)
    {
      typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
      std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
      for (mmiter it=range.first; it !=range.second; it++)
        { 
          int ipfound=(it->second).first;
          if (ipfound==ip)
            local[i]=(it->second).second; 

        }
    }
} 

Here is the call graph for this function:

void ParallelTopology::convertGlobalFaceListWithTwins ( const int *  face_list,
int  nbface,
int *&  local,
int *&  ip,
int *&  full_array,
int &  size 
) [virtual]

Converts a list of global face numbers to a distributed array with local face numbers.

If a face in the list is represented on several domains, all the values are put in the array

Implements MEDPARTITIONER::Topology.

Definition at line 411 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  size=0;
  for (int i=0; i< nbface; i++)
    {
      //int count = _face_glob_to_loc.count(face_list[i]);
      //if (count >1) MESSAGE_MED("face en doublon "<<face_list[i]);
      size+= _face_glob_to_loc.count(face_list[i]);
    }
  int index=0;
  ip=new int[size];
  local=new int[size];
  full_array=new int[size];
  for (int i=0; i< nbface; i++)
    {
      typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
      std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
      for (mmiter it=range.first; it !=range.second; it++)
        { 
          ip[index]=(it->second).first;
          local[index]=(it->second).second;
          full_array[index]=face_list[i];
          index++;
        }

    }
}

Here is the call graph for this function:

int ParallelTopology::convertGlobalNode ( int  iglobal,
int  idomain 
) [virtual]

converting a global node number to a local representation

Implements MEDPARTITIONER::Topology.

Definition at line 591 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
  std::pair<MMiter,MMiter> eq = _node_glob_to_loc.equal_range(iglobal);
  for (MMiter it=eq.first; it != eq.second; it++)
    {
      if (it->second.first == idomain)
        return it->second.second;
    }
  return -1;
}

Here is the call graph for this function:

void ParallelTopology::convertGlobalNodeList ( const int *  node_list,
int  nbnode,
int *  local,
int *  ip 
) [virtual]

converts a list of global cell numbers to a distributed array with local cell numbers

Converts a list of global node numbers to a distributed array with local cell numbers.

If a node in the list is represented on several domains, only the first value is returned

Implements MEDPARTITIONER::Topology.

Definition at line 332 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (_node_glob_to_loc.empty()) 
    throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
  for (int i=0; i< nbnode; i++)
    {
      std::pair<int,int> local_node = _node_glob_to_loc.find(node_list[i])->second;
      ip[i]=local_node.first;
      local[i]=local_node.second;
    }
}

Here is the call graph for this function:

void ParallelTopology::convertGlobalNodeList ( const int *  node_list,
int  nbnode,
int *  local,
int  ip 
) [virtual]

Converts a list of global node numbers on domain ip to a distributed array with local cell numbers.

If a node in the list is represented on several domains, only the value with domain ip is returned

Implements MEDPARTITIONER::Topology.

Definition at line 351 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (_node_glob_to_loc.empty()) 
    throw INTERP_KERNEL::Exception("Node mapping has not yet been built");

  for (int i=0; i< nbnode; i++)
    {
      typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
      std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
      for (mmiter it=range.first; it !=range.second; it++)
        { 
          int ipfound=(it->second).first;
          if (ipfound==ip)
            local[i]=(it->second).second;
        }
    }
} 

Here is the call graph for this function:

void ParallelTopology::convertGlobalNodeListWithTwins ( const int *  node_list,
int  nbnode,
int *&  local,
int *&  ip,
int *&  full_array,
int &  size 
) [virtual]

Converts a list of global node numbers to a distributed array with local cell numbers.

If a node in the list is represented on several domains, all the values are put in the array

Implements MEDPARTITIONER::Topology.

Definition at line 375 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (_node_glob_to_loc.empty()) 
    throw INTERP_KERNEL::Exception("Node mapping has not yet been built");

  size=0;
  for (int i=0; i< nbnode; i++)
    {
      int count= _node_glob_to_loc.count(node_list[i]);
      size+=count;
    }
  int index=0;
  ip=new int[size];
  local=new int[size];
  full_array=new int[size];
  for (int i=0; i< nbnode; i++)
    {
      typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
      std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
      for (mmiter it=range.first; it !=range.second; it++)
        { 
          ip[index]=(it->second).first;
          local[index]=(it->second).second;
          full_array [index]=node_list[i];
          index++;
        }

    }
}

Here is the call graph for this function:

int MEDPARTITIONER::ParallelTopology::convertNodeToGlobal ( int  ip,
int  icell 
) const [inline, virtual]

converting node local numbering to global

Implements MEDPARTITIONER::Topology.

Definition at line 77 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _node_loc_to_glob[ip][icell]; }
void MEDPARTITIONER::ParallelTopology::convertNodeToGlobal ( int  ip,
const int *  local,
int  n,
int *  global 
) const [inline, virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 85 of file MEDPARTITIONER_ParallelTopology.hxx.

    {
      for (int i=0; i<n; i++)
        global[i]=_node_loc_to_glob[ip][local[i]];
    }
void ParallelTopology::convertToLocal2ndVersion ( int *  nodes,
int  nbnodes,
int  idomain 
) [virtual]

converting node global numberings to local numberings

Implements MEDPARTITIONER::Topology.

Definition at line 502 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int inode=0; inode<nbnodes; inode++)
    {
      //      cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode];
      int global = nodes[inode];
      typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
      std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
      for (mmiter it=range.first; it !=range.second; it++)
        {
          if ((it->second).first==idomain)
            nodes[inode]=(it->second).second;
        }
    }
}

Here is the call graph for this function:

int MEDPARTITIONER::ParallelTopology::getCellDomainNumber ( int  global) const [inline]

Definition at line 131 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return (_glob_to_loc.find(global)->second).first; }

Here is the call graph for this function:

void ParallelTopology::getCellList ( int  idomain,
int *  list 
) const [virtual]

retrieving list of nodes in global numbers

Implements MEDPARTITIONER::Topology.

Definition at line 554 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i<_nb_cells[idomain];i++)
    list[i]=_loc_to_glob[idomain][i];
}
int MEDPARTITIONER::ParallelTopology::getCellNumber ( int  idomain) const [inline, virtual]

retrieving number of nodes

Implements MEDPARTITIONER::Topology.

Definition at line 129 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_cells[idomain]; }
void ParallelTopology::getFaceList ( int  idomain,
int *  list 
) const [virtual]

retrieving list of faces in global numbers

Implements MEDPARTITIONER::Topology.

Definition at line 575 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i<_nb_faces[idomain];i++)   
    list[i]=_face_loc_to_glob[idomain][i];
}
int MEDPARTITIONER::ParallelTopology::getFaceNumber ( int  idomain) const [inline, virtual]

retrieving number of faces

Implements MEDPARTITIONER::Topology.

Definition at line 135 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_faces[idomain]; }
int ParallelTopology::getFaceNumber ( ) const [virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 560 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (_face_glob_to_loc.empty())
    return 0;
  std::set <int> keys;
  for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
    {
      keys.insert(iter->first);
    }
  return keys.size();
}

Here is the call graph for this function:

std::vector<int>& MEDPARTITIONER::ParallelTopology::getFusedCellNumbers ( int  idomain) [inline, virtual]

retrieving cell numbers after merging in parallel mode

Implements MEDPARTITIONER::Topology.

Definition at line 119 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _cell_loc_to_glob_fuse[idomain]; }
const std::vector<int>& MEDPARTITIONER::ParallelTopology::getFusedCellNumbers ( int  idomain) const [inline, virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 121 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _cell_loc_to_glob_fuse[idomain]; }
std::vector<int>& MEDPARTITIONER::ParallelTopology::getFusedFaceNumbers ( int  idomain) [inline, virtual]

retrieving face numbers after merging in parallel mode

Implements MEDPARTITIONER::Topology.

Definition at line 124 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _face_loc_to_glob_fuse[idomain]; }
const std::vector<int>& MEDPARTITIONER::ParallelTopology::getFusedFaceNumbers ( int  idomain) const [inline, virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 126 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _face_loc_to_glob_fuse[idomain]; }
int ParallelTopology::getMaxGlobalFace ( ) const [virtual]

Return max global face number.

Implements MEDPARTITIONER::Topology.

Definition at line 521 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  int max = 0;
  TGlob2LocsMap::const_iterator g_l_l = _face_glob_to_loc.begin();
  for ( ; g_l_l != _face_glob_to_loc.end(); ++g_l_l )
    if ( g_l_l->first > max )
      max = g_l_l->first;
  return max;
}

Here is the call graph for this function:

void ParallelTopology::getNodeList ( int  idomain,
int *  list 
) const [virtual]

retrieving list of nodes in global numbers

Implements MEDPARTITIONER::Topology.

Definition at line 545 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  for (int i=0; i<_nb_nodes[idomain]; i++) 
    list[i]=_node_loc_to_glob[idomain][i];
}
int MEDPARTITIONER::ParallelTopology::getNodeNumber ( int  idomain) const [inline, virtual]

retrieving number of nodes

Implements MEDPARTITIONER::Topology.

Definition at line 112 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_nodes[idomain]; }
int ParallelTopology::getNodeNumber ( ) const [virtual]

Implements MEDPARTITIONER::Topology.

Definition at line 531 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (_node_glob_to_loc.empty()) return 0;
  std::set <int> keys;
  for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
    {
      keys.insert(iter->first);
    }
  return keys.size();
}

Here is the call graph for this function:

bool MEDPARTITIONER::ParallelTopology::hasCellWithNodes ( const MeshCollection &  ,
int  dom,
const std::set< int > &  nodes 
) [private]
int MEDPARTITIONER::ParallelTopology::nbCells ( ) const [inline, virtual]

number of cells

Implements MEDPARTITIONER::Topology.

Definition at line 105 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_total_cells; }
int MEDPARTITIONER::ParallelTopology::nbCells ( int  idomain) const [inline, virtual]

number of cells on a specific domain

Implements MEDPARTITIONER::Topology.

Definition at line 109 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_cells[idomain]; }
int MEDPARTITIONER::ParallelTopology::nbDomain ( ) const [inline, virtual]

number of doamins

Implements MEDPARTITIONER::Topology.

Definition at line 103 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_domain; }
int MEDPARTITIONER::ParallelTopology::nbNodes ( ) const [inline, virtual]

number of nodes

Implements MEDPARTITIONER::Topology.

Definition at line 107 of file MEDPARTITIONER_ParallelTopology.hxx.

{ return _nb_total_nodes; }
void ParallelTopology::setGlobalNumerotationDefault ( ParaDomainSelector *  domainSelector)

Definition at line 84 of file MEDPARTITIONER_ParallelTopology.cxx.

{
  if (MyGlobals::_Is0verbose>100)
    std::cout<< "setGlobalNumerotationDefault on " << _nb_domain << " domains\n";
  if (_loc_to_glob.size()!=0) throw INTERP_KERNEL::Exception("a global numerotation is done yet");
  _loc_to_glob.resize(_nb_domain);
  _node_loc_to_glob.resize(_nb_domain);
  
  //warning because _nb_cells[idomain] is 0 if not my domain(s)
  //we set loc_to_glob etc.. only for my domain(s)
  if (MyGlobals::_Is0verbose>500)
    std::cout << "(c)idomain|ilocalCell|iglobalCell" << std::endl;
  for (int idomain=0; idomain<_nb_domain; idomain++)
    {
      _loc_to_glob[idomain].resize(_nb_cells[idomain]);
      int domainCellShift=domainSelector->getDomainCellShift(idomain);
      for (int i=0; i<_nb_cells[idomain]; i++)
        {
          int global=domainCellShift+i ;
          _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
          _loc_to_glob[idomain][i]=global;
          if (MyGlobals::_Verbose>500)
            std::cout << "c" << idomain << "|" << i << "|" << global << " ";
        }
    }
#ifdef HAVE_MPI2
  if (MyGlobals::_Verbose>500 && MyGlobals::_World_Size>1) MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose trace
#endif
  if (MyGlobals::_Is0verbose>500) std::cout << std::endl;
  
  if (MyGlobals::_Is0verbose>500) std::cout << "(n)idomain|ilocalNode|iglobalNode" << std::endl;
  for (int idomain=0; idomain<_nb_domain; idomain++)
    {
      _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
      int domainNodeShift=domainSelector->getDomainNodeShift(idomain);
      for (int i=0; i<_nb_nodes[idomain]; i++)
        {
          int global=domainNodeShift+i ;
          _node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
          _node_loc_to_glob[idomain][i]=global;
          if (MyGlobals::_Verbose>500)
            std::cout << "n" << idomain << "|" << i << "|" << global << " ";
        }
    }
#ifdef HAVE_MPI2
  if (MyGlobals::_Verbose>500 && MyGlobals::_World_Size>1) MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose trace
#endif
  if (MyGlobals::_Is0verbose>500) std::cout << std::endl;
  
  _nb_total_cells=domainSelector->getNbTotalCells();
  _nb_total_nodes=domainSelector->getNbTotalNodes();
  _nb_total_faces=domainSelector->getNbTotalFaces();
  if (MyGlobals::_Is0verbose>200)
    std::cout << "globalNumerotation default done meshDimension " << _mesh_dimension << " nbTotalCells " << _nb_total_cells << " nbTotalNodes " << _nb_total_nodes << std::endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::vector<std::vector <int> > MEDPARTITIONER::ParallelTopology::_cell_loc_to_glob_fuse [private]

Definition at line 169 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 174 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<std::vector <int> > MEDPARTITIONER::ParallelTopology::_face_loc_to_glob [private]

Definition at line 177 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<std::vector <int> > MEDPARTITIONER::ParallelTopology::_face_loc_to_glob_fuse [private]

Definition at line 170 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 161 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<std::vector<int> > MEDPARTITIONER::ParallelTopology::_loc_to_glob [private]

Definition at line 162 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 185 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<int> MEDPARTITIONER::ParallelTopology::_nb_cells [private]

Definition at line 178 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 184 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<int> MEDPARTITIONER::ParallelTopology::_nb_faces [private]

Definition at line 180 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<int> MEDPARTITIONER::ParallelTopology::_nb_nodes [private]

Definition at line 179 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 181 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 183 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 182 of file MEDPARTITIONER_ParallelTopology.hxx.

Definition at line 163 of file MEDPARTITIONER_ParallelTopology.hxx.

std::vector<std::vector <int> > MEDPARTITIONER::ParallelTopology::_node_loc_to_glob [private]

Definition at line 166 of file MEDPARTITIONER_ParallelTopology.hxx.


The documentation for this class was generated from the following files: