Reference documentation for deal.II version GIT f0f8c7fe18 2023-03-21 21:25:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
fe_rannacher_turek.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2015 - 2020 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
18 
20 
21 #include <deal.II/lac/vector.h>
22 
23 #include <algorithm>
24 #include <memory>
25 #include <sstream>
26 
27 
29 
30 
31 template <int dim>
33  const unsigned int order,
34  const unsigned int n_face_support_points)
35  : FE_Poly<dim>(PolynomialsRannacherTurek<dim>(),
36  FiniteElementData<dim>(this->get_dpo_vector(),
37  1,
38  2,
39  FiniteElementData<dim>::L2),
40  std::vector<bool>(4, false), // restriction not implemented
41  std::vector<ComponentMask>(4, std::vector<bool>(1, true)))
42  , order(order)
43  , n_face_support_points(n_face_support_points)
44 {
45  Assert(dim == 2, ExcNotImplemented());
48 }
49 
50 
51 
52 template <int dim>
53 std::vector<unsigned int>
55 {
56  std::vector<unsigned int> dpo(dim + 1, 0);
57  dpo[dim - 1] = 1;
58 
59  return dpo;
60 }
61 
62 
63 
64 template <int dim>
65 std::string
67 {
68  std::ostringstream namebuf;
69  namebuf << "FE_RannacherTurek"
70  << "<" << dim << ">"
71  << "(" << this->order << ", " << this->n_face_support_points << ")";
72  return namebuf.str();
73 }
74 
75 
76 
77 template <int dim>
78 std::unique_ptr<FiniteElement<dim, dim>>
80 {
81  return std::make_unique<FE_RannacherTurek<dim>>(this->order,
82  this->n_face_support_points);
83 }
84 
85 
86 
87 template <int dim>
88 void
90 {
91  Assert(dim == 2, ExcNotImplemented());
92  ::QGauss<dim - 1> face_quadrature(this->n_face_support_points);
93  this->weights = face_quadrature.get_weights();
94  this->generalized_support_points.resize(4 * face_quadrature.size());
95  for (unsigned int q = 0; q < face_quadrature.size(); ++q)
96  {
97  this->generalized_support_points[0 * face_quadrature.size() + q] =
98  ::Point<dim>(0, 1 - face_quadrature.point(q)(0));
99  this->generalized_support_points[1 * face_quadrature.size() + q] =
100  ::Point<dim>(1, 1 - face_quadrature.point(q)(0));
101  this->generalized_support_points[2 * face_quadrature.size() + q] =
102  ::Point<dim>(face_quadrature.point(q)(0), 0);
103  this->generalized_support_points[3 * face_quadrature.size() + q] =
104  ::Point<dim>(face_quadrature.point(q)(0), 1);
105  }
106 }
107 
108 
109 
110 template <int dim>
111 void
113  const std::vector<Vector<double>> &support_point_values,
114  std::vector<double> & nodal_values) const
115 {
116  AssertDimension(support_point_values.size(),
117  this->generalized_support_points.size());
118  AssertDimension(nodal_values.size(), this->n_dofs_per_cell());
119 
120  const unsigned int q_points_per_face = this->weights.size();
121  std::fill(nodal_values.begin(), nodal_values.end(), 0.0);
122 
123  std::vector<Vector<double>>::const_iterator value =
124  support_point_values.begin();
125  for (const unsigned int face : ::GeometryInfo<dim>::face_indices())
126  {
127  for (unsigned int q = 0; q < q_points_per_face; ++q)
128  {
129  nodal_values[face] += (*value)[0] * this->weights[q];
130  ++value;
131  }
132  }
133 }
134 
135 
136 
137 // explicit instantiations
138 #include "fe_rannacher_turek.inst"
139 
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
const unsigned int order
FE_RannacherTurek(const unsigned int order=0, const unsigned int n_face_support_points=2)
virtual std::string get_name() const override
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double >> &support_point_values, std::vector< double > &nodal_values) const override
std::vector< unsigned int > get_dpo_vector()
Definition: point.h:110
Definition: vector.h:109
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:474
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:475
#define Assert(cond, exc)
Definition: exceptions.h:1586
static ::ExceptionBase & ExcNotImplemented()
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1759
std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
void L2(Vector< number > &result, const FEValuesBase< dim > &fe, const std::vector< double > &input, const double factor=1.)
Definition: l2.h:160