-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (47 loc) · 1.37 KB
/
main.cpp
File metadata and controls
57 lines (47 loc) · 1.37 KB
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
#include <iostream>
#include <filesystem>
#include "platform.h"
#include "helpers/string_helpers.h"
#include "ZDPlasKinWrapper.h"
#include "ZDPlasKinParams.h"
#include "examples/example1.h"
#ifdef WINDOWS
#include <windows/WindowsLoader.h>
using PlatformLoader = WindowsLoader;
#endif
#ifdef UNIX
#include "unix/UnixLoader.h"
using PlatformLoader = UnixLoader;
#endif
// TODO: handle console in/output on errors with preprocessor/ZDPlaskin/...
// TODO: create python module
// TODO: 'cross-platformize' everything
// - UnixLoader
// - Check if compilation works on UNIX systems
// - Unix preprocessing
// TODO: documentation
// TODO: build/install script
// - gfortran compiler is a requirement
// TODO: recreate ZDPlasKin examples in cpp/python
int main() {
std::string inFile = "kinet.inp";
// ZDPlasKinCompiler::preprocess(inFile);
// ZDPlasKinCompiler::compile();
std::string srcPath = std::filesystem::canonical(inFile).string();
utils::removeSubstr(srcPath, inFile);
std::string path = srcPath + "zdplaskin.dll";
PlatformLoader loader(path);
ZDPlasKinParams parameters(srcPath + "zdplaskin_m.F90");
ZDPlasKinWrapper zdplaskin{&loader, ¶meters};
try {
loader.init();
parameters.readParams();
example1(zdplaskin);
}
catch (const ZDPlaskinException &e) {
std::cerr << "Exception occurred" << std::endl;
std::cerr << e.what() << std::endl;
return 1;
}
return 0;
}