#17328: EDF 20043 - Submeshes

This commit is contained in:
eap 2019-09-03 14:29:31 +03:00
parent 46f1ca0181
commit 9de03403fe
4 changed files with 24 additions and 44 deletions

View File

@ -268,11 +268,15 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
savedHyps.swap( me->_usedHypList ); // it does not change (#16578) savedHyps.swap( me->_usedHypList ); // it does not change (#16578)
me->_usedHypList.clear(); me->_usedHypList.clear();
me->_assigedShapeList.clear();
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary )) if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
{ {
aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true ); aMesh.GetHypotheses( aShape, *filter, me->_usedHypList, true, & me->_assigedShapeList );
if ( ignoreAuxiliary && _usedHypList.size() > 1 ) if ( ignoreAuxiliary && _usedHypList.size() > 1 )
{
me->_usedHypList.clear(); //only one compatible hypothesis allowed me->_usedHypList.clear(); //only one compatible hypothesis allowed
me->_assigedShapeList.clear();
}
} }
if ( _usedHypList == savedHyps ) if ( _usedHypList == savedHyps )
savedHyps.swap( me->_usedHypList ); savedHyps.swap( me->_usedHypList );
@ -280,32 +284,15 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
return _usedHypList; return _usedHypList;
} }
//============================================================================= //================================================================================
/*! /*!
* List the relevant hypothesis associated to the shape. Relevant hypothesis * Return sub-shape to which hypotheses returned by GetUsedHypothesis() are assigned
* have a name (type) listed in the algorithm. Hypothesis associated to
* father shape -are not- taken into account (see GetUsedHypothesis)
*/ */
//============================================================================= //================================================================================
const list<const SMESHDS_Hypothesis *> & const std::list < TopoDS_Shape > & SMESH_Algo::GetAssignedShapes() const
SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary) const
{ {
SMESH_Algo* me = const_cast< SMESH_Algo* >( this ); return _assigedShapeList;
std::list<const SMESHDS_Hypothesis *> savedHyps; // don't delete the list if
savedHyps.swap( me->_appliedHypList ); // it does not change (#16578)
me->_appliedHypList.clear();
if ( const SMESH_HypoFilter* filter = GetCompatibleHypoFilter( ignoreAuxiliary ))
aMesh.GetHypotheses( aShape, *filter, me->_appliedHypList, false );
if ( _appliedHypList == savedHyps )
savedHyps.swap( me->_appliedHypList );
return _appliedHypList;
} }
//============================================================================= //=============================================================================

View File

