mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-05 23:34:17 +05:00
Do not remove nodes of refined elements
This commit is contained in:
parent
e9962a2562
commit
0677cc99fe
@ -2614,20 +2614,20 @@ inline static bool isDefined(const gp_XYZ& theXYZ)
|
|||||||
// are merged in myElemXYZIDs.
|
// are merged in myElemXYZIDs.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_Pattern::mergePoints (map<set<void*>,list<list<int> > >& indGroups,
|
void SMESH_Pattern::mergePoints (map<TNodeSet, list<list<int> > >& indGroups,
|
||||||
map< int, list< list< int >* > > & reverseConnectivity)
|
map< int, list< list< int >* > > & reverseConnectivity)
|
||||||
{
|
{
|
||||||
map< set< void* >, list< list< int > > >::iterator indListIt;
|
map< TNodeSet, list< list< int > > >::iterator indListIt;
|
||||||
for ( indListIt = indGroups.begin(); indListIt != indGroups.end(); indListIt++ )
|
for ( indListIt = indGroups.begin(); indListIt != indGroups.end(); indListIt++ )
|
||||||
{
|
{
|
||||||
list<list< int > > groups = indListIt->second;
|
list<list< int > > groups = indListIt->second;
|
||||||
if ( groups.size() < 2 )
|
if ( groups.size() < 2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// const set< void* > & nodes = indListIt->first;
|
// const TNodeSet & nodes = indListIt->first;
|
||||||
// set< void* >::const_iterator n = nodes.begin();
|
// TNodeSet::const_iterator n = nodes.begin();
|
||||||
// for ( ; n != nodes.end(); n++ )
|
// for ( ; n != nodes.end(); n++ )
|
||||||
// cout << ((SMDS_MeshNode*) *n );
|
// cout << *n ;
|
||||||
|
|
||||||
// find tolerance
|
// find tolerance
|
||||||
Bnd_Box box;
|
Bnd_Box box;
|
||||||
@ -2718,7 +2718,7 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
|
|||||||
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
||||||
|
|
||||||
// to merge nodes on edges of the elements being refined
|
// to merge nodes on edges of the elements being refined
|
||||||
typedef set<void*> TLink;
|
typedef set<const SMDS_MeshNode*> TLink;
|
||||||
map< TLink, list< list< int > > > linkPointIndListMap;
|
map< TLink, list< list< int > > > linkPointIndListMap;
|
||||||
map< int, list< list< int >* > > reverseConnectivity;
|
map< int, list< list< int >* > > reverseConnectivity;
|
||||||
|
|
||||||
@ -2752,18 +2752,22 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
|
|||||||
int nbNodes = (*face)->NbNodes(), eID = nbNodes + 1;
|
int nbNodes = (*face)->NbNodes(), eID = nbNodes + 1;
|
||||||
for ( int i = 0; i < nbNodes; i++ )
|
for ( int i = 0; i < nbNodes; i++ )
|
||||||
{
|
{
|
||||||
|
const SMDS_MeshNode* n1 = myOrderedNodes[ i ];
|
||||||
|
const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ];
|
||||||
// make a link of node pointers
|
// make a link of node pointers
|
||||||
TLink link;
|
TLink link;
|
||||||
link.insert( (void*) myOrderedNodes[ i ] );
|
link.insert( n1 );
|
||||||
link.insert( (void*) myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ]);
|
link.insert( n2 );
|
||||||
// add the link to the map
|
// add the link to the map
|
||||||
list< list< int > >& groups = linkPointIndListMap[ link ];
|
list< list< int > >& groups = linkPointIndListMap[ link ];
|
||||||
groups.push_back();
|
groups.push_back();
|
||||||
list< int >& indList = groups.back();
|
list< int >& indList = groups.back();
|
||||||
list< TPoint* > & linkPoints = getShapePoints( eID++ );
|
list< TPoint* > & linkPoints = getShapePoints( eID++ );
|
||||||
// add points to the map
|
|
||||||
list< TPoint* >::iterator p = linkPoints.begin();
|
list< TPoint* >::iterator p = linkPoints.begin();
|
||||||
for ( ; p != linkPoints.end(); p++ )
|
// map the first link point to n1
|
||||||
|
myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = n1;
|
||||||
|
// add points to the map excluding the end points
|
||||||
|
for ( p++; *p != linkPoints.back(); p++ )
|
||||||
indList.push_back( pointIndex[ *p ] + ind1 );
|
indList.push_back( pointIndex[ *p ] + ind1 );
|
||||||
}
|
}
|
||||||
ind1 += myPoints.size();
|
ind1 += myPoints.size();
|
||||||
@ -2813,8 +2817,7 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
|
|||||||
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
||||||
|
|
||||||
// to merge nodes on edges and faces of the elements being refined
|
// to merge nodes on edges and faces of the elements being refined
|
||||||
typedef set<void*> TSubNodes;
|
map< TNodeSet, list< list< int > > > subPointIndListMap;
|
||||||
map< TSubNodes, list< list< int > > > subPointIndListMap;
|
|
||||||
map< int, list< list< int >* > > reverseConnectivity;
|
map< int, list< list< int >* > > reverseConnectivity;
|
||||||
|
|
||||||
int ind1 = 0; // lowest point index for an element
|
int ind1 = 0; // lowest point index for an element
|
||||||
@ -2847,25 +2850,25 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
|
|||||||
for ( int Id = SMESH_Block::ID_V000; Id <= SMESH_Block::ID_F1yz; Id++ )
|
for ( int Id = SMESH_Block::ID_V000; Id <= SMESH_Block::ID_F1yz; Id++ )
|
||||||
{
|
{
|
||||||
// make a set of sub-points
|
// make a set of sub-points
|
||||||
TSubNodes subNodes;
|
TNodeSet subNodes;
|
||||||
vector< int > subIDs;
|
vector< int > subIDs;
|
||||||
if ( SMESH_Block::IsVertexID( Id )) {
|
if ( SMESH_Block::IsVertexID( Id )) {
|
||||||
subNodes.insert( (void*) myOrderedNodes[ Id - 1 ]);
|
// use nodes of refined volumes for merge
|
||||||
}
|
}
|
||||||
else if ( SMESH_Block::IsEdgeID( Id )) {
|
else if ( SMESH_Block::IsEdgeID( Id )) {
|
||||||
SMESH_Block::GetEdgeVertexIDs( Id, subIDs );
|
SMESH_Block::GetEdgeVertexIDs( Id, subIDs );
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.front() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.back() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SMESH_Block::GetFaceEdgesIDs( Id, subIDs );
|
SMESH_Block::GetFaceEdgesIDs( Id, subIDs );
|
||||||
int e1 = subIDs[ 0 ], e2 = subIDs[ 1 ];
|
int e1 = subIDs[ 0 ], e2 = subIDs[ 1 ];
|
||||||
SMESH_Block::GetEdgeVertexIDs( e1, subIDs );
|
SMESH_Block::GetEdgeVertexIDs( e1, subIDs );
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.front() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.back() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
|
||||||
SMESH_Block::GetEdgeVertexIDs( e2, subIDs );
|
SMESH_Block::GetEdgeVertexIDs( e2, subIDs );
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.front() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
|
||||||
subNodes.insert( (void*) myOrderedNodes[ subIDs.back() - 1 ]);
|
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
|
||||||
}
|
}
|
||||||
list< list< int > >& groups = subPointIndListMap[ subNodes ];
|
list< list< int > >& groups = subPointIndListMap[ subNodes ];
|
||||||
groups.push_back();
|
groups.push_back();
|
||||||
@ -2873,6 +2876,9 @@ bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
|
|||||||
// add points
|
// add points
|
||||||
list< TPoint* > & points = getShapePoints( Id );
|
list< TPoint* > & points = getShapePoints( Id );
|
||||||
list< TPoint* >::iterator p = points.begin();
|
list< TPoint* >::iterator p = points.begin();
|
||||||
|
if ( subNodes.empty() ) // vertex case
|
||||||
|
myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = myOrderedNodes[ Id - 1 ];
|
||||||
|
else
|
||||||
for ( ; p != points.end(); p++ )
|
for ( ; p != points.end(); p++ )
|
||||||
indList.push_back( pointIndex[ *p ] + ind1 );
|
indList.push_back( pointIndex[ *p ] + ind1 );
|
||||||
}
|
}
|
||||||
@ -3157,7 +3163,10 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
|
|||||||
{
|
{
|
||||||
nodesVector.resize( myXYZ.size() );
|
nodesVector.resize( myXYZ.size() );
|
||||||
for ( int i = 0; i < myXYZ.size(); ++i ) {
|
for ( int i = 0; i < myXYZ.size(); ++i ) {
|
||||||
if ( isDefined( myXYZ[ i ] ))
|
map< int, const SMDS_MeshNode*>::iterator idNode = myXYZIdToNodeMap.find( i );
|
||||||
|
if ( idNode != myXYZIdToNodeMap.end() )
|
||||||
|
nodesVector[ i ] = idNode->second;
|
||||||
|
else if ( isDefined( myXYZ[ i ] ))
|
||||||
nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
|
nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
|
||||||
myXYZ[ i ].Y(),
|
myXYZ[ i ].Y(),
|
||||||
myXYZ[ i ].Z());
|
myXYZ[ i ].Z());
|
||||||
@ -3313,7 +3322,7 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
|
|||||||
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
||||||
}
|
}
|
||||||
if ( onMeshElements ) {
|
if ( onMeshElements ) {
|
||||||
list< int > elemIDs, nodeIDs;
|
list< int > elemIDs;
|
||||||
for ( int i = 0; i < myElements.size(); i++ )
|
for ( int i = 0; i < myElements.size(); i++ )
|
||||||
{
|
{
|
||||||
int shapeID = shapeIDs[ i ];
|
int shapeID = shapeIDs[ i ];
|
||||||
@ -3323,15 +3332,10 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
|
|||||||
if ( subMesh )
|
if ( subMesh )
|
||||||
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
||||||
}
|
}
|
||||||
SMDS_ElemIteratorPtr nIt = myElements[ i ]->nodesIterator();
|
|
||||||
while ( nIt->more() ) {
|
|
||||||
nodeIDs.push_back( nIt->next()->GetID() );
|
|
||||||
}
|
|
||||||
elemIDs.push_back( myElements[ i ]->GetID() );
|
elemIDs.push_back( myElements[ i ]->GetID() );
|
||||||
}
|
}
|
||||||
// remove refined elements and their nodes
|
// remove refined elements and their nodes
|
||||||
editor.Remove( elemIDs, false );
|
editor.Remove( elemIDs, false );
|
||||||
editor.Remove( nodeIDs, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return setErrorCode( ERR_OK );
|
return setErrorCode( ERR_OK );
|
||||||
|
@ -270,7 +270,8 @@ class SMESH_Pattern {
|
|||||||
// in a good order, point UVs on edges are computed and points
|
// in a good order, point UVs on edges are computed and points
|
||||||
// are appended to theEdgesPointsList
|
// are appended to theEdgesPointsList
|
||||||
|
|
||||||
void mergePoints (std::map<std::set<void*>,std::list<std::list<int> > >& xyzIndGroups,
|
typedef std::set<const SMDS_MeshNode*> TNodeSet;
|
||||||
|
void mergePoints (std::map<TNodeSet,std::list<std::list<int> > >& xyzIndGroups,
|
||||||
std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
|
std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
|
||||||
// Look for coincident points between myXYZs indexed with
|
// Look for coincident points between myXYZs indexed with
|
||||||
// list<int> of each element of xyzIndGroups. Coincident indices
|
// list<int> of each element of xyzIndGroups. Coincident indices
|
||||||
@ -302,6 +303,7 @@ class SMESH_Pattern {
|
|||||||
// to compute while applying to mesh elements, not to shapes
|
// to compute while applying to mesh elements, not to shapes
|
||||||
std::vector<gp_XYZ> myXYZ;
|
std::vector<gp_XYZ> myXYZ;
|
||||||
std::list< std::list< int > > myElemXYZIDs;
|
std::list< std::list< int > > myElemXYZIDs;
|
||||||
|
std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map id to node of a refined element
|
||||||
std::vector<const SMDS_MeshElement*> myElements; // refined elements
|
std::vector<const SMDS_MeshElement*> myElements; // refined elements
|
||||||
std::vector<const SMDS_MeshNode*> myOrderedNodes;
|
std::vector<const SMDS_MeshNode*> myOrderedNodes;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user