]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH_I/SMESH_Mesh_i.cxx
Salome HOME
Porting on Mandriva 64 (without libtool modifications)
[modules/smesh.git] / src / SMESH_I / SMESH_Mesh_i.cxx
index c56c56918dd829aeb6edc0eed393b25d20ff4cd2..5ccd2e510225eee5a8901521eddd693ea06e8750 100644 (file)
@@ -73,6 +73,8 @@ using SMESH::TPythonDump;
 
 int SMESH_Mesh_i::myIdGenerator = 0;
 
+
+
 //=============================================================================
 /*!
  *  Constructor
@@ -235,6 +237,18 @@ int SMESH_Mesh_i::ImportUNVFile( const char* theFileName )
   // Read mesh with name = <theMeshName> into SMESH_Mesh
   _impl->UNVToMesh( theFileName );
 
+  CreateGroupServants();
+
+  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  if ( !aStudy->_is_nil() ) {
+    // publishing of the groups in the study (sub-meshes are out of scope of UNV import)
+    map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.begin();
+    for (; it != _mapGroups.end(); it++ ) {
+      SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_duplicate( it->second );
+      _gen_i->PublishGroup( aStudy, _this(), aGroup,
+                           GEOM::GEOM_Object::_nil(), aGroup->GetName());
+    }
+  }
   return 1;
 }
 
@@ -266,24 +280,7 @@ int SMESH_Mesh_i::importMEDFile( const char* theFileName, const char* theMeshNam
 {
   // Read mesh with name = <theMeshName> and all its groups into SMESH_Mesh
   int status = _impl->MEDToMesh( theFileName, theMeshName );
-
-  // Create group servants, if any groups were imported
-  list<int> aGroupIds = _impl->GetGroupIds();
-  for ( list<int>::iterator it = aGroupIds.begin(); it != aGroupIds.end(); it++ ) {
-    SMESH_Group_i* aGroupImpl     = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, *it );
-
-    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-    SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
-    aGroupImpl->Register();
-    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-
-    SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aGroupImpl->_this() );
-    _mapGroups[*it]               = SMESH::SMESH_Group::_duplicate( aGroup );
-
-    // register CORBA object for persistence
-    int nextId = _gen_i->RegisterObject( aGroup );
-    if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
-  }
+  CreateGroupServants();
 
   return status;
 }
@@ -316,6 +313,8 @@ static SMESH::Hypothesis_Status ConvertHypothesisStatus
     res = SMESH::HYP_ALREADY_EXIST; break;
   case SMESH_Hypothesis::HYP_BAD_DIM:
     res = SMESH::HYP_BAD_DIM; break;
+  case SMESH_Hypothesis::HYP_BAD_SUBSHAPE:
+    res = SMESH::HYP_BAD_SUBSHAPE; break;
   default:
     res = SMESH::HYP_UNKNOWN_FATAL;
   }
@@ -1167,6 +1166,11 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
  */
 //=============================================================================
 
+CORBA::Boolean SMESH_Mesh_i::HasDuplicatedGroupNamesMED()
+{
+  return _impl->HasDuplicatedGroupNamesMED();
+}
+
 static void PrepareForWriting (const char* file)
 {
   TCollection_AsciiString aFullName ((char*)file);
@@ -1345,6 +1349,13 @@ CORBA::Long SMESH_Mesh_i::NbEdges()throw(SALOME::SALOME_Exception)
   return _impl->NbEdges();
 }
 
+CORBA::Long SMESH_Mesh_i::NbEdgesOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbEdges( (::SMESH_Mesh::ElementOrder) order);
+}
+
 //=============================================================================
 /*!
  *
@@ -1374,6 +1385,27 @@ CORBA::Long SMESH_Mesh_i::NbPolygons()throw(SALOME::SALOME_Exception)
   return _impl->NbPolygons();
 }
 
+CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbFaces( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbTriangles( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbQuadrangles( (::SMESH_Mesh::ElementOrder) order);
+}
+
 //=============================================================================
 /*!
  *
@@ -1415,6 +1447,41 @@ CORBA::Long SMESH_Mesh_i::NbPolyhedrons()throw(SALOME::SALOME_Exception)
   return _impl->NbPolyhedrons();
 }
 
+CORBA::Long SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbVolumes( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbTetras( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbHexas( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbPyramids( (::SMESH_Mesh::ElementOrder) order);
+}
+
+CORBA::Long SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order)
+  throw(SALOME::SALOME_Exception)
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  return _impl->NbPrisms( (::SMESH_Mesh::ElementOrder) order);
+}
+
 //=============================================================================
 /*!
  *
@@ -1563,3 +1630,37 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo
 {
   return ( SMESH::ElementType )_impl->GetElementType( id, iselem );
 }
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Mesh_i::GetMeshPtr()
+{
+  return CORBA::Long(size_t(_impl));
+}
+
+
+void SMESH_Mesh_i::CreateGroupServants() 
+{
+  // Create group servants, if any groups were imported
+  list<int> aGroupIds = _impl->GetGroupIds();
+  for ( list<int>::iterator it = aGroupIds.begin(); it != aGroupIds.end(); it++ ) {
+    SMESH_Group_i* aGroupImpl     = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, *it );
+
+    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
+    SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
+    aGroupImpl->Register();
+    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
+
+    SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( aGroupImpl->_this() );
+    _mapGroups[*it]               = SMESH::SMESH_Group::_duplicate( aGroup );
+
+    // register CORBA object for persistence
+    int nextId = _gen_i->RegisterObject( aGroup );
+    if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
+  }
+}
+