deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+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\}}\)
Loading...
Searching...
No Matches
fe_rannacher_turek.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2015 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
17
19
20#include <deal.II/lac/vector.h>
21
22#include <algorithm>
23#include <memory>
24#include <sstream>
25
26
28
29
30template <int dim>
32 const unsigned int order,
33 const unsigned int n_face_support_points)
34 : FE_Poly<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, ComponentMask(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
52template <int dim>
53std::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
64template <int dim>
65std::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
77template <int dim>
78std::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
87template <int dim>
88void
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
110template <int dim>
111void
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:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
STL namespace.
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()