From b40ff00e3a7cd02c92b17bcd24dc0a25ee131b3d Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 11 May 2016 17:00:53 +0300 Subject: [PATCH] Regression of SALOME_TESTS/Grids/smesh/viscous_layers_01/B2 This modif allows re-meshing a face on which _ViscousBuilder::shrink() fails --- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 1098113..f46be51 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -1771,7 +1771,7 @@ namespace BRepBuilderAPI_MakePolygon wire; const size_t i0 = tmpVertex.size(); - for ( size_t iN = 1; iN < wirePoints.size(); ++iN ) + for ( size_t iN = 0; iN < wirePoints.size(); ++iN ) { wire.Add( SMESH_TNodeXYZ( wirePoints[ iN ].node )); origNodes.push_back( wirePoints[ iN ].node ); @@ -1844,6 +1844,19 @@ namespace SMESH_MesherHelper tmpHelper( *this ); tmpHelper.SetSubShape( _proxyFace ); + // remove the faces made by the mesher + { + SMESHDS_Mesh* meshDS = helper.GetMeshDS(); + SMESH_subMesh* sm = origMesh.GetSubMesh( origFace ); + if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) + { + SMDS_ElemIteratorPtr eIt = smDS->GetElements(); + while ( eIt->more() ) meshDS->RemoveFreeElement( eIt->next(), smDS ); + SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); + while ( nIt->more() ) meshDS->RemoveFreeNode( nIt->next(), smDS ); + } + } + // iterate over tmp faces and copy them in origMesh const SMDS_MeshNode* nodes[27]; const SMDS_MeshNode* nullNode = 0; @@ -1857,7 +1870,7 @@ namespace for ( ; nIt->more(); ++nbN ) { const SMDS_MeshNode* n = static_cast( nIt->next() ); - TN2NMap::iterator n2nIt = + TN2NMap::iterator n2nIt = _tmp2origNN.insert( _tmp2origNN.end(), make_pair( n, nullNode )); if ( !n2nIt->second ) { n->GetXYZ( xyz ); @@ -1868,8 +1881,8 @@ namespace } switch( nbN ) { case 3: helper.AddFace( nodes[0], nodes[1], nodes[2] ); break; - // case 6: helper.AddFace( nodes[0], nodes[1], nodes[2], - // nodes[3], nodes[4], nodes[5]); break; + // case 6: helper.AddFace( nodes[0], nodes[1], nodes[2], + // nodes[3], nodes[4], nodes[5]); break; case 4: helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break; // case 9: helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3], // nodes[4], nodes[5], nodes[6], nodes[7], nodes[8]); break; @@ -1890,7 +1903,6 @@ namespace double * _progress; }; - } // namespace status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data); @@ -1914,10 +1926,15 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) this->SMESH_Algo::_progress = 1e-3; // prevent progress advancment while computing attractors - if ( !compute( aMesh, aShape, /*allowSubMeshClearing=*/true )) - return false; + bool viscousLayersMade = + ( aShape.ShapeType() == TopAbs_FACE && + StdMeshers_ViscousLayers2D::HasProxyMesh( TopoDS::Face( aShape ), aMesh )); + + if ( !viscousLayersMade ) + if ( !compute( aMesh, aShape, /*allowSubMeshClearing=*/true )) + return false; - if ( _haveViscousLayers ) + if ( _haveViscousLayers || viscousLayersMade ) { // Compute viscous layers -- 2.39.2