DOLFIN
DOLFIN C++ interface
AdaptiveLinearVariationalSolver.h
1 // Copyright (C) 2010--2012 Marie E. Rognes
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 Anders Logg, 2010-2011.
19 // Modified by Garth N. Wells, 2011.
20 //
21 // First added: 2010-08-19
22 // Last changed: 2012-11-14
23 
24 #ifndef __ADAPTIVE_LINEAR_VARIATIONAL_SOLVER_H
25 #define __ADAPTIVE_LINEAR_VARIATIONAL_SOLVER_H
26 
27 #include <memory>
28 #include "GenericAdaptiveVariationalSolver.h"
29 
30 namespace dolfin
31 {
32  // Forward declarations
33  class DirichletBC;
34  class Form;
35  class Function;
36  class LinearVariationalProblem;
37  class GoalFunctional;
38  class Mesh;
39 
62 
65  {
66  public:
67 
75  AdaptiveLinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem,
76  std::shared_ptr<GoalFunctional> goal);
77 
88  AdaptiveLinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem,
89  std::shared_ptr<Form> goal,
90  std::shared_ptr<ErrorControl> control);
91 
94 
100  virtual std::shared_ptr<const Function> solve_primal();
101 
107  virtual std::vector<std::shared_ptr<const DirichletBC>> extract_bcs() const;
108 
120  virtual double evaluate_goal(Form& M,
121  std::shared_ptr<const Function> u) const;
122 
128  virtual void adapt_problem(std::shared_ptr<const Mesh> mesh);
129 
130  protected:
131 
137  virtual std::size_t num_dofs_primal();
138 
139  private:
140 
148  void init(std::shared_ptr<LinearVariationalProblem> problem,
149  std::shared_ptr<GoalFunctional> goal);
150 
151  // The primal problem
152  std::shared_ptr<LinearVariationalProblem> _problem;
153 
154  };
155 
156 }
157 
158 #endif
virtual double evaluate_goal(Form &M, std::shared_ptr< const Function > u) const
Definition: AdaptiveLinearVariationalSolver.cpp:104
std::shared_ptr< ErrorControl > control
Error control object.
Definition: GenericAdaptiveVariationalSolver.h:142
Base class for UFC code generated by FFC for DOLFIN with option -l.
Definition: Form.h:85
Definition: GenericAdaptiveVariationalSolver.h:45
Definition: adapt.h:29
virtual std::size_t num_dofs_primal()
Definition: AdaptiveLinearVariationalSolver.cpp:118
~AdaptiveLinearVariationalSolver()
Destructor.
Definition: AdaptiveLinearVariationalSolver.h:93
std::shared_ptr< Form > goal
The goal functional.
Definition: GenericAdaptiveVariationalSolver.h:139
virtual std::shared_ptr< const Function > solve_primal()
Definition: AdaptiveLinearVariationalSolver.cpp:87
virtual void adapt_problem(std::shared_ptr< const Mesh > mesh)
Definition: AdaptiveLinearVariationalSolver.cpp:112
Definition: AdaptiveLinearVariationalSolver.h:63
AdaptiveLinearVariationalSolver(std::shared_ptr< LinearVariationalProblem > problem, std::shared_ptr< GoalFunctional > goal)
Definition: AdaptiveLinearVariationalSolver.cpp:39
virtual std::vector< std::shared_ptr< const DirichletBC > > extract_bcs() const
Definition: AdaptiveLinearVariationalSolver.cpp:97