22313: EDF 2538 SMESH: Face with layers with ViscousLayer3D Hypothesis

This commit is contained in:
eap 2014-01-09 10:29:44 +00:00
parent 3c3543845e
commit b67b2447f1
9 changed files with 318 additions and 180 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -81,29 +81,29 @@ computations.
<li><b>Number of layers</b> - defines the number of element layers.</li>
<li><b>Stretch factor</b> - defines the growth factor of element height
from the mesh boundary inwards.</li>
<li><b>Specified Edges are</b> - defines how the shapes specified by
<li><b>Specified Faces/Edges are</b> - defines how the shapes specified by
the next parameter are used.
<li><b>Faces without layers</b> and <b>Edges with/without layers</b> -
in the 3D case it defines geometrical faces on which element layers
should not be constructed; in the 2D case it defines geometrical edges
on which element layers either should be or should not be
constructed, depending on the value of the previous parameter
(<b>Specified Edges are</b>).
<li><b> Faces/Edges with/without layers</b> -
defines geometrical faces or edges on which element layers
either should be or should not be constructed, depending on the
value of the previous parameter (<b>Specified Faces/Edges are</b>).
Faces (or edges) can be selected either in the Object Browser or in
the VTK Viewer.
\note A mesh shown in the 3D Viewer can prevent selection of faces
and edges, just hide the mesh to avoid this. To avoid a long wait when a
geometry with many faces (or edges) is displayed, the number of faces
(edges) shown at a time is limited by the value of "Sub-shapes
preview chunk size" preference (in Preferences/Mesh/General tab).<br>
Whatever shapes are specified by this
parameter, the element layers are not constructed on geometrical
faces shared by several solids in 3D case and edges shared by
several faces in 2D case. In other words the element layers can be
constructed on boundary faces and edges, and are not constructed on
internal faces and edges. There is an exception to this rule in 2D
case: if "Viscous Layers 2D" hypothesis is assigned to a sub-mesh,
the element layers can be constructed on boundary edges of the shape
of this sub-mesh.
If faces/edges without layers are specified, the element layers are
not constructed on geometrical faces shared by several solids in 3D
case and edges shared by several faces in 2D case. In other words,
in this mode the element layers can be constructed on boundary faces
and edges only, and are not constructed on internal faces and
edges. There is an exception to this rule: if a hypothesis is
assigned to a sub-mesh, the element layers can be constructed on
boundary faces/edges of the shape of this sub-mesh, at same time
possibly being internal faces/edges within the whole model.
\image html viscous_layers_on_submesh.png 2D viscous layers constructed on boundary edges of a sub-mesh on a disk face.
</li>
@ -114,5 +114,4 @@ computations.
<br><b>See also</b> a sample TUI script of a \ref tui_viscous_layers
"Viscous layers construction".
*/

View File

@ -871,6 +871,14 @@ module StdMeshers
void SetIgnoreFaces(in SMESH::long_array faceIDs) raises (SALOME::SALOME_Exception);
SMESH::long_array GetIgnoreFaces();
/*!
* Set faces either to exclude from treatment or to make the Viscous Layers on.
*/
void SetFaces(in SMESH::long_array faceIDs,
in boolean toIgnore) raises (SALOME::SALOME_Exception);
SMESH::long_array GetFaces();
boolean GetIsToIgnoreFaces();
/*!
* Set total thickness of layers of prisms
*/

View File

@ -267,21 +267,26 @@ class Mesh_Algorithm:
# @param thickness total thickness of layers of prisms
# @param numberOfLayers number of layers of prisms
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
# @param ignoreFaces list of geometrical faces (or their ids) not to generate layers on
# @param faces list of geometrical faces (or their ids).
# Viscous layers are either generated on these faces or not, depending on
# the value of \a isFacesToIgnore parameter.
# @param isFacesToIgnore if \c True, the Viscous layers are not generated on the
# faces specified by the previous parameter (\a faces).
# @ingroup l3_hypos_additi
def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, ignoreFaces=[]):
def ViscousLayers(self, thickness, numberOfLayers, stretchFactor,
faces=[], isFacesToIgnore=True ):
if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo):
raise TypeError, "ViscousLayers are supported by 3D algorithms only"
if not "ViscousLayers" in self.GetCompatibleHypothesis():
raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
if ignoreFaces and isinstance( ignoreFaces[0], geomBuilder.GEOM._objref_GEOM_Object ):
ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ]
if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ):
faces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in faces ]
hyp = self.Hypothesis("ViscousLayers",
[thickness, numberOfLayers, stretchFactor, ignoreFaces])
[thickness, numberOfLayers, stretchFactor, faces])
hyp.SetTotalThickness(thickness)
hyp.SetNumberLayers(numberOfLayers)
hyp.SetStretchFactor(stretchFactor)
hyp.SetIgnoreFaces(ignoreFaces)
hyp.SetFaces(faces, isFacesToIgnore)
return hyp
## Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
@ -290,9 +295,9 @@ class Mesh_Algorithm:
# @param thickness total thickness of layers of quadrilaterals
# @param numberOfLayers number of layers
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
# @param edges list of geometrical edge (or their ids).
# @param edges list of geometrical edges (or their ids).
# Viscous layers are either generated on these edges or not, depending on
# the values of \a isEdgesToIgnore parameter.
# the value of \a isEdgesToIgnore parameter.
# @param isEdgesToIgnore if \c True, the Viscous layers are not generated on the
# edges specified by the previous parameter (\a edges).
# @ingroup l3_hypos_additi

