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

A Matrix represents a matrix-valued parameter in parameter file. More...

Public Member Functions

def __init__ (self, label, file)
 Constructor. More...
 
def read (self, file)
 Read the a parameter block from a file. More...
 
def __str__ (self)
 String representation of this Matrix object. More...
 
def getString (self, depth='')
 Indented string representation of this Matrix object. More...
 
def returnData (self)
 Return the value of this Matrix as a list of lists. More...
 
def setValue (self, val)
 Set a new value for this Matrix. More...
 

Detailed Description

A Matrix represents a matrix-valued parameter in parameter file.

A Matrix object represents a two-dimensional array or matrix of element values. A matrix appears in a parameter file in a multi-line format that begins with a line containing a label immediately followed by an opening parenthesis and ends with a line containing only a closing parenthesis. In between, each line contains a row index, a column index and the value of a single element of the matrix.

Definition at line 693 of file param.py.

Constructor & Destructor Documentation

◆ __init__()

def pscfpp.param.Matrix.__init__ (   self,
  label,
  file 
)

Member Function Documentation

◆ read()

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

Read the a parameter block from a file.

This function reads the elements of a Matrix from the file object that is passed as a parameter. On entry, the opening line containing the opening curly 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 718 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.Matrix.__str__ (   self)

String representation of this Matrix object.

This function return a multi-line string representation of this Matrix object in the PSCF param file format, with no indentation of the first line.

Definition at line 749 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.Matrix.getString (   self,
  depth = '' 
)

◆ returnData()

def pscfpp.param.Matrix.returnData (   self)

Return the value of this Matrix as a list of lists.

Definition at line 773 of file param.py.

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

◆ setValue()

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

Set a new value for this Matrix.

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

Parameters
valthe new value

Definition at line 784 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: