deal.II version 9.8.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\}}\)
Loading...
Searching...
No Matches
fe_rannacher_turek.cc
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2015 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
15
17
18#include <deal.II/lac/vector.h>
19
20#include <algorithm>
21#include <memory>
22#include <sstream>
23
24
26
27
28template <int dim>
30 const unsigned int order,
31 const unsigned int n_face_support_points)
32 : FE_Poly<dim>(
35 1,
36 2,
37 FiniteElementData<dim>::L2),
38 std::vector<bool>(4, false), // restriction not implemented
39 std::vector<ComponentMask>(4, ComponentMask(std::vector<bool>(1, true))))
40 , order(order)
42{
43 Assert(dim == 2, ExcNotImplemented());
46}
47
48
49
50template <int dim>
51std::vector<unsigned int>
53{
54 std::vector<unsigned int> dpo(dim + 1, 0);
55 dpo[dim - 1] = 1;
56
57 return dpo;
58}
59
60
61
62template <int dim>
63std::string
65{
66 std::ostringstream namebuf;
67 namebuf << "FE_RannacherTurek"
68 << "<" << dim << ">"
69 << "(" << this->order << ", " << this->n_face_support_points << ")";
70 return namebuf.str();
71}
72
73
74
75template <int dim>
76std::unique_ptr<FiniteElement<dim, dim>>
78{
79 return std::make_unique<FE_RannacherTurek<dim>>(this->order,
81}
82
83
84
85template <int dim>
86void
88{
89 Assert(dim == 2, ExcNotImplemented());
90 ::QGauss<dim - 1> face_quadrature(this->n_face_support_points);
91 this->weights = face_quadrature.get_weights();
92 this->generalized_support_points.resize(4 * face_quadrature.size());
93 for (unsigned int q = 0; q < face_quadrature.size(); ++q)
94 {
95 this->generalized_support_points[0 * face_quadrature.size() + q] =
96 ::Point<dim>(0, 1 - face_quadrature.point(q)[0]);
97 this->generalized_support_points[1 * face_quadrature.size() + q] =
98 ::Point<dim>(1, 1 - face_quadrature.point(q)[0]);
99 this->generalized_support_points[2 * face_quadrature.size() + q] =
100 ::Point<dim>(face_quadrature.point(q)[0], 0);
101 this->generalized_support_points[3 * face_quadrature.size() + q] =
102 ::Point<dim>(face_quadrature.point(q)[0], 1);
103 }
104}
105
106
107
108template <int dim>
109void
111 const std::vector<Vector<double>> &support_point_values,
112 std::vector<double> &nodal_values) const
113{
114 AssertDimension(support_point_values.size(),
115 this->generalized_support_points.size());
116 AssertDimension(nodal_values.size(), this->n_dofs_per_cell());
117
118 const unsigned int q_points_per_face = this->weights.size();
119 std::fill(nodal_values.begin(), nodal_values.end(), 0.0);
120
121 std::vector<Vector<double>>::const_iterator value =
122 support_point_values.begin();
123 for (const unsigned int face : ::GeometryInfo<dim>::face_indices())
124 {
125 for (unsigned int q = 0; q < q_points_per_face; ++q)
126 {
127 nodal_values[face] += (*value)[0] * this->weights[q];
128 ++value;
129 }
130 }
131}
132
133
134
135// explicit instantiations
136#include "fe/fe_rannacher_turek.inst"
137
FE_Poly(const ScalarPolynomialsBase< dim > &poly_space, const FiniteElementData< dim > &fe_data, const std::vector< bool > &restriction_is_additive_flags, const std::vector< ComponentMask > &nonzero_components)
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
std::vector< double > weights
const unsigned int n_face_support_points
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()
FiniteElementData(const std::vector< unsigned int > &dofs_per_object, const unsigned int n_components, const unsigned int degree, const Conformity conformity=unknown, const BlockIndices &block_indices=BlockIndices())
Definition fe_data.cc:112
std::vector< Point< dim > > generalized_support_points
Definition fe.h:2598
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
const bool IsBlockVector< VectorType >::value
STL namespace.
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()