View File

@ -35,6 +35,7 @@
#include "SMESH_ControlsDef.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MesherHelper.hxx"
@ -63,6 +64,7 @@
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
@ -382,8 +384,10 @@ namespace VISCOUS_3D
{
TopoDS_Shape _solid;
const StdMeshers_ViscousLayers* _hyp;
TopoDS_Shape _hypShape;
_MeshOfSolid* _proxyMesh;
set<TGeomID> _reversedFaceIds;
set<TGeomID> _ignoreFaceIds;
double _stepSize, _stepSizeCoeff;
const SMDS_MeshNode* _stepSizeNodes[2];
@ -414,7 +418,9 @@ namespace VISCOUS_3D
_SolidData(const TopoDS_Shape& s=TopoDS_Shape(),
const StdMeshers_ViscousLayers* h=0,
_MeshOfSolid* m=0) :_solid(s), _hyp(h), _proxyMesh(m) {}
const TopoDS_Shape& hs=TopoDS_Shape(),
_MeshOfSolid* m=0)
:_solid(s), _hyp(h), _hypShape(hs), _proxyMesh(m) {}
~_SolidData();
Handle(Geom_Curve) CurveForSmooth( const TopoDS_Edge& E,
@ -513,7 +519,6 @@ namespace VISCOUS_3D
SMESH_ComputeErrorPtr _error;
vector< _SolidData > _sdVec;
set<TGeomID> _ignoreShapeIds;
int _tmpFaceID;
};
//--------------------------------------------------------------------------------
@ -575,7 +580,7 @@ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
//
StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen)
:SMESH_Hypothesis(hypId, studyId, gen),
_isToIgnoreShapes(18), _nbLayers(1), _thickness(1), _stretchFactor(1)
_isToIgnoreShapes(1), _nbLayers(1), _thickness(1), _stretchFactor(1)
{
_name = StdMeshers_ViscousLayers::GetHypType();
_param_algo_dim = -3; // auxiliary hyp used by 3D algos
@ -644,7 +649,7 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save)
<< " " << _thickness
<< " " << _stretchFactor
<< " " << _shapeIds.size();
for ( unsigned i = 0; i < _shapeIds.size(); ++i )
for ( size_t i = 0; i < _shapeIds.size(); ++i )
save << " " << _shapeIds[i];
save << " " << !_isToIgnoreShapes; // negate to keep the behavior in old studies.
return save;
@ -746,7 +751,7 @@ namespace
// get average dir of edges going fromV
gp_XYZ edgeDir;
//if ( edges.size() > 1 )
for ( unsigned i = 0; i < edges.size(); ++i )
for ( size_t i = 0; i < edges.size(); ++i )
{
edgeDir = getEdgeDir( edges[i], fromV );
double size2 = edgeDir.SquareModulus();
@ -873,7 +878,7 @@ namespace
}
void Finish() {
if (py)
*py << "mesh.MakeGroup('Viscous Prisms',VOLUME,FT_ElemGeomType,'=',Geom_PENTA)"<<endl;
*py << "mesh.MakeGroup('Viscous Prisms',SMESH.VOLUME,SMESH.FT_ElemGeomType,'=',SMESH.Geom_PENTA)"<<endl;
delete py; py=0;
}
~PyDump() { Finish(); }
@ -1027,7 +1032,7 @@ SMESH_ComputeErrorPtr _ViscousBuilder::Compute(SMESH_Mesh& theMesh,
if ( !findFacesWithLayers() )
return _error;
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
if ( ! makeLayer(_sdVec[i]) )
return _error;
@ -1066,6 +1071,7 @@ bool _ViscousBuilder::findSolidsWithLayers()
_sdVec.reserve( allSolids.Extent());
SMESH_Gen* gen = _mesh->GetGen();
SMESH_HypoFilter filter;
for ( int i = 1; i <= allSolids.Extent(); ++i )
{
// find StdMeshers_ViscousLayers hyp assigned to the i-th solid
@ -1080,10 +1086,14 @@ bool _ViscousBuilder::findSolidsWithLayers()
viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp );
if ( viscHyp )
{
TopoDS_Shape hypShape;
filter.Init( filter.Is( viscHyp ));
_mesh->GetHypothesis( allSolids(i), filter, true, &hypShape );
_MeshOfSolid* proxyMesh = _ViscousListener::GetSolidMesh( _mesh,
allSolids(i),
/*toCreate=*/true);
_sdVec.push_back( _SolidData( allSolids(i), viscHyp, proxyMesh ));
_sdVec.push_back( _SolidData( allSolids(i), viscHyp, hypShape, proxyMesh ));
_sdVec.back()._index = getMeshDS()->ShapeToIndex( allSolids(i));
}
}
@ -1102,44 +1112,69 @@ bool _ViscousBuilder::findSolidsWithLayers()
bool _ViscousBuilder::findFacesWithLayers()
{
// collect all faces to ignore defined by hyp
vector<TopoDS_Shape> ignoreFaces;
for ( unsigned i = 0; i < _sdVec.size(); ++i )
{
vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
for ( unsigned i = 0; i < ids.size(); ++i )
{
const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );
if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE )
{
_ignoreShapeIds.insert( ids[i] );
ignoreFaces.push_back( s );
}
}
}
// ignore internal faces
SMESH_MesherHelper helper( *_mesh );
TopExp_Explorer exp;
for ( unsigned i = 0; i < _sdVec.size(); ++i )
TopTools_IndexedMapOfShape solids;
// collect all faces to ignore defined by hyp
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE );
solids.Add( _sdVec[i]._solid );
vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
if ( _sdVec[i]._hyp->IsToIgnoreShapes() ) // FACEs to ignore are given
{
for ( size_t ii = 0; ii < ids.size(); ++ii )
{
const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[ii] );
if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE )
_sdVec[i]._ignoreFaceIds.insert( ids[ii] );
}
}
else // FACEs with layers are given
{
exp.Init( _sdVec[i]._solid, TopAbs_FACE );
for ( ; exp.More(); exp.Next() )
{
TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() );
if ( helper.NbAncestors( exp.Current(), *_mesh, TopAbs_SOLID ) > 1 )
if ( find( ids.begin(), ids.end(), faceInd ) == ids.end() )
_sdVec[i]._ignoreFaceIds.insert( faceInd );
}
}
// ignore internal FACEs if inlets and outlets are specified
{
TopTools_IndexedDataMapOfShapeListOfShape solidsOfFace;
if ( _sdVec[i]._hyp->IsToIgnoreShapes() )
TopExp::MapShapesAndAncestors( _sdVec[i]._hypShape,
TopAbs_FACE, TopAbs_SOLID, solidsOfFace);
exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE );
for ( ; exp.More(); exp.Next() )
{
const TopoDS_Face& face = TopoDS::Face( exp.Current() );
if ( helper.NbAncestors( face, *_mesh, TopAbs_SOLID ) < 2 )
continue;
const TGeomID faceInd = getMeshDS()->ShapeToIndex( face );
if ( _sdVec[i]._hyp->IsToIgnoreShapes() )
{
int nbSolids = solidsOfFace.FindFromKey( face ).Extent();
if ( nbSolids > 1 )
_sdVec[i]._ignoreFaceIds.insert( faceInd );
}
if ( helper.IsReversedSubMesh( face ))
{
_ignoreShapeIds.insert( faceInd );
ignoreFaces.push_back( exp.Current() );
if ( helper.IsReversedSubMesh( TopoDS::Face( exp.Current() )))
_sdVec[i]._reversedFaceIds.insert( faceInd );
}
}
}
}
// Find faces to shrink mesh on (solution 2 in issue 0020832);
TopTools_IndexedMapOfShape shapes;
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
shapes.Clear();
TopExp::MapShapes(_sdVec[i]._solid, TopAbs_EDGE, shapes);
@ -1159,18 +1194,35 @@ bool _ViscousBuilder::findFacesWithLayers()
// check presence of layers on them
int ignore[2];
for ( int j = 0; j < 2; ++j )
ignore[j] = _ignoreShapeIds.count ( getMeshDS()->ShapeToIndex( FF[j] ));
if ( ignore[0] == ignore[1] ) continue; // nothing interesting
ignore[j] = _sdVec[i]._ignoreFaceIds.count ( getMeshDS()->ShapeToIndex( FF[j] ));
if ( ignore[0] == ignore[1] )
continue; // nothing interesting
TopoDS_Shape fWOL = FF[ ignore[0] ? 0 : 1 ];
// check presence of layers on fWOL within an adjacent SOLID
PShapeIteratorPtr sIt = helper.GetAncestors( fWOL, *_mesh, TopAbs_SOLID );
while ( const TopoDS_Shape* solid = sIt->next() )
if ( !solid->IsSame( _sdVec[i]._solid ))
{
int iSolid = solids.FindIndex( *solid );
int iFace = getMeshDS()->ShapeToIndex( fWOL );
if ( iSolid > 0 && !_sdVec[ iSolid-1 ]._ignoreFaceIds.count( iFace ))
{
_sdVec[i]._noShrinkFaces.insert( iFace );
fWOL.Nullify();
}
}
// add edge to maps
if ( !fWOL.IsNull())
{
TGeomID edgeInd = getMeshDS()->ShapeToIndex( edge );
_sdVec[i]._shrinkShape2Shape.insert( make_pair( edgeInd, fWOL ));
}
}
}
// Exclude from _shrinkShape2Shape FACE's that can't be shrinked since
// the algo of the SOLID sharing the FACE does not support it
set< string > notSupportAlgos; notSupportAlgos.insert("Hexa_3D");
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
TopTools_MapOfShape noShrinkVertices;
map< TGeomID, TopoDS_Shape >::iterator e2f = _sdVec[i]._shrinkShape2Shape.begin();
@ -1187,7 +1239,7 @@ bool _ViscousBuilder::findFacesWithLayers()
SMESH_Algo* algo = _mesh->GetGen()->GetAlgo( *_mesh, *solid );
if ( !algo || !notSupportAlgos.count( algo->GetName() )) continue;
notShrinkFace = true;
for ( unsigned j = 0; j < _sdVec.size(); ++j )
for ( size_t j = 0; j < _sdVec.size(); ++j )
{
if ( _sdVec[j]._solid.IsSame( *solid ) )
if ( _sdVec[j]._shrinkShape2Shape.count( edgeID ))
@ -1223,7 +1275,7 @@ bool _ViscousBuilder::findFacesWithLayers()
// Find the SHAPE along which to inflate _LayerEdge based on VERTEX
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
shapes.Clear();
TopExp::MapShapes(_sdVec[i]._solid, TopAbs_VERTEX, shapes);
@ -1237,11 +1289,12 @@ bool _ViscousBuilder::findFacesWithLayers()
while ( fIt->more())
{
const TopoDS_Shape* f = fIt->next();
const int fID = getMeshDS()->ShapeToIndex( *f );
if ( helper.IsSubShape( *f, _sdVec[i]._solid ) )
{
totalNbFaces++;
if ( _ignoreShapeIds.count ( fID ) && ! _sdVec[i]._noShrinkFaces.count( fID ))
const int fID = getMeshDS()->ShapeToIndex( *f );
if ( _sdVec[i]._ignoreFaceIds.count ( fID ) &&
!_sdVec[i]._noShrinkFaces.count( fID ))
facesWOL.push_back( *f );
}
}
@ -1309,9 +1362,9 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
subIds = data._noShrinkFaces;
TopExp_Explorer exp( data._solid, TopAbs_FACE );
for ( ; exp.More(); exp.Next() )
if ( ! _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
{
SMESH_subMesh* fSubM = _mesh->GetSubMesh( exp.Current() );
if ( ! data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
faceIds.insert( fSubM->GetId() );
SMESH_subMeshIteratorPtr subIt =
fSubM->getDependsOnIterator(/*includeSelf=*/true, /*complexShapeFirst=*/false);
@ -1326,7 +1379,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
for (; s2s != data._shrinkShape2Shape.end(); ++s2s )
{
TGeomID shapeInd = s2s->first;
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
if ( _sdVec[i]._index == data._index ) continue;
map< TGeomID, TopoDS_Shape >::iterator s2s2 = _sdVec[i]._shrinkShape2Shape.find( shapeInd );
@ -1433,7 +1486,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
// Set target nodes into _Simplex and _2NearEdges
TNode2Edge::iterator n2e;
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
if ( data._edges[i]->IsOnEdge())
for ( int j = 0; j < 2; ++j )
@ -1447,7 +1500,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
data._edges[i]->_2neibors->_edges[j] = n2e->second;
}
else
for ( unsigned j = 0; j < data._edges[i]->_simplices.size(); ++j )
for ( size_t j = 0; j < data._edges[i]->_simplices.size(); ++j )
{
_Simplex& s = data._edges[i]->_simplices[j];
s._nNext = data._n2eMap[ s._nNext ]->_nodes.back();
@ -1531,7 +1584,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
SMESH_MesherHelper helper( *_mesh );
bool ok = true;
for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS )
for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS )
{
vector<_LayerEdge*>& eS = edgesByGeom[iS];
if ( eS.empty() ) continue;
@ -1575,7 +1628,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
if ( eE.empty() ) continue;
if ( eE[0]->_sWOL.IsNull() )
{
for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i )
for ( size_t i = 0; i < eE.size() && !needSmooth; ++i )
needSmooth = ( eE[i]->_cosin > 0.1 );
}
else
@ -1583,7 +1636,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
const TopoDS_Face& F1 = TopoDS::Face( S );
const TopoDS_Face& F2 = TopoDS::Face( eE[0]->_sWOL );
const TopoDS_Edge& E = TopoDS::Edge( eExp.Current() );
for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i )
for ( size_t i = 0; i < eE.size() && !needSmooth; ++i )
{
gp_Vec dir1 = getFaceDir( F1, E, eE[i]->_nodes[0], helper, ok );
gp_Vec dir2 = getFaceDir( F2, E, eE[i]->_nodes[0], helper, ok );
@ -1622,7 +1675,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
}
// then the rest _LayerEdge's
for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS )
for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS )
{
vector<_LayerEdge*>& eVec = edgesByGeom[iS];
data._edges.insert( data._edges.end(), eVec.begin(), eVec.end() );
@ -1799,9 +1852,9 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
if ( posType == SMDS_TOP_FACE )
{
getSimplices( node, edge._simplices, _ignoreShapeIds, &data );
getSimplices( node, edge._simplices, data._ignoreFaceIds, &data );
double avgNormProj = 0, avgLen = 0;
for ( unsigned i = 0; i < edge._simplices.size(); ++i )
for ( size_t i = 0; i < edge._simplices.size(); ++i )
{
gp_XYZ vec = edge._pos.back() - SMESH_TNodeXYZ( edge._simplices[i]._nPrev );
avgNormProj += edge._normal * vec;
@ -1993,7 +2046,7 @@ void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node,
const TGeomID shapeInd = f->getshapeId();
if ( ingnoreShapes.count( shapeInd )) continue;
const int nbNodes = f->NbCornerNodes();
int srcInd = f->GetNodeIndex( node );
const int srcInd = f->GetNodeIndex( node );
const SMDS_MeshNode* nPrev = f->GetNode( SMESH_MesherHelper::WrapIndex( srcInd-1, nbNodes ));
const SMDS_MeshNode* nNext = f->GetNode( SMESH_MesherHelper::WrapIndex( srcInd+1, nbNodes ));
const SMDS_MeshNode* nOpp = f->GetNode( SMESH_MesherHelper::WrapIndex( srcInd+2, nbNodes ));
@ -2031,7 +2084,7 @@ void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node,
void _ViscousBuilder::makeGroupOfLE()
{
#ifdef _DEBUG_
for ( unsigned i = 0 ; i < _sdVec.size(); ++i )
for ( size_t i = 0 ; i < _sdVec.size(); ++i )
{
if ( _sdVec[i]._edges.empty() ) continue;
// string name = SMESH_Comment("_LayerEdge's_") << i;
@ -2041,10 +2094,10 @@ void _ViscousBuilder::makeGroupOfLE()
// SMESHDS_Mesh* mDS = _mesh->GetMeshDS();
dumpFunction( SMESH_Comment("make_LayerEdge_") << i );
for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j )
for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j )
{
_LayerEdge* le = _sdVec[i]._edges[j];
for ( unsigned iN = 1; iN < le->_nodes.size(); ++iN )
for ( size_t iN = 1; iN < le->_nodes.size(); ++iN )
dumpCmd(SMESH_Comment("mesh.AddEdge([ ") <<le->_nodes[iN-1]->GetID()
<< ", " << le->_nodes[iN]->GetID() <<"])");
//gDS->SMDSGroup().Add( mDS->AddEdge( le->_nodes[iN-1], le->_nodes[iN]));
@ -2052,7 +2105,7 @@ void _ViscousBuilder::makeGroupOfLE()
dumpFunctionEnd();
dumpFunction( SMESH_Comment("makeNormals") << i );
for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j )
for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j )
{
_LayerEdge& edge = *_sdVec[i]._edges[j];
SMESH_TNodeXYZ nXYZ( edge._nodes[0] );
@ -2106,7 +2159,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
auto_ptr<SMESH_ElementSearcher> searcher
( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(),
data._proxyMesh->GetFaces( data._solid )) );
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
if ( data._edges[i]->IsOnEdge() ) continue;
data._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon );
@ -2141,7 +2194,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
// Elongate _LayerEdge's
dumpFunction(SMESH_Comment("inflate")<<data._index<<"_step"<<nbSteps); // debug
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
data._edges[i]->SetNewLength( curThick, helper );
}
@ -2157,7 +2210,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
if ( nbSteps > 0 )
{
dumpFunction(SMESH_Comment("invalidate")<<data._index<<"_step"<<nbSteps); // debug
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
data._edges[i]->InvalidateStep( nbSteps+1 );
}
@ -2169,7 +2222,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
// Evaluate achieved thickness
avgThick = 0;
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
avgThick += data._edges[i]->_len;
avgThick /= data._edges.size();
#ifdef __myDEBUG
@ -2217,7 +2270,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
TopoDS_Face F;
int iBeg, iEnd = 0;
for ( unsigned iS = 0; iS < data._endEdgeToSmooth.size(); ++iS )
for ( size_t iS = 0; iS < data._endEdgeToSmooth.size(); ++iS )
{
iBeg = iEnd;
iEnd = data._endEdgeToSmooth[ iS ];
@ -2283,7 +2336,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
{
_LayerEdge* edge = data._edges[i];
SMESH_TNodeXYZ tgtXYZ( edge->_nodes.back() );
for ( unsigned j = 0; j < edge->_simplices.size(); ++j )
for ( size_t j = 0; j < edge->_simplices.size(); ++j )
if ( !edge->_simplices[j].IsForward( edge->_nodes[0], &tgtXYZ ))
{
cout << "Bad simplex ( " << edge->_nodes[0]->GetID()<< " "<< tgtXYZ._node->GetID()
@ -2312,7 +2365,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
const SMDS_MeshElement* closestFace = 0;
int iLE = 0;
#endif
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
if ( data._edges[i]->FindIntersection( *searcher, dist, data._epsilon, &intFace ))
return false;
@ -2623,7 +2676,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
vector< const SMDS_MeshNode*> nodes(4); // of a tmp mesh face
dumpFunction(SMESH_Comment("makeTmpFacesOnEdges")<<data._index);
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
_LayerEdge* edge = data._edges[i];
if ( !edge->IsOnEdge() || !edge->_sWOL.IsNull() ) continue;
@ -2640,7 +2693,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
}
// look for a _LayerEdge containg tgt2
// _LayerEdge* neiborEdge = 0;
// unsigned di = 0; // check _edges[i+di] and _edges[i-di]
// size_t di = 0; // check _edges[i+di] and _edges[i-di]
// while ( !neiborEdge && ++di <= data._edges.size() )
// {
// if ( i+di < data._edges.size() && data._edges[i+di]->_nodes.back() == tgt2 )
@ -2679,7 +2732,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
TLEdge2LEdgeSet edge2CloseEdge;
const double eps = data._epsilon * data._epsilon;
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
_LayerEdge* edge = data._edges[i];
if ( !edge->IsOnEdge() || !edge->_sWOL.IsNull() ) continue;
@ -2850,7 +2903,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
// 2) Check absence of intersections
// TODO?
for ( unsigned i = 0 ; i < tmpFaces.size(); ++i )
for ( size_t i = 0 ; i < tmpFaces.size(); ++i )
delete tmpFaces[i];
return true;
@ -2876,7 +2929,7 @@ bool _LayerEdge::FindIntersection( SMESH_ElementSearcher& searcher,
bool segmentIntersected = false;
distance = Precision::Infinite();
int iFace = -1; // intersected face
for ( unsigned j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j )
for ( size_t j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j )
{
const SMDS_MeshElement* face = suspectFaces[j];
if ( face->GetNodeIndex( _nodes.back() ) >= 0 ||
@ -3164,7 +3217,7 @@ bool _LayerEdge::Smooth(int& badNb)
// compute new position for the last _pos
gp_XYZ newPos (0,0,0);
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
newPos += SMESH_TNodeXYZ( _simplices[i]._nPrev );
newPos /= _simplices.size();
@ -3187,11 +3240,11 @@ bool _LayerEdge::Smooth(int& badNb)
// count quality metrics (orientation) of tetras around _tgtNode
int nbOkBefore = 0;
SMESH_TNodeXYZ tgtXYZ( _nodes.back() );
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
nbOkBefore += _simplices[i].IsForward( _nodes[0], &tgtXYZ );
int nbOkAfter = 0;
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
nbOkAfter += _simplices[i].IsForward( _nodes[0], &newPos );
if ( nbOkAfter < nbOkBefore )
@ -3317,14 +3370,14 @@ bool _ViscousBuilder::refine(_SolidData& data)
gp_XY uv;
bool isOnEdge;
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
_LayerEdge& edge = *data._edges[i];
// get accumulated length of segments
vector< double > segLen( edge._pos.size() );
segLen[0] = 0.0;
for ( unsigned j = 1; j < edge._pos.size(); ++j )
for ( size_t j = 1; j < edge._pos.size(); ++j )
segLen[j] = segLen[j-1] + (edge._pos[j-1] - edge._pos[j] ).Modulus();
// allocate memory for new nodes if it is not yet refined
@ -3372,8 +3425,8 @@ bool _ViscousBuilder::refine(_SolidData& data)
// create intermediate nodes
double hSum = 0, hi = h0/f;
unsigned iSeg = 1;
for ( unsigned iStep = 1; iStep < edge._nodes.size(); ++iStep )
size_t iSeg = 1;
for ( size_t iStep = 1; iStep < edge._nodes.size(); ++iStep )
{
// compute an intermediate position
hi *= f;
@ -3440,7 +3493,7 @@ bool _ViscousBuilder::refine(_SolidData& data)
if ( !getMeshDS()->IsEmbeddedMode() )
// Log node movement
for ( unsigned i = 0; i < data._edges.size(); ++i )
for ( size_t i = 0; i < data._edges.size(); ++i )
{
_LayerEdge& edge = *data._edges[i];
SMESH_TNodeXYZ p ( edge._nodes.back() );
@ -3454,7 +3507,7 @@ bool _ViscousBuilder::refine(_SolidData& data)
TopExp_Explorer exp( data._solid, TopAbs_FACE );
for ( ; exp.More(); exp.Next() )
{
if ( _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
if ( data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
continue;
SMESHDS_SubMesh* fSubM = getMeshDS()->MeshElements( exp.Current() );
SMDS_ElemIteratorPtr fIt = fSubM->GetElements();
@ -3505,7 +3558,7 @@ bool _ViscousBuilder::shrink()
// make map of (ids of FACEs to shrink mesh on) to (_SolidData containing _LayerEdge's
// inflated along FACE or EDGE)
map< TGeomID, _SolidData* > f2sdMap;
for ( unsigned i = 0 ; i < _sdVec.size(); ++i )
for ( size_t i = 0 ; i < _sdVec.size(); ++i )
{
_SolidData& data = _sdVec[i];
TopTools_MapOfShape FFMap;
@ -3606,7 +3659,7 @@ bool _ViscousBuilder::shrink()
// Replace source nodes by target nodes in mesh faces to shrink
const SMDS_MeshNode* nodes[20];
for ( unsigned i = 0; i < lEdges.size(); ++i )
for ( size_t i = 0; i < lEdges.size(); ++i )
{
_LayerEdge& edge = *lEdges[i];
const SMDS_MeshNode* srcNode = edge._nodes[0];
@ -3635,7 +3688,7 @@ bool _ViscousBuilder::shrink()
{
dumpFunction(SMESH_Comment("beforeShrinkFace")<<f2sd->first); // debug
const bool sortSimplices = isConcaveFace;
for ( unsigned i = 0; i < smoothNodes.size(); ++i )
for ( size_t i = 0; i < smoothNodes.size(); ++i )
{
const SMDS_MeshNode* n = smoothNodes[i];
nodesToSmooth[ i ]._node = n;
@ -3652,7 +3705,7 @@ bool _ViscousBuilder::shrink()
// Find EDGE's to shrink
set< _Shrinker1D* > eShri1D;
{
for ( unsigned i = 0; i < lEdges.size(); ++i )
for ( size_t i = 0; i < lEdges.size(); ++i )
{
_LayerEdge* edge = lEdges[i];
if ( edge->_sWOL.ShapeType() == TopAbs_EDGE )
@ -3684,7 +3737,7 @@ bool _ViscousBuilder::shrink()
// -----------------------------------------------
dumpFunction(SMESH_Comment("moveBoundaryOnF")<<f2sd->first<<"_st"<<shriStep ); // debug
shrinked = false;
for ( unsigned i = 0; i < lEdges.size(); ++i )
for ( size_t i = 0; i < lEdges.size(); ++i )
{
shrinked |= lEdges[i]->SetNewLength2d( surface,F,helper );
}
@ -3708,7 +3761,7 @@ bool _ViscousBuilder::shrink()
int oldBadNb = badNb;
badNb = 0;
moved = false;
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
{
moved |= nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
smoothType, /*set3D=*/isConcaveFace);
@ -3737,7 +3790,7 @@ bool _ViscousBuilder::shrink()
for ( int st = /*highQuality ? 10 :*/ 3; st; --st )
{
dumpFunction(SMESH_Comment("shrinkFace")<<f2sd->first<<"_st"<<++smooStep); // debug
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
{
nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
smoothType,/*set3D=*/st==1 );
@ -3750,7 +3803,7 @@ bool _ViscousBuilder::shrink()
if ( !getMeshDS()->IsEmbeddedMode() )
// Log node movement
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
{
SMESH_TNodeXYZ p ( nodesToSmooth[i]._node );
getMeshDS()->MoveNode( nodesToSmooth[i]._node, p.X(), p.Y(), p.Z() );
@ -3804,7 +3857,7 @@ bool _ViscousBuilder::prepareEdgeToShrink( _LayerEdge& edge,
if ( faceSubMesh->Contains( f ))
faces.push_back( f );
}
for ( unsigned i = 0; i < faces.size(); ++i )
for ( size_t i = 0; i < faces.size(); ++i )
{
const int nbNodes = faces[i]->NbCornerNodes();
for ( int j = 0; j < nbNodes; ++j )
@ -4087,7 +4140,7 @@ bool _LayerEdge::SetNewLength2d( Handle(Geom_Surface)& surface,
const double kSafe = 0.8;
const double minStepSize = uvLen / 10;
double stepSize = uvLen;
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
{
const SMDS_MeshNode* nn[2] = { _simplices[i]._nPrev, _simplices[i]._nNext };
for ( int j = 0; j < 2; ++j )
@ -4240,11 +4293,11 @@ bool _SmoothNode::Smooth(int& badNb,
// count quality metrics (orientation) of triangles around the node
int nbOkBefore = 0;
gp_XY tgtUV = helper.GetNodeUV( face, _node );
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
nbOkBefore += _simplices[i].IsForward( tgtUV, _node, face, helper, refSign );
int nbOkAfter = 0;
for ( unsigned i = 0; i < _simplices.size(); ++i )
for ( size_t i = 0; i < _simplices.size(); ++i )
nbOkAfter += _simplices[i].IsForward( newPos, _node, face, helper, refSign );
if ( nbOkAfter < nbOkBefore )
@ -4341,7 +4394,7 @@ gp_XY _SmoothNode::computeAngularPos(vector<gp_XY>& uv,
_SolidData::~_SolidData()
{
for ( unsigned i = 0; i < _edges.size(); ++i )
for ( size_t i = 0; i < _edges.size(); ++i )
{
if ( _edges[i] && _edges[i]->_2neibors )
delete _edges[i]->_2neibors;
@ -4414,7 +4467,7 @@ void _Shrinker1D::AddEdge( const _LayerEdge* e, SMESH_MesherHelper& helper )
{
// remove target node of the _LayerEdge from _nodes
int nbFound = 0;
for ( unsigned i = 0; i < _nodes.size(); ++i )
for ( size_t i = 0; i < _nodes.size(); ++i )
if ( !_nodes[i] || _nodes[i] == tgtNode0 || _nodes[i] == tgtNode1 )
_nodes[i] = 0, nbFound++;
if ( nbFound == _nodes.size() )
@ -4452,7 +4505,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() );
double totLen = GCPnts_AbscissaPoint::Length( aCurve, f, l );
for ( unsigned i = 0; i < _nodes.size(); ++i )
for ( size_t i = 0; i < _nodes.size(); ++i )
{
if ( !_nodes[i] ) continue;
double len = totLen * _normPar[i];
@ -4474,7 +4527,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
if ( _edges[1] )
l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() );
for ( unsigned i = 0; i < _nodes.size(); ++i )
for ( size_t i = 0; i < _nodes.size(); ++i )
{
if ( !_nodes[i] ) continue;
double u = f * ( 1-_normPar[i] ) + l * _normPar[i];
@ -4493,7 +4546,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
void _Shrinker1D::RestoreParams()
{
if ( _done )
for ( unsigned i = 0; i < _nodes.size(); ++i )
for ( size_t i = 0; i < _nodes.size(); ++i )
{
if ( !_nodes[i] ) continue;
SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( _nodes[i]->GetPosition() );
@ -4546,7 +4599,7 @@ bool _ViscousBuilder::addBoundaryElements()
{
SMESH_MesherHelper helper( *_mesh );
for ( unsigned i = 0; i < _sdVec.size(); ++i )
for ( size_t i = 0; i < _sdVec.size(); ++i )
{
_SolidData& data = _sdVec[i];
TopTools_IndexedMapOfShape geomEdges;
@ -4617,7 +4670,7 @@ bool _ViscousBuilder::addBoundaryElements()
{
const TopoDS_Shape* pF = fIt->next();
if ( helper.IsSubShape( *pF, data._solid) &&
!_ignoreShapeIds.count( e2f->first ))
!data._ignoreFaceIds.count( e2f->first ))
F = *pF;
}
}
@ -4633,7 +4686,7 @@ bool _ViscousBuilder::addBoundaryElements()
// Make faces
const int dj1 = reverse ? 0 : 1;
const int dj2 = reverse ? 1 : 0;
for ( unsigned j = 1; j < ledges.size(); ++j )
for ( size_t j = 1; j < ledges.size(); ++j )
{
vector< const SMDS_MeshNode*>& nn1 = ledges[j-dj1]->_nodes;
vector< const SMDS_MeshNode*>& nn2 = ledges[j-dj2]->_nodes;

View File

@ -721,9 +721,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
h->SetStretchFactor ( params[2].myValue.toDouble() );
if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 ))
{
h->SetIgnoreFaces( idsWg->GetListOfIDs() );
h->SetFaces( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
}
}
else if( hypType()=="ViscousLayers2D" )
@ -1244,7 +1244,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( !aMainEntry.isEmpty() )
{
item.myName = tr( "SMESH_FACES_WO_LAYERS" );
item.myName = tr( "TO_IGNORE_FACES_OR_NOT" );
p.append( item );
StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg("");
ignoreWdg->setButtonLabels ( QStringList()
<< tr("NOT_TO_IGNORE_FACES")
<< tr("TO_IGNORE_FACES") );
ignoreWdg->setChecked( h->GetIsToIgnoreFaces() );
connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged()));
customWidgets()->append( ignoreWdg );
item.myName =
tr( h->GetIsToIgnoreFaces() ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" );
p.append( item );
StdMeshersGUI_SubShapeSelectorWdg* idsWg =
@ -1252,7 +1264,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
idsWg->SetGeomShapeEntry( aMainEntry );
idsWg->SetMainShapeEntry( aMainEntry );
idsWg->SetListOfIDs( h->GetIgnoreFaces() );
idsWg->SetListOfIDs( h->GetFaces() );
idsWg->showPreview( true );
customWidgets()->append ( idsWg );
}
@ -1656,12 +1668,15 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
toCopyGroups->setEnabled( true );
}
}
else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup"))
else if ( hypType().startsWith( "ViscousLayers" ) && paramWidget->inherits("QButtonGroup"))
{
if ( QLabel* label = getLabel(4) )
{
bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId();
if ( hypType() == "ViscousLayers2D" )
label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
else
label->setText( tr( toIgnore ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" ));
}
}
}

View File

@ -15,6 +15,18 @@
<source>TO_IGNORE_EDGES</source>
<translation>Edges without layers (inlets and oulets)</translation>
</message>
<message>
<source>TO_IGNORE_FACES_OR_NOT</source>
<translation>Specified faces are</translation>
</message>
<message>
<source>NOT_TO_IGNORE_FACES</source>
<translation>Faces with layers (walls)</translation>
</message>
<message>
<source>TO_IGNORE_FACES</source>
<translation>Faces without layers (inlets and oulets)</translation>
</message>
</context>
<context>
<name>@default</name>

View File

@ -78,15 +78,34 @@ StdMeshers_ViscousLayers_i::~StdMeshers_ViscousLayers_i()
*/
//================================================================================
void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs)
void StdMeshers_ViscousLayers_i::SetFaces(const ::SMESH::long_array& faceIDs,
CORBA::Boolean toIgnore)
throw ( SALOME::SALOME_Exception )
{
vector<int> ids( faceIDs.length() );
for ( unsigned i = 0; i < ids.size(); ++i )
if (( ids[i] = faceIDs[i] ) < 1 )
THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
GetImpl()->SetBndShapes( ids, /*toIgnore=*/true );
SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
GetImpl()->SetBndShapes( ids, toIgnore );
SMESH::TPythonDump() << _this() << ".SetFaces( " << faceIDs << ", " << toIgnore << " )";
}
//================================================================================
/*!
* \brief
*/
//================================================================================
SMESH::long_array* StdMeshers_ViscousLayers_i::GetFaces()
{
vector<int> idsVec = GetImpl()->GetBndShapes();
SMESH::long_array_var ids = new SMESH::long_array;
ids->length( idsVec.size() );
for ( unsigned i = 0; i < idsVec.size(); ++i )
ids[i] = idsVec[i];
return ids._retn();
}
//================================================================================
@ -97,15 +116,37 @@ throw ( SALOME::SALOME_Exception )
SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
{
SMESH::long_array_var ids = new SMESH::long_array;
if ( GetImpl()->IsToIgnoreShapes() )
{
vector<int> idsVec = GetImpl()->GetBndShapes();
ids->length( idsVec.size() );
for ( unsigned i = 0; i < idsVec.size(); ++i )
ids[i] = idsVec[i];
return this->GetFaces();
return new SMESH::long_array;
}
return ids._retn();
//================================================================================
/*!
* \brief
*/
//================================================================================
CORBA::Boolean StdMeshers_ViscousLayers_i::GetIsToIgnoreFaces()
{
return GetImpl()->IsToIgnoreShapes();
}
//================================================================================
/*!
* \brief
*/
//================================================================================
void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs)
throw ( SALOME::SALOME_Exception )
{
vector<int> ids( faceIDs.length() );
for ( unsigned i = 0; i < ids.size(); ++i )
if (( ids[i] = faceIDs[i] ) < 1 )
THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
GetImpl()->SetBndShapes( ids, /*toIgnore=*/true );
SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
}
//================================================================================

View File

@ -51,6 +51,11 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i:
void SetIgnoreFaces(const ::SMESH::long_array& faceIDs) throw ( SALOME::SALOME_Exception );
SMESH::long_array* GetIgnoreFaces();
void SetFaces(const SMESH::long_array& faceIDs,
CORBA::Boolean toIgnore) throw (SALOME::SALOME_Exception);
SMESH::long_array* GetFaces();
CORBA::Boolean GetIsToIgnoreFaces();
void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception );
::CORBA::Double GetTotalThickness();