]> SALOME platform Git repositories - plugins/ghs3dprlplugin.git/commitdiff
Salome HOME
remove "using namespace std" from SMESH headers V8_0_0_BR V8_0_0 V8_0_0rc2
authoreap <eap@opencascade.com>
Mon, 15 Feb 2016 14:16:46 +0000 (17:16 +0300)
committervsr <vsr@opencascade.com>
Sat, 20 Feb 2016 08:21:04 +0000 (11:21 +0300)
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx

index 2eb9fb4b9e7ad622daf333bc29dbcd2ade1c3c43..7352c07d1be0293a9e142888776130805def7eb8 100755 (executable)
@@ -57,6 +57,8 @@
 #include <BRepGProp.hxx>
 #include <GProp_GProps.hxx>
 
+using namespace std;
+
 /* 
 #include <med.h>
 //#include <med_config.h>
@@ -158,7 +160,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString &  GHS3DPRL_In,
    int nbVertices=theMesh->NbNodes();
    int nbFaces=theMesh->NbFaces();        //triangles or quadrangles
    const char* space="  ";
-   const int dummyint=1;                  //nrs,nsd,refnum=1 (for wrap)
+   //const int dummyint=1;                  //nrs,nsd,refnum=1 (for wrap)
 
    // Writing SMESH points into GHS3DPRL File.points
    theFile<<nbVertices<<endl;
@@ -240,32 +242,32 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString &  GHS3DPRL_In,
 }
 
 //=======================================================================
-static bool getInt( int & theValue, char * & theLine )
-{
-  char *ptr;
-  theValue = strtol( theLine, &ptr, 10 );
-  if ( ptr == theLine ||
-      // there must not be neither '.' nor ',' nor 'E' ...
-      (*ptr != ' ' && *ptr != '\n' && *ptr != '\0'))
-    return false;
-
-  DUMP( "  " << theValue );
-  theLine = ptr;
-  return true;
-}
+// static bool getInt( int & theValue, char * & theLine )
+// {
+//   char *ptr;
+//   theValue = strtol( theLine, &ptr, 10 );
+//   if ( ptr == theLine ||
+//       // there must not be neither '.' nor ',' nor 'E' ...
+//       (*ptr != ' ' && *ptr != '\n' && *ptr != '\0'))
+//     return false;
+
+//   DUMP( "  " << theValue );
+//   theLine = ptr;
+//   return true;
+// }
 
 //=======================================================================
-static bool getDouble( double & theValue, char * & theLine )
-{
-  char *ptr;
-  theValue = strtod( theLine, &ptr );
-  if ( ptr == theLine )
-    return false;
-
-  DUMP( "   " << theValue );
-  theLine = ptr;
-  return true;
-}
+// static bool getDouble( double & theValue, char * & theLine )
+// {
+//   char *ptr;
+//   theValue = strtod( theLine, &ptr );
+//   if ( ptr == theLine )
+//     return false;
+
+//   DUMP( "   " << theValue );
+//   theLine = ptr;
+//   return true;
+// }
 
 //=======================================================================
 
@@ -274,126 +276,126 @@ static bool getDouble( double & theValue, char * & theLine )
 {  aPtr = fgets( aBuf, GHS3DPRLPlugin_BUFLENGTH - 2, aFile ); aLineNb++; DUMP(endl); }
 
 //=======================================================================
-static bool readResult(FILE *                           theFile,
-                       SMESHDS_Mesh *                   theMesh,
-                       const TopoDS_Shape &             theShape,
-                       map <int,const SMDS_MeshNode*> & theGHS3DPRLIdToNodeMap,
-                       const TCollection_AsciiString &  GHS3DPRL_Out,
-                       int &                            nodeRefNumber)
-{
-  // ---------------------------------
-  // Read generated elements and nodes
-  // ---------------------------------
-
-  cout << "Reading GHS3DPRL output file : " << GHS3DPRL_Out << endl;
-  cout << endl;
-
-  char aBuffer[ GHS3DPRLPlugin_BUFLENGTH ];
-  char * aPtr;
-  int aLineNb = 0;
-  int shapeID = theMesh->ShapeToIndex( theShape );
-
-  int line = 1, EndOfFile = 0, nbElem = 0, nField = 10, nbRef = 0, aGHS3DPRLNodeID = 0;
-  const char * theField;
-
-  vector<const char*> tabField = vector<const char*>(nField);
-  vector<int> tabRef = vector<int>(nField);
-
-  tabField[0] = "MeshVersionFormatted";    tabRef[0] = 0;
-  tabField[1] = "Dimension";               tabRef[1] = 0;
-  tabField[2] = "Vertices";                tabRef[2] = 3;
-  tabField[3] = "Edges";                   tabRef[3] = 2;
-  tabField[4] = "Triangles";               tabRef[4] = 3;
-  tabField[5] = "Quadrilaterals";          tabRef[5] = 4;
-  tabField[6] = "Hexahedra";               tabRef[6] = 8;
-  tabField[7] = "Corners";                 tabRef[7] = 1;
-  tabField[8] = "Ridges";                  tabRef[0] = 1;
-  tabField[9] = "End";                     tabRef[0] = 0;
-
-  nodeRefNumber += theMesh->NbNodes();
-
-  SMDS_NodeIteratorPtr itOnGHS3DPRLInputNode = theMesh->nodesIterator();
-  while ( itOnGHS3DPRLInputNode->more() )
-      theMesh->RemoveNode( itOnGHS3DPRLInputNode->next() );
-
-  while ( EndOfFile == 0  ) {
-      GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
-      for ( int iField = 0; iField < nField; iField++ ) {
-          stringstream theMessage;
-          theField = tabField[iField];
-          if ( strncmp(aPtr, theField, strlen(theField)) == 0 ) {
-              if ( strcmp(theField, "End") == 0 ) {
-                  EndOfFile = 1;
-                  theMessage << "End of GHS3DPRL output file has been reached";
-              }
-              else {
-                  GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
-                  line++;
-                  getInt( nbElem, aPtr );
-
-                  if ( strcmp(theField, "MeshVersionFormatted") == 0 )
-                      theMessage << "GHS3DPRL mesh descriptor : " << theField << " " << nbElem;
-                  else if ( strcmp(theField, "Dimension") == 0 )
-                      theMessage << "GHS3DPRL mesh of " << nbElem << "D dimension";
-                  else if ( strcmp(theField, "Vertices")       == 0 ||
-                            strcmp(theField, "Edges")          == 0 ||
-                            strcmp(theField, "Quadrilaterals") == 0 ||
-                            strcmp(theField, "Hexahedra")      == 0 ) {
-                      nbRef = tabRef[iField];
-                      GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );           // read blank line
-
-                      if ( strcmp(theField, "Vertices") == 0 ) {
-                          int aGHS3DPRLID;
-                          vector<double> coord = vector<double>(nbRef);
-                          SMDS_MeshNode * aGHS3DPRLNode;
-
-                          for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-                              aGHS3DPRLID = iElem + 1 + nodeRefNumber;
-                              GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
-                              for ( int iCoord = 0; iCoord < 3; iCoord++ )
-                                  getDouble ( coord[ iCoord ], aPtr );
-                              aGHS3DPRLNode = theMesh->AddNode(coord[0], coord[1], coord[2]);
-                              theMesh->SetNodeInVolume( aGHS3DPRLNode, shapeID );
-                              theGHS3DPRLIdToNodeMap[ aGHS3DPRLID ] = aGHS3DPRLNode;
-                          }
-                      }
-                      else {
-                          vector<const SMDS_MeshNode*> node = vector<const SMDS_MeshNode*>(nbRef);
-                          SMDS_MeshElement* aGHS3DPRLElement;
-                          map <int,const SMDS_MeshNode*>::iterator itOnGHS3DPRLNode;
-
-                          for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-                              GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
-                              for ( int iRef = 0; iRef < nbRef; iRef++ ) {
-                                  getInt ( aGHS3DPRLNodeID, aPtr );                         // read nbRef aGHS3DPRLNodeID
-                                  aGHS3DPRLNodeID += nodeRefNumber;
-                                  itOnGHS3DPRLNode = theGHS3DPRLIdToNodeMap.find( aGHS3DPRLNodeID );
-                                  node[ iRef ] = itOnGHS3DPRLNode->second;
-                              }
-
-                              if ( strcmp(theField, "Edges") == 0 )                        // create an element
-                                  aGHS3DPRLElement = theMesh->AddEdge( node[0], node[1] );
-                              else if ( strcmp(theField, "Quadrilaterals") == 0 )
-                                  aGHS3DPRLElement = theMesh->AddFace( node[0], node[1], node[2], node[3] );
-                              else if ( strcmp(theField, "Hexahedra") == 0 )
-                                  aGHS3DPRLElement = theMesh->AddVolume( node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] );
-
-                              theMesh->SetMeshElementOnShape( aGHS3DPRLElement, shapeID );
-                          }
-                      }
-                      theMessage << nbElem << " " << theField << " created";
-                  }
-              }
-              if ( theMessage.str().size() != 0 ) {
-                  cout << theMessage.str() << endl;
-                  break;
-              }
-          }
-      }
-  }
-  cout << endl;
-  return true;
-}
+// static bool readResult(FILE *                           theFile,
+//                        SMESHDS_Mesh *                   theMesh,
+//                        const TopoDS_Shape &             theShape,
+//                        map <int,const SMDS_MeshNode*> & theGHS3DPRLIdToNodeMap,
+//                        const TCollection_AsciiString &  GHS3DPRL_Out,
+//                        int &                            nodeRefNumber)
+// {
+//   // ---------------------------------
+//   // Read generated elements and nodes
+//   // ---------------------------------
+
+//   cout << "Reading GHS3DPRL output file : " << GHS3DPRL_Out << endl;
+//   cout << endl;
+
+//   char aBuffer[ GHS3DPRLPlugin_BUFLENGTH ];
+//   char * aPtr;
+//   int aLineNb = 0;
+//   int shapeID = theMesh->ShapeToIndex( theShape );
+
+//   int line = 1, EndOfFile = 0, nbElem = 0, nField = 10, nbRef = 0, aGHS3DPRLNodeID = 0;
+//   const char * theField;
+
+//   vector<const char*> tabField = vector<const char*>(nField);
+//   vector<int> tabRef = vector<int>(nField);
+
+//   tabField[0] = "MeshVersionFormatted";    tabRef[0] = 0;
+//   tabField[1] = "Dimension";               tabRef[1] = 0;
+//   tabField[2] = "Vertices";                tabRef[2] = 3;
+//   tabField[3] = "Edges";                   tabRef[3] = 2;
+//   tabField[4] = "Triangles";               tabRef[4] = 3;
+//   tabField[5] = "Quadrilaterals";          tabRef[5] = 4;
+//   tabField[6] = "Hexahedra";               tabRef[6] = 8;
+//   tabField[7] = "Corners";                 tabRef[7] = 1;
+//   tabField[8] = "Ridges";                  tabRef[0] = 1;
+//   tabField[9] = "End";                     tabRef[0] = 0;
+
+//   nodeRefNumber += theMesh->NbNodes();
+
+//   SMDS_NodeIteratorPtr itOnGHS3DPRLInputNode = theMesh->nodesIterator();
+//   while ( itOnGHS3DPRLInputNode->more() )
+//       theMesh->RemoveNode( itOnGHS3DPRLInputNode->next() );
+
+//   while ( EndOfFile == 0  ) {
+//       GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
+//       for ( int iField = 0; iField < nField; iField++ ) {
+//           stringstream theMessage;
+//           theField = tabField[iField];
+//           if ( strncmp(aPtr, theField, strlen(theField)) == 0 ) {
+//               if ( strcmp(theField, "End") == 0 ) {
+//                   EndOfFile = 1;
+//                   theMessage << "End of GHS3DPRL output file has been reached";
+//               }
+//               else {
+//                   GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );
+//                   line++;
+//                   getInt( nbElem, aPtr );
+
+//                   if ( strcmp(theField, "MeshVersionFormatted") == 0 )
+//                       theMessage << "GHS3DPRL mesh descriptor : " << theField << " " << nbElem;
+//                   else if ( strcmp(theField, "Dimension") == 0 )
+//                       theMessage << "GHS3DPRL mesh of " << nbElem << "D dimension";
+//                   else if ( strcmp(theField, "Vertices")       == 0 ||
+//                             strcmp(theField, "Edges")          == 0 ||
+//                             strcmp(theField, "Quadrilaterals") == 0 ||
+//                             strcmp(theField, "Hexahedra")      == 0 ) {
+//                       nbRef = tabRef[iField];
+//                       GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );           // read blank line
+
+//                       if ( strcmp(theField, "Vertices") == 0 ) {
+//                           int aGHS3DPRLID;
+//                           vector<double> coord = vector<double>(nbRef);
+//                           SMDS_MeshNode * aGHS3DPRLNode;
+
+//                           for ( int iElem = 0; iElem < nbElem; iElem++ ) {
+//                               aGHS3DPRLID = iElem + 1 + nodeRefNumber;
+//                               GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
+//                               for ( int iCoord = 0; iCoord < 3; iCoord++ )
+//                                   getDouble ( coord[ iCoord ], aPtr );
+//                               aGHS3DPRLNode = theMesh->AddNode(coord[0], coord[1], coord[2]);
+//                               theMesh->SetNodeInVolume( aGHS3DPRLNode, shapeID );
+//                               theGHS3DPRLIdToNodeMap[ aGHS3DPRLID ] = aGHS3DPRLNode;
+//                           }
+//                       }
+//                       else {
+//                           vector<const SMDS_MeshNode*> node = vector<const SMDS_MeshNode*>(nbRef);
+//                           SMDS_MeshElement* aGHS3DPRLElement;
+//                           map <int,const SMDS_MeshNode*>::iterator itOnGHS3DPRLNode;
+
+//                           for ( int iElem = 0; iElem < nbElem; iElem++ ) {
+//                               GHS3DPRLPlugin_ReadLine( aPtr, aBuffer, theFile, aLineNb );   // read file lines
+//                               for ( int iRef = 0; iRef < nbRef; iRef++ ) {
+//                                   getInt ( aGHS3DPRLNodeID, aPtr );                         // read nbRef aGHS3DPRLNodeID
+//                                   aGHS3DPRLNodeID += nodeRefNumber;
+//                                   itOnGHS3DPRLNode = theGHS3DPRLIdToNodeMap.find( aGHS3DPRLNodeID );
+//                                   node[ iRef ] = itOnGHS3DPRLNode->second;
+//                               }
+
+//                               if ( strcmp(theField, "Edges") == 0 )                        // create an element
+//                                   aGHS3DPRLElement = theMesh->AddEdge( node[0], node[1] );
+//                               else if ( strcmp(theField, "Quadrilaterals") == 0 )
+//                                   aGHS3DPRLElement = theMesh->AddFace( node[0], node[1], node[2], node[3] );
+//                               else if ( strcmp(theField, "Hexahedra") == 0 )
+//                                   aGHS3DPRLElement = theMesh->AddVolume( node[0], node[1], node[2], node[3], node[4], node[5], node[6], node[7] );
+
+//                               theMesh->SetMeshElementOnShape( aGHS3DPRLElement, shapeID );
+//                           }
+//                       }
+//                       theMessage << nbElem << " " << theField << " created";
+//                   }
+//               }
+//               if ( theMessage.str().size() != 0 ) {
+//                   cout << theMessage.str() << endl;
+//                   break;
+//               }
+//           }
+//       }
+//   }
+//   cout << endl;
+//   return true;
+// }
 
 //=============================================================================
 // Pass parameters to GHS3DPRL
@@ -781,31 +783,6 @@ bool GHS3DPRLPlugin_GHS3DPRL::ComputeForTepal(SMESH_Mesh& theMesh,
    }*/
 }
 
