Salome HOME
Merge multi-study removal branch.
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis_i.cxx
index 2c8c30f5c3d8b2bcd4c57c987ecfc8b203973883..d4348f519259770e23888a401a0a65509c37a368 100644 (file)
@@ -53,7 +53,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
-  MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" );
   myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
                                               theGenImpl);
 }
@@ -63,7 +62,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th
 //=======================================================================
 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
 {
-  MESSAGE( "HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i" );
 }
 
 //=======================================================================
@@ -87,6 +85,64 @@ CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap()
   return this->GetImpl()->GetLayersOnAllWrap();
 }
 
+//=======================================================================
+//function : SetFacesWithLayers
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
+{
+  std::vector<int> ids( theVal.length() );
+  for ( size_t i = 0; i < ids.size(); ++i )
+   ids[i] = theVal[i];
+
+  bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
+  if (valueChanged)
+    SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
+}
+
+//=======================================================================
+//function : GetFacesWithLayers
+//=======================================================================
+
+SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithLayers()
+{
+  const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithLayers();
+  SMESH::long_array_var ids = new SMESH::long_array;
+  ids->length( idsVec.size() );
+  for ( size_t i = 0; i < idsVec.size(); ++i )
+    ids[i] = idsVec[i];
+  return ids._retn();
+}
+
+//=======================================================================
+//function : SetFacesWithImprinting
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis_i::SetFacesWithImprinting(const ::SMESH::long_array& theVal)
+{
+  std::vector<int> ids( theVal.length() );
+  for ( size_t i = 0; i < ids.size(); ++i )
+   ids[i] = theVal[i];
+
+  bool valueChanged = this->GetImpl()->SetFacesWithImprinting(ids);
+  if (valueChanged)
+    SMESH::TPythonDump() << _this() << ".SetFacesWithImprinting( "<< theVal << " )";
+}
+
+//=======================================================================
+//function : GetFacesWithImprinting
+//=======================================================================
+
+SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithImprinting()
+{
+  const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithImprinting();
+  SMESH::long_array_var ids = new SMESH::long_array;
+  ids->length( idsVec.size() );
+  for ( size_t i = 0; i < idsVec.size(); ++i )
+    ids[i] = idsVec[i];
+  return ids._retn();
+}
+
 //=======================================================================
 //function : SetToMeshHoles
 //=======================================================================
@@ -527,7 +583,7 @@ void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
   ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
       (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
   if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
-       l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
+       l > ::HYBRIDPlugin_Hypothesis::Generation_Cartesian_Core )
     THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
     
   ASSERT(myBaseImpl);
@@ -620,6 +676,25 @@ CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
   return this->GetImpl()->GetBoundaryLayersProgression();
 }
 
+//=======================================================================
+//function : SetCoreSize
+//=======================================================================
+void HYBRIDPlugin_Hypothesis_i::SetCoreSize(CORBA::Double toCoreSize)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetCoreSize(toCoreSize);
+  SMESH::TPythonDump() << _this() << ".SetCoreSize( " << toCoreSize << " )";
+}
+
+//=======================================================================
+//function : GetCoreSize
+//=======================================================================
+CORBA::Double HYBRIDPlugin_Hypothesis_i::GetCoreSize()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetCoreSize();
+}
+
 //=======================================================================
 //function : SetMultinormalsAngle
 //=======================================================================
@@ -665,28 +740,24 @@ CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
   return p_SetEnforcedVertex(size, x, y, z);
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
 }
 
@@ -695,7 +766,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -726,11 +796,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
 
   std::string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
 }
@@ -771,11 +839,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
     
   std::string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
 }
@@ -785,7 +851,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
                                                    CORBA::Boolean isCompound)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
   bool newValue = false;
 
   ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
@@ -797,19 +862,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
     coords.push_back(y);
     coords.push_back(z);
     if (coordsList.find(coords) == coordsList.end()) {
-      MESSAGE("Coords not found: add it in coordsList");
       newValue = true;
     }
     else {
-      MESSAGE("Coords already found, compare names");
       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
       else {
-        MESSAGE("The names and size are identical");
       }
     }
 
@@ -833,19 +894,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
 //     ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
-      MESSAGE("Geom entry not found: add it in enfVertexEntryList");
       newValue = true;
     }
     else {
-      MESSAGE("Geom entry already found, compare names");
       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
       else {
-        MESSAGE("The names and size are identical");
       }
     }
 
@@ -860,7 +917,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
   if (newValue)
     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
 
-  MESSAGE("IDL : SetEnforcedVertexEntry END");
   return newValue;
 }
 
@@ -1132,7 +1188,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_p
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
   throw (SALOME::SALOME_Exception)
 {
-//   MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
 // #if HYBRID_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
 // #else
@@ -1184,7 +1239,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr th
 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-  MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
   ASSERT(myBaseImpl);
   
   if (CORBA::is_nil( theSource ))
@@ -1199,25 +1253,17 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   
   switch (theType) {
     case SMESH::NODE:
-      MESSAGE("Required type is NODE");
       break;
     case SMESH::EDGE:
-      MESSAGE("Required type is EDGE");
       break;
     case SMESH::FACE:
-      MESSAGE("Required type is FACE");
       break;
     default:
-        MESSAGE("Incompatible required type: " << theType);
-        return false;
+      return false;
   }
-//   MESSAGE("Required type is "<<theType);
   SMESH::array_of_ElementType_var types = theSource->GetTypes();
-  MESSAGE("Available types:");
-  for (CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
   if ( types->length() >= 1 && types[types->length()-1] <  theType)
   {
-    MESSAGE("Required type not available");
     return false;
 //     SALOME::ExceptionStruct ExDescription;
 //     ExDescription.text = "The source mesh has bad type";
@@ -1268,7 +1314,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   }
   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group")
     try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName && theGroupName[0]) {
@@ -1295,7 +1340,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   }
   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group on geom")
       try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName && theGroupName[0]) {