From 39f36db2191f1778fb392349e3a296c0553489f3 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 19 Jul 2011 12:05:24 +0000 Subject: [PATCH] Merge from V6_3_BR 19/07/2011 --- src/OBJECT/Makefile.am | 4 +++- src/SMDS/Makefile.am | 2 +- src/SMDS/SMDS_Mesh.hxx | 1 + src/SMDS/SMDS_UnstructuredGrid.hxx | 6 ++++-- src/SMDS/chrono.hxx | 6 ++++-- src/SMESH/SMESH_OctreeNode.cxx | 2 +- src/SMESH/memoire.h | 4 ++++ src/SMESHGUI/Makefile.am | 5 +++-- src/SMESH_I/SMESH_Filter_i.cxx | 4 ++++ src/StdMeshers/StdMeshers_Import_1D.cxx | 2 +- src/StdMeshers/StdMeshers_Import_1D2D.cxx | 2 +- src/StdMeshers/StdMeshers_Quadrangle_2D.cxx | 14 ++++++++++---- src/StdMeshers/StdMeshers_ViscousLayers.cxx | 2 +- .../StdMeshersGUI_ObjectReferenceParamWdg.h | 1 + src/Tools/MeshCut/MeshCut_Maillage.cxx | 18 +++++++++++------- src/Tools/MeshCut/MeshCut_Utils.cxx | 5 +++-- 16 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/OBJECT/Makefile.am b/src/OBJECT/Makefile.am index 1e690dbb1..0264d62eb 100644 --- a/src/OBJECT/Makefile.am +++ b/src/OBJECT/Makefile.am @@ -76,7 +76,9 @@ libSMESHObject_la_LDFLAGS = \ ../SMESHClient/libSMESHClient.la \ ../SMDS/libSMDS.la \ ../Controls/libSMESHControls.la \ - $(GUI_LDFLAGS) -lSalomeApp -lSalomeObject -lSVTK -lVTKViewer -lqtx -lsuit \ + $(GUI_LDFLAGS) -lSalomeApp -lSalomeObject -lSVTK -lVTKViewer -lqtx -lsuit -lstd \ + -lPlot2d \ + -lSPlot2d \ $(GEOM_LDFLAGS) -lGEOMObject \ $(CAS_KERNEL) \ $(VTK_LIBS) $(QT_MT_LIBS) diff --git a/src/SMDS/Makefile.am b/src/SMDS/Makefile.am index c5fe45fdc..e3880b458 100644 --- a/src/SMDS/Makefile.am +++ b/src/SMDS/Makefile.am @@ -127,7 +127,7 @@ libSMDS_la_CPPFLAGS = \ libSMDS_la_LDFLAGS = \ $(VTK_LIBS) \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lOpUtil # Executables targets bin_PROGRAMS = SMDS_MemoryLimit diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 4a26c246a..9df39f25a 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -51,6 +51,7 @@ #include #include #include +#include #include "Utils_SALOME_Exception.hxx" #define MYASSERT(val) if (!(val)) throw SALOME_Exception(LOCALIZED("assertion not verified")); diff --git a/src/SMDS/SMDS_UnstructuredGrid.hxx b/src/SMDS/SMDS_UnstructuredGrid.hxx index 02bbf5f85..d2489a020 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.hxx +++ b/src/SMDS/SMDS_UnstructuredGrid.hxx @@ -24,6 +24,8 @@ #ifndef _SMDS_UNSTRUCTUREDGRID_HXX #define _SMDS_UNSTRUCTUREDGRID_HXX +#include "SMESH_SMDS.hxx" + #include #include #include "chrono.hxx" @@ -48,7 +50,7 @@ class SMDS_Downward; class SMDS_Mesh; class SMDS_MeshVolume; -class SMDS_CellLinks: public vtkCellLinks +class SMDS_EXPORT SMDS_CellLinks: public vtkCellLinks { public: vtkCellLinks::Link* ResizeL(vtkIdType sz); @@ -59,7 +61,7 @@ protected: ~SMDS_CellLinks(); }; -class SMDS_UnstructuredGrid: public vtkUnstructuredGrid +class SMDS_EXPORT SMDS_UnstructuredGrid: public vtkUnstructuredGrid { public: void setSMDS_mesh(SMDS_Mesh *mesh); diff --git a/src/SMDS/chrono.hxx b/src/SMDS/chrono.hxx index 98f9df516..a76fd8f40 100644 --- a/src/SMDS/chrono.hxx +++ b/src/SMDS/chrono.hxx @@ -20,6 +20,8 @@ #ifndef _CHRONO_HXX_ #define _CHRONO_HXX_ +#include "SMESH_SMDS.hxx" + #include #include #include @@ -33,7 +35,7 @@ typedef struct acnt double _ctrCumul; } cntStruct; -class counters +class SMDS_EXPORT counters { public: static cntStruct *_ctrs; @@ -44,7 +46,7 @@ protected: static int _nbChrono; }; -class chrono +class SMDS_EXPORT chrono { public: chrono(int i); diff --git a/src/SMESH/SMESH_OctreeNode.cxx b/src/SMESH/SMESH_OctreeNode.cxx index 31d609756..f735011e6 100644 --- a/src/SMESH/SMESH_OctreeNode.cxx +++ b/src/SMESH/SMESH_OctreeNode.cxx @@ -214,7 +214,7 @@ bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node, { double minDist = precision * precision; gp_Pnt p1 ( node.X(), node.Y(), node.Z() ); - set::iterator nIt = myNodes.begin(); + TIDSortedNodeSet::iterator nIt = myNodes.begin(); for ( ; nIt != myNodes.end(); ++nIt ) { gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() ); diff --git a/src/SMESH/memoire.h b/src/SMESH/memoire.h index f8f43493a..98c1d598d 100644 --- a/src/SMESH/memoire.h +++ b/src/SMESH/memoire.h @@ -27,11 +27,15 @@ void memostat(const char* f, int l); void memostat(const char* f, int l) { +#ifdef WIN32 + //rnv: TODO: find alternative of the malloc_stats() on windows platform +#else /* struct mallinfo mem = mallinfo(); */ /* std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " " << mem.uordblks << " " << mem.fordblks << " " << mem.keepcost << std::endl; */ std::cerr << f << ":" << l << " --------------------------" << std::endl; malloc_stats(); std::cerr << f << ":" << l << " --------------------------" << std::endl; +#endif } #define MEMOSTAT //memostat( __FILE__, __LINE__ ) diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index 5cf0556e4..543a86349 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -268,8 +268,9 @@ libSMESH_la_LDFLAGS = \ ../OBJECT/libSMESHObject.la \ $(CAS_LDFLAGS) -lTKV3d \ $(GUI_LDFLAGS) -lSalomePrs -lsuit -lSUITApp -lCAM -lstd \ - $(GEOM_LDFLAGS) -lGEOMBase -lGEOMFiltersSelection -lGEOMObject - + $(GEOM_LDFLAGS) -lGEOMBase -lGEOMFiltersSelection -lGEOMObject \ + $(PYTHON_LIBS) + # resources files nodist_salomeres_DATA= \ SMESH_images.qm \ diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index 948222daf..8dd7ca4f0 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -604,7 +604,11 @@ SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals) std::vector elements; myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements); +#ifdef WIN32 + nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1)); +#else nbIntervals = CORBA::Short( std::min( nbEvents.size(), funValues.size() - 1)); +#endif SMESH::Histogram_var histogram = new SMESH::Histogram; if ( nbIntervals > 0 ) { diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index 51db030b7..890359254 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -486,7 +486,7 @@ namespace // INTERNAL STUFF for ( ; d != dList.end(); ++d ) if ( d->_subM.count( subMesh )) { - set::iterator smIt = d->_subM.begin(); + set::iterator smIt = d->_subM.begin(); for( ; smIt != d->_subM.end(); ++smIt ) if ( (*smIt)->IsMeshComputed() ) d->_computedSubM.insert( *smIt); diff --git a/src/StdMeshers/StdMeshers_Import_1D2D.cxx b/src/StdMeshers/StdMeshers_Import_1D2D.cxx index 01f2f312f..7b3aed368 100644 --- a/src/StdMeshers/StdMeshers_Import_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D2D.cxx @@ -214,7 +214,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & SMDS_MeshElement::iterator node = face->begin_nodes(); for ( unsigned i = 0; i < newNodes.size(); ++i, ++node ) { - TNodeNodeMap::iterator n2nIt = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 )).first; + StdMeshers_Import_1D::TNodeNodeMap::iterator n2nIt = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 )).first; if ( n2nIt->second ) { if ( !subShapeIDs.count( n2nIt->second->getshapeId() )) diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 3589a7870..dbddea789 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -895,9 +895,9 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes for ( int i = degenSides.size()-1; i > -1; --i ) { - StdMeshers_FaceSide * & degenSide = quad->side[ degenSides[ i ]]; - delete degenSide; - quad->side.erase( vector::iterator( & degenSide )); + StdMeshers_FaceSide* degenSide = quad->side[ degenSides[ i ]]; + delete degenSide; + quad->side.erase( quad->side.begin() + degenSides[ i ] ); } for ( unsigned i = TOP_SIDE; i < quad->side.size(); ++i ) quad->side[i]->Reverse(); @@ -2219,7 +2219,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh, int ncol_top = nt1 - 1; int ncol_bot = nb1 - 1; // number of rows needed to reduce ncol_bot to ncol_top using simple 3->1 "tree" (see below) - int nrows_tree31 = int( log( ncol_bot / ncol_top ) / log( 3 )); // = log x base 3 + int nrows_tree31 = int( log( (double)(ncol_bot / ncol_top) ) / log((double) 3 )); // = log x base 3 if ( nrows < nrows_tree31 ) MultipleReduce = true; } @@ -2545,7 +2545,13 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh, // maximum number of bottom elements for "tree" simple reduce 4->2 int max_tree42 = 0; // number of rows needed to reduce ncol_bot to ncol_top using simple 4->2 "tree" +#ifdef WIN32 + // of the MSVC doesn't contain log2 + int nrows_tree42 = int( log( (double)(ncol_bot / ncol_top) )/log((double)2) ); // needed to avoid overflow at pow(2) +#else int nrows_tree42 = int( log2( ncol_bot / ncol_top )); // needed to avoid overflow at pow(2) +#endif + if (ncol_top > npair_top * 2 && nrows_tree42 < nrows) { max_tree42 = npair_top * pow(2.0, nrows + 1); int delta = ncol_bot - int( max_tree42 ); diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index 6fd8738ad..c391333bb 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -2511,7 +2511,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data, if ( S.ShapeType() != TopAbs_EDGE ) continue; // TODO: find EDGE by VERTEX E1 = TopoDS::Edge( S ); - set< _LayerEdge* >::iterator eIt = ee.begin(); + set< _LayerEdge*, _LayerEdgeCmp >::iterator eIt = ee.begin(); while ( E2.IsNull() && eIt != ee.end()) { _LayerEdge* e2 = *eIt++; diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h index d1d39c8cd..30d93de4a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h @@ -37,6 +37,7 @@ // CORBA includes #include +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) class SUIT_SelectionFilter; diff --git a/src/Tools/MeshCut/MeshCut_Maillage.cxx b/src/Tools/MeshCut/MeshCut_Maillage.cxx index 0b0e4fd54..52136a2fc 100644 --- a/src/Tools/MeshCut/MeshCut_Maillage.cxx +++ b/src/Tools/MeshCut/MeshCut_Maillage.cxx @@ -1093,7 +1093,7 @@ void Maillage::outputMED(std::string fichierMED) ngro = ETIQFAM[ifam].size(); // Noms des groupes de la famille: variable nomsGN - char gro[ngro * MED_LNAME_SIZE + 1]; + char *gro = new char[ngro * MED_LNAME_SIZE + 1]; int cptGN = 0; for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++) { @@ -1121,8 +1121,8 @@ void Maillage::outputMED(std::string fichierMED) // Création de la famille if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0) ERREUR("Error MEDfamilyCr"); - - } + delete gro; + } } @@ -1136,7 +1136,7 @@ void Maillage::outputMED(std::string fichierMED) med_float *coo; // Table des coordonnées // Noms des coordonnées (variable nomcoo) - char nomcoo[mdim * MED_SNAME_SIZE + 1]; + char* nomcoo = new char[mdim * MED_SNAME_SIZE + 1]; string strX = (string) "X"; while (strX.size() < MED_SNAME_SIZE) strX += (string) " "; @@ -1155,7 +1155,7 @@ void Maillage::outputMED(std::string fichierMED) nomcoo[mdim * MED_SNAME_SIZE] = '\0'; // Unités des coordonnées (variable unicoo) - char unicoo[mdim * MED_SNAME_SIZE + 1]; + char* unicoo = new char[mdim * MED_SNAME_SIZE + 1]; string strmesure = (string) "SI"; while (strmesure.size() < MED_SNAME_SIZE) strmesure += (string) " "; @@ -1408,7 +1408,7 @@ void Maillage::outputMED(std::string fichierMED) ngro = ETIQFAM[ifam].size(); // Noms des groupes de la famille - char gro[ngro * MED_LNAME_SIZE + 1]; + char* gro = new char[ngro * MED_LNAME_SIZE + 1]; int cptGM = 0; for (unsigned int ign = 0; ign < ETIQFAM[ifam].size(); ign++) { @@ -1436,8 +1436,9 @@ void Maillage::outputMED(std::string fichierMED) // Création de la famille if (MEDfamilyCr(fid, maa, nomfam, numfam, 1, gro) < 0) ERREUR("Error MEDfamilyCr"); - } + delete gro; + } } // ######################################################################## @@ -1557,6 +1558,9 @@ void Maillage::outputMED(std::string fichierMED) cout << "Error on close MED file" << endl; } + delete unicoo; + delete nomcoo; + // cout << endl << endl << "Fin procédure outputMED" << endl; } // outputMED diff --git a/src/Tools/MeshCut/MeshCut_Utils.cxx b/src/Tools/MeshCut/MeshCut_Utils.cxx index 7d0f67855..247dad6ec 100644 --- a/src/Tools/MeshCut/MeshCut_Utils.cxx +++ b/src/Tools/MeshCut/MeshCut_Utils.cxx @@ -24,6 +24,7 @@ #include #include #include +#include using namespace std; using namespace MESHCUT; @@ -92,9 +93,9 @@ bool MESHCUT::appartient(std::string e, std::string tableau[], int taille) float MESHCUT::arrondi(float x) { - if (x > 0 and x < 1.0e-5) + if (x > 0 && x < 1.0e-5) return 0; - else if (x < 0 and x > -1.0e-5) + else if (x < 0 && x > -1.0e-5) return 0; else return x; -- 2.39.2