Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Experiment.cpp

Go to the documentation of this file.
00001 // Experiment.cpp: implementation of the Experiment class.
00002 //
00004 
00005 #include "Experiment.h"
00006 
00008 // Construction/Destruction
00010 
00011 Experiment::Experiment()
00012 {
00013 
00014 }
00015 
00016 Experiment::Experiment(ReactionNetwork *reactionNetwork, std::string experimentName)
00017 {
00018         _reactionNetwork = reactionNetwork;
00019         _experimentName = experimentName;
00020 
00021         _data = new ChemicalTimeSeriesData(_reactionNetwork);
00022         _forcingData = new CForcingData();
00023 }
00024 
00025 Experiment::~Experiment()
00026 {
00027         if(_data != 0) delete [] _data;
00028         if(_forcingData != 0) delete _forcingData;
00029 }
00030 
00031 void Experiment::AddDataFileToList(std::string fileName)
00032 {
00033         _fileList.push_back(fileName);
00034         cout << "File '" << fileName.c_str() << "' added to experiment " << _experimentName.c_str() << endl;
00035 }
00036 
00037 void Experiment::AddForcingFileToList(std::string fileName)
00038 {
00039         _forcingFileList.push_back(fileName);
00040         cout << "File '" << fileName.c_str() << "' added to forcing list of experiment " << _experimentName.c_str() << endl;
00041 }
00042 
00043 void Experiment::ReadData()
00044 {
00045         // read in the experimental data
00046         // does not check for multiple reads, which should be done either
00047         // here or in the AttachNewTimeSeries() function - the only guard
00048         // against this now is popping the files off the list as they are 
00049         // read so they have to be explicitly re-added.  Something safer 
00050         // would be better.  (KSB, 10/12/00)
00051         for(int i = 0; i < _fileList.size(); i++)
00052         {
00053                 _data->AttachNewTimeSeries(_reactionNetwork,_fileList[i]);
00054                 cout << "Data read from file '" << _fileList[i].c_str() << "'" << endl;
00055         }
00056         _fileList.erase(_fileList.begin(),_fileList.end());
00057 }
00058 
00059 void Experiment::ReadForcingData()
00060 {
00061         // read in the forcing data
00062         // comments are ditto as in ReadData();
00063         for(int i = 0; i < _forcingFileList.size(); i++)
00064         {
00065                 _forcingData->AttachNewForcingData(_reactionNetwork,_forcingFileList[i]);
00066                 cout << "Forcing data read from file '" << _forcingFileList[i].c_str() << "'" << endl;
00067         }
00068         _forcingFileList.erase(_forcingFileList.begin(),_forcingFileList.end());
00069 }

Generated on Mon Nov 3 09:37:50 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002