Salome HOME
Copyright update 2022
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_HYBRID.cxx
index af748c7cc1055403b1be120a1deea31e1f6f5633..862a704bcb8d67037ebee8e3ff212334a2295d6c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -70,6 +70,7 @@
 #include <Basics_Utils.hxx>
 #include <utilities.h>
 
+#include <fstream>
 #include <algorithm>
 
 #define castToNode(n) static_cast<const SMDS_MeshNode *>( n );
@@ -167,11 +168,11 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh&         aMesh,
 
 TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry)
 {
-  if ( SMESH_Gen_i::getStudyServant()->_is_nil() )
+  if ( SMESH_Gen_i::GetSMESHGen()->getStudyServant()->_is_nil() )
     throw SALOME_Exception("MG-HYBRID plugin can't work w/o publishing in the study");
   GEOM::GEOM_Object_var aGeomObj;
   TopoDS_Shape S = TopoDS_Shape();
-  SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
+  SALOMEDS::SObject_var aSObj = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectID( entry.c_str() );
   if (!aSObj->_is_nil() ) {
     CORBA::Object_var obj = aSObj->GetObject();
     aGeomObj = GEOM::GEOM_Object::_narrow(obj);
@@ -815,7 +816,7 @@ static bool readGMFFile(MG_HYBRID_API*                          MGOutput,
   std::map<int, std::set<int> >::const_iterator subdomainIt = subdomainId2tetraId.begin();
   std::string aSubdomainFileName = theFile;
   aSubdomainFileName = aSubdomainFileName + ".subdomain";
-  ofstream aSubdomainFile  ( aSubdomainFileName  , ios::out);
+  std::ofstream aSubdomainFile  ( aSubdomainFileName  , ios::out);
 
   aSubdomainFile << "Nb subdomains " << subdomainId2tetraId.size() << std::endl;
   for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) {
@@ -1489,7 +1490,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   // Write aSmdsToHybridIdMap to temp file
   std::string aSmdsToHybridIdMapFileName;
   aSmdsToHybridIdMapFileName = aGenericName + ".ids";  // ids relation
-  ofstream aIdsFile  ( aSmdsToHybridIdMapFileName  , ios::out);
+  std::ofstream aIdsFile  ( aSmdsToHybridIdMapFileName  , ios::out);
   Ok = aIdsFile.rdbuf()->is_open();
   if (!Ok) {
     INFOS( "Can't write into " << aSmdsToHybridIdMapFileName);
@@ -2205,9 +2206,9 @@ bool HYBRIDPlugin_HYBRID::Evaluate(SMESH_Mesh& aMesh,
                                             "Submesh can not be evaluated",this));
       return false;
     }
-    std::vector<int> aVec = (*anIt).second;
-    nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
-    nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+    std::vector<smIdType> aVec = (*anIt).second;
+    nbtri += std::max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+    nbqua += std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
     GProp_GProps G;
     BRepGProp::SurfaceProperties(F,G);
     double anArea = G.Mass();
@@ -2226,9 +2227,9 @@ bool HYBRIDPlugin_HYBRID::Evaluate(SMESH_Mesh& aMesh,
     tmpMap.Add(E);
     SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
     MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
-    std::vector<int> aVec = (*anIt).second;
+    std::vector<smIdType> aVec = (*anIt).second;
     nb0d_e += aVec[SMDSEntity_Node];
-    nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+    nb1d_e += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
     if(IsFirst) {
       IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
       IsFirst = false;
@@ -2246,7 +2247,7 @@ bool HYBRIDPlugin_HYBRID::Evaluate(SMESH_Mesh& aMesh,
   int nbVols = int(aVolume/tetrVol/CoeffQuality);
   int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
   int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
-  std::vector<int> aVec(SMDSEntity_Last);
+  std::vector<smIdType> aVec(SMDSEntity_Last);
   for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
   if( IsQuadratic ) {
     aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;