| [bcf653] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
| [d103d3] | 4 |  * Copyright (C)  2010-2011 University of Bonn. All rights reserved.
 | 
|---|
| [bcf653] | 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
| [5d1611] | 8 | /*
 | 
|---|
 | 9 |  * World.cpp
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *  Created on: Feb 3, 2010
 | 
|---|
 | 12 |  *      Author: crueger
 | 
|---|
 | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
| [bf3817] | 15 | // include config.h
 | 
|---|
 | 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 17 | #include <config.h>
 | 
|---|
 | 18 | #endif
 | 
|---|
 | 19 | 
 | 
|---|
| [ad011c] | 20 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
| [112b09] | 21 | 
 | 
|---|
| [5d1611] | 22 | #include "World.hpp"
 | 
|---|
 | 23 | 
 | 
|---|
| [90c4280] | 24 | #include <functional>
 | 
|---|
| [5d1611] | 25 | 
 | 
|---|
| [3139b2] | 26 | #include "Actions/ActionTrait.hpp"
 | 
|---|
| [d297a3] | 27 | #include "Actions/ManipulateAtomsProcess.hpp"
 | 
|---|
| [6f0841] | 28 | #include "Atom/atom.hpp"
 | 
|---|
| [5dfabd] | 29 | #include "Atom/AtomObserver.hpp"
 | 
|---|
| [d297a3] | 30 | #include "Box.hpp"
 | 
|---|
 | 31 | #include "CodePatterns/Assert.hpp"
 | 
|---|
| [8e1f7af] | 32 | #include "config.hpp"
 | 
|---|
| [fc1b24] | 33 | #include "Descriptors/AtomDescriptor.hpp"
 | 
|---|
| [865a945] | 34 | #include "Descriptors/AtomDescriptor_impl.hpp"
 | 
|---|
| [1c51c8] | 35 | #include "Descriptors/MoleculeDescriptor.hpp"
 | 
|---|
 | 36 | #include "Descriptors/MoleculeDescriptor_impl.hpp"
 | 
|---|
| [6e97e5] | 37 | #include "Descriptors/SelectiveIterator_impl.hpp"
 | 
|---|
| [42127c] | 38 | #include "Element/periodentafel.hpp"
 | 
|---|
| [3139b2] | 39 | #include "Graph/BondGraph.hpp"
 | 
|---|
| [4b8630] | 40 | #include "Graph/DepthFirstSearchAnalysis.hpp"
 | 
|---|
| [e4fe8d] | 41 | #include "Helpers/defs.hpp"
 | 
|---|
| [d297a3] | 42 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
 | 
|---|
 | 43 | #include "molecule.hpp"
 | 
|---|
| [42127c] | 44 | #include "MoleculeListClass.hpp"
 | 
|---|
| [ab26c3] | 45 | #include "Thermostats/ThermoStatContainer.hpp"
 | 
|---|
| [d297a3] | 46 | #include "WorldTime.hpp"
 | 
|---|
| [d346b6] | 47 | 
 | 
|---|
| [3e4fb6] | 48 | #include "IdPool_impl.hpp"
 | 
|---|
 | 49 | 
 | 
|---|
| [ad011c] | 50 | #include "CodePatterns/Singleton_impl.hpp"
 | 
|---|
| [02ce36] | 51 | #include "CodePatterns/Observer/Channels.hpp"
 | 
|---|
 | 52 | #include "CodePatterns/Observer/ObservedContainer_impl.hpp"
 | 
|---|
| [23b547] | 53 | 
 | 
|---|
| [ce7fdc] | 54 | using namespace MoleCuilder;
 | 
|---|
| [4d9c01] | 55 | 
 | 
|---|
| [7188b1] | 56 | /******************************* Notifications ************************/
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | 
 | 
|---|
 | 59 | atom* World::_lastchangedatom = NULL;
 | 
|---|
 | 60 | molecule* World::_lastchangedmol = NULL;
 | 
|---|
 | 61 | 
 | 
|---|
| [5d1611] | 62 | /******************************* getter and setter ************************/
 | 
|---|
| [f71baf] | 63 | periodentafel *&World::getPeriode()
 | 
|---|
 | 64 | {
 | 
|---|
| [5d1611] | 65 |   return periode;
 | 
|---|
 | 66 | }
 | 
|---|
 | 67 | 
 | 
|---|
| [f71baf] | 68 | BondGraph *&World::getBondGraph()
 | 
|---|
 | 69 | {
 | 
|---|
 | 70 |   return BG;
 | 
|---|
 | 71 | }
 | 
|---|
 | 72 | 
 | 
|---|
 | 73 | void World::setBondGraph(BondGraph *_BG){
 | 
|---|
 | 74 |   delete (BG);
 | 
|---|
 | 75 |   BG = _BG;
 | 
|---|
 | 76 | }
 | 
|---|
 | 77 | 
 | 
|---|
| [8e1f7af] | 78 | config *&World::getConfig(){
 | 
|---|
 | 79 |   return configuration;
 | 
|---|
 | 80 | }
 | 
|---|
 | 81 | 
 | 
|---|
| [1c51c8] | 82 | // Atoms
 | 
|---|
 | 83 | 
 | 
|---|
| [7a1ce5] | 84 | atom* World::getAtom(AtomDescriptor descriptor){
 | 
|---|
| [fc1b24] | 85 |   return descriptor.find();
 | 
|---|
 | 86 | }
 | 
|---|
 | 87 | 
 | 
|---|
| [4d72e4] | 88 | World::AtomComposite World::getAllAtoms(AtomDescriptor descriptor){
 | 
|---|
| [fc1b24] | 89 |   return descriptor.findAll();
 | 
|---|
 | 90 | }
 | 
|---|
 | 91 | 
 | 
|---|
| [4d72e4] | 92 | World::AtomComposite World::getAllAtoms(){
 | 
|---|
| [0e2a47] | 93 |   return getAllAtoms(AllAtoms());
 | 
|---|
 | 94 | }
 | 
|---|
 | 95 | 
 | 
