1#ifndef UTIL_CARRAY_2D_PARAM_H
2#define UTIL_CARRAY_2D_PARAM_H
11#include <util/param/MatrixParam.h>
111 template <
class Type>
113 int m,
int n,
int np,
126 template <
class Type>
130 for (i = 0; i < m(); ++i) {
131 for (j = 0; j < n(); ++j) {
132 in >> ptr_[i*np_ + j];
141 template <
class Type>
143 { ar.
unpack(ptr_, m(), n(), np_); }
148 template <
class Type>
150 { ar.
pack(ptr_, m(), n(), np_); }
156 template <
class Type>
158 { bcast<Type>(ioCommunicator(), ptr_, m()*np_, 0); }
164 template <
class Type>
175 for (i = 0; i < m(); ++i) {
176 if (i == 0 && !hasBrackets()) {
179 out << indent() << space;
181 for (j = 0; j < n(); ++j) {
182 out << std::right << std::scientific
This file contains templates for global functions send<T>, recv<T> and bcast<T>.
Saving archive for binary istream.
void unpack(T &data)
Unpack a single T object.
Saving / output archive for binary ostream.
void pack(const T &data)
Pack one object of type T.
A Parameter associated with a 2D built-in C array.
virtual void readValue(std::istream &in)
Read 2D array parameter from an input stream.
virtual void loadValue(Serializable::IArchive &ar)
Load 2D array from an archive.
virtual void saveValue(Serializable::OArchive &ar)
Save 2D array to an archive.
virtual void bcastValue()
Broadcast 2D array within the ioCommunicator.
CArray2DParam(const char *label, Type *ptr, int m, int n, int np, bool isRequired=true)
Constructor.
void writeParam(std::ostream &out) const
Write 2D C array to file.
A label string in a file format.
An array-valued parameter in a parameter file.
int m() const
Get the logical array dimension.
std::string label() const
Return label string.
void setBrackets(std::string lBracket, std::string rBracket)
Set left and right bracket / delimiter strings.
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?
bool isRequired() const
Is this an optional parameter?
int n() const
Get the logical array dimension.
std::string indent() const
Return indent string for this object (string of spaces).
static const int Precision
Precision for io of floating point data field.
Label label_
Label object that contains parameter label string.
bool isActive() const
Is this parameter active?
static const int Width
Width of output field for a scalar variable.
File containing preprocessor macros for error handling.
Utility classes for scientific computation.