Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    r387b36 r84c494  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "World.hpp"
    911
     
    1214#include "molecule.hpp"
    1315#include "periodentafel.hpp"
     16#include "ThermoStatContainer.hpp"
    1417#include "Descriptors/AtomDescriptor.hpp"
    1518#include "Descriptors/AtomDescriptor_impl.hpp"
     
    1821#include "Descriptors/SelectiveIterator_impl.hpp"
    1922#include "Actions/ManipulateAtomsProcess.hpp"
     23#include "Helpers/Assert.hpp"
     24#include "Box.hpp"
     25#include "Matrix.hpp"
    2026
    2127#include "Patterns/Singleton_impl.hpp"
     
    7076// system
    7177
    72 double * World::getDomain() {
    73   return cell_size;
     78Box& World::getDomain() {
     79  return *cell_size;
     80}
     81
     82void World::setDomain(const Matrix &mat){
     83  *cell_size = mat;
    7484}
    7585
    7686void World::setDomain(double * matrix)
    7787{
    78 
     88  Matrix M = ReturnFullMatrixforSymmetric(matrix);
     89  cell_size->setM(M);
    7990}
    8091
     
    8798  defaultName = name;
    8899};
     100
     101class ThermoStatContainer * World::getThermostats()
     102{
     103  return Thermostats;
     104}
     105
    89106
    90107int World::getExitFlag() {
     
    103120  molecule *mol = NULL;
    104121  mol = NewMolecule();
    105   assert(!molecules.count(currMoleculeId));
     122  ASSERT(!molecules.count(currMoleculeId),"currMoleculeId did not specify an unused ID");
    106123  mol->setId(currMoleculeId++);
    107124  // store the molecule by ID
     
    119136  OBSERVE;
    120137  molecule *mol = molecules[id];
    121   assert(mol);
     138  ASSERT(mol,"Molecule id that was meant to be destroyed did not exist");
    122139  DeleteMolecule(mol);
    123140  molecules.erase(id);
    124141}
    125 
    126 double *World::cell_size = NULL;
    127142
    128143atom *World::createAtom(){
     
    155170  OBSERVE;
    156171  atom *atom = atoms[id];
    157   assert(atom);
     172  ASSERT(atom,"Atom ID that was meant to be destroyed did not exist");
    158173  DeleteAtom(atom);
    159174  atoms.erase(id);
     
    167182  if(!target){
    168183    target = atoms[oldId];
    169     assert(target && "Atom with that ID not found");
     184    ASSERT(target,"Atom with that ID not found");
    170185    return target->changeId(newId);
    171186  }
     
    276291
    277292World::World() :
     293    Observable("World"),
    278294    periode(new periodentafel),
    279295    configuration(new config),
     296    Thermostats(new ThermoStatContainer),
    280297    ExitFlag(0),
    281298    atoms(),
     
    285302    molecules_deprecated(new MoleculeListClass(this))
    286303{
    287   cell_size = new double[6];
    288   cell_size[0] = 20.;
    289   cell_size[1] = 0.;
    290   cell_size[2] = 20.;
    291   cell_size[3] = 0.;
    292   cell_size[4] = 0.;
    293   cell_size[5] = 20.;
     304  cell_size = new Box;
     305  Matrix domain;
     306  domain.at(0,0) = 20;
     307  domain.at(1,1) = 20;
     308  domain.at(2,2) = 20;
     309  cell_size->setM(domain);
    294310  defaultName = "none";
    295311  molecules_deprecated->signOn(this);
     
    299315{
    300316  molecules_deprecated->signOff(this);
    301   delete[] cell_size;
     317  delete cell_size;
    302318  delete molecules_deprecated;
    303319  delete periode;
    304320  delete configuration;
     321  delete Thermostats;
    305322  MoleculeSet::iterator molIter;
    306323  for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
Note: See TracChangeset for help on using the changeset viewer.