-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
67 lines (53 loc) · 1.89 KB
/
Copy pathMain.cpp
File metadata and controls
67 lines (53 loc) · 1.89 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
58
59
60
61
62
63
64
65
66
67
#include "Domain.h"
#include "Meshgenerator.h"
#include "Solver.h"
#include "Writer.h"
#include "Integrator.h"
#include "ConstantIntegrator.h"
#include "EnergyFunction.h"
#include "LaplaceEnergyFunction.h"
#include "ShapeFunction.h"
#include "PolynomialShapeFunction.h"
#include "SourceFunction.h"
#include "TestSourceFunction.h"
#include "LapackSolver.h"
#include "EigenSolver.h"
#include "BoundaryCondition.h"
#include "DirichletBC.h"
#include <iostream>
#include <exception>
#include <cstdlib>
int main(int argc, char * argv [])
{
try
{
Meshgenerator test_generator;
int n = argc == 2 ? std::stoi(argv[1]) : 3;
std::cout << "number of triangles in 1 direction = " << n << std::endl;
const Mesh* const testmesh = test_generator.Generate(n);
Integrator* integrator = new ConstantIntegrator();
EnergyFunction* energyfct = new LaplaceEnergyFunction();
SourceFunction* sourcefct = new TestSourceFunction();
ShapeFunction* shapefct = new PolynomialShapeFunction(2, 1);
BoundaryCondition* bc = new DirichletBC();
Domain* testdomain = new Domain(testmesh);
testdomain->SetIntegrator(integrator);
testdomain->SetEquation(new Equation(energyfct, sourcefct));
testdomain->SetShapeFunction(shapefct);
testdomain->SetBoundaryCondition(bc);
Writer writer;
writer.WriteMesh(testdomain->GetMesh(), "Testdomain", "input", Writer::EFormat::CSV);
Solver* testsolver = new EigenSolver();
testsolver->Solve(testdomain);
delete testdomain;
delete testmesh;
delete testsolver;
}
catch (const std::exception& e)
{
std::cout << e.what() << std::endl;
return 1;
}
std::cout << "Ended program successfully." << std::endl;
return 0;
}