~ubuntu-branches/ubuntu/wily/dolfin/wily-proposed

« back to all changes in this revision

Viewing changes to dolfin/multistage/MultiStageScheme.h

  • Committer: Package Import Robot
  • Author(s): Johannes Ring
  • Date: 2014-09-22 14:35:34 UTC
  • mfrom: (1.1.17) (19.1.23 sid)
  • Revision ID: package-import@ubuntu.com-20140922143534-0yi89jyuqbgdxwm9
Tags: 1.4.0+dfsg-4
* debian/control: Disable libcgal-dev on i386, mipsel and sparc.
* debian/rules: Remove bad directives in pkg-config file dolfin.pc
  (closes: #760658).
* Remove debian/libdolfin-dev.lintian-overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17
17
//
18
18
// First added:  2013-02-15
19
 
// Last changed: 2013-04-02
 
19
// Last changed: 2014-03-05
20
20
 
21
21
#ifndef __BUTCHERSCHEME_H
22
22
#define __BUTCHERSCHEME_H
23
23
 
24
24
#include <vector>
25
 
#include <boost/shared_ptr.hpp>
 
25
#include <memory>
26
26
 
27
27
#include <dolfin/common/Variable.h>
28
 
#include <dolfin/function/FunctionAXPY.h>
29
28
#include <dolfin/function/Function.h>
30
29
#include <dolfin/fem/Form.h>
31
30
 
47
46
 
48
47
    /// Constructor
49
48
    /// FIXME: This constructor is a MESS. Needs clean up...
50
 
    MultiStageScheme(std::vector<std::vector<boost::shared_ptr<const Form> > > stage_forms, 
51
 
                  const FunctionAXPY& last_stage, 
52
 
                  std::vector<boost::shared_ptr<Function> > stage_solutions,
53
 
                  boost::shared_ptr<Function> u, 
54
 
                  boost::shared_ptr<Constant> t, 
55
 
                  boost::shared_ptr<Constant> dt,
 
49
    MultiStageScheme(std::vector<std::vector<std::shared_ptr<const Form> > > stage_forms, 
 
50
                  std::shared_ptr<const Form> last_stage, 
 
51
                  std::vector<std::shared_ptr<Function> > stage_solutions,
 
52
                  std::shared_ptr<Function> u, 
 
53
                  std::shared_ptr<Constant> t, 
 
54
                  std::shared_ptr<Constant> dt,
56
55
                  std::vector<double> dt_stage_offset, 
 
56
                  std::vector<int> jacobian_indices,
57
57
                  unsigned int order,
58
58
                  const std::string name,
59
59
                  const std::string human_form);
60
60
 
61
61
    /// Constructor with Boundary conditions
62
 
    MultiStageScheme(std::vector<std::vector<boost::shared_ptr<const Form> > > stage_forms, 
63
 
                  const FunctionAXPY& last_stage, 
64
 
                  std::vector<boost::shared_ptr<Function> > stage_solutions,
65
 
                  boost::shared_ptr<Function> u, 
66
 
                  boost::shared_ptr<Constant> t, 
67
 
                  boost::shared_ptr<Constant> dt, 
 
62
    MultiStageScheme(std::vector<std::vector<std::shared_ptr<const Form> > > stage_forms, 
 
63
                  std::shared_ptr<const Form> last_stage, 
 
64
                  std::vector<std::shared_ptr<Function> > stage_solutions,
 
65
                  std::shared_ptr<Function> u, 
 
66
                  std::shared_ptr<Constant> t, 
 
67
                  std::shared_ptr<Constant> dt, 
68
68
                  std::vector<double> dt_stage_offset, 
 
69
                  std::vector<int> jacobian_indices,
69
70
                  unsigned int order,
70
71
                  const std::string name,
71
72
                  const std::string human_form,
72
73
                  std::vector<const DirichletBC* > bcs);
73
74
 
74
75
    /// Return the stages
75
 
    std::vector<std::vector<boost::shared_ptr<const Form> > >& stage_forms();
 
76
    std::vector<std::vector<std::shared_ptr<const Form> > >& stage_forms();
76
77
 
77
78
    /// Return the last stage
78
 
    FunctionAXPY& last_stage();
 
79
    std::shared_ptr<const Form> last_stage();
79
80
 
80
81
    /// Return stage solutions
81
 
    std::vector<boost::shared_ptr<Function> >& stage_solutions();
 
82
    std::vector<std::shared_ptr<Function> >& stage_solutions();
82
83
    
83
84
    /// Return solution variable
84
 
    boost::shared_ptr<Function> solution();
 
85
    std::shared_ptr<Function> solution();
85
86
 
86
87
    /// Return solution variable (const version)
87
 
    boost::shared_ptr<const Function> solution() const;
 
88
    std::shared_ptr<const Function> solution() const;
88
89
 
89
90
    /// Return local time
90
 
    boost::shared_ptr<Constant> t();
 
91
    std::shared_ptr<Constant> t();
91
92
 
92
93
    /// Return local timestep
93
 
    boost::shared_ptr<Constant> dt();
 
94
    std::shared_ptr<Constant> dt();
94
95
 
95
96
    /// Return local timestep
96
97
    const std::vector<double>& dt_stage_offset() const;
107
108
    /// Return true if the whole scheme is implicit
108
109
    bool implicit() const;
109
110
 
 
111
    // Return a distinct jacobian index for a given stage if negative the 
 
112
    // stage is explicit and hence no jacobian needed.
 
113
    int jacobian_index(unsigned int stage) const;
 
114
 
110
115
    /// Return informal string representation (pretty-print)
111
116
    virtual std::string str(bool verbose) const;
112
117
 
116
121
    void _check_arguments();
117
122
 
118
123
    // Vector of forms for the different RK stages
119
 
    std::vector<std::vector<boost::shared_ptr<const Form> > > _stage_forms;
 
124
    std::vector<std::vector<std::shared_ptr<const Form> > > _stage_forms;
120
125
 
121
126
    // A linear combination of solutions for the last stage
122
 
    FunctionAXPY _last_stage;
 
127
    std::shared_ptr<const Form> _last_stage;
123
128
    
124
129
    // Solutions for the different stages
125
 
    std::vector<boost::shared_ptr<Function> > _stage_solutions;
 
130
    std::vector<std::shared_ptr<Function> > _stage_solutions;
126
131
 
127
132
    // The solution
128
 
    boost::shared_ptr<Function> _u;
 
133
    std::shared_ptr<Function> _u;
129
134
 
130
135
    // The local time 
131
 
    boost::shared_ptr<Constant> _t;
 
136
    std::shared_ptr<Constant> _t;
132
137
 
133
138
    // The local time step
134
 
    boost::shared_ptr<Constant> _dt;
 
139
    std::shared_ptr<Constant> _dt;
135
140
    
136
141
    // The time step offset. (c from the ButcherTableau)
137
142
    std::vector<double> _dt_stage_offset;
138
143
 
 
144
    // Map for distinct storage of jacobians
 
145
    std::vector<int> _jacobian_indices;
 
146
 
139
147
    // The order of the scheme
140
148
    unsigned int _order;
141
149