PSCF v1.1
Public Member Functions | List of all members
pscfpp.param.Array Class Reference

Container for data of an array in a param file. More...

Public Member Functions

def __init__ (self, label, file, val=None)
 Constructor. More...
 
def read (self, file)
 Read the elements of this Array from a file. More...
 
def __str__ (self)
 String representation of this Array object. More...
 
def getString (self, depth='')
 Indented string representation of this Array object. More...
 
def returnData (self)
 Return the value of this Array, as a list of element values. More...
 
def setValue (self, val)
 Set the new value to the Array object. More...
 

Detailed Description

Container for data of an array in a param file.

An Array object represents a one-dimensional array of values. An array appears in a parameter file in a multi-line format with one element value per line, delimited by square brackets. The first lines contains the array label followed immediately by an opening bracket, and the last line contains a closing bracket. Elements of the array appear between these lines in order of increasing array index, starting from 0.

Definition at line 545 of file param.py.

Constructor & Destructor Documentation

◆ __init__()

def pscfpp.param.Array.__init__ (   self,
  label,
  file,
  val = None 
)

Member Function Documentation

◆ read()

def pscfpp.param.Array.read (   self,
  file 
)

Read the elements of this Array from a file.

This function reads the elements of a multi-line array from the file object that is passed as a parameter. On entry, the opening line containing the opening bracket must already have been processed, and the first unread line of the file should contain the value of the first element. Reading stops stops when the closing "]" is read.

Parameters
filea file object, open for reading

Definition at line 575 of file param.py.

References pscfpp.param.getValue(), pscfpp.param.Parameter.val, pscfpp.param.Array.val, and pscfpp.param.Matrix.val.

Referenced by pscfpp.param.Composite.__init__(), pscfpp.field.Field.__init__(), pscfpp.command.Script.__init__(), pscfpp.output.Thermo.__init__(), pscfpp.param.Matrix.__init__(), and pscfpp.param.Array.__init__().

◆ __str__()

def pscfpp.param.Array.__str__ (   self)

String representation of this Array object.

This function return the string representation of this Array object in the multi-line indented param file format, with no indentation of the opening line.

Definition at line 600 of file param.py.

References pscfpp.param.Composite.getString(), pscfpp.param.Parameter.getString(), pscfpp.param.Array.getString(), and pscfpp.param.Matrix.getString().

Referenced by pscfpp.field.Field.write(), pscfpp.output.Thermo.write(), and pscfpp.output.State.write().

◆ getString()

def pscfpp.param.Array.getString (   self,
  depth = '' 
)

Indented string representation of this Array object.

This function returns the string representation for this Array object in a multi-line indented parameter file format with control over indentation of the first line. The parameter 'depth' is a string of spaces that is the indentation of the first line, is prepended to every succeding line.

Parameters
depthstring of spaces prefixed to all lines

Definition at line 614 of file param.py.

References pscfpp.command.Command.label, pscfpp.param.Composite.label, pscfpp.param.Parameter.label, pscfpp.param.Array.label, pscfpp.param.Matrix.label, Util::XmlAttribute.label(), Util::XmlEndTag.label(), Util::XmlStartTag.label(), Util::ArrayParam< Type >.label(), Util::MatrixParam< Type >.label(), Util::Parameter.label(), pscfpp.param.Parameter.val, pscfpp.param.Array.val, and pscfpp.param.Matrix.val.

Referenced by pscfpp.param.Composite.__str__(), pscfpp.param.Parameter.__str__(), pscfpp.param.Array.__str__(), pscfpp.param.Matrix.__str__(), and pscfpp.param.Composite.write().

◆ returnData()

def pscfpp.param.Array.returnData (   self)

Return the value of this Array, as a list of element values.

Definition at line 648 of file param.py.

References pscfpp.param.Parameter.val, pscfpp.param.Array.val, and pscfpp.param.Matrix.val.

◆ setValue()

def pscfpp.param.Array.setValue (   self,
  val 
)

Set the new value to the Array object.

This function sets the new value, parameter val, to the Array object.

Parameters
valthe expected new value.

Definition at line 659 of file param.py.

References pscfpp.param.getValue(), pscfpp.param.Parameter.val, pscfpp.param.Array.val, and pscfpp.param.Matrix.val.


The documentation for this class was generated from the following file: