Windows porting

This commit is contained in:
szy 2005-08-30 12:57:02 +00:00
parent 1809a8e762
commit 42c7eb97f9
16 changed files with 234 additions and 19 deletions

View File

@ -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 ];

View File

@ -29,7 +29,19 @@
#include "SMDS_Position.hxx"
class SMDS_EdgePosition:public SMDS_Position
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -29,7 +29,19 @@
#include "SMDS_Position.hxx"
class SMDS_FacePosition:public SMDS_Position
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -35,6 +35,17 @@
#include "SMDS_ElemIterator.hxx"
#include <NCollection_Map.hxx>
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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 <boost/shared_ptr.hpp>
#include <set>
#include <list>
@ -48,7 +59,7 @@ typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIterat
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
class SMDS_Mesh:public SMDS_MeshObject{
class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
SMDS_Mesh();

View File

@ -32,6 +32,18 @@
#include "SMDS_ElemIterator.hxx"
#include "SMDS_MeshElementIDFactory.hxx"
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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 <vector>
#include <iostream>
@ -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:

View File

@ -29,8 +29,19 @@
#include "SMDS_Mesh.hxx"
#include <set>
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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,

View File

@ -31,7 +31,19 @@
#include "SMDS_Position.hxx"
#include <NCollection_List.hxx>
class SMDS_MeshNode:public SMDS_MeshElement
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -27,7 +27,20 @@
#ifndef _SMDS_MeshObject_HeaderFile
#define _SMDS_MeshObject_HeaderFile
class SMDS_MeshObject
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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() {}

View File

@ -75,7 +75,11 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode
}
int k = 0;
#ifndef WNT
const SMDS_MeshNode* aNodes [aNbNodes];
#else
const SMDS_MeshNode** aNodes = (const SMDS_MeshNode **)new SMDS_MeshNode*[aNbNodes];
#endif
std::set<const SMDS_MeshNode *>::iterator anIter = aSet.begin();
for (; anIter != aSet.end(); anIter++, k++) {
aNodes[k] = *anIter;
@ -91,6 +95,10 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode
myNodes[i] = aNodes[i];
}
#ifdef WNT
delete [] aNodes;
#endif
return true;
}

View File

@ -30,11 +30,23 @@
#include "SMDS_TypeOfPosition.hxx"
#include <boost/shared_ptr.hpp>
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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_Position> SMDS_PositionPtr;
class SMDS_Position
class SMDS_WNT_EXPORT SMDS_Position
{
public:

View File

@ -29,7 +29,19 @@
#include "SMDS_Position.hxx"
class SMDS_SpacePosition:public SMDS_Position
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -29,7 +29,19 @@
#include "SMDS_Position.hxx"
class SMDS_VertexPosition:public SMDS_Position
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -37,6 +37,18 @@ class SMDS_PolyhedralVolumeOfNodes;
#include <vector>
#include <set>
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#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:

View File

@ -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
}
//=======================================================================

View File

@ -43,6 +43,9 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <map>
#ifdef WNT
#include <hash_map>
#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<TopoDS_Shape> > 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<const SMESHDS_Hypothesis*> THypList;
#ifndef WNT
typedef gstd::hash_map<TopoDS_Shape,THypList,HashTopoDS_Shape> ShapeToHypothesis;
#else
typedef gstd::hash_map<TopoDS_Shape,THypList,HashTopoDS_Shape> ShapeToHypothesis;
#endif
ShapeToHypothesis myShapeToHypothesis;
int myMeshID;

View File

@ -87,7 +87,11 @@ int SMESHDS_SubMesh::NbElements() const
return myElements.size();
int nbElems = 0;
#ifndef WNT
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
#else
set<const SMESHDS_SubMesh*>::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<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
#else
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
#endif
for ( ; it != mySubMeshes.end(); it++ )
nbElems += (*it)->NbNodes();