vector<SMESH_subMesh*>::iterator onlyBIt = onlyOrderedList.begin();
vector<SMESH_subMesh*>::iterator onlyEIt = onlyOrderedList.end();
- // iterate on ordered submeshes and insert them in detected positions
+ // iterate on ordered sub-meshes and insert them in detected positions
map< int, TPosInList >::iterator i_pos = sortedPos.begin();
for ( ; onlyBIt != onlyEIt; ++onlyBIt, ++i_pos )
*(i_pos->second) = *onlyBIt;
const SMESH_subMesh* smAfter ) const
{
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
- TListOfInt::const_iterator idBef, idAft;
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++)
{
const TListOfInt& listOfId = *listIdsIt;
- idBef = std::find( listOfId.begin(), listOfId.end(), smBefore->GetId() );
- if ( idBef != listOfId.end() )
- idAft = std::find( listOfId.begin(), listOfId.end(), smAfter->GetId() );
- if ( idAft != listOfId.end () )
- return ( std::distance( listOfId.begin(), idBef ) <
- std::distance( listOfId.begin(), idAft ) );
+ int iB = -1, iA = -1, i = 0;
+ for ( TListOfInt::const_iterator id = listOfId.begin(); id != listOfId.end(); ++id, ++i )
+ {
+ if ( *id == smBefore->GetId() )
+ {
+ iB = i;
+ if ( iA > -1 )
+ return iB < iA;
+ }
+ else if ( *id == smAfter->GetId() )
+ {
+ iA = i;
+ if ( iB > -1 )
+ return iB < iA;
+ }
+ }
}
- return true; // no order imposed to given submeshes
+ return true; // no order imposed to given sub-meshes
}
//=============================================================================
TopoDS_Shape s0 = GetSubShapeByNode( nn[0], GetMeshDS() );
TopoDS_Shape s1 = GetSubShapeByNode( nn[1], GetMeshDS() );
TopoDS_Shape E = GetCommonAncestor( s0, s1, *myMesh, TopAbs_EDGE );
- if ( !E.IsNull() && !s0.IsSame( s1 ))
+ if ( !E.IsNull() && !s0.IsSame( s1 ) && E.Orientation() != TopAbs_INTERNAL )
{
// is E seam edge?
int nb = 0;
if ((int) u2node.size() + nbProxyNodes != myNbPonits &&
(int) u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
{
- MESSAGE("Wrong node parameters on edges, u2node.size():"
- <<u2node.size()<<" != myNbPonits:"<<myNbPonits);
+ return myPoints;
+ }
+ if (( myNbPonits > 0 ) &&
+ ( u2node.begin()->first < 0 || u2node.rbegin()->first > 1 ))
+ {
return myPoints;
}
bool _isBase; /* is used in a base FACE */
EdgeWithNeighbors(const TopoDS_Edge& E, int iE, int nbE, int shift, bool isBase ):
_edge( E ), _iBase( iE + shift ),
- _iL( SMESH_MesherHelper::WrapIndex( iE-1, nbE ) + shift ),
- _iR( SMESH_MesherHelper::WrapIndex( iE+1, nbE ) + shift ),
+ _iL( SMESH_MesherHelper::WrapIndex( iE-1, Max( 1, nbE )) + shift ),
+ _iR( SMESH_MesherHelper::WrapIndex( iE+1, Max( 1, nbE )) + shift ),
_isBase( isBase )
{
}
edges[ iFirst ]._iL = edges[ iFirst ]._iBase; // connect to self
edges[ iLast ]._iR = edges[ iLast ]._iBase;
- // look for an EDGE of the outer WIRE connected to vv
+ // look for an EDGE of the outer WIREs connected to vv
TopoDS_Vertex v0, v1;
- for ( iE = 0; iE < nbEdgesInWires.front(); ++iE )
+ for ( iE = 0; iE < iFirst; ++iE )
{
v0 = SMESH_MesherHelper::IthVertex( 0, edges[ iE ]._edge );
v1 = SMESH_MesherHelper::IthVertex( 1, edges[ iE ]._edge );
if ( vv[0].IsSame( v0 ) || vv[0].IsSame( v1 ))
edges[ iFirst ]._iL = edges[ iE ]._iBase;
if ( vv[1].IsSame( v0 ) || vv[1].IsSame( v1 ))
- edges[ iLast ]._iR = edges[ iE ]._iBase;
+ edges[ iLast ]._iR = edges[ iE ]._iBase;
}
}
iFirst += *nbE;
#include <utilities.h>
+#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepMesh_Delaun.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B2d.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomLib_IsPlanarSurface.hxx>
+#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
SMESH_MesherHelper srcHelper( *srcMesh );
srcHelper.SetSubShape( srcFace );
+ SMESH_MesherHelper edgeHelper( *tgtMesh );
+ edgeHelper.ToFixNodeParameters( true );
const SMDS_MeshNode* nullNode = 0;
TAssocTool::TNodeNodeMap::iterator srcN_tgtN;
}
case SMDS_TOP_EDGE:
{
- const TopoDS_Shape & srcE = srcMeshDS->IndexToShape( srcNode->getshapeId() );
- const TopoDS_Shape & tgtE = shape2ShapeMap( srcE, /*isSrc=*/true );
- double srcU = srcHelper.GetNodeU( TopoDS::Edge( srcE ), srcNode );
- tgtMeshDS->SetNodeOnEdge( n, TopoDS::Edge( tgtE ), srcU );
+ const TopoDS_Edge& srcE = TopoDS::Edge( srcMeshDS->IndexToShape( srcNode->getshapeId()));
+ const TopoDS_Edge& tgtE = TopoDS::Edge( shape2ShapeMap( srcE, /*isSrc=*/true ));
+ double srcU = srcHelper.GetNodeU( srcE, srcNode );
+ tgtMeshDS->SetNodeOnEdge( n, tgtE, srcU );
+ if ( !tgtFace.IsPartner( srcFace ))
+ {
+ bool isOk = true;
+ edgeHelper.SetSubShape( tgtE );
+ edgeHelper.GetNodeU( tgtE, n, 0, &isOk );
+ if ( !isOk ) // projection of n to tgtE failed (23395)
+ {
+ double sF, sL, tF, tL;
+ BRep_Tool::Range( srcE, sF, sL );
+ BRep_Tool::Range( tgtE, tF, tL );
+ double srcR = ( srcU - sF ) / ( sL - sF );
+ double tgtU = tF + srcR * ( tL - tF );
+ tgtMeshDS->SetNodeOnEdge( n, tgtE, tgtU );
+ gp_Pnt newP = BRepAdaptor_Curve( tgtE ).Value( tgtU );
+ double dist = newP.Distance( tgtP );
+ double tol = BRep_Tool::Tolerance( tgtE );
+ if ( tol < dist && dist < 1000*tol )
+ tgtMeshDS->MoveNode( n, newP.X(), newP.Y(), newP.Z() );
+ }
+ }
break;
}
case SMDS_TOP_VERTEX:
if ( !tgtFace.IsPartner( srcFace ) )
{
- SMESH_MesherHelper edgeHelper( *tgtMesh );
- edgeHelper.ToFixNodeParameters( true );
helper.ToFixNodeParameters( true );
int nbOkPos = 0;
- bool toCheck = true;
const double tol2d = 1e-12;
srcN_tgtN = src2tgtNodes.begin();
for ( ; srcN_tgtN != src2tgtNodes.end(); ++srcN_tgtN )
}
case SMDS_TOP_EDGE:
{
- const TopoDS_Edge & tgtE = TopoDS::Edge( tgtMeshDS->IndexToShape( n->getshapeId() ));
- edgeHelper.SetSubShape( tgtE );
- edgeHelper.GetNodeU( tgtE, n, 0, &toCheck );
+ // const TopoDS_Edge & tgtE = TopoDS::Edge( tgtMeshDS->IndexToShape( n->getshapeId() ));
+ // edgeHelper.SetSubShape( tgtE );
+ // edgeHelper.GetNodeU( tgtE, n, 0, &toCheck );
break;
}
default:;
}
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->SetSourceMesh ( meshImpl );
- GetImpl()->SetSourceEdge ( shapes[ SRC_EDGE ] );
- GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX ],
- shapes[ TGT_VERTEX ]);
-
+ try {
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSourceEdge ( shapes[ SRC_EDGE ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX ],
+ shapes[ TGT_VERTEX ]);
+ }
+ catch (...) {
+ }
myBaseImpl->LoadFrom( is );
std::istringstream str( theStream );
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->SetSourceMesh ( meshImpl );
- GetImpl()->SetSourceFace ( shapes[ SRC_FACE ] );
- GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
- shapes[ SRC_VERTEX2 ],
- shapes[ TGT_VERTEX1 ],
- shapes[ TGT_VERTEX2 ]);
+ try {
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSourceFace ( shapes[ SRC_FACE ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
+ shapes[ SRC_VERTEX2 ],
+ shapes[ TGT_VERTEX1 ],
+ shapes[ TGT_VERTEX2 ]);
+ }
+ catch( ... ) {
+ }
myBaseImpl->LoadFrom( is );
std::istringstream str( theStream );
//================================================================================
/*!
* \brief Write parameters in a string
- * \retval char* - resulting string
+ * \retval char* - resulting string
*/
//================================================================================
//================================================================================
/*!
* \brief Retrieve parameters from the string
- * \param theStream - the input string
+ * \param theStream - the input string
*/
//================================================================================
myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );
- GetImpl()->SetSourceMesh ( meshImpl );
- GetImpl()->SetSource3DShape ( shapes[ SRC_SHAPE3D ] );
- GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
- shapes[ SRC_VERTEX2 ],
- shapes[ TGT_VERTEX1 ],
- shapes[ TGT_VERTEX2 ]);
-
+ try {
+ GetImpl()->SetSourceMesh ( meshImpl );
+ GetImpl()->SetSource3DShape ( shapes[ SRC_SHAPE3D ] );
+ GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
+ shapes[ SRC_VERTEX2 ],
+ shapes[ TGT_VERTEX1 ],
+ shapes[ TGT_VERTEX2 ]);
+ }
+ catch (...) {
+ }
myBaseImpl->LoadFrom( is );
std::istringstream str( theStream );
for ( int i = 0; i < nb; ++i )
shapes.push_back( StdMeshers_ObjRefUlils::LoadFromStream( is, & myShapeEntries[i] ));
- GetImpl()->SetEnforcedNodes( shapes, points );
+ try {
+ GetImpl()->SetEnforcedNodes( shapes, points );
+ }
+ catch (...) {
+ }
}
}