DOpE
constraintvector.h
Go to the documentation of this file.
1 
24 #ifndef CONSTRAINT_VECTOR_H_
25 #define CONSTRAINT_VECTOR_H_
26 
27 #include "spacetimehandler_base.h"
28 #include "dopetypes.h"
29 
30 #include <deal.II/lac/vector.h>
31 #include <deal.II/lac/block_vector_base.h>
32 #include <deal.II/lac/block_vector.h>
33 
34 #include <vector>
35 #include <iostream>
36 #include <sstream>
37 
38 
39 namespace DOpE
40 {
47  template<typename VECTOR>
49  {
50  public:
51  //TODO: Currently we only consider one fixed control
52  // for all timesteps, if more is desired one needs to augment the
53  // Spacetimehandler to have a time discretization for the control,
54  // Then one can update this vector similar to the statevector
55  // with different meshes for Vectors.
56  // Note that this requires to keep track of the interpolation
57  // between state and control time points...
61 
62 // /**
63 // * Sets the time in the vector. This Function or SetTimeDoFNumber
64 // * must be called before calling GetSpacialVector
65 // * in order to load the required data.
66 // *
67 // * @param t A double containing the time we are interested in. If t doesn't match the time given by
68 // * time_point, then an interpolation between the corresponding time_points is
69 // * computed.
70 // * @param interval An TimeIterator. The interval containing t.
71 // *
72 // */
73 // void SetTime(double t, const TimeIterator& interval) const;
74 
83  void SetTimeDoFNumber(unsigned int time_point) const;
84 
88  bool HasType(std::string name) const;
89 
96  VECTOR& GetSpacialVector(std::string name);
97 
102  const VECTOR& GetSpacialVector(std::string name) const;
103 
107  const dealii::Vector<double>& GetGlobalConstraints() const;
111  dealii::Vector<double>& GetGlobalConstraints();
117  void operator=(double value);
124  void operator=(const ConstraintVector& dq);
132  void operator+=(const ConstraintVector& dq);
138  void operator*=(double a);
146  double operator*(const ConstraintVector& dq) const;
155  void add(double s, const ConstraintVector& dq);
162  void equ(double s, const ConstraintVector& dq);
163 
169  void PrintInfos(std::stringstream& out);
170 
179  DOpEtypes::VectorStorageType GetBehavior() const { return behavior_; }
180 
184  const SpaceTimeHandlerBase<VECTOR>* GetSpaceTimeHandler() const { return STH_; }
185 
190  void ReInit();
191 
200  double Norm(std::string name,std::string restriction = "all") const;
201 
211  virtual bool
212  IsFeasible() const;
224  virtual bool
225  IsEpsilonFeasible(double eps) const;
226 
236  virtual bool
237  IsLargerThan(double eps) const;
238 
239 
249  virtual double
251 
252  private:
257  void ReSizeLocalSpace(unsigned int ndofs, const std::vector<unsigned int>& dofs_per_block);
258 
259  void ReSizeGlobal(unsigned int ndofs);
260 
261  std::vector<VECTOR* > local_control_constraint_;
262  mutable VECTOR local_constraint_control_;
263 
264  dealii::Vector<double> global_constraint_;
265 
266  mutable int accessor_;
267 
268  const SpaceTimeHandlerBase<VECTOR>* STH_;
270  unsigned int sfh_ticket_;
271  };
272 
273 
274 }
275 #endif
Definition: constraintvector.h:48
double Norm(std::string name, std::string restriction="all") const
Definition: constraintvector.cc:489
void operator*=(double a)
Definition: constraintvector.cc:358
~ConstraintVector()
Definition: constraintvector.cc:84
virtual bool IsLargerThan(double eps) const
Definition: constraintvector.cc:614
double operator*(const ConstraintVector &dq) const
Definition: constraintvector.cc:378
DOpEtypes::VectorStorageType GetBehavior() const
Definition: constraintvector.h:179
void ReInit()
Definition: constraintvector.cc:60
Definition: spacetimehandler_base.h:48
const dealii::Vector< double > & GetGlobalConstraints() const
Definition: constraintvector.cc:174
void PrintInfos(std::stringstream &out)
Definition: constraintvector.cc:450
const SpaceTimeHandlerBase< VECTOR > * GetSpaceTimeHandler() const
Definition: constraintvector.h:184
void SetTimeDoFNumber(unsigned int time_point) const
Definition: constraintvector.cc:102
virtual bool IsEpsilonFeasible(double eps) const
Definition: constraintvector.cc:594
bool HasType(std::string name) const
******************************************************/
Definition: constraintvector.cc:119
void operator=(double value)
Definition: constraintvector.cc:268
VectorStorageType
Definition: dopetypes.h:120
void operator+=(const ConstraintVector &dq)
Definition: constraintvector.cc:336
void equ(double s, const ConstraintVector &dq)
Definition: constraintvector.cc:426
virtual double Complementarity(const ConstraintVector< VECTOR > &g) const
Definition: constraintvector.cc:634
void add(double s, const ConstraintVector &dq)
Definition: constraintvector.cc:403
VECTOR & GetSpacialVector(std::string name)
Definition: constraintvector.cc:130
ConstraintVector(const ConstraintVector &ref)
Definition: constraintvector.cc:37
virtual bool IsFeasible() const
Definition: constraintvector.cc:574