28 #include "sbml/SBase.h"
29 #include "sbml/Compartment.h"
30 #include "sbml/Species.h"
31 #include "sbml/Parameter.h"
32 #include "sbml/Model.h"
46 mpEnd(mArray + size()),
52 mNumberToQuantityFactor(0.0)
58 mAllocatedSteps(src.mAllocatedSteps),
59 mRecordedSteps(src.mRecordedSteps),
60 mpIt(mArray + mRecordedSteps * mCols),
61 mpEnd(mArray + size()),
64 mCompartment(src.mCompartment),
67 mNumberToQuantityFactor(src.mNumberToQuantityFactor)
86 else if (diff > 10000)
131 size_t i, imax = end - it;
151 for (i = 0; it != end; ++i, ++it)
153 if ((pMetab = dynamic_cast< const CMetab *>(*it)) != NULL)
160 mTitles[i] = (*it)->getObjectDisplayName();
163 mKeys[i] = (*it)->getKey();
165 mObjects.insert((*it)->getValueReference());
175 for (i = 0; pUserOrder != pUserOrderEnd; ++pUserOrder)
176 mPivot[i++] = *pUserOrder;
217 for (; pIt !=
mpIt; ++pIt)
218 *pIt = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
235 const size_t & var)
const
244 const size_t & var)
const
248 const size_t & Col =
mPivot[var];
277 std::string key =
getKey(var);
278 std::string result(
"");
286 std::map<CCopasiObject*, SBase*>::const_iterator pos =
const_cast<CCopasiDataModel*
>(pDataModel)->getCopasi2SBMLMap().find(const_cast<CCopasiObject*>(pObject));
288 if (pos != const_cast<CCopasiDataModel*>(pDataModel)->getCopasi2SBMLMap().end())
290 const SBase* pSBMLObject = pos->second;
291 const Compartment* pSBMLCompartment = NULL;
292 const Species* pSBMLSpecies = NULL;
293 const Parameter* pSBMLParameter = NULL;
294 const Model* pSBMLModel = NULL;
296 switch (pSBMLObject->getTypeCode())
298 case SBML_COMPARTMENT:
299 pSBMLCompartment =
dynamic_cast<const Compartment*
>(pSBMLObject);
301 if (pSBMLCompartment && pSBMLCompartment->isSetId())
303 result = pSBMLCompartment->getId();
309 pSBMLSpecies =
dynamic_cast<const Species*
>(pSBMLObject);
311 if (pSBMLSpecies && pSBMLSpecies->isSetId())
313 result = pSBMLSpecies->getId();
319 pSBMLParameter =
dynamic_cast<const Parameter*
>(pSBMLObject);
321 if (pSBMLParameter && pSBMLParameter->isSetId())
323 result = pSBMLParameter->getId();
329 pSBMLModel =
dynamic_cast<const Model*
>(pSBMLObject);
331 if (pSBMLModel && pSBMLModel->isSetId())
333 result = pSBMLModel->getId();
348 int CTimeSeries::save(
const std::string& fileName,
bool writeParticleNumbers,
const std::string& separator)
const
351 std::ostringstream* stringStream =
new std::ostringstream();
352 (*stringStream) <<
"# ";
356 for (counter2 = 0; counter2 < maxCount2; ++counter2)
358 (*stringStream) << this->
getTitle(counter2) << separator;
361 (*stringStream) << std::endl;
362 fileStream << stringStream->str();
364 if (!fileStream.good())
return 1;
369 for (counter = 0; counter < maxCount; ++counter)
372 stringStream =
new std::ostringstream();
374 for (counter2 = 0; counter2 < maxCount2; ++counter2)
378 if (writeParticleNumbers)
380 value = this->
getData(counter, counter2);
387 (*stringStream) << value << separator;
390 (*stringStream) << std::endl;
391 fileStream << stringStream->str();
393 if (!fileStream.good())
return 1;
const size_t & getRecordedSteps() const
C_FLOAT64 getConcentrationData(const size_t &step, const size_t &variable) const
std::string getSBMLId(const size_t &variable, const CCopasiDataModel *pDataModel) const
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
const size_t & getNumVariables() const
virtual CCopasiObjectName getCN() const
int save(const std::string &fileName, bool writeConcentrations=false, const std::string &separator="\t") const
std::vector< std::string > mTitles
CCopasiObject * get(const std::string &key)
const std::string & getTitle(const size_t &variable) const
void allocate(const size_t &steps)
void resize(size_t size, const bool ©=false)
size_t getIndex(const CModelEntity *entity) const
const std::string & getKey(const size_t &variable) const
static std::string mDummyString
const C_FLOAT64 & getNumber2QuantityFactor() const
CModelEntity ** endFixed()
static C_FLOAT64 mDummyFloat
const std::string & getKey() const
virtual void resize(size_t rows, size_t cols, const bool ©=false)
std::set< const CCopasiObject * > mObjects
const C_FLOAT64 & getData(const size_t &step, const size_t &variable) const
const C_FLOAT64 & getTime() const
static CKeyFactory * getKeyFactory()
C_FLOAT64 mNumberToQuantityFactor
const CStateTemplate & getStateTemplate() const
virtual size_t size() const
const CState & getState() const
static CLocaleString fromUtf8(const std::string &utf8)
const CVector< size_t > & getUserOrder() const
void increaseAllocation()
virtual void separate(const Activity &activity)
CCopasiObject * ObjectFromName(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &CN) const
virtual void output(const Activity &activity)
CVector< size_t > mCompartment
CModelEntity ** getEntities()
std::vector< std::string > mKeys