|---|
| [354859] | 96 | int World::numAtoms(){
 | 
|---|
 | 97 |   return atoms.size();
 | 
|---|
 | 98 | }
 | 
|---|
 | 99 | 
 | 
|---|
| [1c51c8] | 100 | // Molecules
 | 
|---|
 | 101 | 
 | 
|---|
 | 102 | molecule *World::getMolecule(MoleculeDescriptor descriptor){
 | 
|---|
 | 103 |   return descriptor.find();
 | 
|---|
 | 104 | }
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | std::vector<molecule*> World::getAllMolecules(MoleculeDescriptor descriptor){
 | 
|---|
 | 107 |   return descriptor.findAll();
 | 
|---|
 | 108 | }
 | 
|---|
 | 109 | 
 | 
|---|
| [97ebf8] | 110 | std::vector<molecule*> World::getAllMolecules(){
 | 
|---|
 | 111 |   return getAllMolecules(AllMolecules());
 | 
|---|
 | 112 | }
 | 
|---|
 | 113 | 
 | 
|---|
| [354859] | 114 | int World::numMolecules(){
 | 
|---|
 | 115 |   return molecules_deprecated->ListOfMolecules.size();
 | 
|---|
 | 116 | }
 | 
|---|
 | 117 | 
 | 
|---|
| [5f612ee] | 118 | // system
 | 
|---|
 | 119 | 
 | 
|---|
| [84c494] | 120 | Box& World::getDomain() {
 | 
|---|
 | 121 |   return *cell_size;
 | 
|---|
 | 122 | }
 | 
|---|
 | 123 | 
 | 
|---|
| [cca9ef] | 124 | void World::setDomain(const RealSpaceMatrix &mat){
 | 
|---|
| [be97a8] | 125 |   OBSERVE;
 | 
|---|
| [84c494] | 126 |   *cell_size = mat;
 | 
|---|
| [5f612ee] | 127 | }
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | void World::setDomain(double * matrix)
 | 
|---|
 | 130 | {
 | 
|---|
| [b9c847] | 131 |   OBSERVE;
 | 
|---|
| [cca9ef] | 132 |   RealSpaceMatrix M = ReturnFullMatrixforSymmetric(matrix);
 | 
|---|
| [84c494] | 133 |   cell_size->setM(M);
 | 
|---|
| [5f612ee] | 134 | }
 | 
|---|
 | 135 | 
 | 
|---|
| [d297a3] | 136 | void World::setTime(const unsigned int _step)
 | 
|---|
 | 137 | {
 | 
|---|
| [76163d] | 138 |   if (_step != WorldTime::getTime()) {
 | 
|---|
 | 139 |     // set new time
 | 
|---|
 | 140 |     WorldTime::setTime(_step);
 | 
|---|
| [4b8630] | 141 |     // TODO: removed when BondGraph creates the adjacency
 | 
|---|
 | 142 |     // 1. remove all of World's molecules
 | 
|---|
 | 143 |     for (MoleculeIterator iter = getMoleculeIter();
 | 
|---|
 | 144 |         getMoleculeIter() != moleculeEnd();
 | 
|---|
 | 145 |         iter = getMoleculeIter()) {
 | 
|---|
 | 146 |       getMolecules()->erase(*iter);
 | 
|---|
 | 147 |       destroyMolecule(*iter);
 | 
|---|
 | 148 |     }
 | 
|---|
 | 149 |     // 2. (re-)create bondgraph
 | 
|---|
 | 150 |     AtomComposite Set = getAllAtoms();
 | 
|---|
 | 151 |     BG->CreateAdjacency(Set);
 | 
|---|
 | 152 | 
 | 
|---|
 | 153 |     // 3. scan for connected subgraphs => molecules
 | 
|---|
 | 154 |     DepthFirstSearchAnalysis DFS;
 | 
|---|
 | 155 |     DFS();
 | 
|---|
 | 156 |     DFS.UpdateMoleculeStructure();
 | 
|---|
| [76163d] | 157 |   }
 | 
|---|
| [d297a3] | 158 | }
 | 
|---|
 | 159 | 
 | 
|---|
| [387b36] | 160 | std::string World::getDefaultName() {
 | 
|---|
| [5f612ee] | 161 |   return defaultName;
 | 
|---|
 | 162 | }
 | 
|---|
 | 163 | 
 | 
|---|
| [387b36] | 164 | void World::setDefaultName(std::string name)
 | 
|---|
| [5f612ee] | 165 | {
 | 
|---|
| [be97a8] | 166 |   OBSERVE;
 | 
|---|
| [387b36] | 167 |   defaultName = name;
 | 
|---|
| [5f612ee] | 168 | };
 | 
|---|
 | 169 | 
 | 
|---|
| [43dad6] | 170 | class ThermoStatContainer * World::getThermostats()
 | 
|---|
 | 171 | {
 | 
|---|
 | 172 |   return Thermostats;
 | 
|---|
 | 173 | }
 | 
|---|
 | 174 | 
 | 
|---|
 | 175 | 
 | 
|---|
| [e4b5de] | 176 | int World::getExitFlag() {
 | 
|---|
 | 177 |   return ExitFlag;
 | 
|---|
 | 178 | }
 | 
|---|
 | 179 | 
 | 
|---|
 | 180 | void World::setExitFlag(int flag) {
 | 
|---|
 | 181 |   if (ExitFlag < flag)
 | 
|---|
 | 182 |     ExitFlag = flag;
 | 
|---|
 | 183 | }
 | 
|---|
| [5f612ee] | 184 | 
 | 
|---|
| [afb47f] | 185 | /******************** Methods to change World state *********************/
 | 
|---|
 | 186 | 
 | 
