Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Sandals.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco and Enrico Bertolazzi. *
3 * *
4 * The Sandals project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Enrico Bertolazzi *
7 * University of Trento University of Trento *
8 * e-mail: davide.stocco@unitn.it e-mail: enrico.bertolazzi@unitn.it *
9\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11#pragma once
12
13#ifndef INCLUDE_SANDALS_HH
14#define INCLUDE_SANDALS_HH
15
16// C++ standard libraries
17#include <iostream>
18#include <string>
19#include <cmath>
20#include <vector>
21#include <map>
22#include <memory>
23#include <chrono>
24
25// Eigen library
26#include <Eigen/Dense>
27
28// Optimist library
29#include <Optimist.hh>
30#include <Optimist/RootFinder/Newton.hh>
31
32// Print Sandals errors
33#ifndef SANDALS_ERROR
34#define SANDALS_ERROR(MSG) \
35 { \
36 std::ostringstream os; \
37 os << MSG; \
38 throw std::runtime_error(os.str()); \
39 }
40#endif
41
42// Assert for Sandals
43#ifndef SANDALS_ASSERT
44#define SANDALS_ASSERT(COND, MSG) \
45 if (!(COND)) \
46 { \
47 SANDALS_ERROR(MSG); \
48 }
49#endif
50
51// Warning for Sandals
52#ifndef SANDALS_WARNING
53#define SANDALS_WARNING(MSG) \
54 { \
55 std::cout << MSG << std::endl; \
56 }
57#endif
58
59// Warning assert for Sandals
60#ifndef SANDALS_ASSERT_WARNING
61#define SANDALS_ASSERT_WARNING(COND, MSG) \
62 if (!(COND)) \
63 { \
64 SANDALS_WARNING(MSG); \
65 }
66#endif
67
68// Define the basic constants for Sandals
69#ifndef SANDALS_BASIC_CONSTANTS
70#define SANDALS_BASIC_CONSTANTS(Real) \
71 static constexpr Real EPSILON{std::numeric_limits<Real>::epsilon()}; \
72 static constexpr Real EPSILON_HIGH{1.0e-12}; \
73 static constexpr Real EPSILON_MEDIUM{1.0e-10}; \
74 static constexpr Real EPSILON_LOW{1.0e-08}; \
75 static constexpr Real INFTY{std::numeric_limits<Real>::infinity()}; \
76 static constexpr Real QUIET_NAN{std::numeric_limits<Real>::quiet_NaN()};
77#endif
78
79#ifndef SANDALS_DEFAULT_INTEGER_TYPE
80#define SANDALS_DEFAULT_INTEGER_TYPE int
81#endif
82
88namespace Sandals
89{
90
98
99} // namespace Sandals
100
101#endif // INCLUDE_SANDALS_HH
#define SANDALS_DEFAULT_INTEGER_TYPE
Definition Sandals.hh:80
The namespace for the Sandals library.
Definition Sandals.hh:89
SANDALS_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Sandals.hh:97