00001 /************************************************************************* 00002 * CompuCell - A software framework for multimodel simulations of * 00003 * biocomplexity problems Copyright (C) 2003 University of Notre Dame, * 00004 * Indiana * 00005 * * 00006 * This program is free software; IF YOU AGREE TO CITE USE OF CompuCell * 00007 * IN ALL RELATED RESEARCH PUBLICATIONS according to the terms of the * 00008 * CompuCell GNU General Public License RIDER you can redistribute it * 00009 * and/or modify it under the terms of the GNU General Public License as * 00010 * published by the Free Software Foundation; either version 2 of the * 00011 * License, or (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, but * 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the Free Software * 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 *************************************************************************/ 00022 00023 #ifndef SIMULATOR_H 00024 #define SIMULATOR_H 00025 00026 #include <CompuCell3D/dllDeclarationSpecifier.h> 00027 00028 #include "PluginManager.h" 00029 #include "Plugin.h" 00030 #include "PluginBase.h" 00031 #include "Steppable.h" 00032 #include <map> 00033 #include <vector> 00034 #include <CompuCell3D/Potts3D/Potts3D.h> 00035 00036 #include <CompuCell3D/ParseData.h> 00037 #include <CompuCell3D/PottsParseData.h> 00038 #include <CompuCell3D/ParserStorage.h> 00039 00040 00041 class CC3DXMLElement; 00042 00043 namespace CompuCell3D { 00044 class ClassRegistry; 00045 00046 00047 template <typename Y> class Field3DImpl; 00048 class Serializer; 00049 class PottsParseData; 00050 00051 class DECLSPECIFIER Simulator : public Steppable { 00052 00053 ClassRegistry *classRegistry; 00054 00055 Potts3D potts; 00056 00057 int currstep; 00058 00059 bool simulatorIsStepping; 00060 bool readPottsSectionFromXML; 00061 std::map<std::string,Field3DImpl<float>*> concentrationFieldNameMap; 00062 //map of steerable objects 00063 std::map<std::string,SteerableObject *> steerableObjectMap; 00064 00065 std::vector<Serializer*> serializerVec; 00066 00067 public: 00068 00069 ParserStorage ps; 00070 PottsParseData * ppdCC3DPtr; 00071 PottsParseData ppd; 00072 PottsParseData *ppdPtr; 00073 00074 double simValue; 00075 00076 static PluginManager<Plugin> pluginManager; 00077 static PluginManager<Steppable> steppableManager; 00078 static BasicPluginManager<PluginBase> pluginBaseManager; 00079 Simulator(); 00080 virtual ~Simulator(); 00081 // PluginManager::plugins_t & getPluginMap(){return pluginManager.getPluginMap();} 00082 00083 void registerSteerableObject(SteerableObject *); 00084 void unregisterSteerableObject(const std::string & ); 00085 SteerableObject * getSteerableObject(const std::string & _objectName); 00086 00087 unsigned int getNumSteps() {return ppdCC3DPtr->numSteps;} 00088 int getStep() {return currstep;} 00089 bool isStepping(){return simulatorIsStepping;} 00090 double getFlip2DimRatio(){return ppdCC3DPtr->flip2DimRatio;} 00091 Potts3D *getPotts() {return &potts;} 00092 Simulator *getSimulatorPtr(){return this;} 00093 ClassRegistry *getClassRegistry() {return classRegistry;} 00094 00095 00096 void registerConcentrationField(std::string _name,Field3DImpl<float>* _fieldPtr); 00097 std::map<std::string,Field3DImpl<float>*> & getConcentrationFieldNameMap(){ 00098 return concentrationFieldNameMap; 00099 } 00100 void registerSerializer(Serializer * _serializerPtr){serializerVec.push_back(_serializerPtr);} 00101 virtual void serialize(); 00102 00103 // Begin Steppable interface 00104 virtual void start(); 00105 virtual void extraInit(); 00106 virtual void step(const unsigned int currentStep); 00107 virtual void finish(); 00108 // End Steppable interface 00109 00110 void unloadModules(); 00111 void initializePottsCC3D(CC3DXMLElement * _xmlData); 00112 void initializeCC3D(); 00113 void setPottsParseData(PottsParseData * _ppdPtr){ppdPtr=_ppdPtr;} 00114 CC3DXMLElement * getCC3DModuleData(std::string _moduleType,std::string _moduleName=""); 00115 void updateCC3DModule(CC3DXMLElement *_element); 00116 void steer(); 00117 00118 }; 00119 }; 00120 #endif
1.5.6