00001 #ifndef NFINPUT_HH_
00002 #define NFINPUT_HH_
00003
00004 #include <iostream>
00005 #include <map>
00006 #include <vector>
00007 #include <stdio.h>
00008
00009 #include <limits.h>
00010 #include <exception>
00011
00012
00013 #include "../NFcore/NFcore.hh"
00014 #include "../NFoutput/NFoutput.hh"
00015 #include "../NFfunction/NFfunction.hh"
00016 #include "../NFreactions/reactions/reaction.hh"
00017 #include "TinyXML/tinyxml.h"
00018
00019 using namespace NFcore;
00020
00021
00022
00024
00032 namespace NFinput {
00033
00035
00038 class component {
00039 public:
00040 component(TemplateMolecule *t, string name);
00041 component(MoleculeType *mt, string name);
00042 ~component();
00043
00044 TemplateMolecule * t;
00045 MoleculeType *mt;
00046 string name;
00047 string uniqueId;
00048
00049 string symPermutationName;
00050
00051
00052 string numOfBondsLabel;
00053 string stateConstraintLabel;
00054 };
00055
00056
00057
00059
00062 System * initializeFromXML(
00063 string filename,
00064 bool blockSameComplexBinding,
00065 int globalMoleculeLimit,
00066 bool verbose,
00067 int &suggestedTraversalLimit);
00068
00070
00073 bool initParameters(
00074 TiXmlElement *pListOfParameters,
00075 System *s,
00076 map <string,double> ¶meter,
00077 bool verbose);
00078
00079
00081
00084 bool initFunctions(
00085 TiXmlElement * pListOfFunctions,
00086 System * system,
00087 map <string,double> ¶meter,
00088 TiXmlElement * pListOfObservables,
00089 map<string,int> &allowedStates,
00090 bool verbose);
00091
00093
00096 bool initMoleculeTypes(
00097 TiXmlElement * pListOfMoleculeTypes,
00098 System * system,
00099 map<string,int> &allowedStates,
00100 bool verbose);
00101
00102
00103
00104
00105
00106 bool FindReactionRuleSymmetry(
00107 TiXmlElement * pRxnRule,
00108 System * s,
00109 map <string,double> ¶meter,
00110 map<string,int> &allowedStates,
00111 map <string, component> &symComps,
00112 map <string, component> &symRxnCenter,
00113 bool verbose);
00114
00115 bool readPatternForSymmetry(
00116 TiXmlElement * pListOfMol,
00117 System * s,
00118 string patternName,
00119 map <string, component> &comps,
00120 map <string, component> &symComps,
00121 bool verbose);
00122
00123 bool generateRxnPermutations(vector<map<string,component> > &permutations,
00124 map<string,component> &symComps,
00125 map<string,component> &symRxnCenter,
00126 bool verbose);
00127
00128
00129 bool readObservableForTemplateMolecules(
00130 TiXmlElement *pObs,
00131 string observableName,
00132 vector <TemplateMolecule *> &tmList,
00133 vector <string> &stochRelation,
00134 vector <int> &stochQuantity,
00135 System *s,
00136 map <string,double> ¶meter,
00137 map<string,int> &allowedStates,
00138 int obsType,
00139 bool verbose,
00140 int &suggestedTraversalLimit);
00141
00142
00143
00144
00145
00147
00150 bool initStartSpecies(
00151 TiXmlElement * pListOfSpecies,
00152 System * system,
00153 map <string,double> ¶meter,
00154 map<string,int> &allowedStates,
00155 bool verbose);
00156
00158
00161 bool initReactionRules(
00162 TiXmlElement * pListOfReactionRules,
00163 System * system,
00164 map <string,double> ¶meter,
00165 map<string,int> &allowedStates,
00166 bool blockSameComplexBinding,
00167 bool verbose,
00168 int &suggestedTraversalLimit);
00169
00171
00174 bool initObservables(
00175 TiXmlElement * pListOfObservables,
00176 System * system,
00177 map <string,double> ¶meter,
00178 map<string,int> &allowedStates,
00179 bool verbose,
00180 int &suggestedTraversalLimit);
00181
00182
00184
00187 TemplateMolecule *readPattern(
00188 TiXmlElement * pListOfMol,
00189 System * s, map <string,double> ¶meter,
00190 map<string,int> &allowedStates,
00191 string patternName,
00192 map <string, TemplateMolecule *> &templates,
00193 map <string, component> &comps,
00194 map <string, component> &symMap,
00195 bool verbose,
00196 int &suggestedTraversalLimit);
00197
00199
00203 bool readProductPattern(
00204 TiXmlElement * pListOfMol,
00205 System * s, map <string,double> ¶meter,
00206 map<string,int> &allowedStates,
00207 string patternName,
00208 vector <MoleculeType *> &productMoleculeTypes,
00209 vector < vector <int> > &stateInformation,
00210 vector < vector <int> > &bindingSiteInformation,
00211 bool verbose);
00212
00213
00214 bool lookup(component *&c, string id, map<string,component> &comps, map<string,component> &symMap);
00215
00216
00217
00219
00222 bool parseArguments(int argc, const char *argv[], map<string,string> &argMap);
00223
00224
00226
00229 int parseAsInt(map<string,string> &argMap, string argName, int defaultValue);
00230
00232
00235 double parseAsDouble(map<string,string> &argMap, string argName, double defaultValue);
00236
00237
00239
00242 void parseAsCommaSeparatedSequence(map<string,string> &argMap,string argName,vector<int> &sequence);
00243
00244
00245
00247
00250 void walk(System *s);
00251
00252
00253
00255
00260 bool createSystemDumper(string paramStr, System *s, bool verbose);
00261
00262
00263
00265
00268 bool parseSequence(string numString, vector <double> &outputTimes);
00269
00270
00271
00272
00273
00275
00276 bool readRNFfile(map<string,string> &argMap, vector<string> &commands, bool verbose);
00277 bool runRNFcommands(System *s, map<string,string> &argMap, vector<string> &commands, bool verbose);
00278
00279
00280
00281
00282 }
00283
00284
00285
00286 #endif