1 #ifndef UTIL_D_ARRAY_PARAM_H 2 #define UTIL_D_ARRAY_PARAM_H 11 #include <util/param/Parameter.h> 12 #include <util/containers/DArray.h> 105 for (
int i = 0; i < n_; ++i) {
106 in >> (*arrayPtr_)[i];
113 template <
class Type>
120 if (arrayPtr_->capacity() < n_) {
128 template <
class Type>
144 template <
class Type>
152 template <
class Type>
158 UTIL_THROW(
"Cannot write unallocated DArray");
161 UTIL_THROW(
"Error: DArray capacity != n in writeParam");
166 for (i = 0; i < n_; ++i) {
172 out << std::right << std::scientific
std::string label() const
Return label string.
virtual void bcastValue()
Broadcast parameter value within the ioCommunicator.
Label label_
Label object that contains parameter label string.
A single variable in a parameter file.
virtual void saveValue(Serializable::OArchive &ar)
Save parameter value to an archive.
File containing preprocessor macros for error handling.
Parameter(const char *label, bool isRequired=true)
Constructor.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void readValue(std::istream &in)
Read parameter value from an input stream.
MPI::Intracomm & ioCommunicator() const
Get the MPI communicator by reference.
Utility classes for scientific computation.
void writeParam(std::ostream &out)
Write parameter to stream.
bool isAllocated() const
Return true if the DArray has been allocated, false otherwise.
static const int Precision
Precision for io of floating point data field.
bool isActive() const
Is this parameter active?
A label string in a file format.
Saving archive for binary istream.
static const int Width
Width of output field for a scalar variable.
A Parameter associated with a DArray container.
bool isRequired() const
Is this an optional parameter?
int capacity() const
Return allocated size.
void allocate(int capacity)
Allocate the underlying C array.
virtual void loadValue(Serializable::IArchive &ar)
Load bare parameter value from an archive.
std::string indent() const
Return indent string for this object (string of spaces).