@ -93,7 +93,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
bool IsCompatible( const Features& algo2 ) const; bool IsCompatible( const Features& algo2 ) const;
}; };
/*! /*!
* \brief Returns a structure describing algorithm features * \brief Return a structure describing algorithm features
*/ */
static const Features& GetFeatures( const std::string& algoType ); static const Features& GetFeatures( const std::string& algoType );
const Features& GetFeatures() const { return GetFeatures( _name ); } const Features& GetFeatures() const { return GetFeatures( _name ); }
@ -127,7 +127,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
virtual std::istream & LoadFrom(std::istream & load); virtual std::istream & LoadFrom(std::istream & load);
/*! /*!
* \brief Returns all types of compatible hypotheses * \brief Return all types of compatible hypotheses
*/ */
const std::vector < std::string > & GetCompatibleHypothesis(); const std::vector < std::string > & GetCompatibleHypothesis();
@ -196,7 +196,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
MapShapeNbElems& aResMap) = 0; MapShapeNbElems& aResMap) = 0;
/*! /*!
* \brief Returns a list of compatible hypotheses used to mesh a shape * \brief Return a list of compatible hypotheses used to mesh a shape
* \param aMesh - the mesh * \param aMesh - the mesh
* \param aShape - the shape * \param aShape - the shape
* \param ignoreAuxiliary - do not include auxiliary hypotheses in the list * \param ignoreAuxiliary - do not include auxiliary hypotheses in the list
@ -213,22 +213,11 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true) const; const bool ignoreAuxiliary=true) const;
/*! /*!
* \brief Returns a list of compatible hypotheses assigned to a shape in a mesh * \brief Return sub-shape to which hypotheses returned by GetUsedHypothesis() are assigned
* \param aMesh - the mesh
* \param aShape - the shape
* \param ignoreAuxiliary - do not include auxiliary hypotheses in the list
* \retval const std::list <const SMESHDS_Hypothesis*> - hypotheses list
*
* List the relevant hypothesis associated to the shape. Relevant hypothesis
* have a name (type) listed in the algorithm. Hypothesis associated to
* father shape -are not- taken into account (see GetUsedHypothesis)
*/ */
const std::list <const SMESHDS_Hypothesis *> & virtual const std::list < TopoDS_Shape > & GetAssignedShapes() const;
GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true) const;
/*! /*!
* \brief Returns the filter recognizing only compatible hypotheses * \brief Return the filter recognizing only compatible hypotheses
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
* \retval SMESH_HypoFilter* - the filter that can be NULL * \retval SMESH_HypoFilter* - the filter that can be NULL
*/ */
@ -442,8 +431,8 @@ protected:
const SMESH_HypoFilter * _compatibleAllHypFilter; const SMESH_HypoFilter * _compatibleAllHypFilter;
const SMESH_HypoFilter * _compatibleNoAuxHypFilter; const SMESH_HypoFilter * _compatibleNoAuxHypFilter;
std::vector<std::string> _compatibleHypothesis; std::vector<std::string> _compatibleHypothesis;
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
std::list<const SMESHDS_Hypothesis *> _usedHypList; std::list<const SMESHDS_Hypothesis *> _usedHypList;
std::list<TopoDS_Shape> _assigedShapeList; // _usedHypList assigned to
// Algo features influencing which Compute() and how is called: // Algo features influencing which Compute() and how is called:

View File

@ -201,7 +201,7 @@ SMESH_Algo* SMESH_subMesh::GetAlgo() const
if ( !_algo ) if ( !_algo )
{ {
SMESH_subMesh* me = const_cast< SMESH_subMesh* >( this ); SMESH_subMesh* me = const_cast< SMESH_subMesh* >( this );
me->_algo = _father->GetGen()->GetAlgo( me ); me->_algo = _father->GetGen()->GetAlgo( me, & me->_algoShape );
} }
return _algo; return _algo;
} }
@ -2120,8 +2120,9 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
return _subShape; return _subShape;
const bool skipAuxHyps = false; const bool skipAuxHyps = false;
list<const SMESHDS_Hypothesis*> aUsedHyp = list<const SMESHDS_Hypothesis*> usedHyps =
theAlgo->GetUsedHypothesis( *_father, _subShape, skipAuxHyps ); // copy theAlgo->GetUsedHypothesis( *_father, _subShape, skipAuxHyps ); // copy
std::list < TopoDS_Shape > assiShapes = theAlgo->GetAssignedShapes();
// put in a compound all shapes with the same hypothesis assigned // put in a compound all shapes with the same hypothesis assigned
// and a good ComputeState // and a good ComputeState
@ -2148,7 +2149,9 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
{ {
SMESH_Algo* anAlgo = subMesh->GetAlgo(); SMESH_Algo* anAlgo = subMesh->GetAlgo();
if (( anAlgo->IsSameName( *theAlgo )) && // same algo if (( anAlgo->IsSameName( *theAlgo )) && // same algo
( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == aUsedHyp )) // same hyps ( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == usedHyps ) && // same hyps
( anAlgo->GetAssignedShapes() == assiShapes ) && // on same sub-shapes
( _algoShape == subMesh->_algoShape ))
{ {
aBuilder.Add( aCompound, S ); aBuilder.Add( aCompound, S );
if ( !subMesh->SubMeshesComputed() ) if ( !subMesh->SubMeshesComputed() )

View File

@ -332,6 +332,7 @@ protected:
std::vector< SMESH_subMesh * > _ancestors; std::vector< SMESH_subMesh * > _ancestors;
SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call
TopoDS_Shape _algoShape; // shape the algorithm is assigned to
algo_state _algoState; algo_state _algoState;
compute_state _computeState; compute_state _computeState;
SMESH_ComputeErrorPtr _computeError; SMESH_ComputeErrorPtr _computeError;