diff_system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_DIFF_SYSTEM_H
21 #define LIBMESH_DIFF_SYSTEM_H
22 
23 // Local Includes
24 #include "libmesh/auto_ptr.h"
25 #include "libmesh/diff_context.h"
26 #include "libmesh/diff_physics.h"
27 #include "libmesh/diff_qoi.h"
29 #include "libmesh/time_solver.h"
30 
31 // C++ includes
32 
33 namespace libMesh
34 {
35 
36 // Forward Declarations
37 class TimeSolver;
38 
39 template <typename T> class NumericVector;
40 
53 // ------------------------------------------------------------
54 // DifferentiableSystem class definition
55 
57  public virtual DifferentiablePhysics,
58  public virtual DifferentiableQoI
59 {
60 public:
61 
67  const std::string& name,
68  const unsigned int number);
69 
73  virtual ~DifferentiableSystem ();
74 
79 
84 
89  virtual void clear ();
90 
95  virtual void reinit ();
96 
101  virtual void assemble ();
102 
107  virtual LinearSolver<Number> *get_linear_solver() const;
108 
114  virtual std::pair<unsigned int, Real>
116 
121  virtual void release_linear_solver(LinearSolver<Number> *) const;
122 
127  virtual void assembly (bool get_residual, bool get_jacobian) = 0;
128 
134  virtual void solve ();
135 
140  virtual std::pair<unsigned int, Real> adjoint_solve (const QoISet& qoi_indices = QoISet());
141 
146  { libmesh_error();
147  // dummy
148  return AutoPtr<DifferentiablePhysics>(this); }
149 
154  { libmesh_error();
155  // dummy
156  return AutoPtr<DifferentiableQoI>(this); }
157 
164  { return this->_diff_physics; }
165 
171  { return this->_diff_physics; }
172 
177  { this->_diff_physics = (physics_in->clone_physics()).release();
178  this->_diff_physics->init_physics(*this);}
179 
184  const DifferentiableQoI* get_qoi() const
185  { return this->diff_qoi; }
186 
192  { return this->diff_qoi; }
193 
198  { this->diff_qoi = (qoi_in->clone()).release();
199  // User needs to resize qoi system qoi accordingly
200  this->diff_qoi->init_qoi( this->qoi );}
201 
207 
212  {
213  time_solver = _time_solver;
214  }
215 
220 
224  const TimeSolver& get_time_solver() const;
225 
231 
241 
246  virtual void postprocess (){}
247 
251  virtual void element_postprocess (DiffContext &) {}
252 
257  virtual void side_postprocess (DiffContext &) {}
258 
264 
270 
276 
281 
286 
291 
296 
301 
302 protected:
303 
310 
317 
322  virtual void init_data ();
323 };
324 
325 // --------------------------------------------------------------
326 // DifferentiableSystem inline methods
327 inline
329 {
331  libmesh_assert_equal_to (&(time_solver->system()), this);
332  return *time_solver;
333 }
334 
335 inline
337 {
339  libmesh_assert_equal_to (&(time_solver->system()), this);
340  return *time_solver;
341 }
342 
343 } // namespace libMesh
344 
345 
346 #endif // LIBMESH_DIFF_SYSTEM_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo