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 <lac/vector.h>
32 #include <lac/block_vector_base.h>
33 #include <lac/block_vector.h>
34 #include <lac/constraint_matrix.h>
35 #include <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(const 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(const 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 &
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 
309  virtual const std::vector<unsigned int>&
310  GetStateDoFsPerBlock(int time_point = -1) const =0;
311 
312  /******************************************************/
313 
317  virtual const dealii::ConstraintMatrix &
318  GetStateDoFConstraints() const=0;
319 
320  /*******************************************************/
321 
326  virtual const std::vector<dealii::Point<dealdim> > &
328 
329  /******************************************************/
330 
334  virtual void
335  ComputeStateSparsityPattern(SPARSITYPATTERN & sparsity) const=0;
336 
337  /******************************************************/
338 
343  virtual void
344  ComputeMGStateSparsityPattern(dealii::MGLevelObject<dealii::BlockSparsityPattern> & /*mg_sparsity_patterns*/,
345  unsigned int /*n_levels*/) const
346  {
347  throw DOpEException(
348  "Not used for normal DofHandler",
349  "StateSpaceTimeHandler.h");
350  }
351 
352  /******************************************************/
353 
358  virtual void
359  ComputeMGStateSparsityPattern(dealii::MGLevelObject<dealii::SparsityPattern> & /*mg_sparsity_patterns*/,
360  unsigned int /*n_levels*/) const
361  {
362  throw DOpEException(
363  "Not used for normal DofHandler",
364  "StateSpaceTimeHandler.h");
365  }
366 
367 
368  /******************************************************/
373  virtual const FE<dealdim, dealdim>&
374  GetFESystem(std::string name) const=0;
375 
376  /******************************************************/
377 
380  {
381  _data_out.clear();
382  return _data_out;
383  }
384 
385  protected:
386  //we need this here, because we know the type of the DoFHandler in use.
387  //This saves us a template argument for statpdeproblem etc.
390  mutable std::vector<const DOpEWrapper::DoFHandler<dealdim, DH>*> _domain_dofhandler_vector;
391 
392  };
393 }
394 
395 #endif
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 const dealii::MGConstrainedDoFs & GetMGConstrainedDoFs() const
Definition: statespacetimehandler.h:271
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:379
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:47
std::vector< const DOpEWrapper::DoFHandler< dealdim, DH > * > _domain_dofhandler_vector
Definition: statespacetimehandler.h:390
virtual void ComputeMGStateSparsityPattern(dealii::MGLevelObject< dealii::SparsityPattern > &, unsigned int) const
Definition: statespacetimehandler.h:359
virtual unsigned int GetStateDoFsPerBlock(unsigned int b, int time_point=-1) const =0
virtual void SetActiveFEIndexState(typename dealii::hp::DoFHandler< dealdim >::active_cell_iterator &) const
Definition: active_fe_index_setter_interface.h:51
StateSpaceTimeHandler(const dealii::Triangulation< 1 > &times, const ActiveFEIndexSetterInterface< dealdim > &index_setter)
Definition: statespacetimehandler.h:78
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
const ActiveFEIndexSetterInterface< dealdim > * _fe_index_setter
Definition: statespacetimehandler.h:389
virtual void ComputeStateSparsityPattern(SPARSITYPATTERN &sparsity) const =0
DOpEWrapper::DataOut< dealdim, DH > _data_out
Definition: statespacetimehandler.h:388
StateSpaceTimeHandler(const dealii::Triangulation< 1 > &times)
Definition: statespacetimehandler.h:67
virtual const dealii::ConstraintMatrix & GetStateDoFConstraints() const =0
std::vector< typename DOpEWrapper::DoFHandler< dealdim, DH >::cell_iterator > GetDoFHandlerBeginActiveAllLevels() const
Definition: statespacetimehandler.h:183
virtual void ComputeMGStateSparsityPattern(dealii::MGLevelObject< dealii::BlockSparsityPattern > &, unsigned int) const
Definition: statespacetimehandler.h:344
Definition: dopeexception.h:35
const ActiveFEIndexSetterInterface< dealdim > & GetFEIndexSetter() const
Definition: statespacetimehandler.h:239
StateSpaceTimeHandler(const ActiveFEIndexSetterInterface< dealdim > &index_setter)
Definition: statespacetimehandler.h:72