DOpE
statespacetimehandler.h
Go to the documentation of this file.
1 
24 #ifndef STATE_SPACE_TIME_HANDLER_H_
25 #define STATE_SPACE_TIME_HANDLER_H_
26 
27 #include "spacetimehandler_base.h"
29 #include "dataout_wrapper.h"
30 
31 #include <deal.II/lac/vector.h>
32 #include <deal.II/lac/block_vector_base.h>
33 #include <deal.II/lac/block_vector.h>
34 #include <deal.II/lac/constraint_matrix.h>
35 #include <deal.II/dofs/dof_handler.h>
36 //#include <deal.II/multigrid/mg_dof_handler.h>
37 //#include <deal.II/multigrid/mg_constrained_dofs.h>
38 
39 #include <vector>
40 #include <iostream>
41 #include <sstream>
42 
43 namespace DOpE
44 {
57  template<template<int, int> class FE, template<int, int> class DH, typename SPARSITYPATTERN,
58  typename VECTOR, int dealdim>
60  {
61  public:
63  SpaceTimeHandlerBase<VECTOR>()
64  {
65  domain_dofhandler_vector_.resize(1);
66  }
67  StateSpaceTimeHandler(dealii::Triangulation<1> & times) :
68  SpaceTimeHandlerBase<VECTOR>(times)
69  {
70  domain_dofhandler_vector_.resize(1);
71  }
73  const ActiveFEIndexSetterInterface<dealdim>& index_setter) :
74  SpaceTimeHandlerBase<VECTOR>(), fe_index_setter_(&index_setter)
75  {
76  domain_dofhandler_vector_.resize(1);
77  }
78  StateSpaceTimeHandler(dealii::Triangulation<1> & times,
79  const ActiveFEIndexSetterInterface<dealdim>& index_setter) :
80  SpaceTimeHandlerBase<VECTOR>(times), fe_index_setter_(&index_setter)
81  {
82  domain_dofhandler_vector_.resize(1);
83  }
84  virtual
86  {
87  }
88 
97  virtual void
98  ReInit(unsigned int state_n_blocks,
99  const std::vector<unsigned int>& state_block_component) =0;
100 
101  /******************************************************/
102 
107  GetStateDoFHandler() const =0;
108 
109  /******************************************************/
110 
114  virtual const DOpEWrapper::Mapping<dealdim, DH>&
115  GetMapping() const = 0;
116 
117  /******************************************************/
118 
123  const std::vector<const DOpEWrapper::DoFHandler<dealdim, DH>*>&
125  {
128  }
129 
130  /******************************************************/
131 
136  std::vector<
139  {
140  std::vector<
142  this->GetDoFHandler().size());
143  for (unsigned int dh = 0; dh < this->GetDoFHandler().size(); dh++)
144  {
145  ret[dh] = this->GetDoFHandler()[dh]->begin_active();
146  }
147  return ret;
148  }
149 
150  /******************************************************/
151 
157  std::vector<
160  {
161  std::vector<
163  this->GetDoFHandler().size());
164  for (unsigned int dh = 0; dh < this->GetDoFHandler().size(); dh++)
165  {
166  ret[dh] = this->GetDoFHandler()[dh]->end();
167  }
168  return ret;
169  }
170 
171 
172  /******************************************************/
173 
181  std::vector<
184  {
185  std::vector<
187  this->GetDoFHandler().size());
188  for (unsigned int dh = 0; dh < this->GetDoFHandler().size(); dh++)
189  {
190  ret[dh] = this->GetDoFHandler()[dh]->begin_active();
191  }
192  return ret;
193  }
194 
195  /******************************************************/
196 
205  std::vector<
208  {
209  std::vector<
211  this->GetDoFHandler().size());
212  for (unsigned int dh = 0; dh < this->GetDoFHandler().size(); dh++)
213  {
214  ret[dh] = this->GetDoFHandler()[dh]->end();
215  }
216  return ret;
217  }
218 
219 
220 
221  /******************************************************/
222 
227  unsigned int
229  {
230  return 0;
231  }
232 
233  /******************************************************/
240  {
241  //makes only sense in the hp case.
242  return *fe_index_setter_;
243  }
244 
245  /******************************************************/
246  /*
247  * This function sets for every cell the right fe index for the state variable.
248  * This is only useful in the hp case!
249  *
250  * @param dof_handler The dof_handler for which the fe indices have to be set.
251  */
252  void
255  {
256  if (dof_handler.NeedIndexSetter())
257  {
258  for (typename DH<dealdim, dealdim>::active_cell_iterator element =
259  dof_handler.begin_active(); element != dof_handler.end(); ++element)
260  {
261  this->GetFEIndexSetter().SetActiveFEIndexState(element);
262  }
263  }
264  }
265 
266  /******************************************************/
267  /*
268 // * Experimental status for MG prec
269 // */
270 // virtual const dealii::MGConstrainedDoFs &
271 // GetMGConstrainedDoFs() const
272 // {
273 // throw DOpEException(
274 // "Not used for normal DofHandler",
275 // "StateSpaceTimeHandler.h");
276 //
277 // }
278 
279  /******************************************************/
283  virtual const dealii::Triangulation<dealdim>&
285  {
286  throw DOpEException(
287  "Not used for normal DofHandler",
288  "StateSpaceTimeHandler.h");
289 
290  }
291 
292 
293 
294  /******************************************************/
295 
299  virtual unsigned int
300  GetStateDoFsPerBlock(unsigned int b, int time_point = -1) const =0;
301 
302  /******************************************************/
303 
307  virtual const dealii::ConstraintMatrix &
308  GetStateDoFConstraints() const=0;
309 
310  /*******************************************************/
311 
316  virtual const std::vector<dealii::Point<dealdim> > &
318 
319  /******************************************************/
320 
324  virtual void
325  ComputeStateSparsityPattern(SPARSITYPATTERN & sparsity) const=0;
326 
327  /******************************************************/
328 
329 // /**
330 // * Experimental status:
331 // * Needed for MG prec.
332 // */
333 // virtual void
334 // ComputeMGStateSparsityPattern(dealii::MGLevelObject<dealii::BlockSparsityPattern> & /*mg_sparsity_patterns*/,
335 // unsigned int /*n_levels*/) const
336 // {
337 // throw DOpEException(
338 // "Not used for normal DofHandler",
339 // "StateSpaceTimeHandler.h");
340 // }
341 //
342 // /******************************************************/
343 //
344 // /**
345 // * Experimental status:
346 // * Needed for MG prec.
347 // */
348 // virtual void
349 // ComputeMGStateSparsityPattern(dealii::MGLevelObject<dealii::SparsityPattern> & /*mg_sparsity_patterns*/,
350 // unsigned int /*n_levels*/) const
351 // {
352 // throw DOpEException(
353 // "Not used for normal DofHandler",
354 // "StateSpaceTimeHandler.h");
355 // }
356 
357 
358  /******************************************************/
363  virtual const FE<dealdim, dealdim>&
364  GetFESystem(std::string name) const=0;
365 
366  /******************************************************/
367 
370  {
371  data_out_.clear();
372  return data_out_;
373  }
374 
375  protected:
376  //we need this here, because we know the type of the DoFHandler in use.
377  //This saves us a template argument for statpdeproblem etc.
380  mutable std::vector<const DOpEWrapper::DoFHandler<dealdim, DH>*> domain_dofhandler_vector_;
381 
382  };
383 }
384 
385 #endif
StateSpaceTimeHandler(dealii::Triangulation< 1 > &times)
Definition: statespacetimehandler.h:67
std::vector< typename DOpEWrapper::DoFHandler< dealdim, DH >::active_cell_iterator > GetDoFHandlerEnd() const
Definition: statespacetimehandler.h:159
virtual const FE< dealdim, dealdim > & GetFESystem(std::string name) const =0
static bool NeedIndexSetter()
virtual ~StateSpaceTimeHandler()
Definition: statespacetimehandler.h:85
virtual const dealii::Triangulation< dealdim > & GetTriangulation() const
Definition: statespacetimehandler.h:284
virtual const DOpEWrapper::DoFHandler< dealdim, DH > & GetStateDoFHandler() const =0
std::vector< typename DOpEWrapper::DoFHandler< dealdim, DH >::cell_iterator > GetDoFHandlerEndAllLevels() const
Definition: statespacetimehandler.h:207
virtual void ReInit(unsigned int state_n_blocks, const std::vector< unsigned int > &state_block_component)=0
void SetActiveFEIndicesState(DOpEWrapper::DoFHandler< dealdim, DH > &dof_handler)
Definition: statespacetimehandler.h:253
DOpEWrapper::DataOut< dealdim, DH > & GetDataOut()
Definition: statespacetimehandler.h:369
const std::vector< const DOpEWrapper::DoFHandler< dealdim, DH > * > & GetDoFHandler() const
Definition: statespacetimehandler.h:124
std::vector< typename DOpEWrapper::DoFHandler< dealdim, DH >::active_cell_iterator > GetDoFHandlerBeginActive() const
Definition: statespacetimehandler.h:138
virtual const std::vector< dealii::Point< dealdim > > & GetMapDoFToSupportPoints()=0
Definition: spacetimehandler_base.h:48
StateSpaceTimeHandler(dealii::Triangulation< 1 > &times, const ActiveFEIndexSetterInterface< dealdim > &index_setter)
Definition: statespacetimehandler.h:78
virtual unsigned int GetStateDoFsPerBlock(unsigned int b, int time_point=-1) const =0
const ActiveFEIndexSetterInterface< dealdim > * fe_index_setter_
Definition: statespacetimehandler.h:379
virtual void SetActiveFEIndexState(typename dealii::hp::DoFHandler< dealdim >::active_cell_iterator &) const
Definition: active_fe_index_setter_interface.h:51
StateSpaceTimeHandler()
Definition: statespacetimehandler.h:62
unsigned int GetStateIndex()
Definition: statespacetimehandler.h:228
virtual const DOpEWrapper::Mapping< dealdim, DH > & GetMapping() const =0
Definition: statespacetimehandler.h:59
virtual void ComputeStateSparsityPattern(SPARSITYPATTERN &sparsity) const =0
DOpEWrapper::DataOut< dealdim, DH > data_out_
Definition: statespacetimehandler.h:378
std::vector< const DOpEWrapper::DoFHandler< dealdim, DH > * > domain_dofhandler_vector_
Definition: statespacetimehandler.h:380
virtual const dealii::ConstraintMatrix & GetStateDoFConstraints() const =0
std::vector< typename DOpEWrapper::DoFHandler< dealdim, DH >::cell_iterator > GetDoFHandlerBeginActiveAllLevels() const
Definition: statespacetimehandler.h:183
Definition: dopeexception.h:35
const ActiveFEIndexSetterInterface< dealdim > & GetFEIndexSetter() const
Definition: statespacetimehandler.h:239
StateSpaceTimeHandler(const ActiveFEIndexSetterInterface< dealdim > &index_setter)
Definition: statespacetimehandler.h:72