VTK-m  2.0
ErrorCode.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_exec_ErrorCode_h
11 #define vtk_m_exec_ErrorCode_h
12 
13 #include <lcl/ErrorCode.h>
14 
16 namespace vtkm
17 {
18 
19 enum class ErrorCode
20 {
21  Success,
35 
37 };
38 
40 inline const char* ErrorString(vtkm::ErrorCode code) noexcept
41 {
42  switch (code)
43  {
45  return "Success";
47  return "Invalid shape id";
49  return "Invalid number of points";
51  return "Invalid cell metric";
53  return "Wrong shape id for tag type";
55  return "Invalid point id";
57  return "Invalid edge id";
59  return "Invalid face id";
61  return "Solution did not converge";
63  return "Matrix factorization failed";
65  return "Degenerate cell detected";
67  return "Malformed cell detected";
69  return "Operation on empty cell";
71  return "Cell not found";
73  return "Unknown error";
74  }
75 
76  return "Invalid error";
77 }
78 
79 namespace internal
80 {
81 
82 VTKM_EXEC_CONT inline vtkm::ErrorCode LclErrorToVtkmError(lcl::ErrorCode code) noexcept
83 {
84  switch (code)
85  {
86  case lcl::ErrorCode::SUCCESS:
88  case lcl::ErrorCode::INVALID_SHAPE_ID:
90  case lcl::ErrorCode::INVALID_NUMBER_OF_POINTS:
92  case lcl::ErrorCode::WRONG_SHAPE_ID_FOR_TAG_TYPE:
94  case lcl::ErrorCode::INVALID_POINT_ID:
96  case lcl::ErrorCode::SOLUTION_DID_NOT_CONVERGE:
98  case lcl::ErrorCode::MATRIX_LUP_FACTORIZATION_FAILED:
100  case lcl::ErrorCode::DEGENERATE_CELL_DETECTED:
102  }
103 
105 }
106 
107 } // namespace internal
108 
109 } // namespace vtkm
110 
111 #define VTKM_RETURN_ON_ERROR(call) \
112  do \
113  { \
114  auto status = (call); \
115  if (status != ::vtkm::ErrorCode::Success) \
116  { \
117  return status; \
118  } \
119  } while (false)
120 
121 #endif //vtk_m_exec_ErrorCode_h
vtkm::ErrorCode
ErrorCode
Definition: ErrorCode.h:19
vtkm::ErrorCode::WrongShapeIdForTagType
@ WrongShapeIdForTagType
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::ErrorCode::UnknownError
@ UnknownError
vtkm::ErrorCode::DegenerateCellDetected
@ DegenerateCellDetected
vtkm::ErrorCode::Success
@ Success
vtkm::ErrorCode::MatrixFactorizationFailed
@ MatrixFactorizationFailed
vtkm::ErrorCode::MalformedCellDetected
@ MalformedCellDetected
vtkm::ErrorCode::InvalidEdgeId
@ InvalidEdgeId
vtkm::ErrorCode::InvalidFaceId
@ InvalidFaceId
ExportMacros.h
vtkm::ErrorCode::InvalidCellMetric
@ InvalidCellMetric
vtkm::ErrorCode::InvalidPointId
@ InvalidPointId
vtkm::ErrorCode::CellNotFound
@ CellNotFound
vtkm::ErrorCode::OperationOnEmptyCell
@ OperationOnEmptyCell
vtkm::ErrorCode::SolutionDidNotConverge
@ SolutionDidNotConverge
vtkm::ErrorString
const VTKM_EXEC_CONT char * ErrorString(vtkm::ErrorCode code) noexcept
Definition: ErrorCode.h:40
vtkm::ErrorCode::InvalidNumberOfPoints
@ InvalidNumberOfPoints
vtkm::ErrorCode::InvalidShapeId
@ InvalidShapeId