vectors.hh

Go to the documentation of this file.
1 
6 #ifndef timestepVectors_hh
7 #define timestepVectors_hh
8 
9 #include "function/linearForm.hh"
10 #include "function/vector.hh"
11 
12 // debugging
13 #include "basics/debug.hh"
14 
15 #define TimeVector_D 0
16 
17 namespace concepts {
18 
19  // forward declaration
20  template<class F>
21  class Formula; // declared in formula/formula.hh
22 }
23 
24 namespace timestepping {
25 
26  using concepts::Real;
27 
28 
29  // ******************************************************** TimeLinearForm **
30 
35  class TimeLinearForm : public concepts::LinearForm<Real> {
36  public:
39  virtual void time(Real time) { time_ = time; }
41  Real time() { return time_; }
42  protected:
45  };
46 
47  // ************************************************************ TimeVector **
48 
53  class TimeVector : public concepts::Vector<Real> {
54  public:
61  : concepts::Vector<Real>(spc, tlf), spc_(&spc), tlf_(&tlf)
62  , time_(tlf.time()), frm_(0), template_(0) {}
68  : concepts::Vector<Real>(spc), spc_(&spc), tlf_(0)
69  , time_(0), frm_(0), template_(0) {}
75  : concepts::Vector<Real>(vec), spc_(0), tlf_(0)
76  , time_(0), frm_(0), template_(0) {}
83  const concepts::Formula<Real>& frm, const Real time = 0);
84 
85  ~TimeVector() {if (template_) delete template_; }
86 
88  Real time() const { return time_; }
92  void time(Real time);
93  private:
104 
106  void updateEntries_() {
108  if (time_ != tlf_->time()) {
109  tlf_->time(time_);
110  DEBUGL(TimeVector_D, "new time: " << tlf_->time() << std::endl);
112  fillEntries_(*spc_, *tlf_);
113  DEBUGL(TimeVector_D, "new vector(1): " << *this << std::endl);
114  }
115  }
116 
121  void set_(const concepts::Vector<Real>& vec);
122  };
123 
124 } // namespace timestepping
125 
126 #endif // timestepVectors_hh
Vector(const Vector< Real > &f)
Copy constructor.
const concepts::Vector< Real > * template_
Template vector.
Definition: vectors.hh:103
TimeLinearForm * tlf_
Linear form.
Definition: vectors.hh:97
Timestepping methods used to solve PDEs in time and space.
Definition: alpha.hh:18
const concepts::Formula< Real > * frm_
Formula in time to multiply with template vector.
Definition: vectors.hh:101
TimeVector(const concepts::Space< Real > &spc, TimeLinearForm &tlf)
Constructor.
Definition: vectors.hh:60
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
Abstract class for a linear form.
Real time()
Returns time_.
Definition: vectors.hh:41
#define TimeVector_D
Definition: vectors.hh:15
#define DEBUGL(doit, msg)
virtual void time(Real time)
Sets time_.
Definition: vectors.hh:39
void set_(const concepts::Vector< Real > &vec)
Sets the vector to vec.
TimeVector(const concepts::Vector< Real > &vec)
Copy Constructor.
Definition: vectors.hh:74
Real time_
Time, is not necessarily correlated to the values of the vector.
Definition: vectors.hh:99
void time(Real time)
Sets the current time_.
TimeVector(const concepts::Space< Real > &spc)
Constructor.
Definition: vectors.hh:67
Exception class for assertions.
Definition: exceptions.hh:258
Real time_
The current time.
Definition: vectors.hh:44
void updateEntries_()
Evaluates tlf_ at time_.
Definition: vectors.hh:106
Abstract class implementing time dependent linear forms.
Definition: vectors.hh:35
Class implementing time dependent vectors.
Definition: vectors.hh:53
const concepts::Space< Real > * spc_
Space.
Definition: vectors.hh:95
TimeVector(const concepts::Vector< Real > &vec, const concepts::Formula< Real > &frm, const Real time=0)
Constructor for a constant vector times a formula in time.
Real time() const
Returns the current time_.
Definition: vectors.hh:88
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
void fillEntries_(const Space< G > &spc, const LinearForm< Real, G > &lf)
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich