Reference documentation for deal.II version 9.1.0-pre
immersed_surface_quadrature.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2017 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 #include <deal.II/non_matching/immersed_surface_quadrature.h>
17 
18 DEAL_II_NAMESPACE_OPEN
19 namespace NonMatching
20 {
21  template <int dim>
23  const std::vector<Point<dim>> & points,
24  const std::vector<double> & weights,
25  const std::vector<Tensor<1, dim>> &normals)
26  : Quadrature<dim>(points, weights)
27  , normals(normals)
28  {
29  AssertDimension(weights.size(), points.size());
30  AssertDimension(normals.size(), points.size());
31  for (auto normal : normals)
32  {
33  (void)normal;
34  Assert(std::abs(normal.norm() - 1.0) < 1e-9,
35  ExcMessage("Normal is not normalized."));
36  }
37  }
38 
39 
40 
41  template <int dim>
42  void
44  const double weight,
45  const Tensor<1, dim> &normal)
46  {
47  this->quadrature_points.push_back(point);
48  this->weights.push_back(weight);
49  this->normals.push_back(normal);
50  Assert(std::abs(normal.norm() - 1.0) < 1e-9,
51  ExcMessage("Normal is not normalized."));
52  }
53 
54 
55 
56  template <int dim>
57  const Tensor<1, dim> &
59  {
60  AssertIndexRange(i, this->size());
61  return normals[i];
62  }
63 
64 
65 
66  template <int dim>
67  const std::vector<Tensor<1, dim>> &
69  {
70  return normals;
71  }
72 
73 
74 
75  template class ImmersedSurfaceQuadrature<1>;
76  template class ImmersedSurfaceQuadrature<2>;
77  template class ImmersedSurfaceQuadrature<3>;
78 
79 } // namespace NonMatching
80 DEAL_II_NAMESPACE_CLOSE
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1366
std::vector< double > weights
Definition: quadrature.h:273
const std::vector< Tensor< 1, dim > > & get_normal_vectors() const
#define AssertIndexRange(index, range)
Definition: exceptions.h:1407
numbers::NumberTraits< Number >::real_type norm() const
Definition: tensor.h:1301
const Point< dim > & point(const unsigned int i) const
unsigned int size() const
static::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1227
double weight(const unsigned int i) const
std::vector< Point< dim > > quadrature_points
Definition: quadrature.h:267
const Tensor< 1, dim > & normal_vector(const unsigned int i) const
void push_back(const Point< dim > &point, const double weight, const Tensor< 1, dim > &normal)