24 #ifndef _TIMEDOFHANDLER_H_
25 #define _TIMEDOFHANDLER_H_
33 #include <deal.II/fe/fe_q.h>
34 #include <deal.II/fe/fe_dgq.h>
35 #include <deal.II/fe/fe_nothing.h>
36 #include <deal.II/fe/fe_update_flags.h>
37 #include <deal.II/fe/fe_values.h>
38 #include <deal.II/dofs/dof_handler.h>
39 #include <deal.II/dofs/dof_renumbering.h>
40 #include <deal.II/base/point.h>
46 using namespace dealii;
72 _dofs_per_element = 1;
82 const dealii::FiniteElement<1>& fe)
83 : dealii::DoFHandler<1>(tria)
86 this->distribute_dofs();
91 : dealii::DoFHandler<1>(tria)
93 _fe =
new dealii::FE_Q<1>(1);
94 this->distribute_dofs();
119 dealii::DoFHandler<1>::distribute_dofs(*_fe);
122 #if DEAL_II_VERSION_GTE(7,3)
123 dealii::DoFRenumbering::downstream<dealii::DoFHandler<1> >(*
this,
124 dealii::Point<1>(1.),
true);
126 dealii::DoFRenumbering::downstream<dealii::DoFHandler<1>, 1>(*
this,
127 dealii::Point<1>(1.),
true);
132 _dofs_per_element = this->get_fe().dofs_per_cell;
143 return this->get_tria().n_active_cells();
155 return this->n_dofs();
163 const std::vector<double>&
177 std::vector<double>& local_times)
const
179 assert(local_times.size() == GetLocalNbrOfDoFs());
181 std::vector<unsigned int> global_dof_indices(GetLocalNbrOfDoFs());
183 for (
unsigned int i = 0; i < GetLocalNbrOfDoFs(); ++i)
185 local_times[i] = _times[global_dof_indices[i]];
195 assert(timestep < _times.size());
196 return _times[timestep];
205 assert(_initialized);
206 return _first_interval;
216 assert(_initialized);
217 return _before_first_interval;
226 assert(_initialized);
227 return _last_interval;
237 assert(_initialized);
238 return _after_last_interval;
247 return _dofs_per_element;
258 DoFHandler<1>::active_cell_iterator element = this->begin_active();
259 while (element->face(0)->boundary_indicator() != 0)
261 element = element->neighbor(0);
263 _first_interval.Initialize(element, 0);
264 _before_first_interval.Initialize(element, -2);
266 element = this->begin_active();
267 while (element->face(1)->boundary_indicator() != 1)
269 element = element->neighbor(1);
271 assert(static_cast<int>(this->get_tria().n_active_cells() - 1) >= 0);
272 _last_interval.Initialize(element,
273 static_cast<int>(this->get_tria().n_active_cells() - 1));_after_last_interval
274 .Initialize(element, -1);
284 assert(this->get_fe().has_support_points());
286 _times.resize(this->n_dofs());
289 dealii::Quadrature<1> quadrature_formula(
290 this->get_fe().get_unit_support_points());
294 dealii::FEValues<1> fe_values(this->get_fe(), quadrature_formula,
295 dealii::UpdateFlags(update_q_points));
297 const unsigned int n_q_points = quadrature_formula.size();
298 std::vector<unsigned int> global_dof_indices(
299 this->get_fe().dofs_per_cell);
304 DoFHandler<1>::active_cell_iterator element = this->begin_active(), endc =
306 for (; element != endc; ++element)
308 fe_values.reinit(element);
309 element->get_dof_indices(global_dof_indices);
310 for (
unsigned int i = 0; i < n_q_points; ++i)
312 _times[global_dof_indices[i]] =
313 fe_values.get_quadrature_points()[i](0);
319 TimeIterator _first_interval, _last_interval, _before_first_interval,
320 _after_last_interval;
326 const dealii::FiniteElement<1>* _fe;
331 std::vector<double> _times;
332 unsigned int _dofs_per_element;
333 bool _need_delete, _initialized;
Definition: timedofhandler.h:64
TimeDoFHandler()
Definition: timedofhandler.h:68
const std::vector< double > & GetTimes() const
Definition: timedofhandler.h:164
TimeIterator first_interval() const
Definition: timedofhandler.h:203
void GetTimes(const TimeIterator &interval, std::vector< double > &local_times) const
Definition: timedofhandler.h:176
TimeIterator before_first_interval() const
Definition: timedofhandler.h:214
TimeIterator after_last_interval() const
Definition: timedofhandler.h:235
Definition: timeiterator.h:63
unsigned int GetNbrOfDoFs() const
Definition: timedofhandler.h:152
TimeDoFHandler(const Triangulation< 1 > &tria, const dealii::FiniteElement< 1 > &fe)
Definition: timedofhandler.h:81
TimeIterator last_interval() const
Definition: timedofhandler.h:224
unsigned int GetNbrOfIntervals() const
Definition: timedofhandler.h:140
void get_time_dof_indices(std::vector< unsigned int > &local_dof_indices) const
Definition: timeiterator.h:208
unsigned int GetLocalNbrOfDoFs() const
Definition: timedofhandler.h:245
~TimeDoFHandler()
Definition: timedofhandler.h:99
void distribute_dofs()
Definition: timedofhandler.h:115
TimeDoFHandler(const Triangulation< 1 > &tria)
Definition: timedofhandler.h:90
double GetTime(unsigned int timestep)
Definition: timedofhandler.h:193