-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
bool* check) const
{
gp_Pnt2d uv( Precision::Infinite(), Precision::Infinite() );
+
const SMDS_PositionPtr Pos = n->GetPosition();
bool uvOK = false;
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
const SMDS_MeshNode* inEdgeNode,
bool* check)
{
- double param = 0;
+ double param = Precision::Infinite();
+
const SMDS_PositionPtr pos = n->GetPosition();
if ( pos->GetTypeOfPosition()==SMDS_TOP_EDGE )
{
{
double r = Max( 0.5, 1 - tol*n->GetID()); // to get a unique u on edge
u = f*r + l*(1-r);
+ MESSAGE("curve.IsNull: " << u);
}
}
else
}
Quantity_Parameter U = projector->LowerDistanceParameter();
u = double( U );
+ MESSAGE(" f " << f << " l " << l << " u " << u);
curvPnt = curve->Value( u );
dist = nodePnt.Distance( curvPnt );
if ( distXYZ ) {
}
else if ( fabs( u ) > numeric_limits<double>::min() )
{
+ MESSAGE("fabs( u ) > numeric_limits<double>::min() ; u " << u << " f " << f << " l " << l);
setPosOnShapeValidity( shapeID, true );
}
if (( u < f-tol || u > l+tol ) && force )
{
+ MESSAGE("u < f-tol || u > l+tol ; u " << u << " f " << f << " l " << l);
// node is on vertex but is set on periodic but trimmed edge (issue 0020890)
try
{
Handle( Geom_Surface ) S = BRep_Tool::Surface( F, loc );
P = S->Value( uvAvg.X(), uvAvg.Y() ).Transformed( loc );
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
- if ( mySetElemOnShape )
- meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
+ // if ( mySetElemOnShape ) node is not elem!
+ meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
return centralNode;
}
SMESH_TNodeXYZ( n4 ) ) / 4;
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
- if ( mySetElemOnShape )
+ if ( !F.IsNull() )
{
- if ( !F.IsNull() )
- {
- uvAvg = (GetNodeUV(F,n1,n3) +
- GetNodeUV(F,n2,n4) +
- GetNodeUV(F,n3,n1) +
- GetNodeUV(F,n4,n2)) / 4;
- CheckNodeUV( F, centralNode, uvAvg, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
- meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
- }
- else if ( shapeID > 0 )
- meshDS->SetNodeInVolume( centralNode, shapeID );
- else if ( myShapeID > 0 )
- meshDS->SetMeshElementOnShape( centralNode, myShapeID );
+ uvAvg = (GetNodeUV(F,n1,n3) +
+ GetNodeUV(F,n2,n4) +
+ GetNodeUV(F,n3,n1) +
+ GetNodeUV(F,n4,n2)) / 4;
+ CheckNodeUV( F, centralNode, uvAvg, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
+ meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
+ }
+ else if ( shapeID > 0 )
+ {
+ meshDS->SetNodeInVolume( centralNode, shapeID );
+ }
+ else if ( myShapeID > 0 && mySetElemOnShape )
+ {
+ meshDS->SetMeshElementOnShape( centralNode, myShapeID );
}
-
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
return centralNode;
}
gp_XY UV = GetMiddleUV( S, uv[0], uv[1] );
gp_Pnt P = S->Value( UV.X(), UV.Y() ).Transformed(loc);
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
- if ( mySetElemOnShape )
- meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y());
+ // if ( mySetElemOnShape ) node is not elem!
+ meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y());
myTLinkNodeMap.insert(make_pair(link,n12));
return n12;
}
gp_Pnt P = C->Value( U );
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
- if ( mySetElemOnShape )
- meshDS->SetNodeOnEdge(n12, edgeID, U);
+ //if ( mySetElemOnShape ) node is not elem!
+ meshDS->SetNodeOnEdge(n12, edgeID, U);
myTLinkNodeMap.insert(make_pair(link,n12));
return n12;
}
double z = ( n1->Z() + n2->Z() )/2.;
n12 = meshDS->AddNode(x,y,z);
- if ( mySetElemOnShape )
+ //if ( mySetElemOnShape ) node is not elem!
{
if ( !F.IsNull() )
{
gp_XY UV = ( uv[0] + uv[1] ) / 2.;
- CheckNodeUV( F, n12, UV, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
+ CheckNodeUV( F, n12, UV, 2 * BRep_Tool::Tolerance( F ), /*force=*/true);
meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y() );
}
else if ( !E.IsNull() )
{
double U = ( u[0] + u[1] ) / 2.;
- CheckNodeU( E, n12, U, 2*BRep_Tool::Tolerance( E ), /*force=*/true);
+ CheckNodeU( E, n12, U, 2 * BRep_Tool::Tolerance( E ), /*force=*/true);
meshDS->SetNodeOnEdge(n12, edgeID, U);
}
- else if ( myShapeID > 0 )
+ else if ( myShapeID > 0 && mySetElemOnShape )
{
meshDS->SetMeshElementOnShape(n12, myShapeID);
}
GetMeshDS()->MoveNode( n12, p.X(), p.Y(), p.Z() );
}
- if ( mySetElemOnShape )
- GetMeshDS()->SetNodeOnEdge(n12, edges[iOkEdge], u);
-
+ //if ( mySetElemOnShape ) node is not elem!
+ {
+ int edgeID = GetMeshDS()->ShapeToIndex( edges[iOkEdge] );
+ if ( edgeID != n12->getshapeId() )
+ GetMeshDS()->UnSetNodeOnShape( n12 );
+ GetMeshDS()->SetNodeOnEdge(n12, edgeID, u);
+ }
myTLinkNodeMap.insert( make_pair( SMESH_TLink(n1,n2), n12 ));
return n12;
node = meshDS->AddNodeWithID( x, y, z, ID );
else
node = meshDS->AddNode( x, y, z );
- if ( mySetElemOnShape && myShapeID > 0 ) {
+ if ( mySetElemOnShape && myShapeID > 0 ) { // node is not elem ?
switch ( myShape.ShapeType() ) {
case TopAbs_SOLID: meshDS->SetNodeInVolume( node, myShapeID); break;
case TopAbs_SHELL: meshDS->SetNodeInVolume( node, myShapeID); break;
if ( theParam2ColumnMap.empty() )
{
// get data of edges for normalization of params
-
vector< double > length;
double fullLen = 0;
list<TopoDS_Edge>::const_iterator edge;
map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNN.begin();
if ( theProxyMesh ) // from sortedBaseNN remove nodes not shared by faces of faceSubMesh
{
- const SMDS_MeshNode* n1 = sortedBaseNN.begin()->second;
- const SMDS_MeshNode* n2 = sortedBaseNN.rbegin()->second;
+ const SMDS_MeshNode* n1 = (++sortedBaseNN.begin())->second;
+ const SMDS_MeshNode* n2 = (++sortedBaseNN.rbegin())->second;
bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
n2 != theProxyMesh->GetProxyNode( n2 ));
if ( allNodesAreProxy )
while ( ++u_n != sortedBaseNN.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
sortedBaseNN.erase( sortedBaseNN.begin(), u_n );
}
- else if ( u_n = --sortedBaseNN.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
+ if ( u_n = --sortedBaseNN.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
{
while ( u_n != sortedBaseNN.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
sortedBaseNN.erase( ++u_n, sortedBaseNN.end() );
list< int > nbEdgesInWires;
int nbWires = SMESH_Block::GetOrderedEdges( TopoDS::Face( faceSM->GetSubShape() ),
edges, nbEdgesInWires );
- if ( nbWires != 1 || nbEdgesInWires.front() != 4 )
+ if ( nbWires != 1 /*|| nbEdgesInWires.front() != 4*/ ) // allow composite sides
return false;
// algo: find corners of a structure and then analyze nb of faces and