Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'origin/V7_dev' into V8_0_0_BR
[modules/smesh.git]
/
src
/
StdMeshers
/
StdMeshers_Import_1D2D.cxx
diff --git
a/src/StdMeshers/StdMeshers_Import_1D2D.cxx
b/src/StdMeshers/StdMeshers_Import_1D2D.cxx
index 505b85f729c0d8fd13105c8978087f8f79217870..df7f8c0655a6348b1dd87382e2b0fa2c1485b27a 100644
(file)
--- a/
src/StdMeshers/StdMeshers_Import_1D2D.cxx
+++ b/
src/StdMeshers/StdMeshers_Import_1D2D.cxx
@@
-44,11
+44,13
@@
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
+#include <BRepBndLib.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B2d.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B2d.hxx>
+#include <Bnd_Box.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Precision.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Precision.hxx>
@@
-190,13
+192,16
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
const int shapeID = tgtMesh->ShapeToIndex( geomFace );
const bool toCheckOri = (helper.NbAncestors( geomFace, theMesh, TopAbs_SOLID ) == 1 );
const int shapeID = tgtMesh->ShapeToIndex( geomFace );
const bool toCheckOri = (helper.NbAncestors( geomFace, theMesh, TopAbs_SOLID ) == 1 );
+
Handle(Geom_Surface) surface = BRep_Tool::Surface( geomFace );
Handle(Geom_Surface) surface = BRep_Tool::Surface( geomFace );
- const bool reverse =
+ const bool reverse =
( helper.GetSubShapeOri( tgtMesh->ShapeToMesh(), geomFace ) == TopAbs_REVERSED );
gp_Pnt p; gp_Vec du, dv;
( helper.GetSubShapeOri( tgtMesh->ShapeToMesh(), geomFace ) == TopAbs_REVERSED );
gp_Pnt p; gp_Vec du, dv;
+ // BRepClass_FaceClassifier is most time consuming, so minimize its usage
BRepClass_FaceClassifier classifier;
Bnd_B2d bndBox2d;
BRepClass_FaceClassifier classifier;
Bnd_B2d bndBox2d;
+ Bnd_Box bndBox3d;
{
Standard_Real umin,umax,vmin,vmax;
BRepTools::UVBounds(geomFace,umin,umax,vmin,vmax);
{
Standard_Real umin,umax,vmin,vmax;
BRepTools::UVBounds(geomFace,umin,umax,vmin,vmax);
@@
-212,6
+217,9
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
bndBox2d.Add( pmax );
}
bndBox2d.Enlarge( 1e-2 * Sqrt( bndBox2d.SquareExtent() ));
bndBox2d.Add( pmax );
}
bndBox2d.Enlarge( 1e-2 * Sqrt( bndBox2d.SquareExtent() ));
+
+ BRepBndLib::Add( geomFace, bndBox3d );
+ bndBox3d.Enlarge( 1e-5 * sqrt( bndBox3d.SquareExtent() ));
}
set<int> subShapeIDs;
}
set<int> subShapeIDs;
@@
-271,6
+279,7
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
vector<TopAbs_State> nodeState;
vector<const SMDS_MeshNode*> newNodes; // of a face
set <const SMDS_MeshNode*> bndNodes; // nodes classified ON
vector<TopAbs_State> nodeState;
vector<const SMDS_MeshNode*> newNodes; // of a face
set <const SMDS_MeshNode*> bndNodes; // nodes classified ON
+ vector<bool> isNodeIn; // nodes classified IN, by node ID
for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
@@
-284,9
+293,10
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
const double groupTol = 0.5 * sqrt( getMinElemSize2( srcGroup ));
minGroupTol = std::min( groupTol, minGroupTol );
const double groupTol = 0.5 * sqrt( getMinElemSize2( srcGroup ));
minGroupTol = std::min( groupTol, minGroupTol );
- GeomAdaptor_Surface S( surface );
- const double clsfTol = Min( S.UResolution( 0.1 * groupTol ),
- S.VResolution( 0.1 * groupTol ));
+ //GeomAdaptor_Surface S( surface );
+ // const double clsfTol = Min( S.UResolution( 0.1 * groupTol ), -- issue 0023092
+ // S.VResolution( 0.1 * groupTol ));
+ const double clsfTol = BRep_Tool::Tolerance( geomFace );
StdMeshers_Import_1D::TNodeNodeMap::iterator n2nIt;
pair< StdMeshers_Import_1D::TNodeNodeMap::iterator, bool > it_isnew;
StdMeshers_Import_1D::TNodeNodeMap::iterator n2nIt;
pair< StdMeshers_Import_1D::TNodeNodeMap::iterator, bool > it_isnew;
@@
-296,13
+306,16
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
{
const SMDS_MeshElement* face = srcElems->next();
{
const SMDS_MeshElement* face = srcElems->next();
+ SMDS_MeshElement::iterator node = face->begin_nodes();
+ if ( bndBox3d.IsOut( SMESH_TNodeXYZ( *node )))
+ continue;
+
// find or create nodes of a new face
nodeState.resize( face->NbNodes() );
newNodes.resize( nodeState.size() );
newNodes.back() = 0;
int nbCreatedNodes = 0;
bool isOut = false, isIn = false; // if at least one node isIn - do not classify other nodes
// find or create nodes of a new face
nodeState.resize( face->NbNodes() );
newNodes.resize( nodeState.size() );
newNodes.back() = 0;
int nbCreatedNodes = 0;
bool isOut = false, isIn = false; // if at least one node isIn - do not classify other nodes
- SMDS_MeshElement::iterator node = face->begin_nodes();
for ( size_t i = 0; i < newNodes.size(); ++i, ++node )
{
SMESH_TNodeXYZ nXYZ = *node;
for ( size_t i = 0; i < newNodes.size(); ++i, ++node )
{
SMESH_TNodeXYZ nXYZ = *node;
@@
-320,6
+333,9
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
{
if ( !subShapeIDs.count( newNode->getshapeId() ))
break; // node is Imported onto other FACE
{
if ( !subShapeIDs.count( newNode->getshapeId() ))
break; // node is Imported onto other FACE
+ if ( newNode->GetID() < (int) isNodeIn.size() &&
+ isNodeIn[ newNode->GetID() ])
+ isIn = true;
if ( !isIn && bndNodes.count( *node ))
nodeState[ i ] = TopAbs_ON;
}
if ( !isIn && bndNodes.count( *node ))
nodeState[ i ] = TopAbs_ON;
}
@@
-352,10
+368,15
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
newNode = tgtMesh->AddNode( nXYZ.X(), nXYZ.Y(), nXYZ.Z());
tgtMesh->SetNodeOnFace( newNode, shapeID, uv.X(), uv.Y() );
nbCreatedNodes++;
newNode = tgtMesh->AddNode( nXYZ.X(), nXYZ.Y(), nXYZ.Z());
tgtMesh->SetNodeOnFace( newNode, shapeID, uv.X(), uv.Y() );
nbCreatedNodes++;
+ if ( newNode->GetID() >= (int) isNodeIn.size() )
+ {
+ isNodeIn.push_back( false ); // allow allocate more than newNode->GetID()
+ isNodeIn.resize( newNode->GetID() + 1, false );
+ }
if ( nodeState[i] == TopAbs_ON )
bndNodes.insert( *node );
else
if ( nodeState[i] == TopAbs_ON )
bndNodes.insert( *node );
else
- isIn = true;
+ is
NodeIn[ newNode->GetID() ] = is
In = true;
}
}
if ( !(newNodes[i] = newNode ) || isOut )
}
}
if ( !(newNodes[i] = newNode ) || isOut )
@@
-433,7
+454,7
@@
bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
if ( geomNorm * meshNorm < 0 )
SMDS_MeshCell::applyInterlace
if ( geomNorm * meshNorm < 0 )
SMDS_MeshCell::applyInterlace
- ( SMDS_MeshCell::reverseSmdsOrder( face->GetEntityType() ), newNodes );
+ ( SMDS_MeshCell::reverseSmdsOrder( face->GetEntityType()
, newNodes.size()
), newNodes );
}
// make a new face
}
// make a new face
@@
-803,7
+824,7
@@
bool StdMeshers_Import_1D2D::Evaluate(SMESH_Mesh & theMesh,
set<const SMDS_MeshNode* > allNodes;
gp_XY uv;
double minGroupTol = 1e100;
set<const SMDS_MeshNode* > allNodes;
gp_XY uv;
double minGroupTol = 1e100;
- for (
in
t iG = 0; iG < srcGroups.size(); ++iG )
+ for (
size_
t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
const double groupTol = 0.5 * sqrt( getMinElemSize2( srcGroup ));
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
const double groupTol = 0.5 * sqrt( getMinElemSize2( srcGroup ));