|---|
| [354859] | 187 | molecule* World::createMolecule(){
 | 
|---|
 | 188 |   OBSERVE;
 | 
|---|
 | 189 |   molecule *mol = NULL;
 | 
|---|
| [cbc5fb] | 190 |   mol = NewMolecule();
 | 
|---|
| [3e4fb6] | 191 |   moleculeId_t id = moleculeIdPool.getNextId();
 | 
|---|
| [127a8e] | 192 |   ASSERT(!molecules.count(id),"proposed id did not specify an unused ID");
 | 
|---|
 | 193 |   mol->setId(id);
 | 
|---|
| [244d26] | 194 |   // store the molecule by ID
 | 
|---|
| [cbc5fb] | 195 |   molecules[mol->getId()] = mol;
 | 
|---|
| [354859] | 196 |   mol->signOn(this);
 | 
|---|
| [7188b1] | 197 |   _lastchangedmol = mol;
 | 
|---|
 | 198 |   NOTIFY(MoleculeInserted);
 | 
|---|
| [354859] | 199 |   return mol;
 | 
|---|
 | 200 | }
 | 
|---|
 | 201 | 
 | 
|---|
| [cbc5fb] | 202 | void World::destroyMolecule(molecule* mol){
 | 
|---|
 | 203 |   OBSERVE;
 | 
|---|
| [fa7989] | 204 |   ASSERT(mol,"Molecule that was meant to be destroyed did not exist");
 | 
|---|
| [cbc5fb] | 205 |   destroyMolecule(mol->getId());
 | 
|---|
 | 206 | }
 | 
|---|
 | 207 | 
 | 
|---|
 | 208 | void World::destroyMolecule(moleculeId_t id){
 | 
|---|
 | 209 |   molecule *mol = molecules[id];
 | 
|---|
| [6d574a] | 210 |   ASSERT(mol,"Molecule id that was meant to be destroyed did not exist");
 | 
|---|
| [38f991] | 211 |   // give notice about immediate removal
 | 
|---|
 | 212 |   {
 | 
|---|
 | 213 |     OBSERVE;
 | 
|---|
 | 214 |     _lastchangedmol = mol;
 | 
|---|
 | 215 |     NOTIFY(MoleculeRemoved);
 | 
|---|
 | 216 |   }
 | 
|---|
| [cbc5fb] | 217 |   DeleteMolecule(mol);
 | 
|---|
| [38f991] | 218 |   if (isMoleculeSelected(id))
 | 
|---|
 | 219 |     selectedMolecules.erase(id);
 | 
|---|
| [cbc5fb] | 220 |   molecules.erase(id);
 | 
|---|
| [3e4fb6] | 221 |   moleculeIdPool.releaseId(id);
 | 
|---|
| [cbc5fb] | 222 | }
 | 
|---|
 | 223 | 
 | 
|---|
| [46d958] | 224 | atom *World::createAtom(){
 | 
|---|
 | 225 |   OBSERVE;
 | 
|---|
| [3e4fb6] | 226 |   atomId_t id = atomIdPool.getNextId();
 | 
|---|
| [127a8e] | 227 |   ASSERT(!atoms.count(id),"proposed id did not specify an unused ID");
 | 
|---|
| [88d586] | 228 |   atom *res = NewAtom(id);
 | 
|---|
| [46d958] | 229 |   res->setWorld(this);
 | 
|---|
| [5dfabd] | 230 |   // sign on to global atom change tracker
 | 
|---|
 | 231 |   AtomObserver::getInstance().AtomInserted(res);
 | 
|---|
| [244d26] | 232 |   // store the atom by ID
 | 
|---|
| [46d958] | 233 |   atoms[res->getId()] = res;
 | 
|---|
| [7188b1] | 234 |   _lastchangedatom = res;
 | 
|---|
 | 235 |   NOTIFY(AtomInserted);
 | 
|---|
| [46d958] | 236 |   return res;
 | 
|---|
 | 237 | }
 | 
|---|
 | 238 | 
 | 
|---|
| [5f612ee] | 239 | 
 | 
|---|
| [46d958] | 240 | int World::registerAtom(atom *atom){
 | 
|---|
 | 241 |   OBSERVE;
 | 
|---|
| [3e4fb6] | 242 |   atomId_t id = atomIdPool.getNextId();
 | 
|---|
| [88d586] | 243 |   atom->setId(id);
 | 
|---|
| [46d958] | 244 |   atom->setWorld(this);
 | 
|---|
 | 245 |   atoms[atom->getId()] = atom;
 | 
|---|
 | 246 |   return atom->getId();
 | 
|---|
 | 247 | }
 | 
|---|
 | 248 | 
 | 
|---|
 | 249 | void World::destroyAtom(atom* atom){
 | 
|---|
 | 250 |   int id = atom->getId();
 | 
|---|
 | 251 |   destroyAtom(id);
 | 
|---|
 | 252 | }
 | 
|---|
 | 253 | 
 | 
|---|
| [cbc5fb] | 254 | void World::destroyAtom(atomId_t id) {
 | 
|---|
| [46d958] | 255 |   atom *atom = atoms[id];
 | 
|---|
| [6d574a] | 256 |   ASSERT(atom,"Atom ID that was meant to be destroyed did not exist");
 | 
|---|
| [ab4a33] | 257 |   // give notice about immediate removal
 | 
|---|
 | 258 |   {
 | 
|---|
 | 259 |     OBSERVE;
 | 
|---|
 | 260 |     _lastchangedatom = atom;
 | 
|---|
 | 261 |     NOTIFY(AtomRemoved);
 | 
|---|
 | 262 |   }
 | 
|---|
| [46d958] | 263 |   DeleteAtom(atom);
 | 
|---|
| [38f991] | 264 |   if (isAtomSelected(id))
 | 
|---|
 | 265 |     selectedAtoms.erase(id);
 | 
|---|
| [46d958] | 266 |   atoms.erase(id);
 | 
|---|
| [3e4fb6] | 267 |   atomIdPool.releaseId(id);
 | 
|---|
| [88d586] | 268 | }
 | 
|---|
 | 269 | 
 | 
