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,0)
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_;
251 using dealii::DoFHandler<1>::distribute_dofs;
259 DoFHandler<1>::active_cell_iterator element = this->begin_active();
260 #if DEAL_II_VERSION_GTE(8,3,0)
261 while (element->face(0)->boundary_id() != 0)
263 while (element->face(0)->boundary_indicator() != 0)
266 element = element->neighbor(0);
268 first_interval_.Initialize(element, 0);
269 before_first_interval_.Initialize(element, -2);
271 element = this->begin_active();
272 #if DEAL_II_VERSION_GTE(8,3,0)
273 while (element->face(1)->boundary_id() != 1)
275 while (element->face(1)->boundary_indicator() != 1)
278 element = element->neighbor(1);
280 assert(static_cast<int>(this->get_tria().n_active_cells() - 1) >= 0);
281 last_interval_.Initialize(element,
282 static_cast<int>(this->get_tria().n_active_cells() - 1));after_last_interval_
283 .Initialize(element, -1);
293 assert(this->get_fe().has_support_points());
295 times_.resize(this->n_dofs());
298 dealii::Quadrature<1> quadrature_formula(
299 this->get_fe().get_unit_support_points());
303 dealii::FEValues<1> fe_values(this->get_fe(), quadrature_formula,
304 dealii::UpdateFlags(update_q_points));
306 const unsigned int n_q_points = quadrature_formula.size();
307 std::vector<unsigned int> global_dof_indices(
308 this->get_fe().dofs_per_cell);
313 DoFHandler<1>::active_cell_iterator element = this->begin_active(), endc =
315 for (; element != endc; ++element)
317 fe_values.reinit(element);
318 element->get_dof_indices(global_dof_indices);
319 for (
unsigned int i = 0; i < n_q_points; ++i)
321 times_[global_dof_indices[i]] =
322 fe_values.get_quadrature_points()[i](0);
328 TimeIterator first_interval_, last_interval_, before_first_interval_,
329 after_last_interval_;
335 const dealii::FiniteElement<1>* fe_;
340 std::vector<double> times_;
341 unsigned int dofs_per_element_;
342 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:62
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:207
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