DOLFIN
DOLFIN C++ interface
AdaptiveNonlinearVariationalSolver.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_NONLINEAR_VARIATIONAL_SOLVER_H
25 #define __ADAPTIVE_NONLINEAR_VARIATIONAL_SOLVER_H
26 
27 #include <memory>
28 
29 #include "GenericAdaptiveVariationalSolver.h"
30 
31 namespace dolfin
32 {
33  // Forward declarations
34  class DirichletBC;
35  class Function;
36  class NonlinearVariationalProblem;
37  class GoalFunctional;
38  class Mesh;
39 
62 
65  {
66  public:
67 
75  AdaptiveNonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem,
76  std::shared_ptr<GoalFunctional> goal);
77 
88  AdaptiveNonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem,
89  std::shared_ptr<Form> goal,
90  std::shared_ptr<ErrorControl> control);
91 
92 
95 
101  virtual std::shared_ptr<const Function> solve_primal();
102 
108  virtual std::vector<std::shared_ptr<const DirichletBC>>
109  extract_bcs() const;
110 
122  virtual double evaluate_goal(Form& M,
123  std::shared_ptr<const Function> u) const;
124 
130  virtual void adapt_problem(std::shared_ptr<const Mesh> mesh);
131 
132  protected:
133 
139  virtual std::size_t num_dofs_primal();
140 
141  private:
142 
150  void init(std::shared_ptr<NonlinearVariationalProblem> problem,
151  std::shared_ptr<GoalFunctional> goal);
152 
153  // The problem
154  std::shared_ptr<NonlinearVariationalProblem> _problem;
155 
156  };
157 
158 }
159 
160 #endif
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
std::shared_ptr< Form > goal
The goal functional.
Definition: GenericAdaptiveVariationalSolver.h:139
virtual void adapt_problem(std::shared_ptr< const Mesh > mesh)
Definition: AdaptiveNonlinearVariationalSolver.cpp:107
virtual std::vector< std::shared_ptr< const DirichletBC > > extract_bcs() const
Definition: AdaptiveNonlinearVariationalSolver.cpp:95
virtual double evaluate_goal(Form &M, std::shared_ptr< const Function > u) const
Definition: AdaptiveNonlinearVariationalSolver.cpp:101
virtual std::size_t num_dofs_primal()
Definition: AdaptiveNonlinearVariationalSolver.cpp:114
AdaptiveNonlinearVariationalSolver(std::shared_ptr< NonlinearVariationalProblem > problem, std::shared_ptr< GoalFunctional > goal)
Definition: AdaptiveNonlinearVariationalSolver.cpp:38
~AdaptiveNonlinearVariationalSolver()
Destructor.
Definition: AdaptiveNonlinearVariationalSolver.h:94
virtual std::shared_ptr< const Function > solve_primal()
Definition: AdaptiveNonlinearVariationalSolver.cpp:85
Definition: AdaptiveNonlinearVariationalSolver.h:63