|---|
 | 270 | bool World::changeAtomId(atomId_t oldId, atomId_t newId, atom* target){
 | 
|---|
 | 271 |   OBSERVE;
 | 
|---|
 | 272 |   // in case this call did not originate from inside the atom, we redirect it,
 | 
|---|
 | 273 |   // to also let it know that it has changed
 | 
|---|
 | 274 |   if(!target){
 | 
|---|
 | 275 |     target = atoms[oldId];
 | 
|---|
| [6d574a] | 276 |     ASSERT(target,"Atom with that ID not found");
 | 
|---|
| [88d586] | 277 |     return target->changeId(newId);
 | 
|---|
 | 278 |   }
 | 
|---|
 | 279 |   else{
 | 
|---|
| [3e4fb6] | 280 |     if(atomIdPool.reserveId(newId)){
 | 
|---|
| [88d586] | 281 |       atoms.erase(oldId);
 | 
|---|
 | 282 |       atoms.insert(pair<atomId_t,atom*>(newId,target));
 | 
|---|
 | 283 |       return true;
 | 
|---|
 | 284 |     }
 | 
|---|
 | 285 |     else{
 | 
|---|
 | 286 |       return false;
 | 
|---|
 | 287 |     }
 | 
|---|
 | 288 |   }
 | 
|---|
| [46d958] | 289 | }
 | 
|---|
 | 290 | 
 | 
|---|
| [a7a087] | 291 | bool World::changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target){
 | 
|---|
 | 292 |   OBSERVE;
 | 
|---|
 | 293 |   // in case this call did not originate from inside the atom, we redirect it,
 | 
|---|
 | 294 |   // to also let it know that it has changed
 | 
|---|
 | 295 |   if(!target){
 | 
|---|
 | 296 |     target = molecules[oldId];
 | 
|---|
 | 297 |     ASSERT(target,"Molecule with that ID not found");
 | 
|---|
 | 298 |     return target->changeId(newId);
 | 
|---|
 | 299 |   }
 | 
|---|
 | 300 |   else{
 | 
|---|
| [3e4fb6] | 301 |     if(moleculeIdPool.reserveId(newId)){
 | 
|---|
| [a7a087] | 302 |       molecules.erase(oldId);
 | 
|---|
 | 303 |       molecules.insert(pair<moleculeId_t,molecule*>(newId,target));
 | 
|---|
 | 304 |       return true;
 | 
|---|
 | 305 |     }
 | 
|---|
 | 306 |     else{
 | 
|---|
 | 307 |       return false;
 | 
|---|
 | 308 |     }
 | 
|---|
 | 309 |   }
 | 
|---|
 | 310 | }
 | 
|---|
 | 311 | 
 | 
|---|
| [7c4e29] | 312 | ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name,AtomDescriptor descr){
 | 
|---|
| [3139b2] | 313 |   ActionTrait manipulateTrait(name);
 | 
|---|
| [e4afb4] | 314 |   return new ManipulateAtomsProcess(op, descr,manipulateTrait,false);
 | 
|---|
| [7c4e29] | 315 | }
 | 
|---|
 | 316 | 
 | 
|---|
| [0e2a47] | 317 | ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name){
 | 
|---|
 | 318 |   return manipulateAtoms(op,name,AllAtoms());
 | 
|---|
 | 319 | }
 | 
|---|
 | 320 | 
 | 
|---|
| [afb47f] | 321 | /********************* Internal Change methods for double Callback and Observer mechanism ********/
 | 
|---|
 | 322 | 
 | 
|---|
 | 323 | void World::doManipulate(ManipulateAtomsProcess *proc){
 | 
|---|
 | 324 |   proc->signOn(this);
 | 
|---|
 | 325 |   {
 | 
|---|
 | 326 |     OBSERVE;
 | 
|---|
 | 327 |     proc->doManipulate(this);
 | 
|---|
 | 328 |   }
 | 
|---|
 | 329 |   proc->signOff(this);
 | 
|---|
 | 330 | }
 | 
|---|
| [865a945] | 331 | /******************************* Iterators ********************************/
 | 
|---|
 | 332 | 
 | 
|---|
| [fa0b18] | 333 | // external parts with observers
 | 
|---|
 | 334 | 
 | 
|---|
| [6e97e5] | 335 | CONSTRUCT_SELECTIVE_ITERATOR(atom*,World::AtomSet,AtomDescriptor);
 | 
|---|
 | 336 | 
 | 
|---|
| [fa0b18] | 337 | World::AtomIterator
 | 
|---|
 | 338 | World::getAtomIter(AtomDescriptor descr){
 | 
|---|
 | 339 |     return AtomIterator(descr,atoms);
 | 
|---|
 | 340 | }
 | 
|---|
| [865a945] | 341 | 
 | 
|---|
| [fa0b18] | 342 | World::AtomIterator
 | 
|---|
 | 343 | World::getAtomIter(){
 | 
|---|
 | 344 |     return AtomIterator(AllAtoms(),atoms);
 | 
|---|
| [865a945] | 345 | }
 | 
|---|
| [354859] | 346 | 
 | 
|---|
| [fa0b18] | 347 | World::AtomIterator
 | 
|---|
 | 348 | World::atomEnd(){
 | 
|---|
| [6e97e5] | 349 |   return AtomIterator(AllAtoms(),atoms,atoms.end());
 | 
|---|
| [7c4e29] | 350 | }
 | 
|---|
 | 351 | 
 | 
|---|
| [6e97e5] | 352 | CONSTRUCT_SELECTIVE_ITERATOR(molecule*,World::MoleculeSet,MoleculeDescriptor);
 | 
|---|
 | 353 | 
 | 
|---|
| [5d880e] | 354 | World::MoleculeIterator
 | 
|---|
 | 355 | World::getMoleculeIter(MoleculeDescriptor descr){
 | 
|---|
 | 356 |     return MoleculeIterator(descr,molecules);
 | 
|---|
 | 357 | }
 | 
|---|
 | 358 | 
 | 
|---|
 | 359 | World::MoleculeIterator
 | 
|---|
 | 360 | World::getMoleculeIter(){
 | 
|---|
 | 361 |     return MoleculeIterator(AllMolecules(),molecules);
 | 
|---|
| [1c51c8] | 362 | }
 | 
