mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-05 03:34:18 +05:00
22264: EDF 2648 GEOM: Propagate edges automatic orientation
PB: chains are built incorrectly in a compound of solids + Fix and optimize LyingOnGeom
This commit is contained in:
parent
ef27b97a53
commit
5c372c1659
@ -68,6 +68,7 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AUXILIARY METHODS
|
AUXILIARY METHODS
|
||||||
@ -4506,12 +4507,22 @@ void LyingOnGeom::init()
|
|||||||
myIsSubshape = false;
|
myIsSubshape = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TopTools_IndexedMapOfShape aMap;
|
myIsSubshape = myMeshDS->IsGroupOfSubShapes( myShape );
|
||||||
TopExp::MapShapes(aMainShape, aMap);
|
|
||||||
myIsSubshape = IsSubShape(aMap, myShape);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myIsSubshape)
|
if (myIsSubshape)
|
||||||
|
{
|
||||||
|
TopTools_IndexedMapOfShape shapes;
|
||||||
|
TopExp::MapShapes( myShape, shapes );
|
||||||
|
mySubShapesIDs.Clear();
|
||||||
|
for ( int i = 1; i <= shapes.Extent(); ++i )
|
||||||
|
{
|
||||||
|
int subID = myMeshDS->ShapeToIndex( shapes( i ));
|
||||||
|
if ( subID > 0 )
|
||||||
|
mySubShapesIDs.Add( subID );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
myElementsOnShapePtr.reset(new ElementsOnShape());
|
myElementsOnShapePtr.reset(new ElementsOnShape());
|
||||||
myElementsOnShapePtr->SetTolerance(myTolerance);
|
myElementsOnShapePtr->SetTolerance(myTolerance);
|
||||||
@ -4531,43 +4542,22 @@ bool LyingOnGeom::IsSatisfy( long theId )
|
|||||||
return myElementsOnShapePtr->IsSatisfy(theId);
|
return myElementsOnShapePtr->IsSatisfy(theId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case of submesh
|
// Case of sub-mesh
|
||||||
if( myType == SMDSAbs_Node )
|
|
||||||
|
const SMDS_MeshElement* elem =
|
||||||
|
( myType == SMDSAbs_Node ) ? myMeshDS->FindNode( theId ) : myMeshDS->FindElement( theId );
|
||||||
|
|
||||||
|
if ( mySubShapesIDs.Contains( elem->getshapeId() ))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( elem->GetType() != SMDSAbs_Node )
|
||||||
{
|
{
|
||||||
if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
|
SMDS_ElemIteratorPtr nodeItr = elem->nodesIterator();
|
||||||
|
while ( nodeItr->more() )
|
||||||
{
|
{
|
||||||
const SMDS_PositionPtr& aPosition = aNode->GetPosition();
|
const SMDS_MeshElement* aNode = nodeItr->next();
|
||||||
SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
|
if ( mySubShapesIDs.Contains( aNode->getshapeId() ))
|
||||||
switch( aTypeOfPosition )
|
return true;
|
||||||
{
|
|
||||||
case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
|
|
||||||
case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
|
|
||||||
case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
|
|
||||||
case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
|
|
||||||
{
|
|
||||||
if( myType == SMDSAbs_All )
|
|
||||||
{
|
|
||||||
return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
|
|
||||||
Contains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
|
|
||||||
Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
|
|
||||||
Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
|
|
||||||
}
|
|
||||||
else if( myType == anElem->GetType() )
|
|
||||||
{
|
|
||||||
switch( myType )
|
|
||||||
{
|
|
||||||
case SMDSAbs_Edge : return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE );
|
|
||||||
case SMDSAbs_Face : return Contains( myMeshDS,myShape,anElem,TopAbs_FACE );
|
|
||||||
case SMDSAbs_Volume: return Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
|
|
||||||
Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4613,34 +4603,30 @@ bool LyingOnGeom::Contains( const SMESHDS_Mesh* theMeshDS,
|
|||||||
TopAbs_ShapeEnum theFindShapeEnum,
|
TopAbs_ShapeEnum theFindShapeEnum,
|
||||||
TopAbs_ShapeEnum theAvoidShapeEnum )
|
TopAbs_ShapeEnum theAvoidShapeEnum )
|
||||||
{
|
{
|
||||||
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
|
// if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
|
||||||
return true;
|
// return true;
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape aSubShapes;
|
// TopTools_MapOfShape aSubShapes;
|
||||||
TopExp::MapShapes( theShape, aSubShapes );
|
// TopExp_Explorer exp( theShape, theFindShapeEnum, theAvoidShapeEnum );
|
||||||
|
// for ( ; exp.More(); exp.Next() )
|
||||||
|
// {
|
||||||
|
// const TopoDS_Shape& aShape = exp.Current();
|
||||||
|
// if ( !aSubShapes.Add( aShape )) continue;
|
||||||
|
|
||||||
for (int i = 1; i <= aSubShapes.Extent(); i++)
|
// if ( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ))
|
||||||
{
|
// {
|
||||||
const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
|
// if ( aSubMesh->Contains( theElem ))
|
||||||
|
// return true;
|
||||||
|
|
||||||
if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
|
// SMDS_ElemIteratorPtr nodeItr = theElem->nodesIterator();
|
||||||
if( aSubMesh->Contains( theElem ) )
|
// while ( nodeItr->more() )
|
||||||
return true;
|
// {
|
||||||
|
// const SMDS_MeshElement* aNode = nodeItr->next();
|
||||||
SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
|
// if ( aSubMesh->Contains( aNode ))
|
||||||
while ( aNodeIt->more() )
|
// return true;
|
||||||
{
|
// }
|
||||||
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
|
// }
|
||||||
SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
|
// }
|
||||||
while ( anElemIt->more() )
|
|
||||||
{
|
|
||||||
const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
|
|
||||||
if (anElement == theElem)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include <TColStd_SequenceOfInteger.hxx>
|
#include <TColStd_SequenceOfInteger.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
#include <gp_XYZ.hxx>
|
#include <gp_XYZ.hxx>
|
||||||
|
|
||||||
@ -974,6 +973,7 @@ namespace SMESH{
|
|||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
|
TColStd_MapOfInteger mySubShapesIDs;
|
||||||
const SMESHDS_Mesh* myMeshDS;
|
const SMESHDS_Mesh* myMeshDS;
|
||||||
SMDSAbs_ElementType myType;
|
SMDSAbs_ElementType myType;
|
||||||
bool myIsSubshape;
|
bool myIsSubshape;
|
||||||
|
@ -237,8 +237,11 @@ bool StdMeshersGUI_PropagationHelperWdg::buildChains()
|
|||||||
NCollection_DataMap< TGeomID, TWiresOfEdge > wiresOfEdge( egdeIDs.count() );
|
NCollection_DataMap< TGeomID, TWiresOfEdge > wiresOfEdge( egdeIDs.count() );
|
||||||
|
|
||||||
TopExp_Explorer wire;
|
TopExp_Explorer wire;
|
||||||
|
TopTools_MapOfShape faceMap;
|
||||||
for ( TopExp_Explorer face( shape, TopAbs_FACE ); face.More(); face.Next() )
|
for ( TopExp_Explorer face( shape, TopAbs_FACE ); face.More(); face.Next() )
|
||||||
{
|
{
|
||||||
|
if ( !faceMap.Add( face.Current() )) continue;
|
||||||
|
|
||||||
wire.Init( face.Current(), TopAbs_WIRE );
|
wire.Init( face.Current(), TopAbs_WIRE );
|
||||||
TopoDS_Shape W = wire.Current().Oriented( TopAbs_FORWARD );
|
TopoDS_Shape W = wire.Current().Oriented( TopAbs_FORWARD );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user