0020206: EDF SMESH 987: Netgen1D2D3D +submesh
orient previosly generated faces correctly
This commit is contained in:
parent
cb1285240a
commit
61fe14dcc1
@ -24,8 +24,6 @@
|
|||||||
// Author : Michael Sazonov (OCN)
|
// Author : Michael Sazonov (OCN)
|
||||||
// Date : 31/03/2006
|
// Date : 31/03/2006
|
||||||
// Project : SALOME
|
// Project : SALOME
|
||||||
// $Header$
|
|
||||||
//=============================================================================
|
|
||||||
//
|
//
|
||||||
#include "NETGENPlugin_Mesher.hxx"
|
#include "NETGENPlugin_Mesher.hxx"
|
||||||
#include "NETGENPlugin_Hypothesis_2D.hxx"
|
#include "NETGENPlugin_Hypothesis_2D.hxx"
|
||||||
@ -273,15 +271,15 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo,
|
|||||||
* \brief return id of netgen point corresponding to SMDS node
|
* \brief return id of netgen point corresponding to SMDS node
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
typedef map< const SMDS_MeshNode*, int > TNode2IdMap;
|
||||||
|
|
||||||
static int ngNodeId( const SMDS_MeshNode* node,
|
static int ngNodeId( const SMDS_MeshNode* node,
|
||||||
netgen::Mesh& ngMesh,
|
netgen::Mesh& ngMesh,
|
||||||
map< const SMDS_MeshNode*, int >& nodeNgIdMap)
|
TNode2IdMap& nodeNgIdMap)
|
||||||
{
|
{
|
||||||
int newNgId = ngMesh.GetNP() + 1;
|
int newNgId = ngMesh.GetNP() + 1;
|
||||||
|
|
||||||
pair< map< const SMDS_MeshNode*, int >::iterator, bool > it_isNew =
|
pair< TNode2IdMap::iterator, bool > it_isNew = nodeNgIdMap.insert( make_pair( node, newNgId ));
|
||||||
nodeNgIdMap.insert( make_pair( node, newNgId ));
|
|
||||||
|
|
||||||
if ( it_isNew.second ) {
|
if ( it_isNew.second ) {
|
||||||
netgen::MeshPoint p( netgen::Point<3> (node->X(), node->Y(), node->Z()) );
|
netgen::MeshPoint p( netgen::Point<3> (node->X(), node->Y(), node->Z()) );
|
||||||
@ -301,7 +299,7 @@ bool NETGENPlugin_Mesher::fillNgMesh(netgen::OCCGeometry& occgeom,
|
|||||||
vector<SMDS_MeshNode*>& nodeVec,
|
vector<SMDS_MeshNode*>& nodeVec,
|
||||||
const list< SMESH_subMesh* > & meshedSM)
|
const list< SMESH_subMesh* > & meshedSM)
|
||||||
{
|
{
|
||||||
map< const SMDS_MeshNode*, int > nodeNgIdMap;
|
TNode2IdMap nodeNgIdMap;
|
||||||
|
|
||||||
TopTools_MapOfShape visitedShapes;
|
TopTools_MapOfShape visitedShapes;
|
||||||
|
|
||||||
@ -416,7 +414,7 @@ bool NETGENPlugin_Mesher::fillNgMesh(netgen::OCCGeometry& occgeom,
|
|||||||
const TopoDS_Face& geomFace = TopoDS::Face( sm->GetSubShape() );
|
const TopoDS_Face& geomFace = TopoDS::Face( sm->GetSubShape() );
|
||||||
helper.SetSubShape( geomFace );
|
helper.SetSubShape( geomFace );
|
||||||
|
|
||||||
// find solids geomFace bounds
|
// Find solids the geomFace bounds
|
||||||
int solidID1 = 0, solidID2 = 0;
|
int solidID1 = 0, solidID2 = 0;
|
||||||
const TopTools_ListOfShape& ancestors = _mesh->GetAncestors( geomFace );
|
const TopTools_ListOfShape& ancestors = _mesh->GetAncestors( geomFace );
|
||||||
TopTools_ListIteratorOfListOfShape ancestorIt ( ancestors );
|
TopTools_ListIteratorOfListOfShape ancestorIt ( ancestors );
|
||||||
@ -433,7 +431,19 @@ bool NETGENPlugin_Mesher::fillNgMesh(netgen::OCCGeometry& occgeom,
|
|||||||
_faceDescriptors[ faceID ].first = solidID1;
|
_faceDescriptors[ faceID ].first = solidID1;
|
||||||
_faceDescriptors[ faceID ].second = solidID2;
|
_faceDescriptors[ faceID ].second = solidID2;
|
||||||
|
|
||||||
// add surface elements
|
// Orient the face correctly in solidID1 (issue 0020206)
|
||||||
|
bool reverse = false;
|
||||||
|
if ( solidID1 ) {
|
||||||
|
TopoDS_Shape solid = occgeom.somap( solidID1 );
|
||||||
|
for ( TopExp_Explorer f( solid, TopAbs_FACE ); f.More(); f.Next() ) {
|
||||||
|
if ( geomFace.IsSame( f.Current() )) {
|
||||||
|
reverse = SMESH_Algo::IsReversedSubMesh( TopoDS::Face( f.Current()), helper.GetMeshDS() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add surface elements
|
||||||
SMDS_ElemIteratorPtr faces = smDS->GetElements();
|
SMDS_ElemIteratorPtr faces = smDS->GetElements();
|
||||||
while ( faces->more() ) {
|
while ( faces->more() ) {
|
||||||
|
|
||||||
@ -462,9 +472,15 @@ bool NETGENPlugin_Mesher::fillNgMesh(netgen::OCCGeometry& occgeom,
|
|||||||
inFaceNode = f->GetNode( i+1 );
|
inFaceNode = f->GetNode( i+1 );
|
||||||
|
|
||||||
gp_XY uv = helper.GetNodeUV( geomFace, node, inFaceNode );
|
gp_XY uv = helper.GetNodeUV( geomFace, node, inFaceNode );
|
||||||
tri.GeomInfoPi(i+1).u = uv.X();
|
if ( reverse ) {
|
||||||
tri.GeomInfoPi(i+1).v = uv.Y();
|
tri.GeomInfoPi(3-i).u = uv.X();
|
||||||
tri.PNum(i+1) = ngNodeId( node, ngMesh, nodeNgIdMap );
|
tri.GeomInfoPi(3-i).v = uv.Y();
|
||||||
|
tri.PNum (3-i) = ngNodeId( node, ngMesh, nodeNgIdMap );
|
||||||
|
} else {
|
||||||
|
tri.GeomInfoPi(i+1).u = uv.X();
|
||||||
|
tri.GeomInfoPi(i+1).v = uv.Y();
|
||||||
|
tri.PNum (i+1) = ngNodeId( node, ngMesh, nodeNgIdMap );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngMesh.AddSurfaceElement (tri);
|
ngMesh.AddSurfaceElement (tri);
|
||||||
@ -486,7 +502,7 @@ bool NETGENPlugin_Mesher::fillNgMesh(netgen::OCCGeometry& occgeom,
|
|||||||
|
|
||||||
// fill nodeVec
|
// fill nodeVec
|
||||||
nodeVec.resize( ngMesh.GetNP() + 1 );
|
nodeVec.resize( ngMesh.GetNP() + 1 );
|
||||||
map< const SMDS_MeshNode*, int >::iterator node_NgId, nodeNgIdEnd = nodeNgIdMap.end();
|
TNode2IdMap::iterator node_NgId, nodeNgIdEnd = nodeNgIdMap.end();
|
||||||
for ( node_NgId = nodeNgIdMap.begin(); node_NgId != nodeNgIdEnd; ++node_NgId)
|
for ( node_NgId = nodeNgIdMap.begin(); node_NgId != nodeNgIdEnd; ++node_NgId)
|
||||||
nodeVec[ node_NgId->second ] = (SMDS_MeshNode*) node_NgId->first;
|
nodeVec[ node_NgId->second ] = (SMDS_MeshNode*) node_NgId->first;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user