|---|
 | 363 | 
 | 
|---|
| [5d880e] | 364 | World::MoleculeIterator
 | 
|---|
 | 365 | World::moleculeEnd(){
 | 
|---|
| [6e97e5] | 366 |   return MoleculeIterator(AllMolecules(),molecules,molecules.end());
 | 
|---|
| [1c51c8] | 367 | }
 | 
|---|
 | 368 | 
 | 
|---|
| [fa0b18] | 369 | // Internal parts, without observers
 | 
|---|
 | 370 | 
 | 
|---|
 | 371 | // Build the AtomIterator from template
 | 
|---|
 | 372 | CONSTRUCT_SELECTIVE_ITERATOR(atom*,World::AtomSet::set_t,AtomDescriptor);
 | 
|---|
 | 373 | 
 | 
|---|
 | 374 | 
 | 
|---|
 | 375 | World::internal_AtomIterator
 | 
|---|
 | 376 | World::getAtomIter_internal(AtomDescriptor descr){
 | 
|---|
 | 377 |   return internal_AtomIterator(descr,atoms.getContent());
 | 
|---|
 | 378 | }
 | 
|---|
 | 379 | 
 | 
|---|
 | 380 | World::internal_AtomIterator
 | 
|---|
 | 381 | World::atomEnd_internal(){
 | 
|---|
 | 382 |   return internal_AtomIterator(AllAtoms(),atoms.getContent(),atoms.end_internal());
 | 
|---|
 | 383 | }
 | 
|---|
 | 384 | 
 | 
|---|
| [6e97e5] | 385 | // build the MoleculeIterator from template
 | 
|---|
| [e3d865] | 386 | CONSTRUCT_SELECTIVE_ITERATOR(molecule*,World::MoleculeSet::set_t,MoleculeDescriptor);
 | 
|---|
| [6e97e5] | 387 | 
 | 
|---|
| [e3d865] | 388 | World::internal_MoleculeIterator World::getMoleculeIter_internal(MoleculeDescriptor descr){
 | 
|---|
 | 389 |   return internal_MoleculeIterator(descr,molecules.getContent());
 | 
|---|
| [1c51c8] | 390 | }
 | 
|---|
 | 391 | 
 | 
|---|
| [e3d865] | 392 | World::internal_MoleculeIterator World::moleculeEnd_internal(){
 | 
|---|
 | 393 |   return internal_MoleculeIterator(AllMolecules(),molecules.getContent(),molecules.end_internal());
 | 
|---|
| [1c51c8] | 394 | }
 | 
|---|
 | 395 | 
 | 
|---|
| [90c4280] | 396 | /************************** Selection of Atoms and molecules ******************/
 | 
|---|
 | 397 | 
 | 
|---|
 | 398 | // Atoms
 | 
|---|
 | 399 | 
 | 
|---|
 | 400 | void World::clearAtomSelection(){
 | 
|---|
 | 401 |   selectedAtoms.clear();
 | 
|---|
 | 402 | }
 | 
|---|
 | 403 | 
 | 
|---|
| [e4afb4] | 404 | void World::selectAtom(const atom *_atom){
 | 
|---|
 | 405 |   // atom * is unchanged in this function, but we do store entity as changeable
 | 
|---|
 | 406 |   ASSERT(_atom,"Invalid pointer in selection of atom");
 | 
|---|
 | 407 |   selectedAtoms[_atom->getId()]=const_cast<atom *>(_atom);
 | 
|---|
| [90c4280] | 408 | }
 | 
|---|
 | 409 | 
 | 
|---|
| [e4afb4] | 410 | void World::selectAtom(const atomId_t id){
 | 
|---|
| [90c4280] | 411 |   ASSERT(atoms.count(id),"Atom Id selected that was not in the world");
 | 
|---|
 | 412 |   selectedAtoms[id]=atoms[id];
 | 
|---|
 | 413 | }
 | 
|---|
 | 414 | 
 | 
|---|
 | 415 | void World::selectAllAtoms(AtomDescriptor descr){
 | 
|---|
 | 416 |   internal_AtomIterator begin = getAtomIter_internal(descr);
 | 
|---|
 | 417 |   internal_AtomIterator end = atomEnd_internal();
 | 
|---|
| [e4afb4] | 418 |   void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function
 | 
|---|
| [90c4280] | 419 |   for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above
 | 
|---|
 | 420 | }
 | 
|---|
 | 421 | 
 | 
|---|
| [e4afb4] | 422 | void World::selectAtomsOfMolecule(const molecule *_mol){
 | 
|---|
| [90c4280] | 423 |   ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule");
 | 
|---|
 | 424 |   // need to make it const to get the fast iterators
 | 
|---|
 | 425 |   const molecule *mol = _mol;
 | 
|---|
| [e4afb4] | 426 |   void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function
 | 
|---|
| [90c4280] | 427 |   for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is select... see above
 | 
|---|
 | 428 | }
 | 
|---|
 | 429 | 
 | 
|---|
| [e4afb4] | 430 | void World::selectAtomsOfMolecule(const moleculeId_t id){
 | 
|---|
| [90c4280] | 431 |   ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule");
 | 
|---|
 | 432 |   selectAtomsOfMolecule(molecules[id]);
 | 
|---|
 | 433 | }
 | 
|---|
 | 434 | 
 | 
|---|
| [e4afb4] | 435 | void World::unselectAtom(const atom *_atom){
 | 
|---|
 | 436 |   ASSERT(_atom,"Invalid pointer in unselection of atom");
 | 
|---|
 | 437 |   unselectAtom(_atom->getId());
 | 
|---|
| [61d655e] | 438 | }
 | 
|---|
 | 439 | 
 | 
|---|
| [e4afb4] | 440 | void World::unselectAtom(const atomId_t id){
 | 
|---|
| [61d655e] | 441 |   ASSERT(atoms.count(id),"Atom Id unselected that was not in the world");
 | 
|---|
 | 442 |   selectedAtoms.erase(id);
 | 
|---|
 | 443 | }
 | 
