This commit is contained in:
rnv 2021-08-23 18:07:41 +03:00
commit 3d563f7964
3 changed files with 92 additions and 45 deletions

View File

@ -547,7 +547,7 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder();
std::string compDataType = ComponentDataType(); // SMESH module's data type CORBA::String_var compDataType = ComponentDataType(); // SMESH module's data type
std::string ior; std::string ior;
{ {
CORBA::String_var iorString = GetORB()->object_to_string( SMESH_Gen::_this() ); CORBA::String_var iorString = GetORB()->object_to_string( SMESH_Gen::_this() );
@ -562,7 +562,8 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
CORBA::String_var ior_i; CORBA::String_var ior_i;
bool ok = f_i->ComponentIOR(ior_i.out()); bool ok = f_i->ComponentIOR(ior_i.out());
CORBA::String_var cdt(f_i->ComponentDataType()); CORBA::String_var cdt(f_i->ComponentDataType());
if ( ok && compDataType == cdt.in() && ior == ior_i.in()) { if ( ok && strcmp( compDataType.in(), cdt.in() ) == 0 && ior == ior_i.in())
{
father = f_i; father = f_i;
break; break;
} }
@ -583,14 +584,14 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
if ( CORBA::is_nil( aCat ) ) if ( CORBA::is_nil( aCat ) )
return father._retn(); return father._retn();
SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.c_str() ); SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.in() );
if ( CORBA::is_nil( aComp ) ) if ( CORBA::is_nil( aComp ) )
return father._retn(); return father._retn();
SALOMEDS::GenericAttribute_wrap anAttr; SALOMEDS::GenericAttribute_wrap anAttr;
SALOMEDS::AttributePixMap_wrap aPixmap; SALOMEDS::AttributePixMap_wrap aPixmap;
father = aStudyBuilder->NewComponent( compDataType.c_str() ); father = aStudyBuilder->NewComponent( compDataType.in() );
aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() ); aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() );
anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" ); anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" );
aPixmap = anAttr; aPixmap = anAttr;

View File

@ -1138,12 +1138,7 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
SMESH_ProxyMesh* proxyMesh) SMESH_ProxyMesh* proxyMesh)
{ {
SMESH_ComputeErrorPtr err = SMESH_ComputeError::New(); SMESH_ComputeErrorPtr err = SMESH_ComputeError::New();
if ( proxyMesh )
{
err->myName = COMPERR_BAD_INPUT_MESH;
err->myComment = "Can't build pentahedral mesh on viscous layers";
return err;
}
bool bOK; bool bOK;
StdMeshers_Penta_3D anAlgo; StdMeshers_Penta_3D anAlgo;
// //
@ -1165,6 +1160,24 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
err = aPrism3D->GetComputeError(); err = aPrism3D->GetComputeError();
} }
} }
if ( !bOK && proxyMesh )
{
// check if VL elements are present on block FACEs
bool hasVLonFace = false;
for ( TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next() )
{
const SMESHDS_SubMesh* sm1 = aMesh.GetSubMesh( exp.Current() )->GetSubMeshDS();
const SMESHDS_SubMesh* sm2 = proxyMesh->GetSubMesh( exp.Current() );
if (( hasVLonFace = ( sm2 && sm1->NbElements() != sm2->NbElements() )))
break;
}
if ( hasVLonFace )
{
err->myName = COMPERR_BAD_INPUT_MESH;
err->myComment = "Can't build pentahedral mesh on viscous layers";
}
}
return err; return err;
} }

View File

