From 42c7eb97f9ec27537b638c98ef69dc55f19fa1cd Mon Sep 17 00:00:00 2001 From: szy Date: Tue, 30 Aug 2005 12:57:02 +0000 Subject: [PATCH] Windows porting --- src/Controls/SMESH_Controls.cxx | 35 ++++++++++++++++++----- src/SMDS/SMDS_EdgePosition.hxx | 14 ++++++++- src/SMDS/SMDS_FacePosition.hxx | 14 ++++++++- src/SMDS/SMDS_Mesh.hxx | 13 ++++++++- src/SMDS/SMDS_MeshElement.hxx | 14 ++++++++- src/SMDS/SMDS_MeshGroup.hxx | 13 ++++++++- src/SMDS/SMDS_MeshNode.hxx | 14 ++++++++- src/SMDS/SMDS_MeshObject.hxx | 15 +++++++++- src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx | 8 ++++++ src/SMDS/SMDS_Position.hxx | 14 ++++++++- src/SMDS/SMDS_SpacePosition.hxx | 14 ++++++++- src/SMDS/SMDS_VertexPosition.hxx | 14 ++++++++- src/SMDS/SMDS_VolumeTool.hxx | 14 ++++++++- src/SMESHDS/SMESHDS_Mesh.cxx | 20 ++++++++++++- src/SMESHDS/SMESHDS_Mesh.hxx | 29 +++++++++++++++++++ src/SMESHDS/SMESHDS_SubMesh.cxx | 8 ++++++ 16 files changed, 234 insertions(+), 19 deletions(-) diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 0714f7ea4..1aef723e8 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -253,7 +253,13 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P ) // Compute lengths of the sides - double aLen[ nbNodes ]; + //double aLen[ nbNodes ]; +#ifndef WNT + double aLen [nbNodes]; +#else + double* aLen = (double *)new double[nbNodes]; +#endif + for ( int i = 0; i < nbNodes - 1; i++ ) aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) ); aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) ); @@ -279,6 +285,9 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P ) aMinLen = Min( aMinLen, aLen[ i ] ); aMaxLen = Max( aMaxLen, aLen[ i ] ); } +#ifdef WNT + delete [] aLen; +#endif if ( aMinLen <= Precision::Confusion() ) return 0.; @@ -1270,7 +1279,12 @@ bool FreeEdges::IsSatisfy( long theId ) return false; int nbNodes = aFace->NbNodes(); - const SMDS_MeshNode* aNodes[ nbNodes ]; + //const SMDS_MeshNode* aNodes[ nbNodes ]; +#ifndef WNT + const SMDS_MeshNode* aNodes [nbNodes]; +#else + const SMDS_MeshNode** aNodes = (const SMDS_MeshNode **)new SMDS_MeshNode*[nbNodes]; +#endif int i = 0; SMDS_ElemIteratorPtr anIter = aFace->nodesIterator(); if ( anIter != 0 ) @@ -1285,13 +1299,20 @@ bool FreeEdges::IsSatisfy( long theId ) } for ( int i = 0; i < nbNodes - 1; i++ ) - if ( IsFreeEdge( &aNodes[ i ], theId ) ) + if ( IsFreeEdge( &aNodes[ i ], theId ) ) { +#ifdef WNT + delete [] aNodes; +#endif return true; + } aNodes[ 1 ] = aNodes[ nbNodes - 1 ]; - - return IsFreeEdge( &aNodes[ 0 ], theId ); - + const Standard_Boolean isFree = IsFreeEdge( &aNodes[ 0 ], theId ); +#ifdef WNT + delete [] aNodes; +#endif +// return + return isFree; } SMDSAbs_ElementType FreeEdges::GetType() const @@ -2138,7 +2159,7 @@ void ManifoldPart::expandBoundary { ManifoldPart::TVectorOfLink aLinks; getLinks( theNextFace, aLinks ); - int aNbLink = aLinks.size(); + int aNbLink = (int)aLinks.size(); for ( int i = 0; i < aNbLink; i++ ) { ManifoldPart::Link aLink = aLinks[ i ]; diff --git a/src/SMDS/SMDS_EdgePosition.hxx b/src/SMDS/SMDS_EdgePosition.hxx index 84916246b..fd297d3ab 100644 --- a/src/SMDS/SMDS_EdgePosition.hxx +++ b/src/SMDS/SMDS_EdgePosition.hxx @@ -29,7 +29,19 @@ #include "SMDS_Position.hxx" -class SMDS_EdgePosition:public SMDS_Position +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_EdgePosition:public SMDS_Position { public: diff --git a/src/SMDS/SMDS_FacePosition.hxx b/src/SMDS/SMDS_FacePosition.hxx index 255fd05d8..8ca74130f 100644 --- a/src/SMDS/SMDS_FacePosition.hxx +++ b/src/SMDS/SMDS_FacePosition.hxx @@ -29,7 +29,19 @@ #include "SMDS_Position.hxx" -class SMDS_FacePosition:public SMDS_Position +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_FacePosition:public SMDS_Position { public: diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 7f00c4be7..612082ce4 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -35,6 +35,17 @@ #include "SMDS_ElemIterator.hxx" #include +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + #include #include #include @@ -48,7 +59,7 @@ typedef boost::shared_ptr > SMDS_FaceIterat typedef SMDS_Iterator SMDS_VolumeIterator; typedef boost::shared_ptr > SMDS_VolumeIteratorPtr; -class SMDS_Mesh:public SMDS_MeshObject{ +class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{ public: SMDS_Mesh(); diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index b9f61351b..73870b707 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -32,6 +32,18 @@ #include "SMDS_ElemIterator.hxx" #include "SMDS_MeshElementIDFactory.hxx" +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + #include #include @@ -42,7 +54,7 @@ class SMDS_MeshFace; /////////////////////////////////////////////////////////////////////////////// /// Base class for elements /////////////////////////////////////////////////////////////////////////////// -class SMDS_MeshElement:public SMDS_MeshObject +class SMDS_WNT_EXPORT SMDS_MeshElement:public SMDS_MeshObject { public: diff --git a/src/SMDS/SMDS_MeshGroup.hxx b/src/SMDS/SMDS_MeshGroup.hxx index ef2264c12..37893fab4 100644 --- a/src/SMDS/SMDS_MeshGroup.hxx +++ b/src/SMDS/SMDS_MeshGroup.hxx @@ -29,8 +29,19 @@ #include "SMDS_Mesh.hxx" #include +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif -class SMDS_MeshGroup:public SMDS_MeshObject +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_MeshGroup:public SMDS_MeshObject { public: SMDS_MeshGroup(const SMDS_Mesh * theMesh, diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index fec75242e..042a1734a 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -31,7 +31,19 @@ #include "SMDS_Position.hxx" #include -class SMDS_MeshNode:public SMDS_MeshElement +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement { public: diff --git a/src/SMDS/SMDS_MeshObject.hxx b/src/SMDS/SMDS_MeshObject.hxx index 8386f2115..f734309cf 100644 --- a/src/SMDS/SMDS_MeshObject.hxx +++ b/src/SMDS/SMDS_MeshObject.hxx @@ -27,7 +27,20 @@ #ifndef _SMDS_MeshObject_HeaderFile #define _SMDS_MeshObject_HeaderFile -class SMDS_MeshObject + +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_MeshObject { public: virtual ~SMDS_MeshObject() {} diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx index 8b2613474..84ce2134d 100644 --- a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx @@ -75,7 +75,11 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector::iterator anIter = aSet.begin(); for (; anIter != aSet.end(); anIter++, k++) { aNodes[k] = *anIter; @@ -91,6 +95,10 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + class SMDS_Position; typedef boost::shared_ptr SMDS_PositionPtr; -class SMDS_Position +class SMDS_WNT_EXPORT SMDS_Position { public: diff --git a/src/SMDS/SMDS_SpacePosition.hxx b/src/SMDS/SMDS_SpacePosition.hxx index e4fadd6b1..f4c7bff1a 100644 --- a/src/SMDS/SMDS_SpacePosition.hxx +++ b/src/SMDS/SMDS_SpacePosition.hxx @@ -29,7 +29,19 @@ #include "SMDS_Position.hxx" -class SMDS_SpacePosition:public SMDS_Position +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_SpacePosition:public SMDS_Position { public: diff --git a/src/SMDS/SMDS_VertexPosition.hxx b/src/SMDS/SMDS_VertexPosition.hxx index 52ef05918..68c1e3a58 100644 --- a/src/SMDS/SMDS_VertexPosition.hxx +++ b/src/SMDS/SMDS_VertexPosition.hxx @@ -29,7 +29,19 @@ #include "SMDS_Position.hxx" -class SMDS_VertexPosition:public SMDS_Position +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + +class SMDS_WNT_EXPORT SMDS_VertexPosition:public SMDS_Position { public: diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index 89732b1da..e8891b93a 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -37,6 +37,18 @@ class SMDS_PolyhedralVolumeOfNodes; #include #include +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SMDS_EXPORTS +#define SMDS_WNT_EXPORT __declspec( dllexport ) +#else +#define SMDS_WNT_EXPORT +#endif + // ========================================================================= // // Class providing topological and other information about SMDS_MeshVolume: @@ -45,7 +57,7 @@ class SMDS_PolyhedralVolumeOfNodes; // // ========================================================================= -class SMDS_VolumeTool +class SMDS_WNT_EXPORT SMDS_VolumeTool { public: diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index ded954d0c..40d686a7e 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -173,11 +173,20 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, //ASSERT( nbnodes < 9 ); //int i, IDs[ 8 ]; +#ifndef WNT int i, IDs[ nbnodes ]; +#else + int i, *IDs; + IDs = new int[ nbnodes]; +#endif for ( i = 0; i < nbnodes; i++ ) IDs [ i ] = nodes[ i ]->GetID(); myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes); +#ifdef WNT + delete [] IDs; +#endif + return true; } @@ -192,12 +201,21 @@ bool SMESHDS_Mesh::ChangePolygonNodes ASSERT(nodes.size() > 3); int nb = nodes.size(); +#ifndef WNT const SMDS_MeshNode* nodes_array [nb]; +#else + const SMDS_MeshNode** nodes_array = (const SMDS_MeshNode **)new SMDS_MeshNode*[nb]; +#endif for (int inode = 0; inode < nb; inode++) { nodes_array[inode] = nodes[inode]; } - +#ifndef WNT return ChangeElementNodes(elem, nodes_array, nb); +#else + bool aRes = ChangeElementNodes(elem, nodes_array, nb); + delete [] nodes_array; + return aRes; +#endif } //======================================================================= diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index 86b9071c1..fdf90a30b 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -43,6 +43,9 @@ #include #include #include +#ifdef WNT +#include +#endif //Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more. #ifdef __GNUC__ @@ -235,13 +238,39 @@ public: ~SMESHDS_Mesh(); private: +#ifndef WNT struct HashTopoDS_Shape{ size_t operator()(const TopoDS_Shape& S) const { return S.HashCode(2147483647); } }; +#else + typedef gstd::hash_compare< TopoDS_Shape, less > HashTopoDS; + + class HashTopoDS_Shape : public HashTopoDS { + public: + + size_t operator()(const TopoDS_Shape& S) const { + return S.HashCode(2147483647); + } + + bool operator()(const TopoDS_Shape& S1,const TopoDS_Shape& S2) const { + return S1==S2; + } + }; + + + +#endif + typedef std::list THypList; + +#ifndef WNT + typedef gstd::hash_map ShapeToHypothesis; +#else typedef gstd::hash_map ShapeToHypothesis; +#endif + ShapeToHypothesis myShapeToHypothesis; int myMeshID; diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index 4218db744..5bdbfc6a4 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -87,7 +87,11 @@ int SMESHDS_SubMesh::NbElements() const return myElements.size(); int nbElems = 0; +#ifndef WNT set::iterator it = mySubMeshes.begin(); +#else + set::const_iterator it = mySubMeshes.begin(); +#endif for ( ; it != mySubMeshes.end(); it++ ) nbElems += (*it)->NbElements(); @@ -105,7 +109,11 @@ int SMESHDS_SubMesh::NbNodes() const return myNodes.size(); int nbElems = 0; +#ifndef WNT set::iterator it = mySubMeshes.begin(); +#else + set::const_iterator it = mySubMeshes.begin(); +#endif for ( ; it != mySubMeshes.end(); it++ ) nbElems += (*it)->NbNodes(); -- 2.39.2