|---|
 | 444 | 
 | 
|---|
 | 445 | void World::unselectAllAtoms(AtomDescriptor descr){
 | 
|---|
 | 446 |   internal_AtomIterator begin = getAtomIter_internal(descr);
 | 
|---|
 | 447 |   internal_AtomIterator end = atomEnd_internal();
 | 
|---|
| [e4afb4] | 448 |   void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
 | 
|---|
| [61d655e] | 449 |   for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
 | 
|---|
 | 450 | }
 | 
|---|
 | 451 | 
 | 
|---|
| [e4afb4] | 452 | void World::unselectAtomsOfMolecule(const molecule *_mol){
 | 
|---|
| [61d655e] | 453 |   ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule");
 | 
|---|
 | 454 |   // need to make it const to get the fast iterators
 | 
|---|
 | 455 |   const molecule *mol = _mol;
 | 
|---|
| [e4afb4] | 456 |   void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
 | 
|---|
| [61d655e] | 457 |   for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is unsselect... see above
 | 
|---|
 | 458 | }
 | 
|---|
 | 459 | 
 | 
|---|
| [e4afb4] | 460 | void World::unselectAtomsOfMolecule(const moleculeId_t id){
 | 
|---|
| [61d655e] | 461 |   ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule");
 | 
|---|
 | 462 |   unselectAtomsOfMolecule(molecules[id]);
 | 
|---|
 | 463 | }
 | 
|---|
 | 464 | 
 | 
|---|
| [e472eab] | 465 | size_t World::countSelectedAtoms() const {
 | 
|---|
| [eacc3b] | 466 |   size_t count = 0;
 | 
|---|
| [e472eab] | 467 |   for (AtomSet::const_iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter)
 | 
|---|
| [eacc3b] | 468 |     count++;
 | 
|---|
 | 469 |   return count;
 | 
|---|
 | 470 | }
 | 
|---|
 | 471 | 
 | 
|---|
| [e4afb4] | 472 | bool World::isSelected(const atom *_atom) const {
 | 
|---|
| [89643d] | 473 |   return isAtomSelected(_atom->getId());
 | 
|---|
 | 474 | }
 | 
|---|
 | 475 | 
 | 
|---|
 | 476 | bool World::isAtomSelected(const atomId_t no) const {
 | 
|---|
 | 477 |   return selectedAtoms.find(no) != selectedAtoms.end();
 | 
|---|
| [e0e156] | 478 | }
 | 
|---|
 | 479 | 
 | 
|---|
| [e472eab] | 480 | const std::vector<atom *> World::getSelectedAtoms() const {
 | 
|---|
 | 481 |   std::vector<atom *> returnAtoms;
 | 
|---|
 | 482 |   returnAtoms.resize(countSelectedAtoms());
 | 
|---|
 | 483 |   int count = 0;
 | 
|---|
 | 484 |   for (AtomSet::const_iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter)
 | 
|---|
 | 485 |     returnAtoms[count++] = iter->second;
 | 
|---|
 | 486 |   return returnAtoms;
 | 
|---|
 | 487 | }
 | 
|---|
 | 488 | 
 | 
|---|
 | 489 | 
 | 
|---|
| [90c4280] | 490 | // Molecules
 | 
|---|
 | 491 | 
 | 
|---|
 | 492 | void World::clearMoleculeSelection(){
 | 
|---|
 | 493 |   selectedMolecules.clear();
 | 
|---|
 | 494 | }
 | 
|---|
 | 495 | 
 | 
|---|
| [e4afb4] | 496 | void World::selectMolecule(const molecule *_mol){
 | 
|---|
 | 497 |   // molecule * is unchanged in this function, but we do store entity as changeable
 | 
|---|
 | 498 |   ASSERT(_mol,"Invalid pointer to molecule in selection");
 | 
|---|
 | 499 |   selectedMolecules[_mol->getId()]=const_cast<molecule *>(_mol);
 | 
|---|
| [90c4280] | 500 | }
 | 
|---|
 | 501 | 
 | 
|---|
| [e4afb4] | 502 | void World::selectMolecule(const moleculeId_t id){
 | 
|---|
| [90c4280] | 503 |   ASSERT(molecules.count(id),"Molecule Id selected that was not in the world");
 | 
|---|
 | 504 |   selectedMolecules[id]=molecules[id];
 | 
|---|
 | 505 | }
 | 
|---|
 | 506 | 
 | 
