Program listing for file kernel/src/simulationTools/SimulationGraphs.hpp

  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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef SimulationGraphs_H
#define SimulationGraphs_H

#include "SiconosGraph.hpp"
#include "SiconosProperties.hpp"
#include "SiconosPointers.hpp"
#include "SiconosFwd.hpp"
#include "SiconosAlgebraTypeDef.hpp"
#include "SimulationTypeDef.hpp"




struct InteractionProperties
{
  SP::SiconosMatrix block;
  SP::DynamicalSystem source;
  unsigned int source_pos;
  SP::DynamicalSystem target;
  unsigned int target_pos;
  unsigned int absolute_position;
  unsigned int absolute_position_proj;
  bool forControl;
  SP::VectorOfVectors workVectors;
  SP::VectorOfBlockVectors workBlockVectors;
  SP::VectorOfSMatrices workMatrices;

  ACCEPT_SERIALIZATION(InteractionProperties);
};


struct DynamicalSystemProperties
{
  SP::SiconosMatrix upper_block;
  SP::SiconosMatrix lower_block;
  SP::VectorOfVectors workVectors;
  SP::VectorOfMatrices workMatrices;
  SP::OneStepIntegrator osi;
  SP::SimpleMatrix W;
  SP::SimpleMatrix WBoundaryConditions;
  unsigned int absolute_position;


  ACCEPT_SERIALIZATION(DynamicalSystemProperties);
};



struct GraphProperties
{
  bool symmetric;

  ACCEPT_SERIALIZATION(GraphProperties);
};



class _DynamicalSystemsGraph :
  public SiconosGraph < std::shared_ptr<DynamicalSystem>,
                        std::shared_ptr<Interaction>,
                        DynamicalSystemProperties, InteractionProperties,
                        GraphProperties >
{
  ACCEPT_SERIALIZATION(_DynamicalSystemsGraph);
};


class _InteractionsGraph :
  public SiconosGraph < std::shared_ptr<Interaction>,
                        std::shared_ptr<DynamicalSystem>,
                        InteractionProperties, DynamicalSystemProperties,
                        GraphProperties >
{
  ACCEPT_SERIALIZATION(_InteractionsGraph);
};

struct DynamicalSystemsGraph : public _DynamicalSystemsGraph
{

  INSTALL_GRAPH_PROPERTIES(DynamicalSystems,
                           ((VertexSP, MatrixIntegrator, Ad))
                           ((VertexSP, MatrixIntegrator, AdInt))
                           ((VertexSP, MatrixIntegrator, Ld))
                           ((VertexSP, MatrixIntegrator, Bd))
                           ((VertexSP, SiconosMatrix, B))
                           ((VertexSP, SiconosMatrix, L))
                           ((VertexSP, PluggedObject, pluginB))
                           ((VertexSP, PluggedObject, pluginL))
                           ((VertexSP, SiconosVector, e))
                           ((VertexSP, SiconosVector, u))
                           ((VertexSP, PluggedObject, pluginU))
                           ((VertexSP, PluggedObject, pluginJacgx))
                           ((VertexSP, SiconosVector, tmpXdot))
                           ((VertexSP, SimpleMatrix, jacgx))
                           ((Vertex, std::string, name))
                           ((Vertex, unsigned int, groupId)));





  ACCEPT_SERIALIZATION(DynamicalSystemsGraph);


  void eraseProperties(_DynamicalSystemsGraph::VDescriptor vd)
  {
    Ad._store->erase(vd);
    AdInt._store->erase(vd);
    Ld._store->erase(vd);
    Bd._store->erase(vd);
    B._store->erase(vd);
    L._store->erase(vd);
    pluginB._store->erase(vd);
    pluginL._store->erase(vd);
    e._store->erase(vd);
    u._store->erase(vd);
    pluginU._store->erase(vd);
    pluginJacgx._store->erase(vd);
    tmpXdot._store->erase(vd);
    jacgx._store->erase(vd);
    name._store->erase(vd);
    groupId._store->erase(vd);
  }
};

struct InteractionsGraph : public _InteractionsGraph
{

  INSTALL_GRAPH_PROPERTIES(Interactions,
                           ((Vertex, SP::SimpleMatrix, blockProj))
                           ((Edge, SP::SimpleMatrix, upper_blockProj))
                           ((Edge, SP::SimpleMatrix, lower_blockProj))
                           ((Vertex, std::string, name)));


  void eraseProperties(_InteractionsGraph::VDescriptor vd)
  {
    blockProj._store->erase(vd);
    name._store->erase(vd);
  }


  void eraseProperties(_InteractionsGraph::EDescriptor ed)
  {
    upper_blockProj._store->erase(ed);
    lower_blockProj._store->erase(ed);
  }


  ACCEPT_SERIALIZATION(InteractionsGraph);
};



#endif