-//=============================================================================
-ostream & GHS3DPRLPlugin_GHS3DPRL::SaveTo(ostream & save)
-{
-  return save;
-}
-
-//=============================================================================
-istream & GHS3DPRLPlugin_GHS3DPRL::LoadFrom(istream & load)
-{
-  return load;
-}
-
-//=============================================================================
-ostream & operator << (ostream & save, GHS3DPRLPlugin_GHS3DPRL & hyp)
-{
-  return hyp.SaveTo( save );
-}
-
-//=============================================================================
-istream & operator >> (istream & load, GHS3DPRLPlugin_GHS3DPRL & hyp)
-{
-  return hyp.LoadFrom( load );
-}
-
-
 //=============================================================================
 /*!
  *  
index 8a485ad63a3dc8f4338624a17b4717c3be1f1287..a36733a7752ba6757c9b4e303b69ce8a0833a19a 100755 (executable)
@@ -54,11 +54,6 @@ public:
                         const TopoDS_Shape& aShape,
                         MapShapeNbElems&    aResMap);
 
-  ostream & SaveTo(ostream & save);
-  istream & LoadFrom(istream & load);
-  friend ostream & operator << (ostream & save, GHS3DPRLPlugin_GHS3DPRL & hyp);
-  friend istream & operator >> (istream & load, GHS3DPRLPlugin_GHS3DPRL & hyp);
-
 protected:
   const GHS3DPRLPlugin_Hypothesis* _hypothesis;
 private:
@@ -66,15 +61,15 @@ private:
   int   _countTotal;
   int   _nodeRefNumber;
 
-  string _MEDName;
-  int   _NbPart;      //number of partitions
-  bool  _KeepFiles;   //tepal file .noboite binary or not
-  bool  _Background;  //true for big meshes
+  std::string _MEDName;
+  int         _NbPart;      //number of partitions
+  bool        _KeepFiles;   //tepal file .noboite binary or not
+  bool        _Background;  //true for big meshes
   //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains
-  bool  _ToMergeSubdomains;
-  bool  _ToTagSubdomains;
-  bool  _ToOutputInterfaces;
-  bool  _ToDiscardSubdomains;
+  bool        _ToMergeSubdomains;
+  bool        _ToTagSubdomains;
+  bool        _ToOutputInterfaces;
+  bool        _ToDiscardSubdomains;
 };
 
 #endif