//#define PRINT_WHO_COMPUTE_WHAT
#endif
+//#define PRINT_WHO_COMPUTE_WHAT
//=============================================================================
/*!
* \brief Allocate some memory at construction and release it at destruction.
TopExp_Explorer exp( _subShape, (TopAbs_ShapeEnum) type );
for ( ; exp.More(); exp.Next() )
{
- if ( SMESHDS_SubMesh * smDS = meshDS->MeshElements( exp.Current() ))
+ if ( SMESHDS_SubMesh * smDS = meshDS->MeshElements( exp.Current() ) )
{
bool computed = (dim > 0) ? smDS->NbElements() : smDS->NbNodes();
if ( computed )
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();
ASSERT(algo);
- ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
+ if(!_father->IsParallel())
+ ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
+ else
+ ret = true;
if (!ret)
{
MESSAGE("***** verify compute state *****");
break;
}
TopoDS_Shape shape = _subShape;
- algo->SubMeshesToCompute().assign( 1, this );
+ if(!_father->IsParallel())
+ algo->SubMeshesToCompute().assign( 1, this );
// check submeshes needed
- if (_father->HasShapeToMesh() ) {
+ // In parallel there would be no submesh to check
+ if (_father->HasShapeToMesh() && !_father->IsParallel()) {
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
}
else
{
- std::cout<<"Running compute for " << _father << " of shape type " << shape.ShapeType() << std::endl;
+ // TODO: Do switch of compute here instead of within algo
ret = algo->Compute((*_father), shape);
}
// algo can set _computeError of submesh
#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();
+ if(!_father->IsParallel())
+ algo->CheckHypothesis((*_father), _subShape, hyp_status);
}
break;
case COMPUTE_CANCELED: // nothing to do