Version: 9.16.0
SMESH_ComputeError.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File : SMESH_ComputeError.hxx
21// Author : Edward AGAPOV (eap)
22// Module : SMESH
23//
24#ifndef SMESH_ComputeError_HeaderFile
25#define SMESH_ComputeError_HeaderFile
26
27#include "SMESH_Utils.hxx"
29
30#include <string>
31#include <list>
32#include <boost/shared_ptr.hpp>
33
34class SMESH_Algo;
37
38typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
39
40// =============================================================
41
43{
44 // If you modify it, pls update SMESH_ComputeError::CommonName() below.
45 // Positive values are for algo specific errors
60 // Errors of SMESH_MeshEditor follow
61 EDITERR_NO_MEDIUM_ON_GEOM= -101 /* during conversion to quadratic,
62 some medium nodes not placed on geometry
63 to avoid distorting elements, which are
64 stored in SMESH_ComputeError::myBadElements */
65};
66
67// =============================================================
71// =============================================================
72
74{
75 int myName;
76 std::string myComment;
78
80 std::string comment = "",
81 const SMESH_Algo* algo = 0)
82 { return SMESH_ComputeErrorPtr( new SMESH_ComputeError( error, comment, algo )); }
83
85 std::string comment = "",
86 const SMESH_Algo* algo = 0)
87 : myName(error), myComment(comment), myAlgo(algo) {}
88
89 bool IsOK() const { return myName == COMPERR_OK; }
90 bool IsKO() const { return myName != COMPERR_OK && myName != COMPERR_WARNING; }
91 bool IsCommon() const { return myName < 0 && myName > COMPERR_LAST_ALGO_ERROR; }
92 virtual bool HasBadElems() const { return false; }
93
94 // not inline methods are implemented in src/SMESHUtils/SMESH_TryCatch.cxx
95
96 // Return myName as text, to be used to dump errors in terminal
97 std::string CommonName() const;
98
99 // Return the most severe error
102
104};
105
107{
108 typedef std::list<const SMDS_MeshElement*> TElemList;
110
112 int error = COMPERR_OK,
113 std::string comment = "",
114 const SMESH_Algo* algo = 0)
115 :SMESH_ComputeError(error, comment ,algo), SMDS_ElementHolder(mesh) {}
116
117 const SMDS_Mesh* GetMesh() const { return myMesh; }
118 const TElemList& GetElements() { return myBadElements; }
119
120 virtual bool HasBadElems() const { return !myBadElements.empty(); }
121
122 // methods of SMDS_ElementHolder
123 virtual SMDS_ElemIteratorPtr getElements();
124 virtual void tmpClear();
125 virtual void add( const SMDS_MeshElement* element );
126 virtual void compact() { }
127};
128
129#endif
boost::shared_ptr< SMDS_Iterator< const SMDS_MeshElement * > > SMDS_ElemIteratorPtr
Definition: SMDS_ElemIterator.hxx:43
SMESH_ComputeErrorName
Definition: SMESH_ComputeError.hxx:43
@ COMPERR_LAST_ALGO_ERROR
terminator of mesh computation errors
Definition: SMESH_ComputeError.hxx:59
@ COMPERR_CANCELED
compute canceled
Definition: SMESH_ComputeError.hxx:56
@ COMPERR_NO_MESH_ON_SHAPE
no mesh elements assigned to sub-shape
Definition: SMESH_ComputeError.hxx:57
@ COMPERR_WARNING
algo reports error but sub-mesh is computed anyway
Definition: SMESH_ComputeError.hxx:55
@ COMPERR_BAD_SHAPE
bad geometry
Definition: SMESH_ComputeError.hxx:54
@ COMPERR_SLM_EXCEPTION
SALOME exception raised.
Definition: SMESH_ComputeError.hxx:50
@ COMPERR_MEMORY_PB
std::bad_alloc exception
Definition: SMESH_ComputeError.hxx:52
@ EDITERR_NO_MEDIUM_ON_GEOM
Definition: SMESH_ComputeError.hxx:61
@ COMPERR_BAD_INPUT_MESH
wrong mesh on lower submesh
Definition: SMESH_ComputeError.hxx:47
@ COMPERR_EXCEPTION
other exception raised
Definition: SMESH_ComputeError.hxx:51
@ COMPERR_OK
Definition: SMESH_ComputeError.hxx:46
@ COMPERR_ALGO_FAILED
algo failed for some reason
Definition: SMESH_ComputeError.hxx:53
@ COMPERR_BAD_PARMETERS
incorrect hypotheses parameters
Definition: SMESH_ComputeError.hxx:58
@ COMPERR_OCC_EXCEPTION
OCC exception raised.
Definition: SMESH_ComputeError.hxx:49
@ COMPERR_STD_EXCEPTION
some std exception raised
Definition: SMESH_ComputeError.hxx:48
boost::shared_ptr< SMESH_ComputeError > SMESH_ComputeErrorPtr
Definition: SMESH_ComputeError.hxx:38
#define SMESHUtils_EXPORT
Definition: SMESH_Utils.hxx:37
Base class of object holding SMDS_MeshElement pointers.
Definition: SMDS_ElementHolder.hxx:48
Base class for elements.
Definition: SMDS_MeshElement.hxx:56
Definition: SMDS_Mesh.hxx:53
Root of all algorithms.
Definition: SMESH_Algo.hxx:79
Definition: SMESH_ComputeError.hxx:107
TElemList myBadElements
to explain COMPERR_BAD_INPUT_MESH
Definition: SMESH_ComputeError.hxx:109
const SMDS_Mesh * GetMesh() const
Definition: SMESH_ComputeError.hxx:117
virtual bool HasBadElems() const
Definition: SMESH_ComputeError.hxx:120
std::list< const SMDS_MeshElement * > TElemList
Definition: SMESH_ComputeError.hxx:108
const TElemList & GetElements()
Definition: SMESH_ComputeError.hxx:118
virtual void compact()
allow the descendant treat its elements before mesh clearing
Definition: SMESH_ComputeError.hxx:126
SMESH_BadInputElements(const SMDS_Mesh *mesh, int error=COMPERR_OK, std::string comment="", const SMESH_Algo *algo=0)
Definition: SMESH_ComputeError.hxx:111
Contains an algorithm and description of an occurred error.
Definition: SMESH_ComputeError.hxx:74
SMESH_ComputeError(int error=COMPERR_OK, std::string comment="", const SMESH_Algo *algo=0)
Definition: SMESH_ComputeError.hxx:84
const SMESH_Algo * myAlgo
Definition: SMESH_ComputeError.hxx:77
bool IsOK() const
Definition: SMESH_ComputeError.hxx:89
bool IsKO() const
Definition: SMESH_ComputeError.hxx:90
static SMESH_ComputeErrorPtr New(int error=COMPERR_OK, std::string comment="", const SMESH_Algo *algo=0)
Definition: SMESH_ComputeError.hxx:79
virtual ~SMESH_ComputeError()
Definition: SMESH_ComputeError.hxx:103
virtual bool HasBadElems() const
Definition: SMESH_ComputeError.hxx:92
int myName
SMESH_ComputeErrorName or anything algo specific.
Definition: SMESH_ComputeError.hxx:75
bool IsCommon() const
Definition: SMESH_ComputeError.hxx:91
std::string myComment
Definition: SMESH_ComputeError.hxx:76