+ port to OCC 7.0

This commit is contained in:
wmayer
2016-05-14 16:53:27 +02:00
parent 8200432a3d
commit cb73d010bb
44 changed files with 380 additions and 323 deletions

View File

@@ -1,27 +1,27 @@
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
// Module : SMESH
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
@@ -33,6 +33,11 @@
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Version_HeaderFile
#include <Standard_Version.hxx>
#endif
#if OCC_VERSION_HEX < 0x070000
#ifndef _Handle_MeshVS_DataSource3D_HeaderFile
#include <Handle_MeshVS_DataSource3D.hxx>
#endif
@@ -74,4 +79,5 @@ class Handle(SMESH_MeshVSLink) : public Handle(MeshVS_DataSource3D) {
Standard_EXPORT static const Handle(SMESH_MeshVSLink) DownCast(const Handle(Standard_Transient)& AnObject);
};
#endif // OCC_VERSION_HEX < 0x070000
#endif

View File

@@ -38,6 +38,7 @@
#include "SMESH_Exception.hxx"
#include <Standard_Version.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -47,7 +48,9 @@
class SMESH_Gen;
class SMESHDS_Document;
class SMESH_Group;
#if OCC_VERSION_HEX < 0x070000
class TopTools_ListOfShape;
#endif
class SMESH_subMesh;
class SMESH_HypoFilter;
class TopoDS_Solid;

View File

