00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "ClassRegistry.h"
00025 using namespace CompuCell3D;
00026
00027 #include <CompuCell3D/Boundary/BoundaryStrategy.h>
00028 #include <CompuCell3D/Potts3D/EnergyFunctionCalculator.h>
00029 #include <CompuCell3D/Field3D/WatchableField3D.h>
00030
00031 #include <BasicUtils/BasicString.h>
00032 #include <BasicUtils/BasicException.h>
00033 #include <BasicUtils/BasicRandomNumberGenerator.h>
00034 #include <PublicUtilities/StringUtils.h>
00035 #include <string>
00036 #include <CompuCell3D/Serializer.h>
00037
00038 #include <time.h>
00039 #include <limits>
00040
00041 #include <XMLUtils/CC3DXMLElement.h>
00042
00043 #undef max
00044 #undef min
00045
00046 #define EXP_STL
00047 #include "Simulator.h"
00048
00049
00050 #define DEBUG_IN "("<<in.getLineNumber()<<" , "<<in.getColumnNumber()<<")"<<endl
00051
00052 using namespace std;
00053
00054 PluginManager<Plugin> Simulator::pluginManager;
00055 PluginManager<Steppable> Simulator::steppableManager;
00056 BasicPluginManager<PluginBase> Simulator::pluginBaseManager;
00057
00058
00059 Simulator::Simulator() {
00060 ppdPtr=0;
00061 ppdCC3DPtr=0;
00062 readPottsSectionFromXML=false;
00063 simValue=20.5;
00064 pluginManager.setSimulator(this);
00065 steppableManager.setSimulator(this);
00066 currstep=-1;
00067 classRegistry = new ClassRegistry(this);
00068
00069
00070 simulatorIsStepping=false;
00071 potts.setSimulator(this);
00072
00073 }
00074
00075 Simulator::~Simulator() {
00076 delete classRegistry;
00077
00078 }
00080 void Simulator::registerConcentrationField(std::string _name,Field3DImpl<float>* _fieldPtr){
00081 concentrationFieldNameMap.insert(std::make_pair(_name,_fieldPtr));
00082 }
00084 void Simulator::serialize(){
00085 for(int i = 0 ; i < serializerVec.size() ; ++i){
00086 serializerVec[i]->serialize();
00087 }
00088 }
00089
00091
00092 void Simulator::registerSteerableObject(SteerableObject * _steerableObject){
00093 cerr<<"Dealing with _steerableObject->steerableName()="<<_steerableObject->steerableName()<<endl;
00094 std::map<std::string,SteerableObject *>::iterator mitr;
00095 mitr=steerableObjectMap.find(_steerableObject->steerableName());
00096 cerr<<"after find"<<endl;
00097
00098 ASSERT_OR_THROW("Steerable Object "+_steerableObject->steerableName()+" already exist!", mitr==steerableObjectMap.end());
00099
00100 steerableObjectMap[_steerableObject->steerableName()]=_steerableObject;
00101 }
00103
00104 void Simulator::unregisterSteerableObject(const std::string & _objectName){
00105 std::map<std::string,SteerableObject *>::iterator mitr;
00106 mitr=steerableObjectMap.find(_objectName);
00107 if(mitr!=steerableObjectMap.end()){
00108 steerableObjectMap.erase(mitr);
00109 }else{
00110 cerr<<"Could not find steerable object called "<<_objectName<<endl;
00111 }
00112 }
00114
00115 SteerableObject * Simulator::getSteerableObject(const std::string & _objectName){
00116 std::map<std::string,SteerableObject *>::iterator mitr;
00117 mitr=steerableObjectMap.find(_objectName);
00118 if(mitr!=steerableObjectMap.end()){
00119 return mitr->second;
00120 }else{
00121 return 0;
00122 }
00123
00124 }
00125
00127
00128 void Simulator::start() {
00129
00130 try{
00131
00132 cout << "Plugins:";
00133 BasicPluginManager<Plugin>::infos_t *infos = &pluginManager.getPluginInfos();
00134 BasicPluginManager<Plugin>::infos_t::iterator it;
00135 for (it = infos->begin(); it != infos->end(); it++)
00136 if (pluginManager.isLoaded((*it)->getName())) {
00137 if (it != infos->begin()) cout << ",";
00138 cout << " " << (*it)->getName();
00139 }
00140 cout << endl;
00141
00142
00143 classRegistry->start();
00144
00145 currstep = 0;
00146
00147 cout << "Step " << 0 << " "
00148 << "Energy " << potts.getEnergy() << " "
00149 << "Cells " << potts.getNumCells()
00150 << endl;
00151
00152 simulatorIsStepping=true;
00153 }catch (const BasicException &e) {
00154 cerr << "ERROR: " << e << endl;
00155 unloadModules();
00156 throw e;
00157 }
00158
00159 }
00161 void Simulator::extraInit(){
00162 try{
00163 BasicPluginManager<Plugin>::infos_t *infos = &pluginManager.getPluginInfos();
00164 BasicPluginManager<Plugin>::infos_t::iterator it;
00165 for (it = infos->begin(); it != infos->end(); it++)
00166 if (pluginManager.isLoaded((*it)->getName())) {
00167 pluginManager.get((*it)->getName())->extraInit(this);
00168 if (it != infos->begin()) cout << ",";
00169 cerr << " extraInit for: " << (*it)->getName()<<endl;
00170
00171 }
00172
00173 classRegistry->extraInit(this);
00174 }catch (const BasicException &e) {
00175 cerr << "ERROR: " << e << endl;
00176 unloadModules();
00177 throw e;
00178 }
00179
00180 }
00182 void Simulator::step(const unsigned int currentStep) {
00183
00184 try{
00185
00186
00187
00188
00189
00190
00191 Dim3D dim = potts.getCellFieldG()->getDim();
00192 int flipAttempts = (int)(dim.x * dim.y * dim.z * ppdCC3DPtr->flip2DimRatio);
00193 int flips = potts.metropolis(flipAttempts, ppdCC3DPtr->temperature);
00194
00195 currstep = currentStep;
00196
00197
00198 classRegistry->step(currentStep);
00199
00200
00201 if(! (currentStep % ppdCC3DPtr->debugOutputFrequency) ){
00202 cout << "Step " << currentStep << " "
00203 << "Flips " << flips << "/" << flipAttempts << " "
00204 << "Energy " << potts.getEnergy() << " "
00205 << "Cells " << potts.getNumCells()<<" Inventory="<<potts.getCellInventory().getCellInventorySize()
00206 << endl;
00207 }
00208
00209 }catch (const BasicException &e) {
00210 cerr << "ERROR: " << e << endl;
00211 unloadModules();
00212 throw e;
00213 }
00214
00215 }
00216
00217
00218
00219 void Simulator::finish() {
00220
00221 try{
00222
00223 ppdCC3DPtr->temperature = 0.0;
00224
00225
00226 for (unsigned int i = 1; i <= ppdCC3DPtr->anneal; i++)
00227 step(ppdCC3DPtr->numSteps+i);
00228
00229 classRegistry->finish();
00230 unloadModules();
00231
00232
00233 }catch (const BasicException &e) {
00234 cerr << "ERROR: " << e << endl;
00235 throw e;
00236 }
00237
00238 }
00239
00240 void Simulator::unloadModules(){
00241 pluginManager.unload();
00242 steppableManager.unload();
00243 }
00244
00245 void Simulator::initializeCC3D(){
00246
00247
00248
00249 cerr<<"BEFORE initializePotts"<<endl;
00250
00251 initializePottsCC3D(ps.pottsCC3DXMLElement);
00252
00253
00254 cerr<<"AFTER initializePotts"<<endl;
00255 std::set<std::string> initializedPlugins;
00256 std::set<std::string> initializedSteppables;
00257
00258 for(int i=0; i <ps.pluginCC3DXMLElementVector.size(); ++i){
00259
00260 std::string pluginName = ps.pluginCC3DXMLElementVector[i]->getAttribute("Name");
00261 bool pluginAlreadyRegisteredFlag=false;
00262 Plugin *plugin = pluginManager.get(pluginName,&pluginAlreadyRegisteredFlag);
00263 if(!pluginAlreadyRegisteredFlag){
00264
00265 cerr<<"INITIALIZING "<<pluginName<<endl;
00266 plugin->init(this, ps.pluginCC3DXMLElementVector[i]);
00267 }
00268 }
00269
00270 for(int i=0; i <ps.steppableCC3DXMLElementVector.size(); ++i){
00271 std::string steppableName = ps.steppableCC3DXMLElementVector[i]->getAttribute("Type");
00272 bool steppableAlreadyRegisteredFlag=false;
00273 Steppable *steppable = steppableManager.get(steppableName,&steppableAlreadyRegisteredFlag);
00274
00275 if(!steppableAlreadyRegisteredFlag){
00276
00277 cerr<<"INITIALIZING "<<steppableName<<endl;
00278 if(ps.steppableCC3DXMLElementVector[i]->findAttribute("Frequency"))
00279 steppable->frequency=ps.steppableCC3DXMLElementVector[i]->getAttributeAsUInt("Frequency");
00280
00281 steppable->init(this, ps.steppableCC3DXMLElementVector[i]);
00282 classRegistry->addStepper(steppableName,steppable);
00283
00284 }
00285 }
00286 if(ppdCC3DPtr->cellTypeMotilityVector.size()){
00287
00288
00289
00290
00291 potts.initializeCellTypeMotility(ppdCC3DPtr->cellTypeMotilityVector);
00292 }
00293
00294 }
00295
00296
00297
00298
00299 void Simulator::initializePottsCC3D(CC3DXMLElement * _xmlData){
00300
00301 cerr<<"INSIDE initializePottsCC3D="<<endl;
00302
00303 registerSteerableObject(&potts);
00304
00305 if (!ppdCC3DPtr){
00306 delete ppdCC3DPtr;
00307 ppdCC3DPtr=0;
00308 }
00309
00310 ppdCC3DPtr= new PottsParseData();
00311 cerr<<"ppdCC3DPtr="<<ppdCC3DPtr<<"ppdCC3DPtr->dim="<<ppdCC3DPtr->dim<<endl;
00312
00313 cerr<<"_xmlData->getFirstElement(Dimensions)->getAttributeAsUInt(x)="<<_xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("x")<<endl;
00314 cerr<<"_xmlData->getFirstElement(Dimensions)->getAttributeAsUInt(y)="<<_xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("y")<<endl;
00315 cerr<<"_xmlData->getFirstElement(Dimensions)->getAttributeAsUInt(z)="<<_xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("z")<<endl;
00316
00317 ppdCC3DPtr->dim.x = _xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("x");
00318 ppdCC3DPtr->dim.y = _xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("y");
00319 ppdCC3DPtr->dim.z = _xmlData->getFirstElement("Dimensions")->getAttributeAsUInt("z");
00320
00321 if (_xmlData->getFirstElement("Temperature")) {
00322 ppdCC3DPtr->temperature=_xmlData->getFirstElement("Temperature")->getDouble();
00323 }
00324 if(_xmlData->getFirstElement("CellMotility")){
00325 CC3DXMLElementList motilityVec=_xmlData->getFirstElement("CellMotility")->getElements("MotilityParameters");
00326 for (int i = 0 ; i<motilityVec.size(); ++i){
00327 CellTypeMotilityData motilityData;
00328
00329 motilityData.typeName=motilityVec[i]->getAttribute("CellType");
00330 motilityData.motility=motilityVec[i]->getAttributeAsDouble("Motility");
00331 ppdCC3DPtr->cellTypeMotilityVector.push_back(motilityData);
00332 }
00333 }
00334
00335 if (_xmlData->getFirstElement("Steps")) {
00336 ppdCC3DPtr->numSteps=_xmlData->getFirstElement("Steps")->getUInt();
00337 }
00338 if (_xmlData->getFirstElement("Anneal")) {
00339 ppdCC3DPtr->anneal=_xmlData->getFirstElement("Anneal")->getUInt();
00340 }
00341 if (_xmlData->getFirstElement("Flip2DimRatio")) {
00342 ppdCC3DPtr->flip2DimRatio=_xmlData->getFirstElement("Flip2DimRatio")->getDouble();
00343 }
00344
00345
00346
00347
00348
00349 ASSERT_OR_THROW("You must set Dimensions!", ppdCC3DPtr->dim.x!=0 || ppdCC3DPtr->dim.y!=0 || ppdCC3DPtr->dim.z!=0);
00350 potts.createCellField(ppdCC3DPtr->dim);
00351
00352
00353
00354
00355 std::string metropolisAlgorithmName="";
00356 if(_xmlData->getFirstElement("MetropolisAlgorithm"))
00357 metropolisAlgorithmName = _xmlData->getFirstElement("MetropolisAlgorithm")->getText();
00358
00359 cerr << "_ppdCC3DPtr->algorithmName = " << metropolisAlgorithmName << endl;
00360
00361 if(metropolisAlgorithmName!=""){
00362 potts.setMetropolisAlgorithm(metropolisAlgorithmName);
00363 }
00364
00365
00366
00367
00368 if(!_xmlData->getFirstElement("RandomSeed")){
00369 srand(time(0));
00370 unsigned int randomSeed=(unsigned int)rand()*((std::numeric_limits<unsigned int>::max)()-1);
00371
00372 BasicRandomNumberGenerator *rand = BasicRandomNumberGenerator::getInstance();
00373 rand->setSeed(randomSeed);
00374 }else{
00375 BasicRandomNumberGenerator *rand = BasicRandomNumberGenerator::getInstance();
00376 rand->setSeed(_xmlData->getFirstElement("RandomSeed")->getUInt());
00377 ppdCC3DPtr->seed=_xmlData->getFirstElement("RandomSeed")->getUInt();
00378 }
00379
00380 cerr << "ppdCC3DPtr->seed = " << ppdCC3DPtr->seed << endl;
00381
00382 if (_xmlData->getFirstElement("Shape")) {
00383 ppdCC3DPtr->shapeFlag=true;
00384 ppdCC3DPtr->shapeAlgorithm = _xmlData->getFirstElement("Shape")->getAttribute("Algorithm");
00385 ppdCC3DPtr->shapeIndex = _xmlData->getFirstElement("Shape")->getAttributeAsInt("Index");
00386 ppdCC3DPtr->shapeSize = _xmlData->getFirstElement("Shape")->getAttributeAsInt("Size");;
00387 ppdCC3DPtr->shapeInputfile = _xmlData->getFirstElement("Shape")->getAttribute("File");;
00388 ppdCC3DPtr->shapeReg = _xmlData->getFirstElement("Shape")->getText();
00389 }
00390
00391
00392 if (_xmlData->getFirstElement("Boundary_x")) {
00393 ppdCC3DPtr->boundary_x = _xmlData->getFirstElement("Boundary_x")->getText();
00394 }
00395 if (_xmlData->getFirstElement("Boundary_y")) {
00396 ppdCC3DPtr->boundary_y = _xmlData->getFirstElement("Boundary_y")->getText();
00397 }
00398
00399 if (_xmlData->getFirstElement("Boundary_z")) {
00400 ppdCC3DPtr->boundary_z = _xmlData->getFirstElement("Boundary_z")->getText();
00401 }
00402
00403
00404 if(ppdCC3DPtr->shapeFlag){
00405 if (ppdCC3DPtr->shapeReg == "irregular") {
00406 ppdCC3DPtr->boundary_x = "noflux";
00407 ppdCC3DPtr->boundary_y = "noflux";
00408 ppdCC3DPtr->boundary_z = "noflux";
00409 }
00410 }
00411
00412
00413 cerr << "ppdCC3DPtr->boundary_x = " << ppdCC3DPtr->boundary_x << endl;
00414
00415 if(ppdCC3DPtr->boundary_x!=""){
00416 potts.setBoundaryXName(ppdCC3DPtr->boundary_x);
00417 }
00418
00419 cerr << "_ppdCC3DPtr->boundary_y = " << ppdCC3DPtr->boundary_y << endl;
00420 if(ppdCC3DPtr->boundary_y!=""){
00421 potts.setBoundaryYName(ppdCC3DPtr->boundary_y);
00422 }
00423
00424 cerr << "ppdCC3DPtr->boundary_z = " << ppdCC3DPtr->boundary_z << endl;
00425 if(ppdCC3DPtr->boundary_z!=""){
00426 potts.setBoundaryZName(ppdCC3DPtr->boundary_z);
00427 }
00428
00429 if (_xmlData->getFirstElement("LatticeType")) {
00430 ppdCC3DPtr->latticeType = _xmlData->getFirstElement("LatticeType")->getText();
00431 }
00432
00433 cerr << "ppdCC3DPtr->latticeType = " << ppdCC3DPtr->latticeType << endl;
00434
00435 changeToLower(ppdCC3DPtr->latticeType);
00436
00437 BoundaryStrategy::destroy();
00438
00439
00440 if(ppdCC3DPtr->latticeType=="hexagonal")
00441 {
00442 if(ppdCC3DPtr->boundary_x=="Periodic")
00443 {
00444 ASSERT_OR_THROW("For hexagonal lattice and x periodic boundary conditions x dimension must be and even number",!(ppdCC3DPtr->dim.x%2));
00445 }
00446 if(ppdCC3DPtr->boundary_y=="Periodic")
00447 {
00448 ASSERT_OR_THROW("For hexagonal lattice and y periodic boundary conditions y dimension must be and even number",!(ppdCC3DPtr->dim.y%2));
00449 }
00450 if(ppdCC3DPtr->boundary_z=="Periodic")
00451 {
00452 ASSERT_OR_THROW("For hexagonal lattice and z periodic boundary conditions z dimension must be and even number",!(ppdCC3DPtr->dim.z%2));
00453 }
00454
00455 BoundaryStrategy::instantiate(ppdCC3DPtr->boundary_x, ppdCC3DPtr->boundary_y, ppdCC3DPtr->boundary_z, ppdCC3DPtr->shapeAlgorithm, ppdCC3DPtr->shapeIndex, ppdCC3DPtr->shapeSize, ppdCC3DPtr->shapeInputfile,HEXAGONAL_LATTICE);
00456 cerr<<"initialized hex lattice"<<endl;
00457 }
00458 else
00459 {
00460 BoundaryStrategy::instantiate(ppdCC3DPtr->boundary_x, ppdCC3DPtr->boundary_y, ppdCC3DPtr->boundary_z, ppdCC3DPtr->shapeAlgorithm, ppdCC3DPtr->shapeIndex, ppdCC3DPtr->shapeSize, ppdCC3DPtr->shapeInputfile,SQUARE_LATTICE);
00461 cerr<<"initialized square lattice"<<endl;
00462 }
00463
00464 cerr<<"potts.getLatticeType()="<<potts.getLatticeType()<<endl;
00465
00466
00467 BoundaryStrategy::getInstance()->setDim(ppdCC3DPtr->dim);
00468
00469
00470
00471 if (_xmlData->getFirstElement("FlipNeighborMaxDistance")) {
00472
00473 ppdCC3DPtr->depth=_xmlData->getFirstElement("FlipNeighborMaxDistance")->getDouble();
00474 ppdCC3DPtr->depthFlag=true;
00475 }
00476
00477 if (_xmlData->getFirstElement("NeighborOrder")) {
00478
00479 ppdCC3DPtr->neighborOrder=_xmlData->getFirstElement("NeighborOrder")->getUInt();
00480 ppdCC3DPtr->depthFlag=false;
00481 }
00482
00483 if(ppdCC3DPtr->depthFlag)
00484 {
00485 potts.setDepth(ppdCC3DPtr->depth);
00486 }
00487 else
00488 {
00489 potts.setNeighborOrder(ppdCC3DPtr->neighborOrder);
00490 }
00491
00492 cerr << "ppdCC3DPtr->depthFlag = " << ppdCC3DPtr->depthFlag << endl;
00493
00494 if (_xmlData->getFirstElement("DebugOutputFrequency")) {
00495 ppdCC3DPtr->debugOutputFrequency=_xmlData->getFirstElement("DebugOutputFrequency")->getUInt();
00496 }
00497
00498
00499 cerr << "ppdCC3DPtr->debugOutputFrequency = " << ppdCC3DPtr->debugOutputFrequency << endl;
00500 if(ppdCC3DPtr->debugOutputFrequency<=0)
00501 {
00502 potts.setDebugOutputFrequency(1);
00503 }
00504 else
00505 {
00506 potts.setDebugOutputFrequency(ppdCC3DPtr->debugOutputFrequency);
00507 }
00508
00509 if (_xmlData->getFirstElement("AcceptanceFunctionName")) {
00510 ppdCC3DPtr->acceptanceFunctionName=_xmlData->getFirstElement("AcceptanceFunctionName")->getText();
00511 }
00512
00513
00514 potts.setAcceptanceFunctionByName(ppdCC3DPtr->acceptanceFunctionName);
00515
00516
00517 if (_xmlData->getFirstElement("Offset")) {
00518 ppdCC3DPtr->acceptanceFunctionName=_xmlData->getFirstElement("Offset")->getDouble();
00519 }
00520
00521 if (_xmlData->getFirstElement("KBoltzman")) {
00522 ppdCC3DPtr->acceptanceFunctionName=_xmlData->getFirstElement("KBoltzman")->getDouble();
00523 }
00524
00525 if(ppdCC3DPtr->offset!=0.)
00526 {
00527 potts.getAcceptanceFunction()->setOffset(ppdCC3DPtr->offset);
00528 }
00529 if(ppdCC3DPtr->kBoltzman!=1.0)
00530 {
00531 potts.getAcceptanceFunction()->setK(ppdCC3DPtr->kBoltzman);
00532 }
00533
00534
00535 if(_xmlData->getFirstElement("EnergyFunctionCalculator"))
00536 {
00537 if(_xmlData->getFirstElement("EnergyFunctionCalculator")->findAttribute("Type")){
00538 std::string energyFunctionCalculatorType=_xmlData->getFirstElement("EnergyFunctionCalculator")->getAttribute("Type");
00539 if(energyFunctionCalculatorType=="Statistics"){
00540 potts.createEnergyFunction(energyFunctionCalculatorType);
00541 }
00542 }
00543 EnergyFunctionCalculator * enCalculator=potts.getEnergyFunctionCalculator();
00544 enCalculator->setSimulator(this);
00545 enCalculator->init(_xmlData->getFirstElement("EnergyFunctionCalculator"));
00546 }
00547
00548
00549
00550
00551 }
00552
00553
00555 CC3DXMLElement * Simulator::getCC3DModuleData(std::string _moduleType,std::string _moduleName){
00556 if(_moduleType=="Potts"){
00557 return ps.pottsCC3DXMLElement;
00558 }else if(_moduleType=="Plugin"){
00559 for (int i = 0 ; i<ps.pluginCC3DXMLElementVector.size() ; ++i){
00560 if (ps.pluginCC3DXMLElementVector[i]->getAttribute("Name")==_moduleName)
00561 return ps.pluginCC3DXMLElementVector[i];
00562 }
00563 return 0;
00564 }else if(_moduleType=="Steppable"){
00565 for (int i = 0 ; i<ps.pluginCC3DXMLElementVector.size() ; ++i){
00566 if (ps.steppableCC3DXMLElementVector[i]->getAttribute("Type")==_moduleName)
00567 return ps.steppableCC3DXMLElementVector[i];
00568 }
00569 return 0;
00570 }else{
00571 return 0;
00572 }
00573 }
00574
00575 void Simulator::updateCC3DModule(CC3DXMLElement *_element){
00576 if(!_element)
00577 return;
00578 if(_element->getName()=="Potts"){
00579 ps.updatePottsCC3DXMLElement=_element;
00580 }else if(_element->getName()=="Plugin"){
00581 ps.updatePluginCC3DXMLElementVector.push_back(_element);
00582 }else if(_element->getName()=="Steppable"){
00583 ps.updateSteppableCC3DXMLElementVector.push_back(_element);
00584 }
00585 }
00586
00587 void Simulator::steer(){
00588 std::map<std::string,SteerableObject *>::iterator mitr;
00589
00590 if(ps.updatePottsCC3DXMLElement){
00591
00592 mitr=steerableObjectMap.find("Potts");
00593 if(mitr!=steerableObjectMap.end()){
00594 mitr->second->update(ps.updatePottsCC3DXMLElement);
00595 ps.pottsCC3DXMLElement=ps.updatePottsCC3DXMLElement;
00596 ps.updatePottsCC3DXMLElement=0;
00597 }
00598
00599 }else if(ps.updatePluginCC3DXMLElementVector.size()){
00600
00601 string moduleName;
00602 for (int i = 0 ; i < ps.updatePluginCC3DXMLElementVector.size() ; ++i){
00603 moduleName=ps.updatePluginCC3DXMLElementVector[i]->getAttribute("Name");
00604 mitr=steerableObjectMap.find(moduleName);
00605 if(mitr!=steerableObjectMap.end()){
00606 mitr->second->update(ps.updatePluginCC3DXMLElementVector[i]);
00607
00608 for(int j=0 ; j < ps.pluginCC3DXMLElementVector.size(); ++j){
00609 if(ps.pluginCC3DXMLElementVector[j]->getAttribute("Name")==moduleName)
00610 ps.pluginCC3DXMLElementVector[j]=ps.updatePluginCC3DXMLElementVector[i];
00611 }
00612 }
00613
00614 }
00615 ps.updatePluginCC3DXMLElementVector.clear();
00616 }else if(ps.updateSteppableCC3DXMLElementVector.size()){
00617
00618 string moduleName;
00619 for (int i = 0 ; i < ps.updateSteppableCC3DXMLElementVector.size() ; ++i){
00620 moduleName=ps.updateSteppableCC3DXMLElementVector[i]->getAttribute("Type");
00621 mitr=steerableObjectMap.find(moduleName);
00622 if(mitr!=steerableObjectMap.end()){
00623 mitr->second->update(ps.updateSteppableCC3DXMLElementVector[i]);
00624
00625 for(int j=0 ; j < ps.steppableCC3DXMLElementVector.size(); ++j){
00626 if(ps.steppableCC3DXMLElementVector[j]->getAttribute("Type")==moduleName)
00627 ps.steppableCC3DXMLElementVector[j]=ps.updateSteppableCC3DXMLElementVector[i];
00628 }
00629 }
00630 }
00631 ps.updateSteppableCC3DXMLElementVector.clear();
00632 }
00633
00634 }