+ algo->InitComputeError();
+ MemoryReserve aMemoryReserve;
+ SMDS_Mesh::CheckMemory();
+ if ( !_father->HasShapeToMesh() ) // no shape
+ {
+ SMESH_MesherHelper helper( *_father );
+ helper.SetSubShape( shape );
+ helper.SetElementsOnShape( true );
+ ret = algo->Compute(*_father, &helper );
+ }
+ else
+ {
+ if (!algo->OnlyUnaryInput()) {
+ shape = GetCollection( gen, algo );
+ }
+ ret = algo->Compute((*_father), shape);
+ }
+ if ( !ret )
+ _computeError = algo->GetComputeError();
+ }
+ catch ( std::bad_alloc& exc ) {
+ printf("std::bad_alloc thrown inside algo->Compute()\n");
+ if ( _computeError ) {
+ _computeError->myName = COMPERR_MEMORY_PB;
+ //_computeError->myComment = exc.what();
+ }
+ cleanSubMesh( this );
+ throw exc;
+ }
+ catch ( Standard_OutOfMemory& exc ) {
+ printf("Standard_OutOfMemory thrown inside algo->Compute()\n");
+ if ( _computeError ) {
+ _computeError->myName = COMPERR_MEMORY_PB;
+ //_computeError->myComment = exc.what();
+ }
+ cleanSubMesh( this );
+ throw std::bad_alloc();
+ }
+ catch (Standard_Failure& ex) {
+ if ( !_computeError ) _computeError = SMESH_ComputeError::New();
+ _computeError->myName = COMPERR_OCC_EXCEPTION;
+ _computeError->myComment += ex.DynamicType()->Name();
+ if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) {
+ _computeError->myComment += ": ";
+ _computeError->myComment += ex.GetMessageString();
+ }
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ if ( !_computeError ) _computeError = SMESH_ComputeError::New();
+ _computeError->myName = COMPERR_SLM_EXCEPTION;
+ _computeError->myComment = S_ex.what();
+ }
+ catch ( std::exception& exc ) {
+ if ( !_computeError ) _computeError = SMESH_ComputeError::New();
+ _computeError->myName = COMPERR_STD_EXCEPTION;
+ _computeError->myComment = exc.what();
+ }
+ catch ( ... ) {
+ if ( _computeError )
+ _computeError->myName = COMPERR_EXCEPTION;
+ else
+ ret = false;
+ }
+ if (ret && !_alwaysComputed) { // check if anything was built
+ ret = ( GetSubMeshDS() && ( GetSubMeshDS()->NbElements() || GetSubMeshDS()->NbNodes() ));
+ }
+ bool isComputeErrorSet = !CheckComputeError( algo, shape );
+ if (!ret && !isComputeErrorSet)