-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
* \param [in] braNodes - nodes of the branch
* \param [in] nodeIndex - index of a node of the branch
* \param [inout] mesh - mesh holding the nodes and segments
- *
- *
*/
//================================================================================
: _mesh ( helper.GetMesh() ),
_shape( helper.GetSubShape() ),
_helper( *_mesh ),
- _isQuadratic( helper.GetIsQuadratic() )
+ _isQuadratic( helper.GetIsQuadratic() ),
+ _nodeTag0( 0 )
{
if ( !hyp || !_mesh || hyp->GetEnforcedMeshes().empty() )
return;
splitSelfIntersectingSegments( face );
}
- for ( TEdge2Nodes::Iterator e2nn( _nodesOnEdge ); e2nn.More(); e2nn.Next() )
- {
- splitEdgeByNodes( e2nn.Key(), e2nn.Value() );
- }
+ // for ( TEdge2Nodes::Iterator e2nn( _nodesOnEdge ); e2nn.More(); e2nn.Next() )
+ // {
+ // splitEdgeByNodes( e2nn.Key(), e2nn.Value() );
+ // }
}
//================================================================================
return;
}
+//================================================================================
+/*!
+ * \brief Add a vertex on EDGE
+ */
+//================================================================================
+
+void BLSURFPlugin_EnforcedMesh1D::AddVertexOnEdge( const double* theXYZ )
+{
+ // setup predicates to find the supporting EDGE
+ setupPredicates( _shape );
+
+ SMESHDS_Mesh* meshDS = _mesh->GetMeshDS();
+ const SMDS_MeshNode* nodeOnE = meshDS->AddNode( theXYZ[0], theXYZ[1], theXYZ[2] );
+
+ // check if enfNode is on VERTEX
+ bool toRemove = true;
+ TopoDS_Vertex vertex;
+ TopoDS_Edge edge;
+ if ( _onVertexPredicate->IsSatisfy( nodeOnE, &vertex ))
+ {
+ toRemove = SMESH_Algo::VertexNode( vertex, meshDS );
+ if ( !toRemove )
+ meshDS->SetNodeOnVertex( nodeOnE, vertex );
+ }
+ // find the EDGE supporting theXYZ
+ else if ( _onEdgePredicate->IsSatisfy( nodeOnE, &edge ))
+ {
+ gp_Pnt pnt( theXYZ[0], theXYZ[1], theXYZ[2] );
+ toRemove = findNodeOnEdge( pnt, edge );
+ if ( !toRemove )
+ addNodeOnEdge( nodeOnE, edge );
+ }
+
+ if ( toRemove )
+ meshDS->RemoveFreeNode( nodeOnE, /*submesh=*/nullptr, /*fromGroup=*/false );
+}
+
//================================================================================
/*!
* \brief Return EDGEs resulted from division of FACE boundary by enforced segments
+ * and enforced vertices
* \param [in] edge - possibly divided EDGE
* \param [out] splits - split EDGEs
* \return bool - true if the EDGE is split
std::vector< TopoDS_Edge > & splits,
TopTools_IndexedMapOfShape & edgeTags )
{
+ if ( _nodesOnEdge.IsBound( edge )) // divide the EDGE
+ {
+ splitEdgeByNodes( edge, _nodesOnEdge( edge ));
+
+ _nodesOnEdge.UnBind( edge );
+ }
+
+ // return splits
+
std::vector< TopoDS_Edge > * splitsInMap = _edgeSplitsOfEdge.ChangeSeek( edge );
if ( !splitsInMap )
return false;
SMESH_Mesh* mesh1D;
SMDS_ElemIteratorPtr segIt = theHyp->GetEnforcedSegments( theEnfMesh, mesh1D );
if ( !segIt->more() )
- return;
+ throw SALOME_Exception("No edges in an enforced mesh");
// setup predicates to detect nodes on FACE boundary
setupPredicates( theShape );