forked from NIVANorge/Mobius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobius.h
81 lines (62 loc) · 2.43 KB
/
mobius.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//NOTE: This is designed to be built as a unity build, i.e. in only a single compilation unit.
/*
TODOs:
- PrintPartialDependencyTrace gives incorrect information sometimes about what equation is involved when a solver is the one having a dependency.
- Better encapsulation of the value_set_accessor subsystem. Unify lookup systems for parameters, inputs, results, last_results
- Have to figure out if the initial value equation system we have currently is good.
- Clean up the input tokenizer. Maybe just use fscanf for reading numbers, but it is actually a little complicated since we have to figure out the type in any case.
- Remove units as model entities entirely and only store / input them as strings? They seem like an unnecessary step right now.
- Manage the memory for all the data in the equation batch structure in such a way that it is aligned with how it will be read. (will have to not use std::vector in that case...)
- (Even more) convenience accessors for the DataSet so that io and application code does not have to understand the inner structure of the DataSet that much.
- Should entity handles contain their entity type in the upper bits?? May simplify entity system somewhat.
*/
#if !defined(MOBIUS_H)
#include <stdint.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <iostream>
#include <fstream>
#include <string.h>
#include <assert.h>
#include <float.h>
#include <cmath>
#include <sstream>
#include <iomanip>
//TODO: Does this intrinsic header exist for all compilers? We only use it for __rdtsc();
#include <x86intrin.h>
typedef uint64_t u64;
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
typedef int64_t s64;
typedef int32_t s32;
typedef int16_t s16;
typedef int8_t s8;
//NOTE: We allow the error handling to be replaced by the application. This is for instance useful for the python wrapper.
#if !defined(MOBIUS_PARTIAL_ERROR)
#define MOBIUS_PARTIAL_ERROR(Msg) \
std::cerr << Msg;
#endif
#if !defined(MOBIUS_FATAL_ERROR)
#define MOBIUS_FATAL_ERROR(Msg) \
{MOBIUS_PARTIAL_ERROR(Msg) \
exit(1);}
#endif
#include "mobius_math.h"
#include "mobius_util.h"
#include "datetime.h"
#include "token_string.h"
#include "mobius_model.h"
#include "mobius_data_set.cpp"
#include "jacobian.cpp"
#include "mobius_model.cpp"
#include "lexer.cpp"
#include "mobius_io.cpp"
#include "mobius_solvers.h"
#define MOBIUS_H
#endif