0021468]: EDF 2073 SMESH: Body-fitting algo creates elements in hole

re-fix after optimization
This commit is contained in:
eap 2012-03-22 08:58:34 +00:00
parent 93aaa60ce3
commit 16042a8750

View File

@ -347,8 +347,6 @@ namespace
vector< _Node> _intNodes; // _Node's at GridLine intersections vector< _Node> _intNodes; // _Node's at GridLine intersections
vector< _Link > _splits; vector< _Link > _splits;
vector< _Face*> _faces; vector< _Face*> _faces;
const GridLine* _line;
_Link(): _line(0) {}
}; };
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
struct _OrientedLink struct _OrientedLink
@ -1223,6 +1221,7 @@ namespace
*/ */
void Hexahedron::init( size_t i, size_t j, size_t k ) void Hexahedron::init( size_t i, size_t j, size_t k )
{ {
_i = i; _j = j; _k = k;
// set nodes of grid to nodes of the hexahedron and // set nodes of grid to nodes of the hexahedron and
// count nodes at hexahedron corners located IN and ON geometry // count nodes at hexahedron corners located IN and ON geometry
_nbCornerNodes = _nbBndNodes = 0; _nbCornerNodes = _nbBndNodes = 0;
@ -1476,6 +1475,7 @@ namespace
multiset< IntersectionPoint >::const_iterator ip = line._intPoints.begin(); multiset< IntersectionPoint >::const_iterator ip = line._intPoints.begin();
for ( ; ip != line._intPoints.end(); ++ip ) for ( ; ip != line._intPoints.end(); ++ip )
{ {
if ( !ip->_node ) continue;
lineInd.SetIndexOnLine( ip->_indexOnLine ); lineInd.SetIndexOnLine( ip->_indexOnLine );
for ( int iL = 0; iL < 4; ++iL ) // loop on 4 cells sharing a link for ( int iL = 0; iL < 4; ++iL ) // loop on 4 cells sharing a link
{ {
@ -1497,12 +1497,8 @@ namespace
++nbIntHex; ++nbIntHex;
} }
const int iLink = iL + iDir * 4; const int iLink = iL + iDir * 4;
hex->_hexLinks[iLink]._line = &line; hex->_hexLinks[iLink]._intNodes.push_back( _Node( 0, &(*ip) ));
if ( ip->_node ) hex->_nbIntNodes++;
{
hex->_hexLinks[iLink]._intNodes.push_back( _Node( 0, &(*ip) ));
hex->_nbIntNodes++;
}
} }
} }
} }
@ -1613,23 +1609,29 @@ namespace
const int ijk[3] = { _i, _j, _k }; const int ijk[3] = { _i, _j, _k };
IntersectionPoint curIntPnt; IntersectionPoint curIntPnt;
// consider a cell to be in a hole if all links in any direction
// comes OUT of geometry
for ( int iDir = 0; iDir < 3; ++iDir ) for ( int iDir = 0; iDir < 3; ++iDir )
{ {
const vector<double>& coords = _grid->_coords[ iDir ]; const vector<double>& coords = _grid->_coords[ iDir ];
LineIndexer li = _grid->GetLineIndexer( iDir );
li.SetIJK( _i,_j,_k );
size_t lineIndex[4] = { li.LineIndex (),
li.LineIndex10(),
li.LineIndex01(),
li.LineIndex11() };
bool allLinksOut = true; bool allLinksOut = true;
int linkID = iDir * 4; for ( int iL = 0; iL < 4 && allLinksOut; ++iL ) // loop on 4 links parallel to iDir
for ( int i = 0; i < 4 && allLinksOut; ++i )
{ {
const _Link& link = _hexLinks[ linkID++ ]; const _Link& link = _hexLinks[ iL + 4*iDir ];
if ( !link._line ) return false;
if ( link._splits.empty() ) continue;
// check transition of the first node of a link // check transition of the first node of a link
const IntersectionPoint* firstIntPnt = 0; const IntersectionPoint* firstIntPnt = 0;
if ( link._nodes[0]->Node() ) // 1st node is a hexa corner if ( link._nodes[0]->Node() ) // 1st node is a hexa corner
{ {
curIntPnt._paramOnLine = coords[ ijk[ iDir ]] - coords[0]; curIntPnt._paramOnLine = coords[ ijk[ iDir ]] - coords[0];
const GridLine& line = _grid->_lines[ iDir ][ lineIndex[ iL ]];
multiset< IntersectionPoint >::const_iterator ip = multiset< IntersectionPoint >::const_iterator ip =
link._line->_intPoints.upper_bound( curIntPnt ); line._intPoints.upper_bound( curIntPnt );
--ip; --ip;
firstIntPnt = &(*ip); firstIntPnt = &(*ip);
} }