DOLFIN
DOLFIN C++ interface
Variable.h
1 // Copyright (C) 2003-2009 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 // Modified by Garth N. Wells, 2011
19 //
20 // First added: 2003-02-26
21 // Last changed: 2011-09-24
22 
23 #ifndef __VARIABLE_H
24 #define __VARIABLE_H
25 
26 #include <cstddef>
27 #include <string>
28 #include <dolfin/parameter/Parameters.h>
29 
30 namespace dolfin
31 {
32 
34 
35  class Variable
36  {
37  public:
38 
40  Variable();
41 
43  Variable(const std::string name, const std::string label);
44 
46  Variable(const Variable& variable);
47 
49  virtual ~Variable();
50 
52  const Variable& operator=(const Variable& variable);
53 
55  void rename(const std::string name, const std::string label);
56 
58  std::string name() const;
59 
61  std::string label() const;
62 
68  std::size_t id() const { return unique_id; }
69 
71  virtual std::string str(bool verbose) const;
72 
75 
76  private:
77 
78  // Name
79  std::string _name;
80 
81  // Label
82  std::string _label;
83 
84  // Unique identifier
85  const std::size_t unique_id;
86 
87  };
88 
89 }
90 
91 #endif
Common base class for DOLFIN variables.
Definition: Variable.h:35
virtual ~Variable()
Destructor.
Definition: Variable.cpp:50
Definition: adapt.h:29
void rename(const std::string name, const std::string label)
Rename variable.
Definition: Variable.cpp:65
Variable()
Create unnamed variable.
Definition: Variable.cpp:31
std::string label() const
Return label (description)
Definition: Variable.cpp:76
std::size_t id() const
Definition: Variable.h:68
Parameters parameters
Parameters.
Definition: Variable.h:74
const Variable & operator=(const Variable &variable)
Assignment operator.
Definition: Variable.cpp:55
Definition: Parameters.h:94
std::string name() const
Return name.
Definition: Variable.cpp:71
virtual std::string str(bool verbose) const
Return informal string representation (pretty-print)
Definition: Variable.cpp:81