Changes in src/molecule.hpp [8ab0407:24a5e0]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.hpp
r8ab0407 r24a5e0 27 27 #include <vector> 28 28 29 #include <string> 30 31 #include "defs.hpp" 29 32 #include "graph.hpp" 30 33 #include "stackclass.hpp" 31 34 #include "tesselation.hpp" 35 #include "Patterns/Observer.hpp" 36 #include "Patterns/Cacheable.hpp" 32 37 33 38 /****************************************** forward declarations *****************************/ … … 80 85 * Class incorporates number of types 81 86 */ 82 class molecule : public PointCloud { 87 class molecule : public PointCloud , public Observable { 88 friend molecule *NewMolecule(); 89 friend void DeleteMolecule(molecule *); 83 90 public: 84 91 double cell_size[6];//!< cell size … … 99 106 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules 100 107 Vector Center; //!< Center of molecule in a global box 108 int IndexNr; //!< index of molecule in a MoleculeListClass 101 109 char name[MAXSTRINGSIZE]; //!< arbitrary name 102 int IndexNr; //!< index of molecule in a MoleculeListClass 103 104 molecule(const periodentafel * const teil); 105 virtual ~molecule(); 110 111 private: 112 Cacheable<string> formula; 113 moleculeId_t id; 114 protected: 115 molecule(const periodentafel * const teil); 116 virtual ~molecule(); 117 118 119 public: 120 //getter and setter 121 const std::string getName(); 122 moleculeId_t getId(); 123 void setId(moleculeId_t); 124 void setName(const std::string); 125 const std::string getFormula(); 126 std::string calcFormula(); 127 106 128 107 129 // re-definition of virtual functions from PointCloud … … 269 291 int FragmentMolecule(int Order, config *configuration); 270 292 bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL); 271 bool StoreBondsToFile(char *path , char *filename);272 bool StoreAdjacencyToFile(char *path , char *filename);293 bool StoreBondsToFile(char *path); 294 bool StoreAdjacencyToFile(char *path); 273 295 bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms); 274 296 bool ParseOrderAtSiteFromFile(char *path); … … 299 321 bool OutputTemperatureFromTrajectories(ofstream * const output, int startstep, int endstep); 300 322 323 // Manipulation routines 324 void flipActiveFlag(); 325 301 326 private: 302 327 int last_atom; //!< number given to last atom … … 304 329 }; 305 330 331 molecule *NewMolecule(); 332 void DeleteMolecule(molecule* mol); 333 306 334 #include "molecule_template.hpp" 307 335 308 336 /** A list of \a molecule classes. 309 337 */ 310 class MoleculeListClass {338 class MoleculeListClass : public Observable { 311 339 public: 312 340 MoleculeList ListOfMolecules; //!< List of the contained molecules 313 341 int MaxIndex; 314 342 315 MoleculeListClass( );343 MoleculeListClass(World *world); 316 344 ~MoleculeListClass(); 317 345 … … 322 350 bool OutputConfigForListOfFragments(config *configuration, int *SortIndex); 323 351 int NumberOfActiveMolecules(); 324 void Enumerate(o fstream *out);352 void Enumerate(ostream *out); 325 353 void Output(ofstream *out); 326 354 void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration); 327 355 int CountAllAtoms() const; 356 357 // Methods moved here from the menus 358 // TODO: more refactoring needed on these methods 359 void flipChosen(); 360 void createNewMolecule(periodentafel *periode); 361 void loadFromXYZ(periodentafel *periode); 362 void setMoleculeFilename(); 363 void parseXYZIntoMolecule(); 364 void eraseMolecule(); 365 328 366 329 367 // merging of molecules … … 336 374 337 375 private: 376 World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor 338 377 }; 339 378
Note:
See TracChangeset
for help on using the changeset viewer.