mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 10:08:34 +05:00
PR: tools for crack meshing : when importing a mesh, use a tolerance relative to the edge size.
This commit is contained in:
parent
1f2c6e16a4
commit
16fcf4dea0
@ -670,7 +670,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
|
|||||||
SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements();
|
SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements();
|
||||||
vector<const SMDS_MeshNode*> newNodes;
|
vector<const SMDS_MeshNode*> newNodes;
|
||||||
SMDS_MeshNode *tmpNode = helper.AddNode(0,0,0);
|
SMDS_MeshNode *tmpNode = helper.AddNode(0,0,0);
|
||||||
double u;
|
double u = 0;
|
||||||
while ( srcElems->more() ) // loop on group contents
|
while ( srcElems->more() ) // loop on group contents
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* edge = srcElems->next();
|
const SMDS_MeshElement* edge = srcElems->next();
|
||||||
@ -678,6 +678,10 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
|
|||||||
newNodes.resize( edge->NbNodes() );
|
newNodes.resize( edge->NbNodes() );
|
||||||
newNodes.back() = 0;
|
newNodes.back() = 0;
|
||||||
SMDS_MeshElement::iterator node = edge->begin_nodes();
|
SMDS_MeshElement::iterator node = edge->begin_nodes();
|
||||||
|
SMESH_TNodeXYZ a(edge->GetNode(0));
|
||||||
|
// --- define a tolerance relative to the length of an edge
|
||||||
|
double mytol = a.Distance(edge->GetNode(edge->NbNodes()-1))/25;
|
||||||
|
//MESSAGE("mytol = " << mytol);
|
||||||
for ( unsigned i = 0; i < newNodes.size(); ++i, ++node )
|
for ( unsigned i = 0; i < newNodes.size(); ++i, ++node )
|
||||||
{
|
{
|
||||||
TNodeNodeMap::iterator n2nIt = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 )).first;
|
TNodeNodeMap::iterator n2nIt = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 )).first;
|
||||||
@ -701,7 +705,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
|
|||||||
{
|
{
|
||||||
// find out if node lies on theShape
|
// find out if node lies on theShape
|
||||||
tmpNode->setXYZ( (*node)->X(), (*node)->Y(), (*node)->Z());
|
tmpNode->setXYZ( (*node)->X(), (*node)->Y(), (*node)->Z());
|
||||||
if ( helper.CheckNodeU( geomEdge, tmpNode, u, 10 * edgeTol, /*force=*/true ))
|
if ( helper.CheckNodeU( geomEdge, tmpNode, u, mytol, /*force=*/true ))
|
||||||
{
|
{
|
||||||
SMDS_MeshNode* newNode = tgtMesh->AddNode( (*node)->X(), (*node)->Y(), (*node)->Z());
|
SMDS_MeshNode* newNode = tgtMesh->AddNode( (*node)->X(), (*node)->Y(), (*node)->Z());
|
||||||
n2nIt->second = newNode;
|
n2nIt->second = newNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user