|---|
| [e472eab] | 507 | void World::selectAllMolecules(MoleculeDescriptor descr){
 | 
|---|
| [90c4280] | 508 |   internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
 | 
|---|
 | 509 |   internal_MoleculeIterator end = moleculeEnd_internal();
 | 
|---|
| [e4afb4] | 510 |   void (World::*func)(const molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function
 | 
|---|
| [90c4280] | 511 |   for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above
 | 
|---|
 | 512 | }
 | 
|---|
 | 513 | 
 | 
|---|
| [e4afb4] | 514 | void World::selectMoleculeOfAtom(const atom *_atom){
 | 
|---|
 | 515 |   ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom");
 | 
|---|
 | 516 |   molecule *mol=_atom->getMolecule();
 | 
|---|
| [90c4280] | 517 |   // the atom might not be part of a molecule
 | 
|---|
 | 518 |   if(mol){
 | 
|---|
 | 519 |     selectMolecule(mol);
 | 
|---|
 | 520 |   }
 | 
|---|
 | 521 | }
 | 
|---|
 | 522 | 
 | 
|---|
| [e4afb4] | 523 | void World::selectMoleculeOfAtom(const atomId_t id){
 | 
|---|
| [90c4280] | 524 |   ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
 | 
|---|
 | 525 |   selectMoleculeOfAtom(atoms[id]);
 | 
|---|
 | 526 | }
 | 
|---|
 | 527 | 
 | 
|---|
| [e4afb4] | 528 | void World::unselectMolecule(const molecule *_mol){
 | 
|---|
 | 529 |   ASSERT(_mol,"invalid pointer in unselection of molecule");
 | 
|---|
 | 530 |   unselectMolecule(_mol->getId());
 | 
|---|
| [61d655e] | 531 | }
 | 
|---|
 | 532 | 
 | 
|---|
| [e4afb4] | 533 | void World::unselectMolecule(const moleculeId_t id){
 | 
|---|
| [61d655e] | 534 |   ASSERT(molecules.count(id),"No such molecule with ID in unselection");
 | 
|---|
 | 535 |   selectedMolecules.erase(id);
 | 
|---|
 | 536 | }
 | 
|---|
 | 537 | 
 | 
|---|
| [e472eab] | 538 | void World::unselectAllMolecules(MoleculeDescriptor descr){
 | 
|---|
| [61d655e] | 539 |   internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
 | 
|---|
 | 540 |   internal_MoleculeIterator end = moleculeEnd_internal();
 | 
|---|
| [e4afb4] | 541 |   void (World::*func)(const molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function
 | 
|---|
| [61d655e] | 542 |   for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
 | 
|---|
 | 543 | }
 | 
|---|
 | 544 | 
 | 
|---|
| [e4afb4] | 545 | void World::unselectMoleculeOfAtom(const atom *_atom){
 | 
|---|
 | 546 |   ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom");
 | 
|---|
 | 547 |   molecule *mol=_atom->getMolecule();
 | 
|---|
| [61d655e] | 548 |   // the atom might not be part of a molecule
 | 
|---|
 | 549 |   if(mol){
 | 
|---|
 | 550 |     unselectMolecule(mol);
 | 
|---|
 | 551 |   }
 | 
|---|
 | 552 | }
 | 
|---|
 | 553 | 
 | 
|---|
| [e4afb4] | 554 | void World::unselectMoleculeOfAtom(const atomId_t id){
 | 
|---|
| [61d655e] | 555 |   ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
 | 
|---|
 | 556 |   unselectMoleculeOfAtom(atoms[id]);
 | 
|---|
 | 557 | }
 | 
|---|
 | 558 | 
 | 
|---|
| [e472eab] | 559 | size_t World::countSelectedMolecules() const {
 | 
|---|
| [eacc3b] | 560 |   size_t count = 0;
 | 
|---|
| [e472eab] | 561 |   for (MoleculeSet::const_iterator iter = selectedMolecules.begin(); iter != selectedMolecules.end(); ++iter)
 | 
|---|
| [eacc3b] | 562 |     count++;
 | 
|---|
 | 563 |   return count;
 | 
|---|
 | 564 | }
 | 
|---|
 | 565 | 
 | 
|---|
| [e4afb4] | 566 | bool World::isSelected(const molecule *_mol) const {
 | 
|---|
| [89643d] | 567 |   return isMoleculeSelected(_mol->getId());
 | 
|---|
 | 568 | }
 | 
|---|
 | 569 | 
 | 
|---|
 | 570 | bool World::isMoleculeSelected(const moleculeId_t no) const {
 | 
|---|
 | 571 |   return selectedMolecules.find(no) != selectedMolecules.end();
 | 
|---|
| [e0e156] | 572 | }
 | 
|---|
 | 573 | 
 | 
|---|
| [e472eab] | 574 | const std::vector<molecule *> World::getSelectedMolecules() const {
 | 
|---|
 | 575 |   std::vector<molecule *> returnMolecules;
 | 
|---|
 | 576 |   returnMolecules.resize(countSelectedMolecules());
 | 
|---|
 | 577 |   int count = 0;
 | 
|---|
 | 578 |   for (MoleculeSet::const_iterator iter = selectedMolecules.begin(); iter != selectedMolecules.end(); ++iter)
 | 
|---|
 | 579 |     returnMolecules[count++] = iter->second;
 | 
|---|
 | 580 |   return returnMolecules;
 | 
|---|
 | 581 | }
 | 
|---|
 | 582 | 
 | 
|---|
| [3839e5] | 583 | /******************* Iterators over Selection *****************************/
 | 
|---|
 | 584 | World::AtomSelectionIterator World::beginAtomSelection(){
 | 
|---|
 | 585 |   return selectedAtoms.begin();
 | 
|---|
 | 586 | }
 | 
|---|
 | 587 | 
 | 
|---|
 | 588 | World::AtomSelectionIterator World::endAtomSelection(){
 | 
|---|
 | 589 |   return selectedAtoms.end();
 | 
|---|
 | 590 | }
 | 
|---|
 | 591 | 
 | 
|---|
| [38f991] | 592 | World::AtomSelectionConstIterator World::beginAtomSelection() const{
 | 
|---|
 | 593 |   return selectedAtoms.begin();
 | 
|---|
 | 594 | }
 | 
|---|
 | 595 | 
 | 
|---|
 | 596 | World::AtomSelectionConstIterator World::endAtomSelection() const{
 | 
|---|
 | 597 |   return selectedAtoms.end();
 | 
|---|
 | 598 | }
 | 
|---|
 | 599 | 
 | 
|---|
| [3839e5] | 600 | 
 | 
|---|
 | 601 | World::MoleculeSelectionIterator World::beginMoleculeSelection(){
 | 
|---|
 | 602 |   return selectedMolecules.begin();
 | 
|---|
 | 603 | }
 | 
|---|
 | 604 | 
 | 
|---|
 | 605 | World::MoleculeSelectionIterator World::endMoleculeSelection(){
 | 
|---|
 | 606 |   return selectedMolecules.end();
 | 
|---|
 | 607 | }
 | 
|---|
 | 608 | 
 | 
|---|
| [38f991] | 609 | World::MoleculeSelectionConstIterator World::beginMoleculeSelection() const{
 | 
|---|
 | 610 |   return selectedMolecules.begin();
 | 
|---|
 | 611 | }
 | 
|---|
 | 612 | 
 | 
|---|
 | 613 | World::MoleculeSelectionConstIterator World::endMoleculeSelection() const{
 | 
|---|
 | 614 |   return selectedMolecules.end();
 | 
|---|
 | 615 | }
 | 
|---|
 | 616 | 
 | 
|---|
| [5d1611] | 617 | /******************************* Singleton Stuff **************************/
 | 
|---|
 | 618 | 
 | 
|---|
| [7a1ce5] | 619 | World::World() :
 | 
|---|
| [cd5047] | 620 |     Observable("World"),
 | 
|---|
| [f71baf] | 621 |     BG(new BondGraph(true)),  // assume Angstroem for the moment
 | 
|---|
| [4ae823] | 622 |     periode(new periodentafel(true)),
 | 
|---|
| [8e1f7af] | 623 |     configuration(new config),
 | 
|---|
| [43dad6] | 624 |     Thermostats(new ThermoStatContainer),
 | 
|---|
| [e4b5de] | 625 |     ExitFlag(0),
 | 
|---|
| [fa0b18] | 626 |     atoms(this),
 | 
|---|
| [90c4280] | 627 |     selectedAtoms(this),
 | 
|---|
| [3e4fb6] | 628 |     atomIdPool(0, 20, 100),
 | 
|---|
| [51be2a] | 629 |     molecules(this),
 | 
|---|
| [90c4280] | 630 |     selectedMolecules(this),
 | 
|---|
| [3e4fb6] | 631 |     moleculeIdPool(0, 20,100),
 | 
|---|
| [24a5e0] | 632 |     molecules_deprecated(new MoleculeListClass(this))
 | 
|---|
| [7dad10] | 633 | {
 | 
|---|
| [84c494] | 634 |   cell_size = new Box;
 | 
|---|
| [cca9ef] | 635 |   RealSpaceMatrix domain;
 | 
|---|
| [84c494] | 636 |   domain.at(0,0) = 20;
 | 
|---|
 | 637 |   domain.at(1,1) = 20;
 | 
|---|
 | 638 |   domain.at(2,2) = 20;
 | 
|---|
 | 639 |   cell_size->setM(domain);
 | 
|---|
| [387b36] | 640 |   defaultName = "none";
 | 
|---|
| [02ce36] | 641 |   Channels *OurChannel = new Channels;
 | 
|---|
 | 642 |   NotificationChannels.insert( std::make_pair( this, OurChannel) );
 | 
|---|
| [7188b1] | 643 |   for (size_t type = 0; type < (size_t)NotificationType_MAX; ++type)
 | 
|---|
| [02ce36] | 644 |     OurChannel->addChannel(type);
 | 
|---|
| [7dad10] | 645 |   molecules_deprecated->signOn(this);
 | 
|---|
 | 646 | }
 | 
|---|
| [5d1611] | 647 | 
 | 
|---|
 | 648 | World::~World()
 | 
|---|
| [354859] | 649 | {
 | 
|---|
| [028c2e] | 650 |   molecules_deprecated->signOff(this);
 | 
|---|
| [84c494] | 651 |   delete cell_size;
 | 
|---|
| [46d958] | 652 |   delete molecules_deprecated;
 | 
|---|
| [cbc5fb] | 653 |   MoleculeSet::iterator molIter;
 | 
|---|
 | 654 |   for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
 | 
|---|
 | 655 |     DeleteMolecule((*molIter).second);
 | 
|---|
 | 656 |   }
 | 
|---|
 | 657 |   molecules.clear();
 | 
|---|
 | 658 |   AtomSet::iterator atIter;
 | 
|---|
 | 659 |   for(atIter=atoms.begin();atIter!=atoms.end();++atIter){
 | 
|---|
 | 660 |     DeleteAtom((*atIter).second);
 | 
|---|
| [46d958] | 661 |   }
 | 
|---|
 | 662 |   atoms.clear();
 | 
|---|
| [7188b1] | 663 | 
 | 
|---|
 | 664 |   // empty notifications
 | 
|---|
| [02ce36] | 665 |   std::map<Observable *, Channels*>::iterator iter = NotificationChannels.find(this);
 | 
|---|
 | 666 |   ASSERT(iter != NotificationChannels.end(),
 | 
|---|
 | 667 |       "World::~World() - cannot find our Channels in NotificationChannels.");
 | 
|---|
 | 668 |   delete iter->second;
 | 
|---|
 | 669 |   NotificationChannels.erase(iter);
 | 
|---|
| [7188b1] | 670 | 
 | 
|---|
| [f71baf] | 671 |   delete BG;
 | 
|---|
| [6cb9c76] | 672 |   delete periode;
 | 
|---|
 | 673 |   delete configuration;
 | 
|---|
 | 674 |   delete Thermostats;
 | 
|---|
| [354859] | 675 | }
 | 
|---|
| [5d1611] | 676 | 
 | 
|---|
| [23b547] | 677 | // Explicit instantiation of the singleton mechanism at this point
 | 
|---|
| [5d1611] | 678 | 
 | 
|---|
| [3e4fb6] | 679 | // moleculeId_t und atomId_t sind gleicher Basistyp, deswegen nur einen von beiden konstruieren
 | 
|---|
 | 680 | CONSTRUCT_IDPOOL(moleculeId_t)
 | 
|---|
 | 681 | 
 | 
|---|
| [23b547] | 682 | CONSTRUCT_SINGLETON(World)
 | 
|---|
| [5d1611] | 683 | 
 | 
|---|
| [5f1d5b8] | 684 | CONSTRUCT_OBSERVEDCONTAINER(World::AtomSTLSet)
 | 
|---|
 | 685 | 
 | 
|---|
 | 686 | CONSTRUCT_OBSERVEDCONTAINER(World::MoleculeSTLSet)
 | 
|---|
 | 687 | 
 | 
|---|
| [5d1611] | 688 | /******************************* deprecated Legacy Stuff ***********************/
 | 
|---|
 | 689 | 
 | 
|---|
| [354859] | 690 | MoleculeListClass *&World::getMolecules() {
 | 
|---|
 | 691 |   return molecules_deprecated;
 | 
|---|
| [5d1611] | 692 | }
 | 
|---|