Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
problem.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_PROBLEM_H
2#define _RHEOLEF_PROBLEM_H
3//
4// This file is part of Rheolef.
5//
6// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7//
8// Rheolef is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 2 of the License, or
11// (at your option) any later version.
12//
13// Rheolef is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Rheolef; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// =========================================================================
23// AUTHORS: Pierre.Saramito@imag.fr
24// DATE: 21 february 2020
25
26namespace rheolef {
112} // namespace rheolef
113
114#include "rheolef/form.h"
115
116namespace rheolef {
117
118// [verbatim_problem_basic]
119template <class T, class M = rheo_default_memory_model>
121public:
122
123// typedefs:
124
127
128// allocators:
129
132 const solver_option& sopt = solver_option());
133
135
137
138// accessor:
139
140 void solve (const field_basic<T,M>& lh, field_basic<T,M>& uh) const;
142
144 const solver_option& option() const;
145 bool initialized() const;
146// [verbatim_problem_basic]
147
148// internals:
149
150 // used by problem_mixed:
151 const solver_basic<T,M>& get_solver() const { return _sa; }
152
153// data:
154protected:
157
158// [verbatim_problem_basic_cont]
159};
160// [verbatim_problem_basic_cont]
161
162// [verbatim_problem]
163typedef problem_basic<Float> problem;
164// [verbatim_problem]
165
166// -----------------------------------------------------------------------------
167// inlined
168// -----------------------------------------------------------------------------
169template<class T, class M>
170inline
172 : _a(),
173 _sa()
174{
175}
176template<class T, class M>
177inline
179 const form_basic<T,M>& a,
180 const solver_option& sopt)
181 : _a(a),
182 _sa (a.uu(), sopt)
183{
184}
185template<class T, class M>
186inline
187void
189{
190 _a = a;
191 _sa.update_value (a.uu());
192}
193template<class T, class M>
194inline
195void
197{
198 _sa.set_preconditioner (m);
199}
200template<class T, class M>
201inline
202void
204{
205 uh.set_u() = _sa.solve (lh.u() - _a.ub()*uh.b());
206}
207template<class T, class M>
208void
210{
211 uh.set_u() = _sa.trans_solve (lh.u() - _a.bu().trans_mult(uh.b()));
212}
213template<class T, class M>
214inline
215bool
217{
218 return _sa.initialized();
219}
220template<class T, class M>
221inline
224{
225 return _sa.det();
226}
227template<class T, class M>
228inline
229const solver_option&
231{
232 return _sa.option();
233}
234
235} // namespace rheolef
236#endif // _RHEOLEF_PROBLEM_H
field lh(Float epsilon, Float t, const test &v)
const vec< T, M > & b() const
Definition field.h:283
vec< T, M > & set_u()
Definition field.h:284
problem_basic(const form_basic< T, M > &a, const solver_option &sopt=solver_option())
Definition problem.h:178
const solver_basic< T, M > & get_solver() const
Definition problem.h:151
void set_preconditioner(const solver_basic< T, M > &)
Definition problem.h:196
void solve(const field_basic< T, M > &lh, field_basic< T, M > &uh) const
Definition problem.h:203
void update_value(const form_basic< T, M > &a)
Definition problem.h:188
solver_basic< T, M >::determinant_type determinant_type
Definition problem.h:126
solver_basic< T, M >::size_type size_type
Definition problem.h:125
void trans_solve(const field_basic< T, M > &lh, field_basic< T, M > &uh) const
Definition problem.h:209
solver_basic< T, M > _sa
Definition problem.h:156
const solver_option & option() const
Definition problem.h:230
determinant_type det() const
Definition problem.h:223
form_basic< T, M > _a
Definition problem.h:155
bool initialized() const
Definition problem.h:216
rep::determinant_type determinant_type
Definition solver.h:271
rep::size_type size_type
Definition solver.h:270
see the solver_option page for the full documentation
problem_basic< Float > problem
Definition problem.h:163
This file is part of Rheolef.