@@ -1,27 +1,27 @@
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
// Module : SMESH
#ifndef _SMESH_MeshVSLink_HeaderFile
@@ -36,11 +36,11 @@
#ifndef _TColStd_PackedMapOfInteger_HeaderFile
#include <TColStd_PackedMapOfInteger.hxx>
#endif
#ifndef _Handle_TColStd_HArray2OfInteger_HeaderFile
#include <Handle_TColStd_HArray2OfInteger.hxx>
#ifndef _TColStd_HArray2OfInteger_HeaderFile
#include <TColStd_HArray2OfInteger.hxx>
#endif
#ifndef _Handle_TColStd_HArray2OfReal_HeaderFile
#include <Handle_TColStd_HArray2OfReal.hxx>
#ifndef _TColStd_HArray2OfReal_HeaderFile
#include <TColStd_HArray2OfReal.hxx>
#endif
#ifndef _MeshVS_DataSource3D_HeaderFile
#include <MeshVS_DataSource3D.hxx>
@@ -57,8 +57,8 @@
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _Handle_TColStd_HArray1OfInteger_HeaderFile
#include <Handle_TColStd_HArray1OfInteger.hxx>
#ifndef _TColStd_HArray1OfInteger_HeaderFile
#include <TColStd_HArray1OfInteger.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
@@ -66,7 +66,13 @@
#ifndef _SMESH_Mesh_HeaderFile
#include <SMESH_Mesh.hxx>
#endif
#ifndef _Standard_Version_HeaderFile
#include <Standard_Version.hxx>
#endif
#if OCC_VERSION_HEX >= 0x070000
DEFINE_STANDARD_HANDLE(SMESH_MeshVSLink, MeshVS_DataSource3D)
#endif
class SMESH_MeshVSLink : public MeshVS_DataSource3D {
public:
@@ -125,7 +131,11 @@ class SMESH_MeshVSLink : public MeshVS_DataSource3D {
// Type management
//
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
#if OCC_VERSION_HEX >= 0x070000
DEFINE_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D)
#else
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
#endif
protected:
// Methods PROTECTED

View File

@@ -1,27 +1,27 @@
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
// Module : SMESH
#include <SMESH_MeshVSLink.jxx>
@@ -30,6 +30,11 @@
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _Standard_Version_HeaderFile
#include <Standard_Version.hxx>
#endif
#if OCC_VERSION_HEX < 0x070000
Standard_EXPORT Handle_Standard_Type& SMESH_MeshVSLink_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(MeshVS_DataSource3D);
@@ -69,3 +74,4 @@ const Handle(Standard_Type)& SMESH_MeshVSLink::DynamicType() const
{
return STANDARD_TYPE(SMESH_MeshVSLink) ;
}
#endif

View File

@@ -37,7 +37,9 @@
#include "SMESH_MesherHelper.hxx"
#if OCC_VERSION_HEX < 0x070000
class TopTools_IndexedMapOfShape;
#endif
typedef struct point3Dstruct
{

View File

@@ -30,6 +30,7 @@
#include "SMESH_StdMeshers.hxx"
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
@@ -42,7 +43,6 @@ class SMDS_MeshNode;
class SMESH_Mesh;
class SMESH_Hypothesis;
class SMESH_subMesh;
class TopTools_IndexedDataMapOfShapeListOfShape;
/*!
* \brief Class encapsulating methods common to Projection algorithms

View File

@@ -1,27 +1,27 @@
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshVSLink.cxx
// Created : Mon Dec 1 09:00:00 2008
// Author : Sioutis Fotios
// Module : SMESH
//local headers
@@ -40,58 +40,62 @@
#include <TColgp_Array1OfVec.hxx>
#include <TColStd_Array1OfReal.hxx>
#if OCC_VERSION_HEX >= 0x070000
IMPLEMENT_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D)
#endif
#define MAX_SORT_NODE_COUNT 12
typedef std::map<double, int> T_Double_NodeID_Map;
//=======================================================================
//function : sortNodes
//purpose :
//=======================================================================
bool sortNodes (const SMDS_MeshElement* theTool, const int* idNodes, int theNodeCount, int *myResult)
{
if (theNodeCount < 3) return false;
//INITIAL VARS
TColgp_Array1OfXYZ myNodeList(1, theNodeCount);
TColgp_Array1OfVec myVectList(1, theNodeCount);
TColStd_Array1OfReal myAngleList(1, theNodeCount);
gp_XYZ BaryCenter(0.,0.,0.);
//int myResult[MAX_SORT_NODE_COUNT];
//INITIALIZE THE POINTS
for (int i = 1; i <= theNodeCount; i++ ) {
const SMDS_MeshNode *n = theTool->GetNode( idNodes[i-1] );
gp_XYZ aPoint(n->X(), n->Y(), n->Z());
myNodeList.SetValue(i, aPoint);
}
//CALCULATE THE BARYCENTER
for (int i = 1; i <= theNodeCount; i++ )
BaryCenter += myNodeList.Value(i);
BaryCenter /= theNodeCount;
//CREATE THE VECTORS
for (int i = 1; i <= theNodeCount; i++ ) {
gp_Vec aVector(BaryCenter, myNodeList.Value(i));
myVectList.SetValue(i, aVector);
}
//CALCULATE THE NORMAL USING FIRST THREE POINTS
gp_XYZ q1 = myNodeList.Value(2)-myNodeList.Value(1);
gp_XYZ q2 = myNodeList.Value(3)-myNodeList.Value(1);
gp_XYZ normal = q1 ^ q2;
double modul = normal.Modulus();
if ( modul > 0 )
normal /= modul;
//COUNT THE ANGLE OF THE FIRST WITH EACH
for (int i = 1; i <= theNodeCount; i++ )
myAngleList.SetValue(i, myVectList.Value(1).AngleWithRef(myVectList.Value(i), normal));
//CREATE THE RESULT MAP (WILL SORT THE VERTICES)
T_Double_NodeID_Map myMap;
for (int i = 1; i <= theNodeCount; i++ )
myMap.insert( make_pair(myAngleList.Value(i), idNodes[i-1]));
int resID = 0;
T_Double_NodeID_Map::iterator it;
//function : sortNodes
//purpose :
//=======================================================================
bool sortNodes (const SMDS_MeshElement* theTool, const int* idNodes, int theNodeCount, int *myResult)
{
if (theNodeCount < 3) return false;
//INITIAL VARS
TColgp_Array1OfXYZ myNodeList(1, theNodeCount);
TColgp_Array1OfVec myVectList(1, theNodeCount);
TColStd_Array1OfReal myAngleList(1, theNodeCount);
gp_XYZ BaryCenter(0.,0.,0.);
//int myResult[MAX_SORT_NODE_COUNT];
//INITIALIZE THE POINTS
for (int i = 1; i <= theNodeCount; i++ ) {
const SMDS_MeshNode *n = theTool->GetNode( idNodes[i-1] );
gp_XYZ aPoint(n->X(), n->Y(), n->Z());
myNodeList.SetValue(i, aPoint);
}
//CALCULATE THE BARYCENTER
for (int i = 1; i <= theNodeCount; i++ )
BaryCenter += myNodeList.Value(i);
BaryCenter /= theNodeCount;
//CREATE THE VECTORS
for (int i = 1; i <= theNodeCount; i++ ) {
gp_Vec aVector(BaryCenter, myNodeList.Value(i));
myVectList.SetValue(i, aVector);
}
//CALCULATE THE NORMAL USING FIRST THREE POINTS
gp_XYZ q1 = myNodeList.Value(2)-myNodeList.Value(1);
gp_XYZ q2 = myNodeList.Value(3)-myNodeList.Value(1);
gp_XYZ normal = q1 ^ q2;
double modul = normal.Modulus();
if ( modul > 0 )
normal /= modul;
//COUNT THE ANGLE OF THE FIRST WITH EACH
for (int i = 1; i <= theNodeCount; i++ )
myAngleList.SetValue(i, myVectList.Value(1).AngleWithRef(myVectList.Value(i), normal));
//CREATE THE RESULT MAP (WILL SORT THE VERTICES)
T_Double_NodeID_Map myMap;
for (int i = 1; i <= theNodeCount; i++ )
myMap.insert( make_pair(myAngleList.Value(i), idNodes[i-1]));
int resID = 0;
T_Double_NodeID_Map::iterator it;
for(it = myMap.begin(); it!= myMap.end(); ++it)
myResult[resID++] = it->second;
return true;
myResult[resID++] = it->second;
return true;
}
//END sortNodes CHANGE */
@@ -105,38 +109,38 @@ SMESH_MeshVSLink::SMESH_MeshVSLink(const SMESH_Mesh *aMesh)
//add the nodes
SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator();
for(;aNodeIter->more();) {
const SMDS_MeshNode* aNode = aNodeIter->next();
myNodes.Add( aNode->GetID() );
const SMDS_MeshNode* aNode = aNodeIter->next();
myNodes.Add( aNode->GetID() );
}
//add the edges
SMDS_EdgeIteratorPtr anEdgeIter = myMesh->GetMeshDS()->edgesIterator();
for(;anEdgeIter->more();) {
const SMDS_MeshEdge* anElem = anEdgeIter->next();
myElements.Add( anElem->GetID() );
for(;anEdgeIter->more();) {
const SMDS_MeshEdge* anElem = anEdgeIter->next();
myElements.Add( anElem->GetID() );
}
//add the faces
SMDS_FaceIteratorPtr aFaceIter = myMesh->GetMeshDS()->facesIterator();
for(;aFaceIter->more();) {
const SMDS_MeshFace* anElem = aFaceIter->next();
myElements.Add( anElem->GetID() );
}
//add the volumes
SMDS_VolumeIteratorPtr aVolumeIter = myMesh->GetMeshDS()->volumesIterator();
for(;aVolumeIter->more();) {
const SMDS_MeshVolume* anElem = aVolumeIter->next();
myElements.Add( anElem->GetID() );
}
//add the groups
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetMeshDS()->GetGroups();
if (!groups.empty()) {
std::set<SMESHDS_GroupBase*>::const_iterator GrIt = groups.begin();
for (; GrIt != groups.end(); GrIt++) {
for(;aFaceIter->more();) {
const SMDS_MeshFace* anElem = aFaceIter->next();
myElements.Add( anElem->GetID() );
}
//add the volumes
SMDS_VolumeIteratorPtr aVolumeIter = myMesh->GetMeshDS()->volumesIterator();
for(;aVolumeIter->more();) {
const SMDS_MeshVolume* anElem = aVolumeIter->next();
myElements.Add( anElem->GetID() );
}
//add the groups
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetMeshDS()->GetGroups();
if (!groups.empty()) {
std::set<SMESHDS_GroupBase*>::const_iterator GrIt = groups.begin();
for (; GrIt != groups.end(); GrIt++) {
SMESHDS_Group* grp = dynamic_cast<SMESHDS_Group*>(*GrIt);
if (!grp || grp->IsEmpty()) continue;
myGroups.Add(grp->GetID());
}
}
}
//================================================================
// Function : GetGeom
@@ -325,14 +329,14 @@ Standard_Boolean SMESH_MeshVSLink::GetNormal
if(!myElem) return Standard_False;
if(myElem->NbNodes() < 3) return Standard_False;
gp_XYZ normal;
Standard_Real& nx, Standard_Real& ny,Standard_Real& nz ) const
{
if(Max<3) return Standard_False;
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(Id);
if(!myElem) return Standard_False;
if(myElem->NbNodes() < 3) return Standard_False;
gp_XYZ normal;
gp_XYZ nodes[3];
for (int itr = 0;itr < 3;itr++)
gp_XYZ nodes[3];
for (int itr = 0;itr < 3;itr++)
nodes[itr] = gp_XYZ(myElem->GetNode(itr)->X(), myElem->GetNode(itr)->Y(), myElem->GetNode(itr)->Z());
normal = (nodes[1]-nodes[0]) ^ (nodes[2]-nodes[0]);
if ( normal.Modulus() > 0 )
normal /= normal.Modulus();
nx = normal.X();
ny = normal.Y();
nz = normal.Z();
return Standard_True;
}

View File

@@ -35,6 +35,7 @@
#endif
#include <Standard_Failure.hxx>
#include <Expr_NamedUnknown.hxx>
#ifdef NO_CAS_CATCH
#include <Standard_ErrorHandler.hxx>