DOLFIN
DOLFIN C++ interface
Extrapolation.h
1// Copyright (C) 2009 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// Modified by Marie E. Rognes 2010.
19// Modified by Garth N. Wells 2010.
20//
21// First added: 2009-12-08
22// Last changed: 2010-12-28
23
24#ifndef __EXTRAPOLATION_H
25#define __EXTRAPOLATION_H
26
27#include <map>
28#include <set>
29#include <vector>
30#include <Eigen/Dense>
31
32#include <dolfin/common/types.h>
33
34namespace ufc
35{
36 class cell;
37}
38
39namespace dolfin
40{
41
42 class Cell;
43 class DirichletBC;
44 class Function;
45 class FunctionSpace;
46
58
60 {
61 public:
62
64 static void extrapolate(Function& w, const Function& v);
65
66 private:
67
68 // Build data structures for unique dofs on patch of given cell
69 static void build_unique_dofs(std::set<std::size_t>& unique_dofs,
70 std::map<std::size_t, std::map<std::size_t, std::size_t> >& cell2dof2row,
71 const Cell& cell0,
72 const FunctionSpace& V);
73
74 // Compute unique dofs in given cell
75 static std::map<std::size_t, std::size_t>
76 compute_unique_dofs(const Cell& cell, const FunctionSpace& V,
77 std::size_t& row, std::set<std::size_t>& unique_dofs);
78
79 // Compute coefficients on given cell
80 static void
81 compute_coefficients(std::vector<std::vector<double> >& coefficients,
82 const Function&v, const FunctionSpace& V,
83 const FunctionSpace& W, const Cell& cell0,
84 const std::vector<double>& coordinate_dofs0,
85 const ufc::cell& c0,
86 const Eigen::Ref<const Eigen::Matrix<dolfin::la_index, Eigen::Dynamic, 1>> dofs,
87 std::size_t& offset);
88
89 // Add equations for current cell
90 static void add_cell_equations(Eigen::MatrixXd& A,
91 Eigen::VectorXd& b,
92 const Cell& cell0,
93 const Cell& cell1,
94 const std::vector<double>& coordinate_dofs0,
95 const std::vector<double>& coordinate_dofs1,
96 const ufc::cell& c0,
97 const ufc::cell& c1,
98 const FunctionSpace& V,
99 const FunctionSpace& W,
100 const Function& v,
101 std::map<std::size_t, std::size_t>& dof2row);
102
103 // Average coefficients
104 static void
105 average_coefficients(Function& w,
106 std::vector<std::vector<double> >& coefficients);
107
108 };
109
110}
111
112#endif
A Cell is a MeshEntity of topological codimension 0.
Definition: Cell.h:43
Definition: Extrapolation.h:60
static void extrapolate(Function &w, const Function &v)
Compute extrapolation w from v.
Definition: Extrapolation.cpp:45
Definition: FunctionSpace.h:54
Definition: Function.h:66
Definition: adapt.h:30