forked from Conedy/Conedy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodeNode.cpp
43 lines (29 loc) · 1.35 KB
/
odeNode.cpp
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
#include "odeNode.h"
#include <gsl/gsl_errno.h>
#include "ode.h"
namespace conedy {
int odeNode::dgl ( baseType t,const baseType y[], baseType f[], void *params )
{
baseType * originalNodeStates = containerNode<baseType,1>::dynamicVariablesOfAllDynNodes;
containerNode<baseType,1>::dynamicVariablesOfAllDynNodes = const_cast<baseType*> (y);
list<containerNode<baseType,1>*>::iterator it;
for ( it = containerNode<baseType,1>::nodeList.begin(); it != containerNode<baseType,1>::nodeList.end();it++ )
( * ((odeNode*) * it) )
( &y[ ( *it )->startPosGslOdeNodeArray],
&f[ ( *it )->startPosGslOdeNodeArray] );
containerNode<baseType,1>::dynamicVariablesOfAllDynNodes = originalNodeStates;
return SUCCESS;
}
void odeNode::dgl (baseType *y, baseType* f)
{
baseType * originalNodeStates = containerNode<baseType,1>::dynamicVariablesOfAllDynNodes;
containerNode<baseType,1>::dynamicVariablesOfAllDynNodes = const_cast<baseType*> (y);
list<containerNode<baseType,1>*>::iterator it;
for ( it = containerNode<baseType,1>::nodeList.begin(); it != containerNode<baseType,1>::nodeList.end();it++ )
(* ((odeNode*) *it) )
( &y[ ( *it )->startPosGslOdeNodeArray],
&f[ ( *it )->startPosGslOdeNodeArray] );
containerNode<baseType,1>::dynamicVariablesOfAllDynNodes = originalNodeStates;
return;
}
}