Viskores  1.0
ErrorCode.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_exec_ErrorCode_h
19 #define viskores_exec_ErrorCode_h
20 
21 #include <lcl/ErrorCode.h>
22 
24 namespace viskores
25 {
26 
36 enum class ErrorCode
37 {
38  // Documentation is below (for better layout in generated documents).
39  Success,
53 
55 };
56 
63 
68 
74 
77 
80 
83 
86 
89 
96 
102 
111 
119 
127 
133 
139 inline const char* ErrorString(viskores::ErrorCode code) noexcept
140 {
141  switch (code)
142  {
144  return "Success";
146  return "Invalid shape id";
148  return "Invalid number of points";
150  return "Invalid cell metric";
152  return "Wrong shape id for tag type";
154  return "Invalid point id";
156  return "Invalid edge id";
158  return "Invalid face id";
160  return "Solution did not converge";
162  return "Matrix factorization failed";
164  return "Degenerate cell detected";
166  return "Malformed cell detected";
168  return "Operation on empty cell";
170  return "Cell not found";
172  return "Unknown error";
173  }
174 
175  return "Invalid error";
176 }
177 
178 namespace internal
179 {
180 
181 VISKORES_EXEC_CONT inline viskores::ErrorCode LclErrorToViskoresError(lcl::ErrorCode code) noexcept
182 {
183  switch (code)
184  {
185  case lcl::ErrorCode::SUCCESS:
187  case lcl::ErrorCode::INVALID_SHAPE_ID:
189  case lcl::ErrorCode::INVALID_NUMBER_OF_POINTS:
191  case lcl::ErrorCode::WRONG_SHAPE_ID_FOR_TAG_TYPE:
193  case lcl::ErrorCode::INVALID_POINT_ID:
195  case lcl::ErrorCode::SOLUTION_DID_NOT_CONVERGE:
197  case lcl::ErrorCode::MATRIX_LUP_FACTORIZATION_FAILED:
199  case lcl::ErrorCode::DEGENERATE_CELL_DETECTED:
201  }
202 
204 }
205 
206 } // namespace internal
207 
208 } // namespace viskores
209 
210 #define VISKORES_RETURN_ON_ERROR(call) \
211  do \
212  { \
213  auto status = (call); \
214  if (status != ::viskores::ErrorCode::Success) \
215  { \
216  return status; \
217  } \
218  } while (false)
219 
220 #endif //viskores_exec_ErrorCode_h
viskores::ErrorCode::InvalidFaceId
@ InvalidFaceId
A bad face identifier was detected while operating on a cell.
viskores::ErrorCode::MalformedCellDetected
@ MalformedCellDetected
An operation detected on a malformed cell.
viskores::ErrorCode::InvalidCellMetric
@ InvalidCellMetric
A cell metric was requested for a cell that does not support that metric.
viskores::ErrorCode
ErrorCode
Identifies whether an operation was successful or what type of error it had.
Definition: ErrorCode.h:36
viskores::ErrorCode::InvalidEdgeId
@ InvalidEdgeId
A bad edge identifier was detected while operating on a cell.
viskores::ErrorCode::InvalidNumberOfPoints
@ InvalidNumberOfPoints
The wrong number of points was provided for a given cell type.
viskores::ErrorCode::InvalidPointId
@ InvalidPointId
A bad point identifier was detected while operating on a cell.
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::ErrorCode::InvalidShapeId
@ InvalidShapeId
A unknown shape identifier was encountered.
viskores::ErrorCode::MatrixFactorizationFailed
@ MatrixFactorizationFailed
A solution was not found for a linear system.
viskores::ErrorString
const char * ErrorString(viskores::ErrorCode code) noexcept
Convert a viskores::ErrorCode into a human-readable string.
Definition: ErrorCode.h:139
ExportMacros.h
viskores::ErrorCode::WrongShapeIdForTagType
@ WrongShapeIdForTagType
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::ErrorCode::DegenerateCellDetected
@ DegenerateCellDetected
An operation detected a degenerate cell.
viskores::ErrorCode::OperationOnEmptyCell
@ OperationOnEmptyCell
An operation was attempted on a cell with an empty shape.
viskores::ErrorCode::SolutionDidNotConverge
@ SolutionDidNotConverge
An iterative operation did not find an appropriate solution.
viskores::ErrorCode::CellNotFound
@ CellNotFound
A cell matching some given criteria could not be found.
viskores::ErrorCode::Success
@ Success
A successful operation.
viskores::ErrorCode::UnknownError
@ UnknownError