0022104: EDF 2550 SMESH: 2D viscous layer, allow specifying edges with viscous layer

+  void SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
+  std::vector<int> GetBndShapes() const { return _shapeIds; }
+  bool IsToIgnoreShapes() const { return _isToIgnoreShapes; }

  private:

-  std::vector<int> _ignoreBndShapeIds;
+  std::vector<int> _shapeIds;
+  bool             _isToIgnoreShapes;
This commit is contained in:
eap 2013-05-30 14:14:31 +00:00
parent a29849f24b
commit 4a87093dce
2 changed files with 25 additions and 21 deletions

View File

@ -567,20 +567,17 @@ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
// //
StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen) StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen)
:SMESH_Hypothesis(hypId, studyId, gen), :SMESH_Hypothesis(hypId, studyId, gen),
_nbLayers(1), _thickness(1), _stretchFactor(1) _isToIgnoreShapes(18), _nbLayers(1), _thickness(1), _stretchFactor(1)
{ {
_name = StdMeshers_ViscousLayers::GetHypType(); _name = StdMeshers_ViscousLayers::GetHypType();
_param_algo_dim = -3; // auxiliary hyp used by 3D algos _param_algo_dim = -3; // auxiliary hyp used by 3D algos
} // -------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------
void StdMeshers_ViscousLayers::SetBndShapesToIgnore(const std::vector<int>& faceIds) void StdMeshers_ViscousLayers::SetBndShapes(const std::vector<int>& faceIds, bool toIgnore)
{ {
if ( faceIds != _ignoreBndShapeIds ) if ( faceIds != _shapeIds )
_ignoreBndShapeIds = faceIds, NotifySubMeshesHypothesisModification(); _shapeIds = faceIds, NotifySubMeshesHypothesisModification();
} // -------------------------------------------------------------------------------- if ( _isToIgnoreShapes != toIgnore )
bool StdMeshers_ViscousLayers::IsIgnoredShape(const int shapeID) const _isToIgnoreShapes = toIgnore, NotifySubMeshesHypothesisModification();
{
return ( find( _ignoreBndShapeIds.begin(), _ignoreBndShapeIds.end(), shapeID )
!= _ignoreBndShapeIds.end() );
} // -------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------
void StdMeshers_ViscousLayers::SetTotalThickness(double thickness) void StdMeshers_ViscousLayers::SetTotalThickness(double thickness)
{ {
@ -638,17 +635,22 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save)
save << " " << _nbLayers save << " " << _nbLayers
<< " " << _thickness << " " << _thickness
<< " " << _stretchFactor << " " << _stretchFactor
<< " " << _ignoreBndShapeIds.size(); << " " << _shapeIds.size();
for ( unsigned i = 0; i < _ignoreBndShapeIds.size(); ++i ) for ( unsigned i = 0; i < _shapeIds.size(); ++i )
save << " " << _ignoreBndShapeIds[i]; save << " " << _shapeIds[i];
save << " " << !_isToIgnoreShapes; // negate to keep the behavior in old studies.
return save; return save;
} // -------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------
std::istream & StdMeshers_ViscousLayers::LoadFrom(std::istream & load) std::istream & StdMeshers_ViscousLayers::LoadFrom(std::istream & load)
{ {
int nbFaces, faceID; int nbFaces, faceID, shapeToTreat;
load >> _nbLayers >> _thickness >> _stretchFactor >> nbFaces; load >> _nbLayers >> _thickness >> _stretchFactor >> nbFaces;
while ( _ignoreBndShapeIds.size() < nbFaces && load >> faceID ) while ( _shapeIds.size() < nbFaces && load >> faceID )
_ignoreBndShapeIds.push_back( faceID ); _shapeIds.push_back( faceID );
if ( load >> shapeToTreat )
_isToIgnoreShapes = !shapeToTreat;
else
_isToIgnoreShapes = true; // old behavior
return load; return load;
} // -------------------------------------------------------------------------------- } // --------------------------------------------------------------------------------
bool StdMeshers_ViscousLayers::SetParametersByMesh(const SMESH_Mesh* theMesh, bool StdMeshers_ViscousLayers::SetParametersByMesh(const SMESH_Mesh* theMesh,
@ -1072,7 +1074,7 @@ bool _ViscousBuilder::findFacesWithLayers()
vector<TopoDS_Shape> ignoreFaces; vector<TopoDS_Shape> ignoreFaces;
for ( unsigned i = 0; i < _sdVec.size(); ++i ) for ( unsigned i = 0; i < _sdVec.size(); ++i )
{ {
vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapesToIgnore(); vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
for ( unsigned i = 0; i < ids.size(); ++i ) for ( unsigned i = 0; i < ids.size(); ++i )
{ {
const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] ); const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );

View File

@ -39,10 +39,11 @@ class STDMESHERS_EXPORT StdMeshers_ViscousLayers : public SMESH_Hypothesis
public: public:
StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen); StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen);
// Set boundary shapes to exclude from treatment, faces in 3D, edges in 2D // Set boundary shapes, faces in 3D, edges in 2D, either to exclude from
void SetBndShapesToIgnore(const std::vector<int>& shapeIds); // treatment or to make the Viscous Layers on
std::vector<int> GetBndShapesToIgnore() const { return _ignoreBndShapeIds; } void SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
bool IsIgnoredShape(const int shapeID) const; std::vector<int> GetBndShapes() const { return _shapeIds; }
bool IsToIgnoreShapes() const { return _isToIgnoreShapes; }
// Set total thickness of layers of prisms // Set total thickness of layers of prisms
void SetTotalThickness(double thickness); void SetTotalThickness(double thickness);
@ -86,7 +87,8 @@ public:
private: private:
std::vector<int> _ignoreBndShapeIds; std::vector<int> _shapeIds;
bool _isToIgnoreShapes;
int _nbLayers; int _nbLayers;
double _thickness; double _thickness;
double _stretchFactor; double _stretchFactor;