~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/ode/cGqMethod.h

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2003-2006 Anders Logg.
 
2
// Licensed under the GNU LGPL Version 2.1.
 
3
//
 
4
// First added:  2005-05-02
 
5
// Last changed: 2006-07-07
 
6
 
 
7
#ifndef __CGQ_METHOD_H
 
8
#define __CGQ_METHOD_H
 
9
 
 
10
#include "Method.h"
 
11
 
 
12
namespace dolfin
 
13
{
 
14
 
 
15
  /// Contains all numeric constants, such as nodal points and nodal weights,
 
16
  /// needed for the cG(q) method. The order q must be at least 1. Note that
 
17
  /// q refers to the polynomial order and not the order of convergence for
 
18
  /// the method, which is 2q.
 
19
 
 
20
  class cGqMethod : public Method
 
21
  {
 
22
  public:
 
23
    
 
24
    cGqMethod(unsigned int q);
 
25
 
 
26
    /// Evaluate solution at given point
 
27
    real ueval(real x0, real values[], real tau) const;
 
28
 
 
29
    /// Evaluate solution at given point
 
30
    real ueval(real x0, uBlasVector& values, uint offset, real tau) const;
 
31
 
 
32
    /// Evaluate solution at given node (inline optimized)
 
33
    inline real ueval(real x0, real values[], uint i) const
 
34
    { return ( i == 0 ? x0 : values[i - 1] ); }
 
35
 
 
36
    /// Compute residual at right end-point    
 
37
    real residual(real x0, real values[], real f, real k) const;
 
38
 
 
39
    /// Compute residual at right end-point
 
40
    real residual(real x0, uBlasVector& values, uint offset, real f, real k) const;
 
41
 
 
42
    /// Compute new time step based on the given residual
 
43
    real timestep(real r, real tol, real k0, real kmax) const;
 
44
 
 
45
    /// Compute error estimate (modulo stability factor)
 
46
    real error(real k, real r) const;
 
47
 
 
48
    /// Display method data
 
49
    void disp() const;
 
50
    
 
51
  protected:
 
52
 
 
53
    void computeQuadrature();
 
54
    void computeBasis();
 
55
    void computeWeights();
 
56
 
 
57
  };
 
58
 
 
59
}
 
60
 
 
61
#endif