-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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
private:
- bool findSolidsWithLayers();
+ bool findSolidsWithLayers(const bool checkFaceMesh=true);
bool setBefore( _SolidData& solidBefore, _SolidData& solidAfter );
bool findFacesWithLayers(const bool onlyWith=false);
void findPeriodicFaces();
PyDump(SMESH_Mesh& m) {
int tag = 3 + m.GetId();
const char* fname = "/tmp/viscous.py";
- cout << "execfile('"<<fname<<"')"<<endl;
+ cout << "exec(open('"<<fname<<"','rb').read() )"<<endl;
py = _pyStream = new ofstream(fname);
*py << "import SMESH" << endl
<< "from salome.smesh import smeshBuilder" << endl
return SMESH_ComputeErrorPtr(); // everything already computed
- findSolidsWithLayers();
+ findSolidsWithLayers( /*checkFaceMesh=*/false );
bool ok = findFacesWithLayers( true );
// remove _MeshOfSolid's of _SolidData's
*/
//================================================================================
-bool _ViscousBuilder::findSolidsWithLayers()
+bool _ViscousBuilder::findSolidsWithLayers(const bool checkFaceMesh)
{
// get all solids
TopTools_IndexedMapOfShape allSolids;
SMESH_HypoFilter filter;
for ( int i = 1; i <= allSolids.Extent(); ++i )
{
- // find StdMeshers_ViscousLayers hyp assigned to the i-th solid
SMESH_subMesh* sm = _mesh->GetSubMesh( allSolids(i) );
if ( sm->GetSubMeshDS() && sm->GetSubMeshDS()->NbElements() > 0 )
continue; // solid is already meshed
+ // TODO: check if algo is hidden
SMESH_Algo* algo = sm->GetAlgo();
if ( !algo ) continue;
- // TODO: check if algo is hidden
+ // check if all FACEs are meshed, which can be false if Compute() a sub-shape
+ if ( checkFaceMesh )
+ {
+ bool facesMeshed = true;
+ SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(false,true);
+ while ( smIt->more() && facesMeshed )
+ {
+ SMESH_subMesh * faceSM = smIt->next();
+ if ( faceSM->GetSubShape().ShapeType() != TopAbs_FACE )
+ break;
+ facesMeshed = faceSM->IsMeshComputed();
+ }
+ if ( !facesMeshed )
+ continue;
+ }
+ // find StdMeshers_ViscousLayers hyp assigned to the i-th solid
const list <const SMESHDS_Hypothesis *> & allHyps =
algo->GetUsedHypothesis(*_mesh, allSolids(i), /*ignoreAuxiliary=*/false);
_SolidData* soData = 0;
if ( isC1 )
{
double maxEdgeLen = 3 * Min( eov._edges[0]->_maxLen, eov._hyp.GetTotalThickness() );
- double eLen1 = SMESH_Algo::EdgeLength( TopoDS::Edge( dirOfEdges[i].first->_shape ));
- double eLen2 = SMESH_Algo::EdgeLength( TopoDS::Edge( dirOfEdges[j].first->_shape ));
- if ( eLen1 < maxEdgeLen ) eov._eosC1.push_back( dirOfEdges[i].first );
- if ( eLen2 < maxEdgeLen ) eov._eosC1.push_back( dirOfEdges[j].first );
- dirOfEdges[i].first = 0;
- dirOfEdges[j].first = 0;
+ for ( int isJ = 0; isJ < 2; ++isJ ) // loop on [i,j]
+ {
+ size_t k = isJ ? j : i;
+ const TopoDS_Edge& e = TopoDS::Edge( dirOfEdges[k].first->_shape );
+ double eLen = SMESH_Algo::EdgeLength( e );
+ if ( eLen < maxEdgeLen )
+ {
+ TopoDS_Shape oppV = SMESH_MesherHelper::IthVertex( 0, e );
+ if ( oppV.IsSame( V ))
+ oppV = SMESH_MesherHelper::IthVertex( 1, e );
+ _EdgesOnShape* eovOpp = data.GetShapeEdges( oppV );
+ if ( dirOfEdges[k].second * eovOpp->_edges[0]->_normal < 0 )
+ eov._eosC1.push_back( dirOfEdges[k].first );
+ }
+ dirOfEdges[k].first = 0;
+ }
}
}
} // fill _eosC1 of VERTEXes
void _Smoother1D::offPointsToPython() const
{
const char* fname = "/tmp/offPoints.py";
- cout << "execfile('"<<fname<<"')"<<endl;
+ cout << "exec(open('"<<fname<<"','rb').read() )"<<endl;
ofstream py(fname);
py << "import SMESH" << endl
<< "from salome.smesh import smeshBuilder" << endl
PeriodicFaces( ShrinkFace* sf1, ShrinkFace* sf2 ): _shriFace{ sf1, sf2 } {}
bool IncludeShrunk( const TopoDS_Face& face, const TopTools_MapOfShape& shrunkFaces ) const;
bool MoveNodes( const TopoDS_Face& tgtFace );
+ void Clear() { _nnMap.clear(); }
+ bool IsEmpty() const { return _nnMap.empty(); }
};
//--------------------------------------------------------------------------------
return & _periodicFaces[ i ];
return 0;
}
+ void ClearPeriodic( const TopoDS_Face& face )
+ {
+ for ( size_t i = 0; i < _periodicFaces.size(); ++i )
+ if ( _periodicFaces[ i ]._shriFace[0]->IsSame( face ) ||
+ _periodicFaces[ i ]._shriFace[1]->IsSame( face ))
+ _periodicFaces[ i ].Clear();
+ }
};
//================================================================================
bool PeriodicFaces::IncludeShrunk( const TopoDS_Face& face,
const TopTools_MapOfShape& shrunkFaces ) const
{
+ if ( IsEmpty() ) return false;
return (( _shriFace[0]->IsSame( face ) && _shriFace[1]->IsShrunk( shrunkFaces )) ||
( _shriFace[1]->IsSame( face ) && _shriFace[0]->IsShrunk( shrunkFaces )));
}
if ( iSrc != 0 )
{
trsfInverse = _trsf;
- trsfInverse.Invert();
+ if ( !trsfInverse.Invert())
+ return false;
trsf = &trsfInverse;
}
SMESHDS_Mesh* meshDS = dataSrc->GetHelper().GetMeshDS();
}
}
bool done = ( n2n == _nnMap.end() );
- // cout << "MMMMMMMOOOOOOOOOOVVVVVVVVVVVEEEEEEEE "
- // << _shriFace[iSrc]->_subMesh->GetId() << " -> "
- // << _shriFace[iTgt]->_subMesh->GetId() << " -- "
- // << ( done ? "DONE" : "FAIL") << endl;
+ debugMsg( "PeriodicFaces::MoveNodes "
+ << _shriFace[iSrc]->_subMesh->GetId() << " -> "
+ << _shriFace[iTgt]->_subMesh->GetId() << " -- "
+ << ( done ? "DONE" : "FAIL"));
return done;
}
getMeshDS()->RemoveFreeNode( n, smDS, /*fromGroups=*/false );
}
}
+ _periodicity->ClearPeriodic( F );
+
// restore position and UV of target nodes
gp_Pnt p;
for ( size_t iS = 0; iS < subEOS.size(); ++iS )
if ( !n2 )
return error(SMESH_Comment("Wrongly meshed EDGE ") << getMeshDS()->ShapeToIndex( E ));
+ if ( n2 == tgtNode ) // for 3D_mesh_GHS3D_01/B1
+ {
+ // shrunk by other SOLID
+ edge.Set( _LayerEdge::SHRUNK ); // ???
+ return true;
+ }
+
double uSrc = helper.GetNodeU( E, srcNode, n2 );
double uTgt = helper.GetNodeU( E, tgtNode, srcNode );
double u2 = helper.GetNodeU( E, n2, srcNode );