Exemple #1
0
// sets the entity m from which the mesh will be copied
void GEntity::setMeshMaster(int m_signed)
{
  if(m_signed == tag()){ _meshMaster = m_signed; return; }

  GEntity *gMaster = 0;
  int m = abs(m_signed);
  switch(dim()){
  case 0 : gMaster = model()->getVertexByTag(m); break;
  case 1 : gMaster = model()->getEdgeByTag(m); break;
  case 2 : gMaster = model()->getFaceByTag(m); break;
  case 3 : gMaster = model()->getRegionByTag(m); break;
  }
  if (!gMaster){
    Msg::Error("Model entity %d of dimension %d cannot be the mesh master of entity %d",
               m, dim(), tag());
    return;
  }
  int masterOfMaster = gMaster->meshMaster();

  if (masterOfMaster == gMaster->tag()){
    _meshMaster = m_signed;
  }
  else {
    setMeshMaster ( masterOfMaster * ((m_signed > 0) ? 1 : -1));
  }
}
Exemple #2
0
// gets the entity from which the mesh will be copied
int GEntity::meshMaster() const
{
  if (_meshMaster == tag()) return tag();

  GEntity *gMaster = 0;
  switch(dim()){
  case 0 : gMaster = model()->getVertexByTag(abs(_meshMaster)); break;
  case 1 : gMaster = model()->getEdgeByTag(abs(_meshMaster)); break;
  case 2 : gMaster = model()->getFaceByTag(abs(_meshMaster)); break;
  case 3 : gMaster = model()->getRegionByTag(abs(_meshMaster)); break;
  }
  if (!gMaster){
    Msg::Error("Could not find mesh master entity %d",_meshMaster);
    return tag();
  }
  int masterOfMaster = gMaster->meshMaster();

  if (masterOfMaster == gMaster->tag()){
    return _meshMaster ;
  }
  else {
    return gMaster->meshMaster() * ((_meshMaster > 0) ? 1 : -1);
  }
}