Program listing for file kernel/src/simulationTools/D1MinusLinearOSI.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
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef D1MINUSLINEAR_H
#define D1MINUSLINEAR_H

#ifdef DEBUG_D1MINUSLINEAR

#endif

#include "OneStepIntegrator.hpp"
#include "SimpleMatrix.hpp"





const double DEFAULT_TOL_D1MINUS  = 1e-8;



class D1MinusLinearOSI : public OneStepIntegrator
{
public :

protected:


  struct _NSLEffectOnFreeOutput : public SiconosVisitor
  {

    using SiconosVisitor::visit;

    OneStepNSProblem* _osnsp;
    SP::Interaction _inter;
    InteractionProperties& _interProp;
    _NSLEffectOnFreeOutput(OneStepNSProblem *p, SP::Interaction inter, InteractionProperties& interProp) :
      _osnsp(p), _inter(inter), _interProp(interProp) {};

    void visit(const NewtonImpactNSL& nslaw);
    void visit(const EqualityConditionNSL& nslaw)
    {
      ;
    }
  };


  bool _isThereImpactInTheTimeStep ;
  unsigned int _typeOfD1MinusLinearOSI;


public:


  enum ListOfTypeOfD1MinusLinearOSI {halfexplicit_acceleration_level,
                                     halfexplicit_acceleration_level_full,
                                     explicit_velocity_level,
                                     halfexplicit_velocity_level,
                                     numberOfTypeOfD1MinusLinearOSI
                                    };

  enum D1MinusLinearOSI_ds_workVector_id {RESIDU_FREE, FREE, FREE_TDG, WORK_LENGTH};

  enum D1MinusLinearOSI_interaction_workVector_id{OSNSP_RHS, WORK_INTERACTION_LENGTH};

  enum D1MinusLinearOSI_workBlockVector_id{xfree, BLOCK_WORK_LENGTH};



  D1MinusLinearOSI();


  D1MinusLinearOSI(unsigned int type);


  virtual ~D1MinusLinearOSI() {};


  void setTypeOfD1MinusLinearOSI(unsigned int type);


  unsigned int typeOfD1MinusLinearOSI()
  {
    return _typeOfD1MinusLinearOSI;
  };


  unsigned int numberOfIndexSets() const;


  virtual void initialize_nonsmooth_problems();


  void initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds);


  void initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties& interProp,
                         DynamicalSystemsGraph & DSG);


  virtual double computeResidu();


  virtual double computeResiduHalfExplicitAccelerationLevel();


  virtual double computeResiduHalfExplicitAccelerationLevelFull();


  virtual double computeResiduHalfExplicitVelocityLevel();



  virtual void computeFreeState();


  virtual void computeFreeOutput(InteractionsGraph::VDescriptor& vertex_inter, OneStepNSProblem* osnsp);


  virtual void computeFreeOutputHalfExplicitAccelerationLevel(InteractionsGraph::VDescriptor& vertex_inter, OneStepNSProblem* osnsp);


  virtual void computeFreeOutputHalfExplicitVelocityLevel(InteractionsGraph::VDescriptor& vertex_inter, OneStepNSProblem* osnsp);




  virtual void integrate(double& ti, double& tf, double& t , int& flag)
  {
    RuntimeException::selfThrow("D1MinusLinearOSI::integrate - not implemented!");
  }


  virtual void updateState(const unsigned int level);



  virtual bool addInteractionInIndexSet(SP::Interaction inter, unsigned int i);


  virtual bool removeInteractionFromIndexSet(SP::Interaction inter, unsigned int i);


  virtual bool addInteractionInIndexSetHalfExplicitAccelerationLevel(SP::Interaction inter, unsigned int i);


  virtual bool removeInteractionFromIndexSetHalfExplicitAccelerationLevel(SP::Interaction inter, unsigned int i);


  virtual bool addInteractionInIndexSetHalfExplicitVelocityLevel(SP::Interaction inter, unsigned int i);


  virtual bool removeInteractionFromIndexSetHalfExplicitVelocityLevel(SP::Interaction inter, unsigned int i);


  virtual void display()
  {
    RuntimeException::selfThrow("D1MinusLinearOSI::display - not implemented!");
  }


  virtual void prepareNewtonIteration(double time)
  {
    RuntimeException::selfThrow("D1MinusLinearOSI::prepareNewtonIteration - not implemented!");
  }


  ACCEPT_STD_VISITORS();
};

#endif