mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50:34 +05:00
[SALOME platform 0019316]: Need to have a better interface with GHS3D diagnostics
store bad input elements and nodes
This commit is contained in:
parent
b4aed9ff1c
commit
58f17329c5
@ -502,6 +502,7 @@ bool SMESH_Algo::error(SMESH_ComputeErrorPtr error)
|
||||
if ( error ) {
|
||||
_error = error->myName;
|
||||
_comment = error->myComment;
|
||||
_badInputElements = error->myBadElements;
|
||||
return error->IsOK();
|
||||
}
|
||||
return true;
|
||||
@ -515,7 +516,11 @@ bool SMESH_Algo::error(SMESH_ComputeErrorPtr error)
|
||||
|
||||
SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const
|
||||
{
|
||||
return SMESH_ComputeError::New( _error, _comment, this );
|
||||
SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( _error, _comment, this );
|
||||
// hope this method is called by only SMESH_subMesh after this->Compute()
|
||||
err->myBadElements.splice( err->myBadElements.end(),
|
||||
(list<const SMDS_MeshElement*>&) _badInputElements );
|
||||
return err;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -528,5 +533,23 @@ void SMESH_Algo::InitComputeError()
|
||||
{
|
||||
_error = COMPERR_OK;
|
||||
_comment.clear();
|
||||
list<const SMDS_MeshElement*>::iterator elem = _badInputElements.begin();
|
||||
for ( ; elem != _badInputElements.end(); ++elem )
|
||||
if ( (*elem)->GetID() < 1 )
|
||||
delete *elem;
|
||||
_badInputElements.clear();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief store a bad input element preventing computation,
|
||||
* which may be a temporary one i.e. not residing the mesh,
|
||||
* then it will be deleted by InitComputeError()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem)
|
||||
{
|
||||
if ( elem )
|
||||
_badInputElements.push_back( elem );
|
||||
}
|
||||
|
@ -293,6 +293,12 @@ protected:
|
||||
* \brief store error and return error->IsOK()
|
||||
*/
|
||||
bool error(SMESH_ComputeErrorPtr error);
|
||||
/*!
|
||||
* \brief store a bad input element preventing computation,
|
||||
* which may be a temporary one i.e. not residing the mesh,
|
||||
* then it will be deleted by InitComputeError()
|
||||
*/
|
||||
void addBadInputElement(const SMDS_MeshElement* elem);
|
||||
|
||||
protected:
|
||||
|
||||
@ -310,6 +316,7 @@ protected:
|
||||
|
||||
int _error; //!< SMESH_ComputeErrorName or anything algo specific
|
||||
std::string _comment; //!< any text explaining what is wrong in Compute()
|
||||
std::list<const SMDS_MeshElement*> _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,9 +30,11 @@
|
||||
#define SMESH_ComputeError_HeaderFile
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class SMESH_Algo;
|
||||
class SMDS_MeshElement;
|
||||
struct SMESH_ComputeError;
|
||||
|
||||
typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
|
||||
@ -66,6 +68,8 @@ struct SMESH_ComputeError
|
||||
std::string myComment;
|
||||
const SMESH_Algo* myAlgo;
|
||||
|
||||
std::list<const SMDS_MeshElement*> myBadElements; //!< to explain COMPERR_BAD_INPUT_MESH
|
||||
|
||||
static SMESH_ComputeErrorPtr New( int error = COMPERR_OK,
|
||||
std::string comment = "",
|
||||
const SMESH_Algo* algo = 0)
|
||||
@ -82,19 +86,19 @@ struct SMESH_ComputeError
|
||||
|
||||
};
|
||||
|
||||
#define case2char(err) case err: return #err;
|
||||
#define _case2char(err) case err: return #err;
|
||||
|
||||
std::string SMESH_ComputeError::CommonName() const
|
||||
{
|
||||
switch( myName ) {
|
||||
case2char(COMPERR_OK );
|
||||
case2char(COMPERR_BAD_INPUT_MESH);
|
||||
case2char(COMPERR_STD_EXCEPTION );
|
||||
case2char(COMPERR_OCC_EXCEPTION );
|
||||
case2char(COMPERR_SLM_EXCEPTION );
|
||||
case2char(COMPERR_EXCEPTION );
|
||||
case2char(COMPERR_MEMORY_PB );
|
||||
case2char(COMPERR_ALGO_FAILED );
|
||||
_case2char(COMPERR_OK );
|
||||
_case2char(COMPERR_BAD_INPUT_MESH);
|
||||
_case2char(COMPERR_STD_EXCEPTION );
|
||||
_case2char(COMPERR_OCC_EXCEPTION );
|
||||
_case2char(COMPERR_SLM_EXCEPTION );
|
||||
_case2char(COMPERR_EXCEPTION );
|
||||
_case2char(COMPERR_MEMORY_PB );
|
||||
_case2char(COMPERR_ALGO_FAILED );
|
||||
default:;
|
||||
}
|
||||
return "";
|
||||
|
Loading…
Reference in New Issue
Block a user