MoCSI API Reference
Loading...
Searching...
No Matches
CoreEnums.h
Go to the documentation of this file.
1#ifndef CORE_ENUMS_H
2#define CORE_ENUMS_H
3
4#include <stdexcept>
5#include <string>
6
7enum class Dimension
8{
9 OneD,
10 TwoD,
11 ThreeD,
12};
13
14constexpr Dimension setDimension(const std::string& dimension)
15{
16 if (dimension == "1D")
17 {
18 return Dimension::OneD;
19 }
20 if (dimension == "2D")
21 {
22 return Dimension::TwoD;
23 }
24 if (dimension == "3D")
25 {
26 return Dimension::ThreeD;
27 }
28 throw std::runtime_error(
29 "Unrecognized dimension. Please select \"1D\", \"2D\" or \"3D\" as dimension.");
30}
31
32enum class MatrixType
33{
34 Dense,
35 Csr
36};
37
38constexpr MatrixType setMatrixType(const std::string& type)
39{
40 if (type == "dense" || type == "Dense")
41 {
42 return MatrixType::Dense;
43 }
44 if (type == "csr" || type == "Csr")
45 {
46 return MatrixType::Csr;
47 }
48 throw std::runtime_error("Unknown matrix type: " + type
49 + "Please select \"Dense\" or \"Csr\".");
50}
51
52#endif
constexpr MatrixType setMatrixType(const std::string &type)
Definition CoreEnums.h:38
MatrixType
Definition CoreEnums.h:33
Dimension
Definition CoreEnums.h:8
constexpr Dimension setDimension(const std::string &dimension)
Definition CoreEnums.h:14
Error class to throw when a module chain has circular or missing dependencies. Inherits from std::exc...
Definition ChainManager.h:28