@ -2777,13 +2777,12 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
if ( !setEdgeData( *edge, edgesByGeom[ shapeID ], helper, data )) if ( !setEdgeData( *edge, edgesByGeom[ shapeID ], helper, data ))
return false; return false;
if ( edge->_nodes.size() < 2 ) if ( edge->_nodes.size() < 2 && !noShrink )
edge->Block( data ); edge->Block( data ); // a sole node is moved only if noShrink
//data._noShrinkShapes.insert( shapeID );
} }
dumpMove(edge->_nodes.back()); dumpMove(edge->_nodes.back());
if ( edge->_cosin > faceMaxCosin && !edge->Is( _LayerEdge::BLOCKED )) if ( edge->_cosin > faceMaxCosin && edge->_nodes.size() > 1 )
{ {
faceMaxCosin = edge->_cosin; faceMaxCosin = edge->_cosin;
maxCosinEdge = edge; maxCosinEdge = edge;
@ -3907,7 +3906,7 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
getMeshDS()->SetNodeOnFace( tgtNode, TopoDS::Face( eos._sWOL ), uv.X(), uv.Y() ); getMeshDS()->SetNodeOnFace( tgtNode, TopoDS::Face( eos._sWOL ), uv.X(), uv.Y() );
} }
if ( edge._nodes.size() > 1 ) //if ( edge._nodes.size() > 1 ) -- allow RISKY_SWOL on noShrink shape
{ {
// check if an angle between a FACE with layers and SWOL is sharp, // check if an angle between a FACE with layers and SWOL is sharp,
// else the edge should not inflate // else the edge should not inflate
@ -3922,8 +3921,11 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
geomNorm.Reverse(); // inside the SOLID geomNorm.Reverse(); // inside the SOLID
if ( geomNorm * edge._normal < -0.001 ) if ( geomNorm * edge._normal < -0.001 )
{ {
getMeshDS()->RemoveFreeNode( tgtNode, 0, /*fromGroups=*/false ); if ( edge._nodes.size() > 1 )
edge._nodes.resize( 1 ); {
getMeshDS()->RemoveFreeNode( tgtNode, 0, /*fromGroups=*/false );
edge._nodes.resize( 1 );
}
} }
else if ( realLenFactor > 3 ) /// -- moved to SetCosin() else if ( realLenFactor > 3 ) /// -- moved to SetCosin()
//else if ( edge._lenFactor > 3 ) //else if ( edge._lenFactor > 3 )
@ -4741,7 +4743,7 @@ void _ViscousBuilder::computeGeomSize( _SolidData& data )
double thinkness = eos._hyp.GetTotalThickness(); double thinkness = eos._hyp.GetTotalThickness();
for ( size_t i = 0; i < eos._edges.size(); ++i ) for ( size_t i = 0; i < eos._edges.size(); ++i )
{ {
if ( eos._edges[i]->Is( _LayerEdge::BLOCKED )) continue; if ( eos._edges[i]->_nodes.size() < 2 ) continue;
eos._edges[i]->SetMaxLen( thinkness ); eos._edges[i]->SetMaxLen( thinkness );
eos._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon, eos, &face ); eos._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon, eos, &face );
if ( intersecDist > 0 && face ) if ( intersecDist > 0 && face )
@ -6194,9 +6196,11 @@ bool _Smoother1D::smoothAnalyticEdge( _SolidData& data,
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() ); tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode ); dumpMove( tgtNode );
SMDS_FacePositionPtr pos = tgtNode->GetPosition(); if ( SMDS_FacePositionPtr pos = tgtNode->GetPosition() ) // NULL if F is noShrink
pos->SetUParameter( newUV.X() ); {
pos->SetVParameter( newUV.Y() ); pos->SetUParameter( newUV.X() );
pos->SetVParameter( newUV.Y() );
}
gp_XYZ newUV0( newUV.X(), newUV.Y(), 0 ); gp_XYZ newUV0( newUV.X(), newUV.Y(), 0 );
@ -6306,10 +6310,11 @@ bool _Smoother1D::smoothAnalyticEdge( _SolidData& data,
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() ); tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode ); dumpMove( tgtNode );
SMDS_FacePositionPtr pos = tgtNode->GetPosition(); if ( SMDS_FacePositionPtr pos = tgtNode->GetPosition() ) // NULL if F is noShrink
pos->SetUParameter( newUV.X() ); {
pos->SetVParameter( newUV.Y() ); pos->SetUParameter( newUV.X() );
pos->SetVParameter( newUV.Y() );
}
_eos[i]->Set( _LayerEdge::SMOOTHED ); // to check in refine() (IPAL54237) _eos[i]->Set( _LayerEdge::SMOOTHED ); // to check in refine() (IPAL54237)
} }
} }
@ -6941,14 +6946,14 @@ void _SolidData::PrepareEdgesToSmoothOnFace( _EdgesOnShape* eos, bool substitute
eos->_edgeForOffset = 0; eos->_edgeForOffset = 0;
double maxCosin = -1; double maxCosin = -1;
bool hasNoShrink = false; //bool hasNoShrink = false;
for ( TopExp_Explorer eExp( eos->_shape, TopAbs_EDGE ); eExp.More(); eExp.Next() ) for ( TopExp_Explorer eExp( eos->_shape, TopAbs_EDGE ); eExp.More(); eExp.Next() )
{ {
_EdgesOnShape* eoe = GetShapeEdges( eExp.Current() ); _EdgesOnShape* eoe = GetShapeEdges( eExp.Current() );
if ( !eoe || eoe->_edges.empty() ) continue; if ( !eoe || eoe->_edges.empty() ) continue;
if ( eos->GetData()._noShrinkShapes.count( eoe->_shapeID )) // if ( eos->GetData()._noShrinkShapes.count( eoe->_shapeID ))
hasNoShrink = true; // hasNoShrink = true;
vector<_LayerEdge*>& eE = eoe->_edges; vector<_LayerEdge*>& eE = eoe->_edges;
_LayerEdge* e = eE[ eE.size() / 2 ]; _LayerEdge* e = eE[ eE.size() / 2 ];
@ -6986,8 +6991,8 @@ void _SolidData::PrepareEdgesToSmoothOnFace( _EdgesOnShape* eos, bool substitute
// Try to initialize _Mapper2D // Try to initialize _Mapper2D
if ( hasNoShrink ) // if ( hasNoShrink )
return; // return;
SMDS_ElemIteratorPtr fIt = eos->_subMesh->GetSubMeshDS()->GetElements(); SMDS_ElemIteratorPtr fIt = eos->_subMesh->GetSubMeshDS()->GetElements();
if ( !fIt->more() || fIt->next()->NbCornerNodes() != 4 ) if ( !fIt->more() || fIt->next()->NbCornerNodes() != 4 )
@ -10843,12 +10848,20 @@ namespace VISCOUS_3D
std::vector< SMESH_NodeXYZ > _nodes; std::vector< SMESH_NodeXYZ > _nodes;
TopAbs_ShapeEnum _vertSWOLType[2]; // shrink part includes VERTEXes TopAbs_ShapeEnum _vertSWOLType[2]; // shrink part includes VERTEXes
AverageHyp* _vertHyp[2]; AverageHyp* _vertHyp[2];
double _edgeWOLLen[2]; // length of wol EDGE
double _tol; // to compare _edgeWOLLen's
BndPart(): BndPart():
_isShrink(0), _isReverse(0), _nbSegments(0), _hyp(0), _isShrink(0), _isReverse(0), _nbSegments(0), _hyp(0),
_vertSWOLType{ TopAbs_WIRE, TopAbs_WIRE }, _vertHyp{ 0, 0 } _vertSWOLType{ TopAbs_WIRE, TopAbs_WIRE }, _vertHyp{ 0, 0 }, _edgeWOLLen{ 0., 0.}
{} {}
bool IsEqualLengthEWOL( const BndPart& other ) const
{
return ( std::abs( _edgeWOLLen[0] - other._edgeWOLLen[0] ) < _tol &&
std::abs( _edgeWOLLen[1] - other._edgeWOLLen[1] ) < _tol );
}
bool operator==( const BndPart& other ) const bool operator==( const BndPart& other ) const
{ {
return ( _isShrink == other._isShrink && return ( _isShrink == other._isShrink &&
@ -10859,7 +10872,8 @@ namespace VISCOUS_3D
(( !_isShrink ) || (( !_isShrink ) ||
( *_hyp == *other._hyp && ( *_hyp == *other._hyp &&
vertHyp1() == other.vertHyp1() && vertHyp1() == other.vertHyp1() &&
vertHyp2() == other.vertHyp2() )) vertHyp2() == other.vertHyp2() &&
IsEqualLengthEWOL( other )))
); );
} }
bool CanAppend( const BndPart& other ) bool CanAppend( const BndPart& other )
@ -10877,10 +10891,12 @@ namespace VISCOUS_3D
bool hasCommonNode = ( _nodes.back()->GetID() == other._nodes.front()->GetID() ); bool hasCommonNode = ( _nodes.back()->GetID() == other._nodes.front()->GetID() );
_nodes.insert( _nodes.end(), other._nodes.begin() + hasCommonNode, other._nodes.end() ); _nodes.insert( _nodes.end(), other._nodes.begin() + hasCommonNode, other._nodes.end() );
_vertSWOLType[1] = other._vertSWOLType[1]; _vertSWOLType[1] = other._vertSWOLType[1];
if ( _isShrink ) if ( _isShrink ) {
_vertHyp[1] = other._vertHyp[1]; _vertHyp[1] = other._vertHyp[1];
_edgeWOLLen[1] = other._edgeWOLLen[1];
}
} }
const SMDS_MeshNode* Node(size_t i) const const SMDS_MeshNode* Node(size_t i) const
{ {
return _nodes[ _isReverse ? ( _nodes.size() - 1 - i ) : i ]._node; return _nodes[ _isReverse ? ( _nodes.size() - 1 - i ) : i ]._node;
} }
@ -11028,6 +11044,11 @@ namespace VISCOUS_3D
for ( int iE = 0; iE < nbEdgesInWire.front(); ++iE ) for ( int iE = 0; iE < nbEdgesInWire.front(); ++iE )
{ {
BndPart bndPart; BndPart bndPart;
std::vector<const SMDS_MeshNode*> nodes = fSide.GetOrderedNodes( iE );
bndPart._nodes.assign( nodes.begin(), nodes.end() );
bndPart._nbSegments = bndPart._nodes.size() - 1;
_EdgesOnShape* eos = _data1->GetShapeEdges( fSide.EdgeID( iE )); _EdgesOnShape* eos = _data1->GetShapeEdges( fSide.EdgeID( iE ));
bndPart._isShrink = ( eos->SWOLType() == TopAbs_FACE ); bndPart._isShrink = ( eos->SWOLType() == TopAbs_FACE );
@ -11056,10 +11077,14 @@ namespace VISCOUS_3D
bndPart._vertSWOLType[iV] = eov[iV]->SWOLType(); bndPart._vertSWOLType[iV] = eov[iV]->SWOLType();
} }
} }
bndPart._edgeWOLLen[0] = fSide.EdgeLength( iE - 1 );
bndPart._edgeWOLLen[1] = fSide.EdgeLength( iE + 1 );
bndPart._tol = std::numeric_limits<double>::max(); // tolerance by segment size
for ( size_t i = 1; i < bndPart._nodes.size(); ++i )
bndPart._tol = Min( bndPart._tol,
( bndPart._nodes[i-1] - bndPart._nodes[i] ).SquareModulus() );
} }
std::vector<const SMDS_MeshNode*> nodes = fSide.GetOrderedNodes( iE );
bndPart._nodes.assign( nodes.begin(), nodes.end() );
bndPart._nbSegments = bndPart._nodes.size() - 1;
if ( _boundary.empty() || ! _boundary.back().CanAppend( bndPart )) if ( _boundary.empty() || ! _boundary.back().CanAppend( bndPart ))
_boundary.push_back( bndPart ); _boundary.push_back( bndPart );
@ -11166,6 +11191,9 @@ namespace VISCOUS_3D
} }
SMESHDS_Mesh* meshDS = dataSrc->GetHelper().GetMeshDS(); SMESHDS_Mesh* meshDS = dataSrc->GetHelper().GetMeshDS();
dumpFunction(SMESH_Comment("periodicMoveNodes_F")
<< _shriFace[iSrc]->_subMesh->GetId() << "_F"
<< _shriFace[iTgt]->_subMesh->GetId() );
TNode2Edge::iterator n2e; TNode2Edge::iterator n2e;
TNodeNodeMap::iterator n2n = _nnMap.begin(); TNodeNodeMap::iterator n2n = _nnMap.begin();
for ( ; n2n != _nnMap.end(); ++n2n ) for ( ; n2n != _nnMap.end(); ++n2n )
@ -11195,6 +11223,8 @@ namespace VISCOUS_3D
SMESH_NodeXYZ pSrc = leSrc->_nodes[ iN ]; SMESH_NodeXYZ pSrc = leSrc->_nodes[ iN ];
gp_XYZ pTgt = trsf->Transform( pSrc ); gp_XYZ pTgt = trsf->Transform( pSrc );
meshDS->MoveNode( leTgt->_nodes[ iN ], pTgt.X(), pTgt.Y(), pTgt.Z() ); meshDS->MoveNode( leTgt->_nodes[ iN ], pTgt.X(), pTgt.Y(), pTgt.Z() );
dumpMove( leTgt->_nodes[ iN ]);
} }
} }
} }
@ -11203,6 +11233,7 @@ namespace VISCOUS_3D
<< _shriFace[iSrc]->_subMesh->GetId() << " -> " << _shriFace[iSrc]->_subMesh->GetId() << " -> "
<< _shriFace[iTgt]->_subMesh->GetId() << " -- " << _shriFace[iTgt]->_subMesh->GetId() << " -- "
<< ( done ? "DONE" : "FAIL")); << ( done ? "DONE" : "FAIL"));
dumpFunctionEnd();
return done; return done;
} }
@ -11737,6 +11768,8 @@ bool _ViscousBuilder::shrink(_SolidData& theData)
{ {
_EdgesOnShape& eos = * subEOS[ iS ]; _EdgesOnShape& eos = * subEOS[ iS ];
if ( eos.ShapeType() != TopAbs_EDGE ) continue; if ( eos.ShapeType() != TopAbs_EDGE ) continue;
if ( eos.size() == 0 )
continue;
const TopoDS_Edge& E = TopoDS::Edge( eos._shape ); const TopoDS_Edge& E = TopoDS::Edge( eos._shape );
data.SortOnEdge( E, eos._edges ); data.SortOnEdge( E, eos._edges );
@ -11759,8 +11792,8 @@ bool _ViscousBuilder::shrink(_SolidData& theData)
uvPtVec[ i ].param = helper.GetNodeU( E, edges[i]->_nodes[0] ); uvPtVec[ i ].param = helper.GetNodeU( E, edges[i]->_nodes[0] );
uvPtVec[ i ].SetUV( helper.GetNodeUV( F, edges[i]->_nodes.back() )); uvPtVec[ i ].SetUV( helper.GetNodeUV( F, edges[i]->_nodes.back() ));
} }
if ( edges.empty() ) // if ( edges.empty() )
continue; // continue;
BRep_Tool::Range( E, uvPtVec[0].param, uvPtVec.back().param ); BRep_Tool::Range( E, uvPtVec[0].param, uvPtVec.back().param );
StdMeshers_FaceSide fSide( uvPtVec, F, E, _mesh ); StdMeshers_FaceSide fSide( uvPtVec, F, E, _mesh );
StdMeshers_ViscousLayers2D::SetProxyMeshOfEdge( fSide ); StdMeshers_ViscousLayers2D::SetProxyMeshOfEdge( fSide );