-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <BRepAdaptor_Surface.hxx>
#include <BRepMesh_Delaun.hxx>
+#include <Basics_OCCTVersion.hxx>
+
//================================================================================
/*!
* \brief Construct a Delaunay triangulation of given boundary nodes
* \param [in] boundaryNodes - vector of nodes of a wire
* \param [in] face - the face
* \param [in] faceID - the face ID
- * \param [in] nbNodesToVisit - nb of non-marked nodes on the face
*/
//================================================================================
const int nbDiv = 100;
const double uRange = surf.LastUParameter() - surf.FirstUParameter();
const double vRange = surf.LastVParameter() - surf.FirstVParameter();
+ const double uFixed = surf.FirstUParameter() + 0.5 * uRange;
+ const double vFixed = surf.FirstVParameter() + 0.5 * vRange;
const double dU = uRange / nbDiv;
const double dV = vRange / nbDiv;
double u = surf.FirstUParameter(), v = surf.FirstVParameter();
double lenU = 0, lenV = 0;
for ( ; u < surf.LastUParameter(); u += dU, v += dV )
{
- gp_Pnt p1U = surf.Value( u, surf.FirstVParameter() );
+ gp_Pnt p1U = surf.Value( u, vFixed );
lenU += p1U.Distance( p0U );
p0U = p1U;
- gp_Pnt p1V = surf.Value( surf.FirstUParameter(), v );
+ gp_Pnt p1V = surf.Value( uFixed, v );
lenV += p1V.Distance( p0V );
p0V = p1V;
}
_bndNodes.resize( nbP );
// fill boundary points
+#if OCC_VERSION_LARGE <= 0x07030000
BRepMesh::Array1OfVertexOfDelaun bndVert( 1, 1 + nbP );
+#else
+ IMeshData::Array1OfVertexOfDelaun bndVert( 1, 1 + nbP );
+#endif
BRepMesh_Vertex v( 0, 0, BRepMesh_Frontier );
for ( size_t iW = 0; iW < boundaryNodes.size(); ++iW )
{
gp_XY seg = uv - gc;
tria->Edges( linkIDs, ori );
+#if OCC_VERSION_LARGE <= 0x07030000
int triaID = _triaDS->IndexOf( *tria );
+#else
+ int triaID = tria - & ( _triaDS->GetElement( 0 ));
+#endif
tria = 0;
for ( int i = 0; i < 3; ++i )
const BRepMesh_Triangle* SMESH_Delaunay::GetTriangleNear( int iBndNode )
{
+ if ( iBndNode >= _triaDS->NbNodes() )
+ return 0;
int nodeIDs[3];
int nbNbNodes = _bndNodes.size();
- const BRepMesh::ListOfInteger & linkIds = _triaDS->LinksConnectedTo( iBndNode + 1 );
- BRepMesh::ListOfInteger::const_iterator iLink = linkIds.cbegin();
+#if OCC_VERSION_LARGE <= 0x07030000
+ typedef BRepMesh::ListOfInteger TLinkList;
+#else
+ typedef IMeshData::ListOfInteger TLinkList;
+#endif
+ const TLinkList & linkIds = _triaDS->LinksConnectedTo( iBndNode + 1 );
+ TLinkList::const_iterator iLink = linkIds.cbegin();
for ( ; iLink != linkIds.cend(); ++iLink )
{
const BRepMesh_PairOfIndex & triaIds = _triaDS->ElementsConnectedTo( *iLink );
text << "import salome, SMESH\n";
text << "salome.salome_init()\n";
text << "from salome.smesh import smeshBuilder\n";
- text << "smesh = smeshBuilder.New(salome.myStudy)\n";
+ text << "smesh = smeshBuilder.New()\n";
text << "mesh=smesh.Mesh()\n";
const char* endl = "\n";
file.remove();
file.openForWriting();
file.write( text.c_str(), text.size() );
- cout << "execfile( '" << fileName << "')" << endl;
+ cout << "exec(open('" << fileName << "', 'rb').read())";
}