17 #include <deal.II/base/utilities.h> 18 #include <deal.II/base/quadrature.h> 19 #include <deal.II/base/quadrature_lib.h> 20 #include <deal.II/base/qprojector.h> 21 #include <deal.II/base/table.h> 22 #include <deal.II/grid/tria.h> 23 #include <deal.II/grid/tria_iterator.h> 24 #include <deal.II/dofs/dof_accessor.h> 25 #include <deal.II/fe/fe.h> 26 #include <deal.II/fe/mapping.h> 27 #include <deal.II/fe/fe_raviart_thomas.h> 28 #include <deal.II/fe/fe_values.h> 29 #include <deal.II/fe/fe_tools.h> 33 #include <deal.II/base/std_cxx14/memory.h> 40 DEAL_II_NAMESPACE_OPEN
52 std::vector<bool>(dim,true)))
86 for (
unsigned int i=0; i<GeometryInfo<dim>::max_children_per_face; ++i)
88 FETools::compute_face_embedding_matrices<dim,double>(*
this, face_embeddings, 0, 0);
91 unsigned int target_row=0;
92 for (
unsigned int d=0; d<GeometryInfo<dim>::max_children_per_face; ++d)
93 for (
unsigned int i=0; i<face_embeddings[d].m(); ++i)
95 for (
unsigned int j=0; j<face_embeddings[d].n(); ++j)
118 std::ostringstream namebuf;
119 namebuf <<
"FE_RaviartThomas<" << dim <<
">(" << this->degree-1 <<
")";
121 return namebuf.str();
126 std::unique_ptr<FiniteElement<dim,dim> >
129 return std_cxx14::make_unique<FE_RaviartThomas<dim>>(*this);
143 const unsigned int n_interior_points
144 = (deg>0) ? cell_quadrature.
size() : 0;
146 unsigned int n_face_points = (dim>1) ? 1 : 0;
148 for (
unsigned int d=1; d<dim; ++d)
149 n_face_points *= deg+1;
153 + n_interior_points);
154 this->generalized_face_support_points.resize (n_face_points);
157 unsigned int current = 0;
161 QGauss<dim-1> face_points (deg+1);
165 boundary_weights.reinit(n_face_points, legendre.n());
170 for (
unsigned int k=0; k<n_face_points; ++k)
172 this->generalized_face_support_points[k] = face_points.point(k);
176 for (
unsigned int i=0; i<legendre.n(); ++i)
178 boundary_weights(k, i)
179 = face_points.weight(k)
180 * legendre.compute_value(i, face_points.point(k));
185 for (; current<GeometryInfo<dim>::faces_per_cell*n_face_points;
197 std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
198 for (
unsigned int dd=0; dd<dim; ++dd)
200 std::vector<std::vector<Polynomials::Polynomial<double> > > poly(dim);
201 for (
unsigned int d=0; d<dim; ++d)
205 polynomials[dd] = std_cxx14::make_unique<AnisotropicPolynomials<dim>>(poly);
208 interior_weights.reinit(
TableIndices<3>(n_interior_points, polynomials[0]->n(), dim));
210 for (
unsigned int k=0; k<cell_quadrature.
size(); ++k)
212 this->generalized_support_points[current++] = cell_quadrature.
point(k);
213 for (
unsigned int i=0; i<polynomials[0]->n(); ++i)
214 for (
unsigned int d=0; d<dim; ++d)
215 interior_weights(k,i,d) = cell_quadrature.
weight(k)
216 * polynomials[d]->compute_value(i,cell_quadrature.
point(k));
219 Assert (current == this->generalized_support_points.size(),
232 for (
unsigned int i=0; i<GeometryInfo<1>::max_children_per_cell; ++i)
233 this->restriction[0][i].reinit(0,0);
254 QGauss<dim-1> q_base (this->degree);
255 const unsigned int n_face_points = q_base.size();
258 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
270 for (
unsigned int k=0; k<q_face.
size(); ++k)
271 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
272 cached_values_on_face(i,k)
273 = this->shape_value_component(i, q_face.
point(k),
276 for (
unsigned int sub=0; sub<GeometryInfo<dim>::max_children_per_face; ++sub)
284 const unsigned int child
300 for (
unsigned int k=0; k<n_face_points; ++k)
301 for (
unsigned int i_child = 0; i_child < this->dofs_per_cell; ++i_child)
302 for (
unsigned int i_face = 0; i_face < this->dofs_per_face; ++i_face)
309 this->restriction[iso][child](face*this->dofs_per_face+i_face,
311 += Utilities::fixed_power<dim-1>(.5) * q_sub.
weight(k)
312 * cached_values_on_face(i_child, k)
313 * this->shape_value_component(face*this->dofs_per_face+i_face,
320 if (this->degree == 1)
return;
324 std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
325 for (
unsigned int dd=0; dd<dim; ++dd)
327 std::vector<std::vector<Polynomials::Polynomial<double> > > poly(dim);
328 for (
unsigned int d=0; d<dim; ++d)
332 polynomials[dd] = std_cxx14::make_unique<AnisotropicPolynomials<dim>>(poly);
336 const unsigned int start_cell_dofs
343 for (
unsigned int k=0; k<q_cell.
size(); ++k)
344 for (
unsigned int i = 0; i < this->dofs_per_cell; ++i)
345 for (
unsigned int d=0; d<dim; ++d)
346 cached_values_on_cell(i,k,d) = this->shape_value_component(i, q_cell.
point(k), d);
348 for (
unsigned int child=0; child<GeometryInfo<dim>::max_children_per_cell; ++child)
352 for (
unsigned int k=0; k<q_sub.
size(); ++k)
353 for (
unsigned int i_child = 0; i_child < this->dofs_per_cell; ++i_child)
354 for (
unsigned int d=0; d<dim; ++d)
355 for (
unsigned int i_weight=0; i_weight<polynomials[d]->n(); ++i_weight)
357 this->restriction[iso][child](start_cell_dofs+i_weight*dim+d,
360 * cached_values_on_cell(i_child, k, d)
361 * polynomials[d]->compute_value(i_weight, q_sub.
point(k));
369 std::vector<unsigned int>
374 unsigned int dofs_per_face = 1;
375 for (
unsigned int d=1; d<dim; ++d)
376 dofs_per_face *= deg+1;
380 interior_dofs = dim*deg*dofs_per_face;
382 std::vector<unsigned int> dpo(dim+1);
383 dpo[dim-1] = dofs_per_face;
384 dpo[dim] = interior_dofs;
392 std::pair<Table<2,bool>, std::vector<unsigned int> >
396 for (
unsigned int d=0; d<dim; ++d)
397 for (
unsigned int i=0; i<this->dofs_per_cell; ++i)
398 constant_modes(d,i) =
true;
399 std::vector<unsigned int> components;
400 for (
unsigned int d=0; d<dim; ++d)
401 components.push_back(d);
402 return std::pair<Table<2,bool>, std::vector<unsigned int> >
403 (constant_modes, components);
416 const unsigned int shape_index,
417 const unsigned int face_index)
const 419 Assert (shape_index < this->dofs_per_cell,
427 switch (this->degree)
461 std::vector<double> &nodal_values)
const 463 Assert (support_point_values.size() == this->generalized_support_points.size(),
465 Assert (nodal_values.size() == this->dofs_per_cell,
470 std::fill(nodal_values.begin(), nodal_values.end(), 0.);
472 const unsigned int n_face_points = boundary_weights.size(0);
473 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
474 for (
unsigned int k=0; k<n_face_points; ++k)
475 for (
unsigned int i=0; i<boundary_weights.size(1); ++i)
477 nodal_values[i+face*this->dofs_per_face] += boundary_weights(k,i)
484 for (
unsigned int k=0; k<interior_weights.size(0); ++k)
485 for (
unsigned int i=0; i<interior_weights.size(1); ++i)
486 for (
unsigned int d=0; d<dim; ++d)
487 nodal_values[start_cell_dofs+i*dim+d] += interior_weights(k,i,d) * support_point_values[k+start_cell_points](d);
503 #include "fe_raviart_thomas.inst" 506 DEAL_II_NAMESPACE_CLOSE
virtual std::string get_name() const
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const
static Quadrature< dim > project_to_child(const Quadrature< dim > &quadrature, const unsigned int child_no)
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const
FullMatrix< double > interface_constraints
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
const Point< dim > & point(const unsigned int i) const
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
friend class FE_RaviartThomas
std::vector< std::vector< FullMatrix< double > > > prolongation
void invert(const FullMatrix< number2 > &M)
static unsigned int child_cell_on_face(const RefinementCase< dim > &ref_case, const unsigned int face, const unsigned int subface, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const RefinementCase< dim-1 > &face_refinement_case=RefinementCase< dim-1 >::isotropic_refinement)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
static void project_to_subface(const SubQuadrature &quadrature, const unsigned int face_no, const unsigned int subface_no, std::vector< Point< dim > > &q_points, const RefinementCase< dim-1 > &ref_case=RefinementCase< dim-1 >::isotropic_refinement)
void initialize_support_points(const unsigned int rt_degree)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual std::size_t memory_consumption() const
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
void initialize_restriction()
unsigned int size() const
const unsigned int dofs_per_cell
static Quadrature< dim > project_to_all_faces(const SubQuadrature &quadrature)
static void project_to_face(const SubQuadrature &quadrature, const unsigned int face_no, std::vector< Point< dim > > &q_points)
const unsigned int dofs_per_face
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false, const bool isotropic_prolongation_only=false)
static ::ExceptionBase & ExcNotImplemented()
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
FullMatrix< double > inverse_node_matrix
double weight(const unsigned int i) const
static ::ExceptionBase & ExcInternalError()