Reference documentation for deal.II version 8.1.0
derivative_approximation.h
1 // ---------------------------------------------------------------------
2 // @f$Id: derivative_approximation.h 32050 2013-12-18 17:34:49Z heister @f$
3 //
4 // Copyright (C) 2000 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__gradient_estimator_h
18 #define __deal2__gradient_estimator_h
19 
20 #include <deal.II/base/config.h>
22 #include <deal.II/base/std_cxx1x/tuple.h>
23 #include <deal.II/base/synchronous_iterator.h>
24 #include <deal.II/fe/fe_update_flags.h>
25 #include <deal.II/fe/mapping.h>
26 #include <deal.II/lac/vector.h>
27 #include <deal.II/grid/filtered_iterator.h>
28 
29 #include <utility>
30 
32 
33 template <int dim, int spacedim> class DoFHandler;
34 namespace hp
35 {
36  template <int dim, int spacedim> class DoFHandler;
37 }
38 
39 
40 
189 {
190 public:
206  template <int dim, template <int, int> class DH, class InputVector, int spacedim>
207  static void
208  approximate_gradient (const Mapping<dim,spacedim> &mapping,
209  const DH<dim,spacedim> &dof,
210  const InputVector &solution,
211  Vector<float> &derivative_norm,
212  const unsigned int component = 0);
213 
218  template <int dim, template <int, int> class DH, class InputVector, int spacedim>
219  static void
220  approximate_gradient (const DH<dim,spacedim> &dof,
221  const InputVector &solution,
222  Vector<float> &derivative_norm,
223  const unsigned int component = 0);
224 
242  template <int dim, template <int, int> class DH, class InputVector, int spacedim>
243  static void
244  approximate_second_derivative (const Mapping<dim,spacedim> &mapping,
245  const DH<dim,spacedim> &dof,
246  const InputVector &solution,
247  Vector<float> &derivative_norm,
248  const unsigned int component = 0);
249 
254  template <int dim, template <int, int> class DH, class InputVector, int spacedim>
255  static void
256  approximate_second_derivative (const DH<dim,spacedim> &dof,
257  const InputVector &solution,
258  Vector<float> &derivative_norm,
259  const unsigned int component = 0);
260 
275  template <int dim, template <int, int> class DH, class InputVector, int order, int spacedim>
276  static void
277  approximate_derivative_tensor (const Mapping<dim,spacedim> &mapping,
278  const DH<dim,spacedim> &dof,
279  const InputVector &solution,
280  const typename DH<dim,spacedim>::active_cell_iterator &cell,
281  Tensor<order,dim> &derivative,
282  const unsigned int component = 0);
283 
288  template <int dim, template <int, int> class DH, class InputVector, int order, int spacedim>
289  static void
290  approximate_derivative_tensor (const DH<dim,spacedim> &dof,
291  const InputVector &solution,
292  const typename DH<dim,spacedim>::active_cell_iterator &cell,
293  Tensor<order,dim> &derivative,
294  const unsigned int component = 0);
295 
299  template <int dim, int order>
300  static double
301  derivative_norm(const Tensor<order,dim> &derivative);
302 
306  DeclException2 (ExcInvalidVectorLength,
307  int, int,
308  << "Vector has length " << arg1 << ", but should have "
309  << arg2);
313  DeclException0 (ExcInsufficientDirections);
314 
315 private:
316 
325  template <int dim>
326  class Gradient
327  {
328  public:
333  static const UpdateFlags update_flags;
334 
340 
345  typedef double ProjectedDerivative;
346 
353  template <class InputVector, int spacedim>
354  static ProjectedDerivative
355  get_projected_derivative (const FEValues<dim,spacedim> &fe_values,
356  const InputVector &solution,
357  const unsigned int component);
358 
363  static double derivative_norm (const Derivative &d);
364 
372  static void symmetrize (Derivative &derivative_tensor);
373  };
374 
375 
376 
385  template <int dim>
387  {
388  public:
393  static const UpdateFlags update_flags;
394 
400 
406 
413  template <class InputVector, int spacedim>
414  static ProjectedDerivative
415  get_projected_derivative (const FEValues<dim,spacedim> &fe_values,
416  const InputVector &solution,
417  const unsigned int component);
418 
426  static double derivative_norm (const Derivative &d);
427 
437  static void symmetrize (Derivative &derivative_tensor);
438  };
439 
440  template <int dim>
442  {
443  public:
448  static const UpdateFlags update_flags;
449 
456 
462 
469  template <class InputVector, int spacedim>
470  static ProjectedDerivative
471  get_projected_derivative (const FEValues<dim,spacedim> &fe_values,
472  const InputVector &solution,
473  const unsigned int component);
474 
482  static double derivative_norm (const Derivative &d);
483 
493  static void symmetrize (Derivative &derivative_tensor);
494  };
495 
496  template <int order, int dim>
498  {
499  public:
505  typedef void DerivDescr;
506 
507  };
508 
509  template <int dim>
510  class DerivativeSelector<1,dim>
511  {
512  public:
513 
514  typedef Gradient<dim> DerivDescr;
515  };
516 
517  template <int dim>
518  class DerivativeSelector<2,dim>
519  {
520  public:
521 
523  };
524 
525  template <int dim>
526  class DerivativeSelector<3,dim>
527  {
528  public:
529 
531  };
532 
533 
534 
535 
536 private:
537 
542  typedef std::pair<unsigned int,unsigned int> IndexInterval;
543 
554  template <class DerivativeDescription, int dim,
555  template <int, int> class DH, class InputVector, int spacedim>
556  static void
557  approximate_derivative (const Mapping<dim,spacedim> &mapping,
558  const DH<dim,spacedim> &dof,
559  const InputVector &solution,
560  const unsigned int component,
561  Vector<float> &derivative_norm);
562 
568  template <class DerivativeDescription, int dim,
569  template <int, int> class DH, class InputVector, int spacedim>
570  static void
571  approximate (SynchronousIterators<std_cxx1x::tuple<typename DH<dim,spacedim>::active_cell_iterator,
572  Vector<float>::iterator> > const &cell,
573  const Mapping<dim,spacedim> &mapping,
574  const DH<dim,spacedim> &dof,
575  const InputVector &solution,
576  const unsigned int component);
577 
582  template <class DerivativeDescription, int dim,
583  template <int, int> class DH, class InputVector, int spacedim>
584  static void
585  approximate_cell (const Mapping<dim,spacedim> &mapping,
586  const DH<dim,spacedim> &dof,
587  const InputVector &solution,
588  const unsigned int component,
589  const typename DH<dim,spacedim>::active_cell_iterator &cell,
590  typename DerivativeDescription::Derivative &derivative);
591 };
592 
593 
594 /* -------------- declaration of explicit specializations ------------- */
595 
596 template <>
597 double
599 
600 template <>
601 double
603 
604 template <>
605 double
607 
608 
609 DEAL_II_NAMESPACE_CLOSE
610 
611 #endif
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:525
std::pair< unsigned int, unsigned int > IndexInterval
UpdateFlags
#define DeclException0(Exception0)
Definition: exceptions.h:505
Definition: hp.h:103
static double derivative_norm(const Derivative &d)