Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/non_matching/immersed_surface_quadrature.h>
17 
18 DEAL_II_NAMESPACE_OPEN
19 namespace NonMatching
20 {
21 
22  template <int dim>
24  const std::vector<Point<dim> > &points,
25  const std::vector<double> &weights,
26  const std::vector<Tensor <1,dim>> &normals):
27  Quadrature<dim>(points,weights),
28  normals(normals)
29  {
30  AssertDimension (weights.size(), points.size());
31  AssertDimension (normals.size(), points.size());
32  for (auto normal : normals)
33  {
34  (void)normal;
35  Assert(std::abs(normal.norm() - 1.0) < 1e-9,
36  ExcMessage("Normal is not normalized."));
37  }
38  }
39 
40 
41 
42  template <int dim>
44  const Point<dim> &point,
45  const double weight,
46  const Tensor<1, dim> &normal)
47  {
48  this->quadrature_points.push_back(point);
49  this->weights.push_back(weight);
50  this->normals.push_back(normal);
51  Assert(std::abs(normal.norm() - 1.0) < 1e-9,
52  ExcMessage("Normal is not normalized."));
53  }
54 
55 
56 
57  template <int dim>
58  const Tensor<1,dim> &
60  const unsigned int i) const
61  {
62  AssertIndexRange(i, this->size());
63  return normals[i];
64  }
65 
66 
67 
68  template <int dim>
69  const std::vector<Tensor<1,dim> > &
71  {
72  return normals;
73  }
74 
75 
76 
77  template class ImmersedSurfaceQuadrature<1>;
78  template class ImmersedSurfaceQuadrature<2>;
79  template class ImmersedSurfaceQuadrature<3>;
80 
81 }
82 DEAL_II_NAMESPACE_CLOSE
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1248
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
#define AssertIndexRange(index, range)
Definition: exceptions.h:1284
numbers::NumberTraits< Number >::real_type norm() const
Definition: tensor.h:1273
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1142
void push_back(const Point< dim > &point, const double weight, const Tensor< 1, dim > &normal)