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

  1#ifndef SimulationGraphs_H
  2#define SimulationGraphs_H
  3
  4#include "SiconosGraph.hpp"
  5#include "SiconosProperties.hpp"
  6#include "SiconosPointers.hpp"
  7#include "SiconosFwd.hpp"
  8#include "SiconosAlgebraTypeDef.hpp"
  9#include "SimulationTypeDef.hpp"
 10
 11
 12
 13
 14struct InteractionProperties
 15{
 16  SP::SiconosMatrix block;
 17  SP::DynamicalSystem source;
 18  unsigned int source_pos;
 19  SP::DynamicalSystem target;
 20  unsigned int target_pos;
 21  unsigned int absolute_position;
 22  unsigned int absolute_position_proj;
 23  bool forControl;
 24  SP::VectorOfVectors workVectors;
 25  SP::VectorOfBlockVectors workBlockVectors;
 26  SP::VectorOfSMatrices workMatrices;
 27  SP::OneStepIntegrator osi1;
 28  SP::OneStepIntegrator osi2;
 29
 30  ACCEPT_SERIALIZATION(InteractionProperties);
 31};
 32
 33
 34struct DynamicalSystemProperties
 35{
 36  SP::SiconosMatrix upper_block;
 37  SP::SiconosMatrix lower_block;
 38  SP::VectorOfVectors workVectors;
 39  SP::VectorOfMatrices workMatrices;
 40  SP::OneStepIntegrator osi;
 41  SP::SimpleMatrix W;
 42  SP::SimpleMatrix WBoundaryConditions;
 43  SP::SimpleMatrix Winverse;
 44  unsigned int absolute_position;
 45
 46
 47  ACCEPT_SERIALIZATION(DynamicalSystemProperties);
 48};
 49
 50
 51
 52struct GraphProperties
 53{
 54  bool symmetric;
 55
 56  ACCEPT_SERIALIZATION(GraphProperties);
 57};
 58
 59
 60
 61class _DynamicalSystemsGraph :
 62  public SiconosGraph < std::shared_ptr<DynamicalSystem>,
 63                        std::shared_ptr<Interaction>,
 64                        DynamicalSystemProperties, InteractionProperties,
 65                        GraphProperties >
 66{
 67  ACCEPT_SERIALIZATION(_DynamicalSystemsGraph);
 68};
 69
 70
 71class _InteractionsGraph :
 72  public SiconosGraph < std::shared_ptr<Interaction>,
 73                        std::shared_ptr<DynamicalSystem>,
 74                        InteractionProperties, DynamicalSystemProperties,
 75                        GraphProperties >
 76{
 77  ACCEPT_SERIALIZATION(_InteractionsGraph);
 78};
 79
 80struct DynamicalSystemsGraph : public _DynamicalSystemsGraph
 81{
 82
 83  INSTALL_GRAPH_PROPERTIES(DynamicalSystems,
 84                           ((VertexSP, MatrixIntegrator, Ad))
 85                           ((VertexSP, MatrixIntegrator, AdInt))
 86                           ((VertexSP, MatrixIntegrator, Ld))
 87                           ((VertexSP, MatrixIntegrator, Bd))
 88                           ((VertexSP, SiconosMatrix, B))
 89                           ((VertexSP, SiconosMatrix, L))
 90                           ((VertexSP, PluggedObject, pluginB))
 91                           ((VertexSP, PluggedObject, pluginL))
 92                           ((VertexSP, SiconosVector, e))
 93                           ((VertexSP, SiconosVector, u))
 94                           ((VertexSP, PluggedObject, pluginU))
 95                           ((VertexSP, PluggedObject, pluginJacgx))
 96                           ((VertexSP, SiconosVector, tmpXdot))
 97                           ((VertexSP, SimpleMatrix, jacgx))
 98                           ((Vertex, std::string, name))
 99                           ((Vertex, unsigned int, groupId)));
100
101
102
103
104
105  ACCEPT_SERIALIZATION(DynamicalSystemsGraph);
106
107
108  void eraseProperties(_DynamicalSystemsGraph::VDescriptor vd)
109  {
110    Ad._store->erase(vd);
111    AdInt._store->erase(vd);
112    Ld._store->erase(vd);
113    Bd._store->erase(vd);
114    B._store->erase(vd);
115    L._store->erase(vd);
116    pluginB._store->erase(vd);
117    pluginL._store->erase(vd);
118    e._store->erase(vd);
119    u._store->erase(vd);
120    pluginU._store->erase(vd);
121    pluginJacgx._store->erase(vd);
122    tmpXdot._store->erase(vd);
123    jacgx._store->erase(vd);
124    name._store->erase(vd);
125    groupId._store->erase(vd);
126  }
127};
128
129struct InteractionsGraph : public _InteractionsGraph
130{
131
132  INSTALL_GRAPH_PROPERTIES(Interactions,
133                           ((Vertex, SP::SimpleMatrix, blockProj))
134                           ((Edge, SP::SimpleMatrix, upper_blockProj))
135                           ((Edge, SP::SimpleMatrix, lower_blockProj))
136                           ((Vertex, std::string, name)));
137
138
139  void eraseProperties(_InteractionsGraph::VDescriptor vd)
140  {
141    blockProj._store->erase(vd);
142    name._store->erase(vd);
143  }
144
145
146  void eraseProperties(_InteractionsGraph::EDescriptor ed)
147  {
148    upper_blockProj._store->erase(ed);
149    lower_blockProj._store->erase(ed);
150  }
151
152
153  ACCEPT_SERIALIZATION(InteractionsGraph);
154};
155
156
157
158#endif