PSCF v1.1
MatrixParam.h
1#ifndef UTIL_MATRIX_PARAM_H
2#define UTIL_MATRIX_PARAM_H
3
4/*
5* Util Package - C++ Utilities for Scientific Computation
6*
7* Copyright 2010 - 2017, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/param/Parameter.h>
12
13namespace Util
14{
15
60 template <typename Type>
61 class MatrixParam : public Parameter
62 {
63
64 public:
65
74 MatrixParam(const char *label, int m, int n, bool isRequired = true);
75
79 virtual ~MatrixParam();
80
84 int m() const
85 { return m_; }
86
90 int n() const
91 { return n_; }
92
95 using Parameter::load;
96 using Parameter::save;
97 using Parameter::label;
100
101 protected:
102
108 virtual void readLabel(std::istream& in);
109
119 void readEndBracket(std::istream& in);
120
126 void writeEndBracket(std::ostream& out) const;
127
131 bool hasBrackets() const
132 { return hasBrackets_; }
133
140 void setBrackets(std::string lBracket, std::string rBracket);
141
142 using Parameter::label_;
143
144 private:
145
147 std::string name_;
148
150 std::string lBracket_;
151
153 std::string rBracket_;
154
156 int m_;
157
159 int n_;
160
162 bool isRequired_;
163
165 bool hasBrackets_;
166
167 };
168
169}
170#include <util/param/MatrixParam.tpp>
171#endif
An array-valued parameter in a parameter file.
Definition: MatrixParam.h:62
int m() const
Get the logical array dimension.
Definition: MatrixParam.h:84
std::string label() const
Return label string.
Definition: Parameter.cpp:164
void setBrackets(std::string lBracket, std::string rBracket)
Set left and right bracket / delimiter strings.
Definition: MatrixParam.tpp:54
virtual void readLabel(std::istream &in)
Read parameter label from an input stream.
Definition: MatrixParam.tpp:76
virtual ~MatrixParam()
Destructor.
Definition: MatrixParam.tpp:47
void readEndBracket(std::istream &in)
Read the closing delimiter, if any.
void writeEndBracket(std::ostream &out) const
Write the end bracket delimiter, if any.
bool hasBrackets() const
Are brackets being used as delimiters?
Definition: MatrixParam.h:131
bool isRequired() const
Is this an optional parameter?
Definition: Parameter.cpp:170
int n() const
Get the logical array dimension.
Definition: MatrixParam.h:90
std::string indent() const
Return indent string for this object (string of spaces).
A single variable in a parameter file.
Definition: Parameter.h:46
std::string label() const
Return label string.
Definition: Parameter.cpp:164
virtual void save(Serializable::OArchive &ar)
Save to an archive.
Definition: Parameter.cpp:151
virtual void readValue(std::istream &in)
Read parameter value from an input stream.
Definition: Parameter.h:202
bool isRequired() const
Is this an optional parameter?
Definition: Parameter.cpp:170
Label label_
Label object that contains parameter label string.
Definition: Parameter.h:185
bool isActive() const
Is this parameter active?
Definition: Parameter.cpp:176
virtual void load(Serializable::IArchive &ar)
Load from an archive.
Definition: Parameter.cpp:104
Utility classes for scientific computation.
Definition: accumulators.mod:1