From: eap Date: Mon, 15 Feb 2016 14:16:46 +0000 (+0300) Subject: remove "using namespace std" from SMESH headers X-Git-Tag: V8_0_0rc2^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FV8_0_0_BR;p=plugins%2Fghs3dprlplugin.git remove "using namespace std" from SMESH headers --- diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index 2eb9fb4..7352c07 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -57,6 +57,8 @@ #include #include +using namespace std; + /* #include //#include @@ -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< & 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 tabField = vector(nField); - vector tabRef = vector(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 coord = vector(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 node = vector(nbRef); - SMDS_MeshElement* aGHS3DPRLElement; - map ::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 & 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 tabField = vector(nField); +// vector tabRef = vector(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 coord = vector(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 node = vector(nbRef); +// SMDS_MeshElement* aGHS3DPRLElement; +// map ::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 ); -} - - //============================================================================= /*! * diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx index 8a485ad..a36733a 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx @@ -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