DOLFIN
DOLFIN C++ interface
Lagrange.h
1// Copyright (C) 2003-2005 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// First added: 2003-06-12
19// Last changed: 2009-09-08
20
21#ifndef __LAGRANGE_H
22#define __LAGRANGE_H
23
24#include <vector>
25
26#include <dolfin/log/Event.h>
27#include <dolfin/common/Variable.h>
28
29namespace dolfin
30{
48
49
50 class Lagrange : public Variable
51 {
52 public:
53
55 Lagrange(std::size_t q);
56
58 Lagrange(const Lagrange& p);
59
63 void set(std::size_t i, double x);
64
67 std::size_t size() const;
68
71 std::size_t degree() const;
72
75 double point(std::size_t i) const;
76
80 double operator() (std::size_t i, double x);
81
85 double eval(std::size_t i, double x);
86
90 double ddx(std::size_t i, double x);
91
94 double dqdx(std::size_t i);
95
99 std::string str(bool verbose) const;
100
101 private:
102
103 void init();
104
105 const std::size_t _q;
106
107 // Counts the number of time set has been called to determine when
108 // init should be called
109 std::size_t counter;
110
111 std::vector<double> points;
112 std::vector<double> constants;
113
114 Event instability_detected;
115 };
116
117}
118
119#endif
Definition: Event.h:47
Definition: Lagrange.h:51
void set(std::size_t i, double x)
Definition: Lagrange.cpp:44
double eval(std::size_t i, double x)
Definition: Lagrange.cpp:76
double dqdx(std::size_t i)
Definition: Lagrange.cpp:119
Lagrange(std::size_t q)
Constructor.
Definition: Lagrange.cpp:31
std::size_t degree() const
Definition: Lagrange.cpp:60
double point(std::size_t i) const
Definition: Lagrange.cpp:65
double ddx(std::size_t i, double x)
Definition: Lagrange.cpp:90
std::string str(bool verbose) const
Definition: Lagrange.cpp:128
std::size_t size() const
Definition: Lagrange.cpp:55
double operator()(std::size_t i, double x)
Definition: Lagrange.cpp:71
Common base class for DOLFIN variables.
Definition: Variable.h:36
Definition: adapt.h:30