-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (28 loc) · 898 Bytes
/
Copy pathmain.cpp
File metadata and controls
29 lines (28 loc) · 898 Bytes
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
#include "FEM.hpp"
#include <exception>
#include <iostream>
#include <fstream>
int main(int argc, char** argv) {
try {
if (argc < 3) {
throw std::exception("Case path or result path not found.");
}
std::fstream casefile(argv[1], std::ios_base::in);
std::cout << "Setting up solver\n";
FEM::PoissonSolver solver(casefile);
std::cout << "Solving...\n";
double resid = solver.Solve();
std::cout << "Done with Residual: " << resid << "\n";
casefile.clear();
casefile.seekg(0);
std::string mshfile;
std::getline(casefile, mshfile);//TODO: read mesh file in one place
std::fstream msh = std::fstream(mshfile, std::ios_base::in);
std::fstream output = std::fstream(argv[2], std::ios_base::out);
Mesh::WriteData(msh, output, solver.Nodes, solver.T);
} catch (std::exception e) {
std::cout << "Exception: " << e.what();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}