-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDSIntegratorBlock.h
67 lines (58 loc) · 1.37 KB
/
DSIntegratorBlock.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
//
// DSIntegratorBlock.h
// ims
//
// Created by xkaisl00, xmatej42.
//
#ifndef __ims__DSIntegratorBlock__
#define __ims__DSIntegratorBlock__
#include <iostream>
#include <cmath>
#include "DSBlock.h"
#include "DSEquation.h"
#include "DSTime.h"
#include <vector>
// Vycet typu integracnich metod.
typedef enum intType
{
EULER,
RUNGEKUTT,
ADAMB
}IntegratorType;
// Objekt integratoru
class DSIntegratorBlock : public DSBlock
{
public:
DSIntegratorBlock(DSEquation block, double value = 0);
DSIntegratorBlock(DSBlock &block, double value = 0);
~DSIntegratorBlock();
// Vraci posledni vypoctenou hodnotu.
virtual double value();
// Vyhodnoti integrator
void run();
// Vraci integrator do predchoziho stavu.
void reset();
protected:
DSBlock *equation;
double parametr;
double currTime;
double ABSteps[4];
double resetParameter;
double resetCurrentTime;
double resetLastABStep;
private:
// Vypocet eulera.
double eulerMethod();
// Vypocet RungeKutta.
double rungeKuttMethod();
// Vypocet AdamB.
double adamBMethod();
void registerIntegrator();
};
extern intType integratorType;
extern double eAbs;
extern double eRel;
extern bool flagDecrementStep;
extern bool flagReset;
extern std::vector<DSIntegratorBlock *> integrators;
#endif /* defined(__ims__DSIntegratorBlock__) */