Reference documentation for deal.II version 8.5.1
error_estimator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__error_estimator_h
17 #define dealii__error_estimator_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/function.h>
23 #include <deal.II/dofs/function_map.h>
24 #include <deal.II/fe/component_mask.h>
25 #include <map>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 
30 template <int, int> class Mapping;
31 template <int> class Quadrature;
32 
33 namespace hp
34 {
35  template <int> class QCollection;
36 }
37 
38 
39 
250 template <int dim, int spacedim=dim>
252 {
253 public:
258  enum Strategy
259  {
266  };
267 
328  template <typename InputVector, typename DoFHandlerType>
329  static void estimate
330  (const Mapping<dim, spacedim> &mapping,
331  const DoFHandlerType &dof,
332  const Quadrature<dim-1> &quadrature,
333  const typename FunctionMap<spacedim>::type &neumann_bc,
334  const InputVector &solution,
335  Vector<float> &error,
336  const ComponentMask &component_mask = ComponentMask(),
337  const Function<spacedim> *coefficients = 0,
338  const unsigned int n_threads = numbers::invalid_unsigned_int,
341  const Strategy strategy = cell_diameter_over_24);
342 
347  template <typename InputVector, typename DoFHandlerType>
348  static void estimate
349  (const DoFHandlerType &dof,
350  const Quadrature<dim-1> &quadrature,
351  const typename FunctionMap<spacedim>::type &neumann_bc,
352  const InputVector &solution,
353  Vector<float> &error,
354  const ComponentMask &component_mask = ComponentMask(),
355  const Function<spacedim> *coefficients = 0,
356  const unsigned int n_threads = numbers::invalid_unsigned_int,
359  const Strategy strategy = cell_diameter_over_24);
360 
374  template <typename InputVector, typename DoFHandlerType>
375  static void estimate
376  (const Mapping<dim, spacedim> &mapping,
377  const DoFHandlerType &dof,
378  const Quadrature<dim-1> &quadrature,
379  const typename FunctionMap<spacedim>::type &neumann_bc,
380  const std::vector<const InputVector *> &solutions,
381  std::vector<Vector<float>*> &errors,
382  const ComponentMask &component_mask = ComponentMask(),
383  const Function<spacedim> *coefficients = 0,
384  const unsigned int n_threads = numbers::invalid_unsigned_int,
387  const Strategy strategy = cell_diameter_over_24);
388 
393  template <typename InputVector, typename DoFHandlerType>
394  static void estimate
395  (const DoFHandlerType &dof,
396  const Quadrature<dim-1> &quadrature,
397  const typename FunctionMap<spacedim>::type &neumann_bc,
398  const std::vector<const InputVector *> &solutions,
399  std::vector<Vector<float>*> &errors,
400  const ComponentMask &component_mask = ComponentMask(),
401  const Function<spacedim> *coefficients = 0,
402  const unsigned int n_threads = numbers::invalid_unsigned_int,
405  const Strategy strategy = cell_diameter_over_24);
406 
407 
412  template <typename InputVector, typename DoFHandlerType>
413  static void estimate
414  (const Mapping<dim, spacedim> &mapping,
415  const DoFHandlerType &dof,
416  const hp::QCollection<dim-1> &quadrature,
417  const typename FunctionMap<spacedim>::type &neumann_bc,
418  const InputVector &solution,
419  Vector<float> &error,
420  const ComponentMask &component_mask = ComponentMask(),
421  const Function<spacedim> *coefficients = 0,
422  const unsigned int n_threads = numbers::invalid_unsigned_int,
425  const Strategy strategy = cell_diameter_over_24);
426 
427 
432  template <typename InputVector, typename DoFHandlerType>
433  static void estimate
434  (const DoFHandlerType &dof,
435  const hp::QCollection<dim-1> &quadrature,
436  const typename FunctionMap<spacedim>::type &neumann_bc,
437  const InputVector &solution,
438  Vector<float> &error,
439  const ComponentMask &component_mask = ComponentMask(),
440  const Function<spacedim> *coefficients = 0,
441  const unsigned int n_threads = numbers::invalid_unsigned_int,
444  const Strategy strategy = cell_diameter_over_24);
445 
446 
451  template <typename InputVector, typename DoFHandlerType>
452  static void estimate
453  (const Mapping<dim, spacedim> &mapping,
454  const DoFHandlerType &dof,
455  const hp::QCollection<dim-1> &quadrature,
456  const typename FunctionMap<spacedim>::type &neumann_bc,
457  const std::vector<const InputVector *> &solutions,
458  std::vector<Vector<float>*> &errors,
459  const ComponentMask &component_mask = ComponentMask(),
460  const Function<spacedim> *coefficients = 0,
461  const unsigned int n_threads = numbers::invalid_unsigned_int,
464  const Strategy strategy = cell_diameter_over_24);
465 
466 
471  template <typename InputVector, typename DoFHandlerType>
472  static void estimate
473  (const DoFHandlerType &dof,
474  const hp::QCollection<dim-1> &quadrature,
475  const typename FunctionMap<spacedim>::type &neumann_bc,
476  const std::vector<const InputVector *> &solutions,
477  std::vector<Vector<float>*> &errors,
478  const ComponentMask &component_mask = ComponentMask(),
479  const Function<spacedim> *coefficients = 0,
480  const unsigned int n_threads = numbers::invalid_unsigned_int,
483  const Strategy strategy = cell_diameter_over_24);
484 
489  "You provided a ComponentMask argument that is invalid. "
490  "Component masks need to be either default constructed "
491  "(in which case they indicate that every component is "
492  "selected) or need to have a length equal to the number "
493  "of vector components of the finite element in use "
494  "by the DoFHandler object. In the latter case, at "
495  "least one component needs to be selected.");
500  "If you do specify the argument for a (possibly "
501  "spatially variable) coefficient function for this function, "
502  "then it needs to refer to a coefficient that is either "
503  "scalar (has one vector component) or has as many vector "
504  "components as there are in the finite element used by "
505  "the DoFHandler argument.");
511  int,
512  int,
513  << "You provided a function map that for boundary indicator "
514  << arg1 << " specifies a function with "
515  << arg2 << " vector components. However, the finite "
516  "element in use has "
517  << arg2 << " components, and these two numbers need to match.");
522  int, int,
523  << "The number of input vectors, " << arg1
524  << " needs to be equal to the number of output vectors, "
525  << arg2
526  << ". This is not the case in your call of this function.");
531  "You need to specify at least one solution vector as "
532  "input.");
533 };
534 
535 
536 
548 template <int spacedim>
549 class KellyErrorEstimator<1,spacedim>
550 {
551 public:
574  template <typename InputVector, typename DoFHandlerType>
575  static void estimate
576  (const Mapping<1,spacedim> &mapping,
577  const DoFHandlerType &dof,
578  const Quadrature<0> &quadrature,
579  const typename FunctionMap<spacedim>::type &neumann_bc,
580  const InputVector &solution,
581  Vector<float> &error,
582  const ComponentMask &component_mask = ComponentMask(),
583  const Function<spacedim> *coefficients = 0,
584  const unsigned int n_threads = numbers::invalid_unsigned_int,
587 
592  template <typename InputVector, typename DoFHandlerType>
593  static void estimate
594  (const DoFHandlerType &dof,
595  const Quadrature<0> &quadrature,
596  const typename FunctionMap<spacedim>::type &neumann_bc,
597  const InputVector &solution,
598  Vector<float> &error,
599  const ComponentMask &component_mask = ComponentMask(),
600  const Function<spacedim> *coefficients = 0,
601  const unsigned int n_threads = numbers::invalid_unsigned_int,
604 
618  template <typename InputVector, typename DoFHandlerType>
619  static void estimate
620  (const Mapping<1,spacedim> &mapping,
621  const DoFHandlerType &dof,
622  const Quadrature<0> &quadrature,
623  const typename FunctionMap<spacedim>::type &neumann_bc,
624  const std::vector<const InputVector *> &solutions,
625  std::vector<Vector<float>*> &errors,
626  const ComponentMask &component_mask = ComponentMask(),
627  const Function<spacedim> *coefficients = 0,
628  const unsigned int n_threads = numbers::invalid_unsigned_int,
631 
636  template <typename InputVector, typename DoFHandlerType>
637  static void estimate
638  (const DoFHandlerType &dof,
639  const Quadrature<0> &quadrature,
640  const typename FunctionMap<spacedim>::type &neumann_bc,
641  const std::vector<const InputVector *> &solutions,
642  std::vector<Vector<float>*> &errors,
643  const ComponentMask &component_mask = ComponentMask(),
644  const Function<spacedim> *coefficients = 0,
645  const unsigned int n_threads = numbers::invalid_unsigned_int,
648 
649 
654  template <typename InputVector, typename DoFHandlerType>
655  static void estimate
656  (const Mapping<1,spacedim> &mapping,
657  const DoFHandlerType &dof,
658  const hp::QCollection<0> &quadrature,
659  const typename FunctionMap<spacedim>::type &neumann_bc,
660  const InputVector &solution,
661  Vector<float> &error,
662  const ComponentMask &component_mask = ComponentMask(),
663  const Function<spacedim> *coefficients = 0,
664  const unsigned int n_threads = numbers::invalid_unsigned_int,
667 
668 
673  template <typename InputVector, typename DoFHandlerType>
674  static void estimate
675  (const DoFHandlerType &dof,
676  const hp::QCollection<0> &quadrature,
677  const typename FunctionMap<spacedim>::type &neumann_bc,
678  const InputVector &solution,
679  Vector<float> &error,
680  const ComponentMask &component_mask = ComponentMask(),
681  const Function<spacedim> *coefficients = 0,
682  const unsigned int n_threads = numbers::invalid_unsigned_int,
685 
686 
691  template <typename InputVector, typename DoFHandlerType>
692  static void estimate
693  (const Mapping<1,spacedim> &mapping,
694  const DoFHandlerType &dof,
695  const hp::QCollection<0> &quadrature,
696  const typename FunctionMap<spacedim>::type &neumann_bc,
697  const std::vector<const InputVector *> &solutions,
698  std::vector<Vector<float>*> &errors,
699  const ComponentMask &component_mask = ComponentMask(),
700  const Function<spacedim> *coefficients = 0,
701  const unsigned int n_threads = numbers::invalid_unsigned_int,
704 
705 
710  template <typename InputVector, typename DoFHandlerType>
711  static void estimate
712  (const DoFHandlerType &dof,
713  const hp::QCollection<0> &quadrature,
714  const typename FunctionMap<spacedim>::type &neumann_bc,
715  const std::vector<const InputVector *> &solutions,
716  std::vector<Vector<float>*> &errors,
717  const ComponentMask &component_mask = ComponentMask(),
718  const Function<spacedim> *coefficients = 0,
719  const unsigned int n_threads = numbers::invalid_unsigned_int,
722 
727  "You provided a ComponentMask argument that is invalid. "
728  "Component masks need to be either default constructed "
729  "(in which case they indicate that every component is "
730  "selected) or need to have a length equal to the number "
731  "of vector components of the finite element in use "
732  "by the DoFHandler object. In the latter case, at "
733  "least one component needs to be selected.");
738  "If you do specify the argument for a (possibly "
739  "spatially variable) coefficient function for this function, "
740  "then it needs to refer to a coefficient that is either "
741  "scalar (has one vector component) or has as many vector "
742  "components as there are in the finite element used by "
743  "the DoFHandler argument.");
749  int,
750  int,
751  << "You provided a function map that for boundary indicator "
752  << arg1 << " specifies a function with "
753  << arg2 << " vector components. However, the finite "
754  "element in use has "
755  << arg3 << " components, and these two numbers need to match.");
760  int, int,
761  << "The number of input vectors, " << arg1
762  << " needs to be equal to the number of output vectors, "
763  << arg2
764  << ". This is not the case in your call of this function.");
769  "You need to specify at least one solution vector as "
770  "input.");
771 };
772 
773 
774 
775 DEAL_II_NAMESPACE_CLOSE
776 
777 #endif
static ::ExceptionBase & ExcInvalidBoundaryFunction(types::boundary_id arg1, int arg2, int arg3)
static const unsigned int invalid_unsigned_int
Definition: types.h:170
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:576
static ::ExceptionBase & ExcInvalidCoefficient()
const types::subdomain_id invalid_subdomain_id
Definition: types.h:245
static ::ExceptionBase & ExcInvalidComponentMask()
unsigned char material_id
Definition: types.h:130
Abstract base class for mapping classes.
Definition: dof_tools.h:46
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:553
std::map< types::boundary_id, const Function< dim, Number > * > type
Definition: function_map.h:81
static ::ExceptionBase & ExcIncompatibleNumberOfElements(int arg1, int arg2)
unsigned int subdomain_id
Definition: types.h:42
Definition: hp.h:102
the boundary residual estimator with the factor .
Kelly error estimator with the factor .
unsigned char boundary_id
Definition: types.h:110
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:588
Kelly error estimator with the factor .
const types::material_id invalid_material_id
Definition: types.h:191
static void estimate(const Mapping< dim, spacedim > &mapping, const DoFHandlerType &dof, const Quadrature< dim-1 > &quadrature, const typename FunctionMap< spacedim >::type &neumann_bc, const InputVector &solution, Vector< float > &error, const ComponentMask &component_mask=ComponentMask(), const Function< spacedim > *coefficients=0, const unsigned int n_threads=numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id, const types::material_id material_id=numbers::invalid_material_id, const Strategy strategy=cell_diameter_over_24)
static ::ExceptionBase & ExcNoSolutions()