X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_ViscousLayers.cxx;h=a8d421abaffe3623b76d2e6171d5168497995deb;hb=51540539e509f5e21439ddef0d88dba6a45a6679;hp=47412786ea2ca81fefee7635cdd8ca1bc6ce90a4;hpb=3d563f79648e74ba577341cee8b1a874fbd13c49;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index 47412786e..a8d421aba 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -52,7 +52,14 @@ #include "StdMeshers_Quadrangle_2D.hxx" #include "StdMeshers_ViscousLayers2D.hxx" +#include + +#if OCC_VERSION_LARGE < 0x07070000 #include +#else +#include +#endif + #include #include #include @@ -1818,8 +1825,13 @@ namespace VISCOUS_3D //case GeomAbs_SurfaceOfExtrusion: case GeomAbs_OffsetSurface: { +#if OCC_VERSION_LARGE < 0x07070000 Handle(Adaptor3d_HSurface) base = surface.BasisSurface(); return getRovolutionAxis( base->Surface(), axis ); +#else + Handle(Adaptor3d_Surface) base = surface.BasisSurface(); + return getRovolutionAxis( *base, axis ); +#endif } default: return false; } @@ -2431,7 +2443,14 @@ bool _ViscousBuilder::findFacesWithLayers(const bool onlyWith) break; } default: - return error("Not yet supported case", _sdVec[i]._index); + std::ostringstream msg; + msg << "Not yet supported case: vertex bounded by "; + msg << facesWOL.size(); + msg << " faces without layer at coordinates ("; + TopoDS_Vertex v = TopoDS::Vertex(vertex); + gp_Pnt p = BRep_Tool::Pnt(v); + msg << p.X() << ", " << p.Y() << ", " << p.Z() << ")"; + return error(msg.str().c_str(), _sdVec[i]._index); } } } @@ -3038,6 +3057,7 @@ void _ViscousBuilder::limitStepSizeByCurvature( _SolidData& data ) cnvFace._face = F; cnvFace._normalsFixed = false; cnvFace._isTooCurved = false; + cnvFace._normalsFixedOnBorders = false; double maxCurvature = cnvFace.GetMaxCurvature( data, eof, surfProp, helper ); if ( maxCurvature > 0 ) @@ -4643,7 +4663,9 @@ void _Simplex::SortSimplices(vector<_Simplex>& simplices) void _ViscousBuilder::makeGroupOfLE() { -#ifdef _DEBUG_ + if (!SALOME::VerbosityActivated()) + return; + for ( size_t i = 0 ; i < _sdVec.size(); ++i ) { if ( _sdVec[i]._n2eMap.empty() ) continue; @@ -4699,7 +4721,6 @@ void _ViscousBuilder::makeGroupOfLE() << "'%s-%s' % (faceId1+1, faceId2))"); dumpFunctionEnd(); } -#endif } //================================================================================ @@ -4934,7 +4955,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) if ( eos._edges[i]->_nodes.size() > 1 ) avgThick += Min( 1., eos._edges[i]->_len / shapeTgtThick ); else - avgThick += shapeTgtThick; + avgThick += 1; nbActiveEdges += ( ! eos._edges[i]->Is( _LayerEdge::BLOCKED )); } } @@ -5448,8 +5469,11 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data, // intersection not ignored - if ( toBlockInfaltion && - dist < ( eos._edges[i]->_len * theThickToIntersection )) + double minDist = 0; + if ( eos._edges[i]->_maxLen < 0.99 * eos._hyp.GetTotalThickness() ) // limited length + minDist = eos._edges[i]->_len * theThickToIntersection; + + if ( toBlockInfaltion && dist < minDist ) { if ( is1stBlocked ) { is1stBlocked = false; // debug dumpFunction(SMESH_Comment("blockIntersected") <Is( _LayerEdge::MARKED )) - break; - if ( i < eos._edges.size() ) + if (SALOME::VerbosityActivated()) { - dumpFunction(SMESH_Comment("putOnOffsetSurface_") << eos.ShapeTypeLetter() << eos._shapeID - << "_InfStep" << infStep << "_" << Abs( smooStep )); + // dumpMove() for debug + size_t i = 0; for ( ; i < eos._edges.size(); ++i ) + if ( eos._edges[i]->Is( _LayerEdge::MARKED )) + break; + if ( i < eos._edges.size() ) { - if ( eos._edges[i]->Is( _LayerEdge::MARKED )) { - dumpMove( eos._edges[i]->_nodes.back() ); + dumpFunction(SMESH_Comment("putOnOffsetSurface_") << eos.ShapeTypeLetter() << eos._shapeID + << "_InfStep" << infStep << "_" << Abs( smooStep )); + for ( ; i < eos._edges.size(); ++i ) + { + if ( eos._edges[i]->Is( _LayerEdge::MARKED )) { + dumpMove( eos._edges[i]->_nodes.back() ); + } } + dumpFunctionEnd(); } - dumpFunctionEnd(); } -#endif _ConvexFace* cnvFace; if ( moveAll != _LayerEdge::UPD_NORMAL_CONV && @@ -6562,6 +6585,7 @@ void _Smoother1D::prepare(_SolidData& data) _edgeDir[1] = getEdgeDir( E, leOnV[1]->_nodes[0], data.GetHelper() ); _leOnV[0]._cosin = Abs( leOnV[0]->_cosin ); _leOnV[1]._cosin = Abs( leOnV[1]->_cosin ); + _leOnV[0]._flags = _leOnV[1]._flags = 0; if ( _eos._sWOL.IsNull() ) // 3D for ( int iEnd = 0; iEnd < 2; ++iEnd ) _leOnV[iEnd]._cosin = Abs( _edgeDir[iEnd].Normalized() * leOnV[iEnd]->_normal ); @@ -11792,6 +11816,17 @@ bool _ViscousBuilder::shrink(_SolidData& theData) uvPtVec[ i ].param = helper.GetNodeU( E, edges[i]->_nodes[0] ); uvPtVec[ i ].SetUV( helper.GetNodeUV( F, edges[i]->_nodes.back() )); } + if ( uvPtVec[ 0 ].node == uvPtVec.back().node && // closed + helper.IsSeamShape( uvPtVec[ 0 ].node->GetShapeID() )) + { + uvPtVec[ 0 ].SetUV( helper.GetNodeUV( F, + edges[0]->_nodes.back(), + edges[1]->_nodes.back() )); + size_t i = edges.size() - 1; + uvPtVec[ i ].SetUV( helper.GetNodeUV( F, + edges[i ]->_nodes.back(), + edges[i-1]->_nodes.back() )); + } // if ( edges.empty() ) // continue; BRep_Tool::Range( E, uvPtVec[0].param, uvPtVec.back().param ); @@ -11808,8 +11843,12 @@ bool _ViscousBuilder::shrink(_SolidData& theData) smDS->Clear(); // compute the mesh on the FACE + TopTools_IndexedMapOfShape allowed(1); + allowed.Add( sm->GetSubShape() ); + sm->SetAllowedSubShapes( &allowed ); sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); sm->ComputeStateEngine( SMESH_subMesh::COMPUTE_SUBMESH ); + sm->SetAllowedSubShapes( nullptr ); // re-fill proxy sub-meshes of the FACE for ( size_t i = 0 ; i < _sdVec.size(); ++i ) @@ -12410,17 +12449,16 @@ gp_XY _SmoothNode::computeAngularPos(vector& uv, edgeSize.back() = edgeSize.front(); gp_XY newPos(0,0); - //int nbEdges = 0; - double sumSize = 0; + double sumWgt = 0; for ( size_t i = 1; i < edgeDir.size(); ++i ) { - if ( edgeDir[i-1].X() > 1. ) continue; - int i1 = i-1; + const int i1 = i-1; + if ( edgeDir[i1].X() > 1. ) continue; while ( edgeDir[i].X() > 1. && ++i < edgeDir.size() ); if ( i == edgeDir.size() ) break; gp_XY p = uv[i]; gp_XY norm1( -edgeDir[i1].Y(), edgeDir[i1].X() ); - gp_XY norm2( -edgeDir[i].Y(), edgeDir[i].X() ); + gp_XY norm2( -edgeDir[i ].Y(), edgeDir[i ].X() ); gp_XY bisec = norm1 + norm2; double bisecSize = bisec.Modulus(); if ( bisecSize < numeric_limits::min() ) @@ -12430,16 +12468,16 @@ gp_XY _SmoothNode::computeAngularPos(vector& uv, } bisec /= bisecSize; - gp_XY dirToN = uvToFix - p; - double distToN = dirToN.Modulus(); + gp_XY dirToN = uvToFix - p; + double distToN = bisec * dirToN; if ( bisec * dirToN < 0 ) distToN = -distToN; - newPos += ( p + bisec * distToN ) * ( edgeSize[i1] + edgeSize[i] ); - //++nbEdges; - sumSize += edgeSize[i1] + edgeSize[i]; + double wgt = edgeSize[i1] + edgeSize[i]; + newPos += ( p + bisec * distToN ) * wgt; + sumWgt += wgt; } - newPos /= /*nbEdges * */sumSize; + newPos /= sumWgt; return newPos; }