if ( _usedHypList == savedHyps )
savedHyps.swap( me->_usedHypList );
+ for(auto hyp:_usedHypList){
+ std::cout << hyp << std::endl;
+ }
return _usedHypList;
}
std::cout << "Waiting" << std::endl;
it->wait();
}
+ cout << "Number of segments: " << aMesh.NbEdges() << endl;
//Resetting threaded pool info
previousShapeType = shapeType;
pending.clear();
//#define PRINT_WHO_COMPUTE_WHAT
#endif
+#define PRINT_WHO_COMPUTE_WHAT
//=============================================================================
/*!
* \brief Allocate some memory at construction and release it at destruction.
return _algo;
}
+//================================================================================
+/*!
+ * \brief Returns a current algorithm
+ */
+//================================================================================
+
+SMESH_Algo* SMESH_subMesh::CopyAlgo() const
+{
+ //SMESH_Algo* algo = (SMESH_Algo*) new StdMeshers_Regular_1D(666, _father->GetGent());
+ SMESH_Algo* algo;
+
+ return algo;
+}
+
//================================================================================
/*!
* \brief Allow algo->Compute() if a sub-shape of lower dim is meshed but
else if (( event == COMPUTE || event == COMPUTE_SUBMESH )
&& !_alwaysComputed )
{
+ // LOCK: Adding node to mesh
_father->Lock();
const TopoDS_Vertex & V = TopoDS::Vertex( _subShape );
gp_Pnt P = BRep_Tool::Pnt(V);
_computeState = COMPUTE_OK;
}
_father->Unlock();
+ // UNLOCK
}
if ( event == MODIF_ALGO_STATE )
cleanDependants();
case COMPUTE:
case COMPUTE_SUBMESH:
{
- _father->Lock();
algo = GetAlgo();
+ SMESH_Algo* algo2 = CopyAlgo();
+ cout << "Algo2" << algo2;
ASSERT(algo);
- ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
+ //_father->Lock();
+ //ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
+ //_father->Unlock();
if (!ret)
{
MESSAGE("***** verify compute state *****");
TopoDS_Shape shape = _subShape;
algo->SubMeshesToCompute().assign( 1, this );
// check submeshes needed
- if (_father->HasShapeToMesh() ) {
+ // Forcing to false for parallel run
+ // TODO: Remove forced false
+ if (_father->HasShapeToMesh() && false) {
bool subComputed = false, subFailed = false;
if (!algo->OnlyUnaryInput()) {
// --- commented for bos#22320 to compute all sub-shapes at once if possible;
break; // goto exit
}
}
- _father->Unlock();
// Compute
// to restore cout that may be redirected by algo
#ifdef PRINT_WHO_COMPUTE_WHAT
for (subS.ReInit(); subS.More(); subS.Next())
{
- const std::list <const SMESHDS_Hypothesis *> & hyps =
+ _father->Lock();
+ const std::list <const SMESHDS_Hypothesis *> hyps =
_algo->GetUsedHypothesis( *_father, _subShape );
+ _father->Unlock();
SMESH_Comment hypStr;
if ( !hyps.empty() )
{
updateDependantsState( SUBMESH_COMPUTED );
}
// let algo clear its data gathered while algo->Compute()
- _father->Lock();
- algo->CheckHypothesis((*_father), _subShape, hyp_status);
- _father->Unlock();
+ //_father->Lock();
+ //algo->CheckHypothesis((*_father), _subShape, hyp_status);
+ //_father->Unlock();
}
break;
case COMPUTE_CANCELED: // nothing to do
return _subShape;
const bool skipAuxHyps = false;
+ _father->Lock();
list<const SMESHDS_Hypothesis*> usedHyps =
theAlgo->GetUsedHypothesis( *_father, _subShape, skipAuxHyps ); // copy
+ _father->Lock();
std::list < TopoDS_Shape > assiShapes = theAlgo->GetAssignedShapes();
// put in a compound all shapes with the same hypothesis assigned
}
else if ( subMesh->GetComputeState() == READY_TO_COMPUTE )
{
+ _father->Lock();
SMESH_Algo* anAlgo = subMesh->GetAlgo();
if (( anAlgo->IsSameName( *theAlgo )) && // same algo
( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == usedHyps ) && // same hyps
theSubComputed = false;
theSubs.push_back( subMesh );
}
+ _father->Unlock();
}
}
int GetId() const; // == meshDS->ShapeToIndex( aSubShape )
SMESH_Mesh* GetFather() { return _father; }
-
+
SMESHDS_SubMesh * GetSubMeshDS();
const SMESHDS_SubMesh * GetSubMeshDS() const;
SMESH_subMesh *GetFirstToCompute();
SMESH_Algo* GetAlgo() const;
+ SMESH_Algo* CopyAlgo() const;
const std::map < int, SMESH_subMesh * >& DependsOn();
bool DependsOn( const SMESH_subMesh* other ) const;
};
// ==================================================================
- // Members to track non hierarchical dependencies between sub-meshes
+ // Members to track non hierarchical dependencies between sub-meshes
// ==================================================================
/*!
* \param listener - the listener to store
* \param data - the listener data to store
* \param where - the submesh to store the listener and it's data
- *
+ *
* The method remembers the submesh \awhere it puts the listener in order to delete
* it when HYP_OK algo_state is lost
* After being set, event listener is notified on each event of \awhere submesh.
* \brief Sets an event listener and its data to a submesh
* \param listener - the listener to store
* \param data - the listener data to store
- *
+ *
* After being set, event listener is notified on each event of a submesh.
*/
void setEventListener(EventListener* listener, EventListenerData* data);
bool IsApplicableHypothesis(const SMESH_Hypothesis* theHypothesis) const;
// return true if theHypothesis can be used to mesh me:
// its shape type is checked
-
+
SMESH_Hypothesis::Hypothesis_Status CheckConcurrentHypothesis (const int theHypType);
// check if there are several applicable hypothesis on fathers
int GetComputeCost() const;
// how costly is to compute this sub-mesh
-
+
/*!
* \brief Find common submeshes (based on shared subshapes with other
* \param theOther submesh to check
/*!
* \brief Return a hypothesis attached to theShape.
- *
+ *
* If theHyp is provided, similar but not same hypotheses
* is returned; else an applicable ones having theHypType
* is returned
const SMESH_Hypothesis* getSimilarAttached(const TopoDS_Shape& theShape,
const SMESH_Hypothesis * theHyp,
const int theHypType = 0);
- //
+ //
int computeCost() const;
protected:
_onlyUnaryInput = true;
// check propagation in a redefined GetUsedHypothesis()
- const list <const SMESHDS_Hypothesis * > & hyps =
+ const list <const SMESHDS_Hypothesis * > hyps =
GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false);
-
const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter();
// find non-auxiliary hypothesis
const SMESHDS_Hypothesis *theHyp = 0;
set< string > propagTypes;
+ std::cout << "For shape " << aShape.HashCode(1) << " of type "<< aShape.ShapeType() <<
+ "CheckHypothesis" << std::endl;
+ for(auto hyp:hyps){
+ SMESH_Comment hypStr;
+ hypStr << hyp << " " << hyp->GetName() << " ";
+ ((SMESHDS_Hypothesis*)hyp)->SaveTo( hypStr.Stream() );
+ hypStr << " ";
+ std::cout << hypStr << std::endl;
+ }
list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
for ( ; h != hyps.end(); ++h ) {
if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) {
{
// Number Of Segments hypothesis
nbSegments = _ivalue[ NB_SEGMENTS_IND ];
- if ( nbSegments < 1 ) return false;
- if ( nbSegments == 1 ) return true;
+ if ( nbSegments < 1 ) {
+ return false;
+ }
+ if ( nbSegments == 1 ) {
+ return true;
+ }
switch (_ivalue[ DISTR_TYPE_IND ])
{
bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
{
- if ( _hypType == NONE )
- return false;
+ SMESH_Hypothesis::Hypothesis_Status hyp_status;
+ theMesh.Lock();
+ bool ret = this->CheckHypothesis(theMesh, theShape, hyp_status);
+ int hypType = _hypType;
+ theMesh.Unlock();
- if ( _hypType == ADAPTIVE )
+ if ( hypType == NONE )
+ return false;
+
+ if ( hypType == ADAPTIVE )
{
_adaptiveHyp->GetAlgo()->InitComputeError();
_adaptiveHyp->GetAlgo()->Compute( theMesh, theShape );
SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
theMesh.Lock();
+
const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
int shapeID = meshDS->ShapeToIndex( E );
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if ( !nFirst || !nLast ){
theMesh.Unlock();
+ std::cout << "exit no node" << std::endl;
return error( COMPERR_BAD_INPUT_MESH, "No node on vertex");
}
// remove elements created by e.g. pattern mapping (PAL21999)
// take into account reversing the edge the hypothesis is propagated from
// (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain)
reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
- if ( _hypType != DISTRIB_PROPAGATION ) {
+ if ( hypType != DISTRIB_PROPAGATION ) {
int mainID = meshDS->ShapeToIndex(_mainEdge);
if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end())
reversed = !reversed;
BRepAdaptor_Curve C3d( E );
if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
theMesh.Unlock();
+ std::cout << "exit Compute internal failed" << std::endl;
+
return false;
}
redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
}
}
theMesh.Unlock();
+ std::cout << "exit normal" << std::endl;
+
return true;
}