Reference documentation for deal.II version 9.2.0
\(\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 
19 
21 
22 #include <deal.II/lac/vector.h>
23 
24 #include <algorithm>
25 #include <sstream>
26 
27 
29 
30 
31 template <int dim>
33  const unsigned int order,
34  const unsigned int n_face_support_points)
37  FiniteElementData<dim>(this->get_dpo_vector(),
38  1,
39  2,
40  FiniteElementData<dim>::L2),
41  std::vector<bool>(4, false), // restriction not implemented
42  std::vector<ComponentMask>(4, std::vector<bool>(1, true)))
43  , order(order)
44  , n_face_support_points(n_face_support_points)
45 {
46  Assert(dim == 2, ExcNotImplemented());
49 }
50 
51 
52 
53 template <int dim>
54 std::vector<unsigned int>
56 {
57  std::vector<unsigned int> dpo(dim + 1, 0);
58  dpo[dim - 1] = 1;
59 
60  return dpo;
61 }
62 
63 
64 
65 template <int dim>
66 std::string
68 {
69  std::ostringstream namebuf;
70  namebuf << "FE_RannacherTurek"
71  << "<" << dim << ">"
72  << "(" << this->order << ", " << this->n_face_support_points << ")";
73  return namebuf.str();
74 }
75 
76 
77 
78 template <int dim>
79 std::unique_ptr<FiniteElement<dim, dim>>
81 {
82  return std_cxx14::make_unique<FE_RannacherTurek<dim>>(
83  this->order, this->n_face_support_points);
84 }
85 
86 
87 
88 template <int dim>
89 void
91 {
92  Assert(dim == 2, ExcNotImplemented());
93  ::QGauss<dim - 1> face_quadrature(this->n_face_support_points);
94  this->weights = face_quadrature.get_weights();
95  this->generalized_support_points.resize(4 * face_quadrature.size());
96  for (unsigned int q = 0; q < face_quadrature.size(); ++q)
97  {
98  this->generalized_support_points[0 * face_quadrature.size() + q] =
99  ::Point<dim>(0, 1 - face_quadrature.point(q)(0));
100  this->generalized_support_points[1 * face_quadrature.size() + q] =
101  ::Point<dim>(1, 1 - face_quadrature.point(q)(0));
102  this->generalized_support_points[2 * face_quadrature.size() + q] =
103  ::Point<dim>(face_quadrature.point(q)(0), 0);
104  this->generalized_support_points[3 * face_quadrature.size() + q] =
105  ::Point<dim>(face_quadrature.point(q)(0), 1);
106  }
107 }
108 
109 
110 
111 template <int dim>
112 void
114  const std::vector<Vector<double>> &support_point_values,
115  std::vector<double> & nodal_values) const
116 {
117  AssertDimension(support_point_values.size(),
118  this->generalized_support_points.size());
119  AssertDimension(nodal_values.size(), this->dofs_per_cell);
120 
121  const unsigned int q_points_per_face = this->weights.size();
122  std::fill(nodal_values.begin(), nodal_values.end(), 0.0);
123 
124  std::vector<Vector<double>>::const_iterator value =
125  support_point_values.begin();
126  for (const unsigned int face : ::GeometryInfo<dim>::face_indices())
127  {
128  for (unsigned int q = 0; q < q_points_per_face; ++q)
129  {
130  nodal_values[face] += (*value)[0] * this->weights[q];
131  ++value;
132  }
133  }
134 }
135 
136 
137 
138 // explicit instantiations
139 #include "fe_rannacher_turek.inst"
140 
StandardExceptions::ExcNotImplemented
static ::ExceptionBase & ExcNotImplemented()
FiniteElementData
Definition: fe_base.h:147
FE_RannacherTurek::convert_generalized_support_point_values_to_dof_values
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
Definition: fe_rannacher_turek.cc:113
GeometryInfo
Definition: geometry_info.h:1224
ComponentMask
Definition: component_mask.h:83
FE_RannacherTurek::order
const unsigned int order
Definition: fe_rannacher_turek.h:113
quadrature_lib.h
fe_rannacher_turek.h
bool
FE_RannacherTurek::initialize_support_points
void initialize_support_points()
Definition: fe_rannacher_turek.cc:90
FE_RannacherTurek::get_name
virtual std::string get_name() const override
Definition: fe_rannacher_turek.cc:67
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
AssertDimension
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1579
QGauss
Definition: quadrature_lib.h:40
FE_RannacherTurek::clone
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
Definition: fe_rannacher_turek.cc:80
LocalIntegrators::L2::L2
void L2(Vector< number > &result, const FEValuesBase< dim > &fe, const std::vector< double > &input, const double factor=1.)
Definition: l2.h:171
value
static const bool value
Definition: dof_tools_constraints.cc:433
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
vector.h
FE_RannacherTurek::get_dpo_vector
std::vector< unsigned int > get_dpo_vector()
Definition: fe_rannacher_turek.cc:55
FE_Poly
Definition: fe_poly.h:76
Point< dim >
memory.h
PolynomialsRannacherTurek
Definition: polynomials_rannacher_turek.h:44
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
FE_RannacherTurek::FE_RannacherTurek
FE_RannacherTurek(const unsigned int order=0, const unsigned int n_face_support_points=2)
Definition: fe_rannacher_turek.cc:32
Vector< double >