-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmapNode.h
101 lines (56 loc) · 1.9 KB
/
mapNode.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef mapNode_h
#define mapNode_h mapNode_h
#include <math.h>
#include "containerNode.h"
#include "eventHandler.h"
namespace conedy
{
//! Klasse, für das Integrieren von Maps
class mapNode : public containerNode<baseType,2>
{
protected:
// unsigned short Ngls;
baseType * mapNodeTmp;
public:
// mapNode() {};
//! reserviert Speicher für mapNodeTmp soviel speicher wie die größte Dimension von den Erben von mapNode.
mapNode ( networkElementType n, unsigned int dim ) : // ngls: Anzahl der Gleichungen, NodeNumber, h Schrittweite
containerNode<baseType,2> ( n, dim )
{
}
mapNode ( const mapNode &b ) : containerNode<baseType,2> ( b )
{
mapNodeTmp = ( baseType* ) calloc ( ( &b )->dimension(),sizeof ( baseType ) );
}
virtual ~mapNode() {}
// virtual void randomizeState(randomNumber<baseType> &r) { for (int i = 0; i < Ngls; i++) x[i] = r(); }
virtual void operator() ( baseType xprime [], baseType x[] ) {};
virtual int requiredTimeSteps() { return 1; }
// virtual void swap() { this->state = this->x[0];}
virtual void clean ()
{
};
virtual void evolve ( baseType time )
{
list<containerNode<baseType,2>*>::iterator it;
// dynNode::dt = time;
for ( unsigned int i =0 ; i < ( unsigned int ) ( time+0.5 ) ; i++ ) // Wir wollen hier richtig runden und nicht immer nur ab.
{
for ( it = containerNode<baseType,2>::nodeList.begin(); it != containerNode<baseType,2>::nodeList.end(); it++ )
((mapNode*)( *it ))->action1();
for ( it = containerNode<baseType,2>::nodeList.begin(); it != containerNode<baseType,2>::nodeList.end(); it++ )
((mapNode*)( *it ))->swap();
}
}
virtual void action1()
{
( *this ) ( mapNodeTmp,this->x );
}
virtual void swap()
{
for ( unsigned int i = 0; i < this->dimension(); i++ )
this->x[i] = mapNodeTmp [i];
}
};
}
#endif