3.1.17. c3po.LocalDataManager module
Contain the class LocalDataManager.
- class c3po.LocalDataManager.LocalDataManager
Bases:
DataManager,DataAccessorLocalDataManageris the implementation ofDataManagerfor local data.It also implements
DataAccessor.Data can be double, int, string, fields of double of fields of int. Only double and fields of double are affected by the methods herited from
DataManager. Other data are just (shallow) copied in new objects created by these methods.- __add__(other)
Return
self + other.Use
"+"to call it. For examplea = b + c.- Parameters:
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.- Returns:
A new (consistent with
self)LocalDataManagerwhere the data are added.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __iadd__(other)
Add other in
self(in place addition).Use
"+="to call it. For examplea += b.- Parameters:
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __imul__(scalar)
Multiply
selfbyscalar(in place multiplication).Use
"*="to call it. For examplea *= b.- Parameters:
scalar – A scalar value.
- Returns:
self.- Return type:
- __init__()
Default constructor
- __isub__(other)
Substract
othertoself(in place subtraction).Use
"-="to call it. For examplea -= b.- Parameters:
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __mul__(scalar)
Return
scalar * self.Use
"*"to call it. For examplea = b * c. The scalar first.- Parameters:
scalar – A scalar value.
- Returns:
A new (consistent with
self)LocalDataManagerwhere the data are multiplied byscalar.- Return type:
- __sub__(other)
Return
self - other.Use
"-"to call it. For examplea = b - c.- Parameters:
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.- Returns:
A new (consistent with
self)LocalDataManagerwhere the data are substracted.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- checkBeforeOperator(other)
INTERNAL Make basic checks before the call of an operator: same data names between
selfandother.
- clone()
Return a clone of
self.- Returns:
A clone of
self. Data are copied.- Return type:
- cloneEmpty()
Return a clone of
selfwithout copying the data.- Returns:
An empty clone of
self.- Return type:
- copy(other)
Copy data of other in
self.- Parameters:
other – A
LocalDataManagerwith the same list of data thanself.- Raises:
Exception – If
selfandotherare not consistent.
- dot(other)
Return the scalar product of
selfwithother.- Parameters:
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.- Return type:
The scalar product of
selfwithother.- Raises:
Exception – If
selfandotherare not consistent.
- getFieldType(name)
Return the type of a previously stored field.
- getInputMEDDoubleFieldTemplate(name)
Return the MED field previously stored as a MEDDoubleFieldTemplate under the name
name. If there is not, returns 0.- Parameters:
name – The name of the field to return.
- Return type:
The MED field of name
namepreviously stored, or 0.
- getOutputDoubleValue(name)
Return the scalar of name
namepreviously stored.- Parameters:
name – The name of the value to return.
- Return type:
The value of name
namepreviously stored.- Raises:
Exception – If there is no stored
nameDouble value.
- getOutputIntValue(name)
Similar to
getOutputDoubleValue()but for Int.
- getOutputMEDDoubleField(name)
Return the MED field of name
namepreviously stored.- Parameters:
name – The name of the field to return.
- Return type:
The MED field of name
namepreviously stored.- Raises:
Exception – If there is no stored
nameDouble field.
- getOutputMEDIntField(name)
Similar to
getOutputMEDDoubleField()but for MEDIntField.
- getOutputStringValue(name)
Similar to
getOutputDoubleValue()but for String.
- getValueType(name)
Return the type of a previously stored field.
- imuladd(scalar, other)
Add in
selfscalar * other(in place operation).In order to do so,
other *= scalarandother *= 1./scalarare done.For example
a.imuladd(b, c).- Parameters:
scalar – A scalar value.
other (LocalDataManager) – A
LocalDataManagerwith the same list of data thenself.
- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- norm2()
Return the norm 2.
- Return type:
sqrt(sum_i(val[i] * val[i]))whereval[i]stands for each scalar and each component of the MED fields.
- normMax()
Return the infinite norm.
- Return type:
The max of the absolute values of the scalars and of the infinite norms of the MED fields.
- setInputDoubleValue(name, value)
Store the scalar
valueunder the namename.- Parameters:
name – The name given to the scalar to store.
value – A scalar value to store.
- setInputIntValue(name, value)
Similar to
setInputDoubleValue()but for Int.
- setInputMEDDoubleField(name, field)
Store the MED field
fieldunder the namename.- Parameters:
name – The name given to the field to store.
field – A field to store.
- setInputMEDDoubleFieldTemplate(name, field)
Store the MED field
fieldas a MEDFieldTemplate under the namename.Note
These fields are not be part of data, and will therefore not be taken into account in data manipulations (operators, norms etc.).
- Parameters:
name – The name given to the field to store.
field – A field to store.
- setInputMEDIntField(name, field)
Similar to
setInputMEDDoubleField()but for MEDIntField.
- setInputStringValue(name, value)
Similar to
setInputDoubleValue()but for String.