COPASI API
4.40.278
|
#include <CDataArray.h>
Public Types | |
typedef C_FLOAT64 | data_type |
typedef CArray::index_type | index_type |
enum class | Mode { Objects , Vector , VectorOnTheFly , Strings , Numbers , __SIZE } |
typedef std::vector< std::string > | name_index_type |
Public Types inherited from CDataContainer | |
typedef CDataObjectMap | objectMap |
Public Types inherited from CDataObject | |
typedef std::set< const CDataObject * > | DataObjectSet |
enum | Flag { Container , Vector , Matrix , NameVector , Reference , ValueBool , ValueInt , ValueInt64 , ValueDbl , NonUniqueName , StaticString , ValueString , Separator , DisplayName , ModelEntity , Array , DataModel , Root , Gui , __SIZE } |
Public Types inherited from CObjectInterface | |
typedef std::vector< const CDataContainer * > | ContainerList |
typedef std::set< const CObjectInterface * > | ObjectSet |
Public Member Functions | |
const CDataObject * | addElementReference (C_INT32 u) const |
const CDataObject * | addElementReference (C_INT32 u, C_INT32 v) const |
const CDataObject * | addElementReference (const index_type &index) const |
const CDataObject * | addElementReference (const name_index_type &nameIndex) const |
CArrayInterface * | array () |
const CArrayInterface * | array () const |
CDataArray (const std::string &name, const CDataContainer *pParent, CArrayInterface *array, const bool &adopt) | |
index_type | cnToIndex (const name_index_type &cnIndex) const |
size_t | dimensionality () const |
name_index_type | displayNamesToCN (const std::vector< std::string > &DisplayNames) const |
const std::vector< CRegisteredCommonName > & | getAnnotationsCN (size_t d) const |
const std::vector< std::string > & | getAnnotationsString (size_t d, bool display=true) const |
CArrayInterface * | getArray () const |
Mode | getDefaultMode () const |
const std::string & | getDescription () const |
const std::string & | getDimensionDescription (size_t d) const |
Mode | getMode (size_t d) const |
virtual const CObjectInterface * | getObject (const CCommonName &cn) const |
virtual std::string | getObjectDisplayName () const |
bool | isEmpty () |
data_type & | operator[] (const name_index_type &nameIndex) |
const data_type & | operator[] (const name_index_type &nameIndex) const |
virtual void | print (std::ostream *ostream) const |
void | printRecursively (std::ostream &ostream, size_t level, CArrayInterface::index_type &index, const std::vector< std::vector< std::string > > &display) const |
void | reDimensionalize (size_t d) |
void | resize () |
void | resizeOneDimension (size_t d) |
void | setAnnotation (size_t d, size_t i, const CDataObject *pObject) |
void | setAnnotationString (size_t d, size_t i, const std::string s) |
void | setArray (CArrayInterface *a) |
template<class CType > | |
void | setCopasiVector (size_t d, const CDataVector< CType > &v) |
void | setDescription (const std::string &s) |
void | setDimensionDescription (size_t d, const std::string &s) |
void | setMode (Mode m) |
void | setMode (size_t d, Mode m) |
CArrayInterface::index_type | size () const |
virtual | ~CDataArray () |
Public Member Functions inherited from CDataContainer | |
virtual bool | add (CDataObject *pObject, const bool &adopt=true) |
virtual bool | appendDeletedDependentData (CUndoData &undoData) const |
virtual bool | applyData (const CData &data, CUndoData::CChangeSet &changes) override |
CDataContainer (const CDataContainer &src, const CDataContainer *pParent) | |
CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None) | |
virtual void | createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const override |
virtual std::string | getChildObjectUnits (const CDataObject *pObject) const |
void | getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const |
virtual size_t | getIndex (const CDataObject *pObject) const |
virtual objectMap & | getObjects () |
virtual const objectMap & | getObjects () const |
virtual const std::string | getUnits () const override |
virtual const CDataObject * | getValueObject () const override |
virtual CUndoObjectInterface * | insert (const CData &data) override |
void | objectRenamed (CDataObject *pObject, const std::string &oldName) |
virtual bool | remove (CDataObject *pObject) |
virtual CData | toData () const override |
virtual | ~CDataContainer () |
Public Member Functions inherited from CDataObject | |
void | addIssue (const CIssue &issue) |
void | addReference (const CDataContainer *pReference) |
virtual void | calculateValue () override |
CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL) | |
virtual void | destruct () override |
virtual CCommonName | getCN () const override |
virtual const CDataObject * | getDataObject () const override |
virtual const std::string & | getKey () const |
CDataContainer * | getObjectAncestor (const std::string &type) const |
CDataModel * | getObjectDataModel () const |
const CObjectInterface * | getObjectFromCN (const CCommonName &cn) const |
const std::string & | getObjectName () const |
CDataContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const override |
virtual const CValidity & | getValidity () const override |
virtual void * | getValuePointer () const override |
bool | hasFlag (const Flag &flag) const |
virtual bool | isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override |
bool | prerequisitsContains (const DataObjectSet &objects) const |
void | removeIssue (const CIssue &issue) |
void | removeReference (const CDataContainer *pReference) |
bool | setObjectName (const std::string &name) |
virtual bool | setObjectParent (const CDataContainer *pParent) |
void | validityChanged (const CValidity &changedValidity) override |
void | validityRemoved (const CValidity &changedValidity) |
virtual | ~CDataObject () |
Public Member Functions inherited from CObjectInterface | |
CObjectInterface () | |
CObjectInterface (const CObjectInterface &src) | |
virtual | ~CObjectInterface () |
Public Member Functions inherited from CUndoObjectInterface | |
CUndoObjectInterface () | |
CUndoObjectInterface (const CUndoObjectInterface &src) | |
bool | generateUuid () |
const xg::Guid & | getUuid () const |
bool | setUuid (const std::string &uuid) |
bool | setUuid (const xg::Guid &uuid) |
virtual void | updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject) |
virtual | ~CUndoObjectInterface () |
Private Member Functions | |
CDataArray () | |
CDataArray (const CDataArray &) | |
std::string | createDisplayName (const std::string &cn) const |
CDataArray & | operator= (const CDataArray &) |
void | updateDisplayNames () const |
Private Attributes | |
std::vector< std::vector< CRegisteredCommonName > > | mAnnotationsCN |
std::vector< std::vector< std::string > > | mAnnotationsString |
Mode | mDefaultMode |
std::string | mDescription |
bool | mDestructArray |
std::vector< std::string > | mDimensionDescriptions |
std::vector< Mode > | mModes |
CArrayInterface * | mpArray |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CDataArray &o) |
Additional Inherited Members | |
Static Public Member Functions inherited from CDataContainer | |
static CDataContainer * | fromData (const CData &data, CUndoObjectInterface *pParent) |
Static Public Member Functions inherited from CDataObject | |
static CDataObject * | fromData (const CData &data, CUndoObjectInterface *pParent) |
static void | sanitizeObjectName (std::string &name) |
Static Public Member Functions inherited from CObjectInterface | |
static const CDataObject * | DataObject (const CObjectInterface *pInterface) |
static CObjectInterface * | GetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName) |
Static Public Member Functions inherited from CUndoObjectInterface | |
template<class CType > | |
static CType * | fromData (const CData &, CUndoObjectInterface *) |
Static Public Attributes inherited from CDataContainer | |
static const CObjectInterface::ContainerList | EmptyList |
Protected Member Functions inherited from CDataContainer | |
template<class CType > | |
CDataMatrixReference< CType > * | addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
template<class CType > | |
CDataObjectReference< CType > * | addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
template<class CType > | |
CDataVectorReference< CType > * | addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
CDataContainer (const CDataContainer &src) | |
void | initObjects () |
Protected Member Functions inherited from CDataObject | |
CDataObject () | |
CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None) | |
Protected Attributes inherited from CDataContainer | |
objectMap | mObjects |
Protected Attributes inherited from CDataObject | |
ObjectSet | mPrerequisits |
std::set< CDataContainer * > | mReferences |
Protected Attributes inherited from CObjectInterface | |
CValidity | mValidity |
This class contains the annotations to a n-dimensional array. Annotations can be provided for the array as such, for each of the dimensions, and for each of the indices (rows, columns, ...)
typedef C_FLOAT64 CDataArray::data_type |
typedef std::vector< std::string > CDataArray::name_index_type |
|
strong |
The annotation to an array can work in different modes. The mode for each dimension can be changed independently.
OBJECTS: The CNs for the rows, cols, ... of the array are given explicitly
VECTOR: A CDataVector is provided from which the CNs are generated at the time the vector is set
VectorOnTheFly: A CDataVector is provided, but the CNs are generated every time the annotations are retrieved (so that they are always up to date).
STRINGS: The annotations for the rows, cols, ... are given explicitly as strings.
NUMBERS: The rows, cols, ... of the array are only annotation with running numbers (starting with 0)-
Enumerator | |
---|---|
Objects | |
Vector | |
VectorOnTheFly | |
Strings | |
Numbers | |
__SIZE |
|
private |
|
private |
CDataArray::CDataArray | ( | const std::string & | name, |
const CDataContainer * | pParent, | ||
CArrayInterface * | array, | ||
const bool & | adopt | ||
) |
|
virtual |
References mDestructArray, mpArray, and pdelete.
const CDataObject * CDataArray::addElementReference | ( | C_INT32 | u | ) | const |
a convenience function for 1-dimensional arrays.
References addElementReference().
const CDataObject * CDataArray::addElementReference | ( | C_INT32 | u, |
C_INT32 | v | ||
) | const |
a convenience function for 2-dimensional arrays.
References addElementReference().
const CDataObject * CDataArray::addElementReference | ( | const index_type & | index | ) | const |
an object that will act as a reference to one element of an array will be created and inserted as a child of the array annotation. Basically most of the work will be done by getObject(). If the element already exists, the existing element will be returned.
References mAnnotationsCN, and StringPrint().
Referenced by COutputAssistant::add2DDataArrayToVector(), addElementReference(), CObjectLists::getListOfConstObjects(), and getObject().
const CDataObject * CDataArray::addElementReference | ( | const name_index_type & | nameIndex | ) | const |
|
inline |
References mpArray.
Referenced by printRecursively().
|
inline |
References mpArray.
CDataArray::index_type CDataArray::cnToIndex | ( | const name_index_type & | cnIndex | ) | const |
References C_INVALID_INDEX, dimensionality(), mAnnotationsCN, and strToIndex().
Referenced by operator[]().
|
private |
References CObjectInterface::DataObject(), CDataObject::getObjectDisplayName(), and CDataObject::getObjectFromCN().
Referenced by displayNamesToCN(), getAnnotationsString(), and updateDisplayNames().
size_t CDataArray::dimensionality | ( | ) | const |
CDataArray::name_index_type CDataArray::displayNamesToCN | ( | const std::vector< std::string > & | DisplayNames | ) | const |
References C_INVALID_INDEX, createDisplayName(), dimensionality(), mAnnotationsCN, strToIndex(), and CCommonName::unescape().
Referenced by getObject().
const std::vector< CRegisteredCommonName > & CDataArray::getAnnotationsCN | ( | size_t | d | ) | const |
returns the vector of CNs that correspond to the rows, columns, ... of the array. This method must not be called if the mode for the dimension d is STRINGS or NUMBERS
References mAnnotationsCN.
const std::vector< std::string > & CDataArray::getAnnotationsString | ( | size_t | d, |
bool | display = true |
||
) | const |
This returns strings that annotate the rows, columns, ... of the array. If the mode is OBJECTS, VECTOR, or VectorOnTheFly the display argument determines if the object name or the object display name is used. Note that this method returns a reference. The content that the reference points to may be changes by later calls to the getAnnotationsCN() method with the same value for d. Specifically if you use this method to obtain a reference to the list of display names and then call the method again to get the plain object names, the first reference will after that also point to the plain object names.
References createDisplayName(), mAnnotationsCN, mAnnotationsString, mModes, Numbers, and StringPrint().
CArrayInterface * CDataArray::getArray | ( | ) | const |
References mpArray.
Referenced by CFitProblem::calculate().
|
inline |
References mDefaultMode.
const std::string & CDataArray::getDescription | ( | ) | const |
References mDescription.
const std::string & CDataArray::getDimensionDescription | ( | size_t | d | ) | const |
References mDimensionDescriptions.
Referenced by printRecursively().
|
virtual |
Resolve a cn. Since this is an array, the CN can start with an index like "[2][3]". Since this is also a container, this is not necessarily the case.
Reimplemented from CDataContainer.
References addElementReference(), C_INT32, displayNamesToCN(), CDataObjectMap::equal_range(), CCommonName::escape(), CCommonName::getElementName(), CDataContainer::getObject(), CDataObject::getObject(), CCommonName::getRemainder(), and CDataContainer::mObjects.
|
virtual |
generate a display name for the array annotation.
Reimplemented from CDataObject.
References CDataObject::getObjectDisplayName(), CDataObject::getObjectName(), CDataObject::getObjectParent(), and CDataObject::getObjectType().
bool CDataArray::isEmpty | ( | ) |
Check whether the size of array is greater than 0 for each dimension. Return true, if so. Otherwise, false.
References dimensionality(), and size().
|
private |
CDataArray::data_type & CDataArray::operator[] | ( | const name_index_type & | nameIndex | ) |
References cnToIndex(), and mpArray.
const CDataArray::data_type & CDataArray::operator[] | ( | const name_index_type & | nameIndex | ) | const |
References cnToIndex(), and mpArray.
|
virtual |
This is the output method for any object. The default implementation provided with CDataObject uses the ostream operator<< of the object to print the object.To override this default behavior one needs to reimplement the virtual print function.
std::ostream | * ostream |
Reimplemented from CDataObject.
void CDataArray::printRecursively | ( | std::ostream & | ostream, |
size_t | level, | ||
CArrayInterface::index_type & | index, | ||
const std::vector< std::vector< std::string > > & | display | ||
) | const |
References array(), dimensionality(), getDimensionDescription(), size(), and SPC.
void CDataArray::reDimensionalize | ( | size_t | d | ) |
resize the internal vectors according to the dimensionality of the array
References mAnnotationsCN, mAnnotationsString, mDefaultMode, mDimensionDescriptions, and mModes.
Referenced by resize().
void CDataArray::resize | ( | ) |
adjust the dimensionality and size to that of the array
References CArrayInterface::dimensionality(), mpArray, reDimensionalize(), and resizeOneDimension().
Referenced by CFitProblem::calculateStatistics(), CDataArray(), CFitProblem::initialize(), CSensMethod::initialize(), CCSPMethod::initializeOutput(), CTimeSensMethod::initResult(), CLNAMethod::resizeAllMatrices(), CMCAMethod::resizeAllMatrices(), CCSPMethod::setAnnotationM(), CILDMMethod::setAnnotationM(), CILDMModifiedMethod::setAnnotationM(), CCSPMethod::start(), CSteadyStateTask::updateMatrices(), and CModel::updateMatrixAnnotations().
void CDataArray::resizeOneDimension | ( | size_t | d | ) |
References mAnnotationsCN, mAnnotationsString, mpArray, and CArrayInterface::size().
Referenced by resize(), setAnnotation(), and setMode().
void CDataArray::setAnnotation | ( | size_t | d, |
size_t | i, | ||
const CDataObject * | pObject | ||
) |
References dimensionality(), CDataObject::getCN(), CDataObject::getObjectDisplayName(), mAnnotationsCN, mAnnotationsString, resizeOneDimension(), and size().
Referenced by CSensMethod::initialize(), CTimeSensMethod::initResult(), CSteadyStateTask::updateMatrices(), and CModel::updateMatrixAnnotations().
void CDataArray::setAnnotationString | ( | size_t | d, |
size_t | i, | ||
const std::string | s | ||
) |
References dimensionality(), CCommonName::escape(), mAnnotationsCN, mAnnotationsString, and size().
Referenced by CFitProblem::calculateStatistics(), CFitProblem::initialize(), CCSPMethod::initializeOutput(), CMCAMethod::resizeAllMatrices(), CCSPMethod::setAnnotationM(), CILDMMethod::setAnnotationM(), and CILDMModifiedMethod::setAnnotationM().
void CDataArray::setArray | ( | CArrayInterface * | a | ) |
let the ArrayAnnotation point to a different array. If you use this method without updating the annotations afterwards it is your responsibility to make sure the new array fits the existing annotation (in dimensionality and, if not in VectorOnTheFly mode, in size).
References mpArray.
|
inline |
Associates a dimension d of the array with a CDataVector of CDataObjects. If the mode of the dimension d is VECTOR than the CNs of the objects in the vector are generated and stored immediately. If the mode is VectorOnTheFly the CNs are generated when getAnnotationsCN() or getAnnotationsString() is called.
References dimensionality(), CDataObject::getCN(), mAnnotationsCN, mModes, CDataVector< CType >::size(), Vector, and VectorOnTheFly.
Referenced by CCSPMethod::initializeOutput(), CModel::initObjects(), CLNAMethod::resizeAllMatrices(), CMCAMethod::resizeAllMatrices(), CCSPMethod::setAnnotationM(), CILDMMethod::setAnnotationM(), CILDMModifiedMethod::setAnnotationM(), CCSPMethod::start(), and CModel::updateMatrixAnnotations().
void CDataArray::setDescription | ( | const std::string & | s | ) |
References mDescription.
Referenced by CCSPMethod::createAnnotationsM(), CILDMMethod::createAnnotationsM(), CILDMModifiedMethod::createAnnotationsM(), CLNAMethod::initObjects(), CModel::initObjects(), CFitProblem::initObjects(), CSensProblem::initObjects(), CMCAMethod::initObjects(), CSteadyStateTask::initObjects(), and CTimeSensProblem::initObjects().
void CDataArray::setDimensionDescription | ( | size_t | d, |
const std::string & | s | ||
) |
References mDimensionDescriptions.
Referenced by CCSPMethod::createAnnotationsM(), CILDMMethod::createAnnotationsM(), CILDMModifiedMethod::createAnnotationsM(), CSensMethod::initialize(), CLNAMethod::initObjects(), CModel::initObjects(), CFitProblem::initObjects(), CMCAMethod::initObjects(), CSteadyStateTask::initObjects(), and CTimeSensMethod::initResult().
void CDataArray::setMode | ( | Mode | m | ) |
set the mode for all dimensions, this also sets the default mode that is used when resizing the ArrayAnnotion to a larger dimensionality
References mDefaultMode, mModes, and setMode().
void CDataArray::setMode | ( | size_t | d, |
Mode | m | ||
) |
set the mode for the dimension d
References mModes, and resizeOneDimension().
Referenced by CCSPMethod::createAnnotationsM(), CILDMMethod::createAnnotationsM(), CILDMModifiedMethod::createAnnotationsM(), CLNAMethod::initObjects(), CModel::initObjects(), CFitProblem::initObjects(), CSensProblem::initObjects(), CMCAMethod::initObjects(), CSteadyStateTask::initObjects(), CTimeSensProblem::initObjects(), and setMode().
|
inline |
References mpArray, and CArrayInterface::size().
Referenced by COutputAssistant::add2DDataArrayToVector(), CObjectLists::getListOfConstObjects(), isEmpty(), printRecursively(), setAnnotation(), and setAnnotationString().
|
private |
References createDisplayName(), mAnnotationsCN, and mAnnotationsString.
|
friend |
|
private |
|
mutableprivate |
Referenced by getAnnotationsString(), reDimensionalize(), resizeOneDimension(), setAnnotation(), setAnnotationString(), and updateDisplayNames().
|
private |
This contains the default mode that is used if during a resize() the dimensionality is increased.
Referenced by getDefaultMode(), reDimensionalize(), and setMode().
|
private |
Referenced by getDescription(), and setDescription().
|
private |
Referenced by ~CDataArray().
|
private |
Referenced by getDimensionDescription(), reDimensionalize(), and setDimensionDescription().
|
private |
This contains the mode for the different dimensions
Referenced by dimensionality(), getAnnotationsString(), getMode(), reDimensionalize(), setCopasiVector(), and setMode().
|
private |
Referenced by array(), CDataArray(), getArray(), operator[](), resize(), resizeOneDimension(), setArray(), size(), and ~CDataArray().