Changes in / [6b5657:13e3c3]


Ignore:
Files:
5 added
27 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AtomAction/AddAction.cpp

    r6b5657 r13e3c3  
    1515#include "Actions/AtomAction/AddAction.hpp"
    1616#include "Actions/ActionRegistry.hpp"
     17#include "Descriptors/AtomIdDescriptor.hpp"
    1718#include "atom.hpp"
    1819#include "element.hpp"
     
    3132#include "UIElements/Dialog.hpp"
    3233#include "Actions/ValueStorage.hpp"
     34
     35// memento to remember the state when undoing
     36
     37class AtomAddState : public ActionState {
     38public:
     39  AtomAddState(const Vector &_position, const element *_elemental, const atomId_t _id) :
     40    position(_position),
     41    elemental(_elemental),
     42    id(_id)
     43  {}
     44  Vector position;
     45  const element *elemental;
     46  atomId_t id;
     47};
    3348
    3449const char AtomAddAction::NAME[] = "add-atom";
     
    7590    (*iter)->AddAtom(first);
    7691  }
    77   return Action::success;
     92  return Action::state_ptr(new AtomAddState(position, elemental, first->getId()));
    7893}
    7994
    8095Action::state_ptr AtomAddAction::performUndo(Action::state_ptr _state) {
    81 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     96  AtomAddState *state = assert_cast<AtomAddState*>(_state.get());
    8297
    83   return Action::failure;
    84 //  string newName = state->mol->getName();
    85 //  state->mol->setName(state->lastName);
    86 //
    87 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     98  DoLog(1) && (Log() << Verbose(1) << "Removing atom with id " << state->id << "." << endl);
     99  World::getInstance().destroyAtom(state->id);
     100
     101  return Action::state_ptr(_state);
    88102}
    89103
    90104Action::state_ptr AtomAddAction::performRedo(Action::state_ptr _state){
    91   return Action::failure;
     105  AtomAddState *state = assert_cast<AtomAddState*>(_state.get());
     106
     107  atom * first = World::getInstance().createAtom();
     108  first->setType(state->elemental);
     109  first->setPosition(state->position);
     110  DoLog(1) && (Log() << Verbose(1) << "Re-adding new atom with element " << state->elemental->getName() << " at " << state->position << "." << endl);
     111  // TODO: remove when all of World's atoms are stored.
     112  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
     113  if (!molecules.empty()) {
     114    std::vector<molecule *>::iterator iter = molecules.begin();
     115    (*iter)->AddAtom(first);
     116  }
     117  if (first->getId() != state->id)
     118    if (!first->changeId(state->id))
     119      return Action::failure;
     120  return Action::state_ptr(_state);
    92121}
    93122
    94123bool AtomAddAction::canUndo() {
    95   return false;
     124  return true;
    96125}
    97126
    98127bool AtomAddAction::shouldUndo() {
    99   return false;
     128  return true;
    100129}
    101130
  • src/Actions/AtomAction/ChangeElementAction.cpp

    r6b5657 r13e3c3  
    1515#include "Actions/AtomAction/ChangeElementAction.hpp"
    1616#include "Actions/ActionRegistry.hpp"
     17#include "Descriptors/AtomIdDescriptor.hpp"
    1718#include "atom.hpp"
    1819#include "element.hpp"
     
    2425
    2526#include <iostream>
     27#include <map>
    2628#include <string>
    2729
     
    3133#include "UIElements/Dialog.hpp"
    3234#include "Actions/ValueStorage.hpp"
     35
     36typedef std::map<int, const element *> ElementMap;
     37
     38// memento to remember the state when undoing
     39
     40class AtomChangeElementState : public ActionState {
     41public:
     42  AtomChangeElementState(ElementMap _Elements, const element *_elemental) :
     43    Elements(_Elements),
     44    elemental(_elemental)
     45  {}
     46  ElementMap Elements;
     47  const element *elemental;
     48};
    3349
    3450const char AtomChangeElementAction::NAME[] = "change-element";
     
    6177  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
    6278
     79  // create undo state
     80  ElementMap Elements;
     81  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
     82    Elements.insert(std::pair<int, const element *> (iter->second->getId(), iter->second->getType()));
     83  }
     84  AtomChangeElementState *UndoState = new AtomChangeElementState(Elements, elemental);
     85
    6386  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
    6487    first = iter->second;
     
    6992    mol->AddAtom(first);  // add atom to ensure correctness of formula
    7093  }
    71   return Action::success;
     94  return Action::state_ptr(UndoState);
    7295}
    7396
    7497Action::state_ptr AtomChangeElementAction::performUndo(Action::state_ptr _state) {
    75 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     98  AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get());
     99  atom *first = NULL;
     100  molecule *mol = NULL;
    76101
    77   return Action::failure;
    78 //  string newName = state->mol->getName();
    79 //  state->mol->setName(state->lastName);
    80 //
    81 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     102  for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) {
     103    first = World::getInstance().getAtom(AtomById(iter->first));
     104    mol = first->getMolecule();
     105    first->removeFromMolecule(); // remove atom
     106    first->setType(iter->second);
     107    mol->AddAtom(first);  // add atom to ensure correctness of formula
     108  }
     109
     110  return Action::state_ptr(_state);
    82111}
    83112
    84113Action::state_ptr AtomChangeElementAction::performRedo(Action::state_ptr _state){
    85   return Action::failure;
     114  AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get());
     115  atom *first = NULL;
     116  molecule *mol = NULL;
     117
     118  for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) {
     119    first = World::getInstance().getAtom(AtomById(iter->first));
     120    mol = first->getMolecule();
     121    first->removeFromMolecule(); // remove atom
     122    first->setType(state->elemental);
     123    mol->AddAtom(first);  // add atom to ensure correctness of formula
     124  }
     125
     126  return Action::state_ptr(_state);
    86127}
    87128
    88129bool AtomChangeElementAction::canUndo() {
    89   return false;
     130  return true;
    90131}
    91132
    92133bool AtomChangeElementAction::shouldUndo() {
    93   return false;
     134  return true;
    94135}
    95136
  • src/Actions/AtomAction/RemoveAction.cpp

    r6b5657 r13e3c3  
    1616#include "Actions/ActionRegistry.hpp"
    1717#include "atom.hpp"
     18#include "AtomicInfo.hpp"
    1819#include "Descriptors/AtomDescriptor.hpp"
    1920#include "Helpers/Log.hpp"
     
    3031#include "UIElements/Dialog.hpp"
    3132#include "Actions/ValueStorage.hpp"
     33
     34// memento to remember the state when undoing
     35
     36class AtomRemoveState : public ActionState {
     37public:
     38  AtomRemoveState(std::vector<AtomicInfo> _Walkers) :
     39    Walkers(_Walkers)
     40  {}
     41  std::vector<AtomicInfo> Walkers;
     42};
    3243
    3344const char AtomRemoveAction::NAME[] = "remove-atom";
     
    5566  atom *first = NULL;
    5667
    57   std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
     68  // create undo state
     69  std::vector<AtomicInfo> Walkers;
     70  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
     71    Walkers.push_back(AtomicInfo(*(iter->second)));
     72  }
     73  AtomRemoveState *UndoState = new AtomRemoveState(Walkers);
     74
     75  // remove all selected atoms
     76//  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
    5877  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
    5978    first = iter->second;
    6079    DoLog(1) && (Log() << Verbose(1) << "Removing atom " << first->getId() << "." << endl);
    61     // TODO: this is not necessary when atoms and their storing to file are handled by the World
    62     // simply try to erase in every molecule found
    63     for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) {
    64       (*iter)->erase(first);
    65     }
     80//    // TODO: this is not necessary when atoms and their storing to file are handled by the World
     81//    // simply try to erase in every molecule found
     82//    for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) {
     83//      (*iter)->erase(first);
     84//    }
    6685    World::getInstance().destroyAtom(first);
    6786  }
    68   return Action::success;
     87  return Action::state_ptr(UndoState);
    6988}
    7089
    7190Action::state_ptr AtomRemoveAction::performUndo(Action::state_ptr _state) {
    72 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     91  AtomRemoveState *state = assert_cast<AtomRemoveState*>(_state.get());
    7392
    74   return Action::failure;
    75 //  string newName = state->mol->getName();
    76 //  state->mol->setName(state->lastName);
    77 //
    78 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     93  size_t i=0;
     94  for (; i<state->Walkers.size(); ++i) {
     95    // re-create the atom
     96    DoLog(1) && (Log() << Verbose(1) << "Re-adding atom " << state->Walkers[i].getId() << "." << endl);
     97    atom *Walker = World::getInstance().createAtom();
     98    if (!state->Walkers[i].setAtom(*Walker)) {
     99      DoeLog(1) && (eLog() << Verbose(1) << "Failed to set id." << endl);
     100      World::getInstance().destroyAtom(Walker);
     101      break;
     102    }
     103  }
     104  if (i<state->Walkers.size()) {
     105    // remove all previous ones, too
     106    for (size_t j=0;j<i;++j)
     107      World::getInstance().destroyAtom(state->Walkers[j].getId());
     108    // and announce the failure of the undo
     109    return Action::failure;
     110  }
     111  return Action::state_ptr(_state);
    79112}
    80113
    81114Action::state_ptr AtomRemoveAction::performRedo(Action::state_ptr _state){
    82   return Action::failure;
     115  AtomRemoveState *state = assert_cast<AtomRemoveState*>(_state.get());
     116
     117  // simple remove again all previously added atoms
     118  for (size_t i=0; i<state->Walkers.size(); ++i) {
     119    DoLog(1) && (Log() << Verbose(1) << "Re-removing atom " << state->Walkers[i].getId() << "." << endl);
     120    World::getInstance().destroyAtom(state->Walkers[i].getId());
     121  }
     122
     123  return Action::state_ptr(_state);
    83124}
    84125
    85126bool AtomRemoveAction::canUndo() {
    86   return false;
     127  return true;
    87128}
    88129
    89130bool AtomRemoveAction::shouldUndo() {
    90   return false;
     131  return true;
    91132}
    92133
  • src/Actions/CmdAction/FastParsingAction.cpp

    r6b5657 r13e3c3  
    3333class CommandLineFastParsingState : public ActionState {
    3434public:
    35   CommandLineFastParsingState(bool _bool) :
    36     boolean(_bool)
     35  CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
     36    oldvalue(_oldvalue),
     37    newvalue(_newvalue)
    3738  {}
    38   bool boolean;
     39  bool oldvalue;
     40  bool newvalue;
    3941};
    4042
     
    6365
    6466Action::state_ptr CommandLineFastParsingAction::performCall() {
    65 
    6667  config *configuration = World::getInstance().getConfig();
    67   ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing);
     68  bool oldvalue = configuration->FastParsing;
     69  bool newvalue;
     70  ValueStorage::getInstance().queryCurrentValue(NAME, newvalue);
     71  configuration->FastParsing = newvalue;
    6872  if (configuration->FastParsing)
    6973    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    7074  else
    7175    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    72   return Action::success;
     76  return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
    7377}
    7478
     
    7781
    7882  config *configuration = World::getInstance().getConfig();
    79   configuration->FastParsing = state->boolean;
     83  configuration->FastParsing = state->oldvalue;
     84  if (configuration->FastParsing)
     85    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
     86  else
     87    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    8088
    81   return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
     89  return Action::state_ptr(_state);
    8290}
    8391
    8492Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){
    85   return performUndo(_state);
     93  CommandLineFastParsingState *state = assert_cast<CommandLineFastParsingState*>(_state.get());
     94
     95  config *configuration = World::getInstance().getConfig();
     96  configuration->FastParsing = state->newvalue;
     97  if (configuration->FastParsing)
     98    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
     99  else
     100    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
     101
     102  return Action::state_ptr(_state);
    86103}
    87104
  • src/Actions/CmdAction/VerboseAction.cpp

    r6b5657 r13e3c3  
    3131class CommandLineVerboseState : public ActionState {
    3232public:
    33   CommandLineVerboseState(int _verbosity) :
    34     verbosity(_verbosity)
     33  CommandLineVerboseState(const int _oldverbosity, const int _newverbosity) :
     34    oldverbosity(_oldverbosity),
     35    newverbosity(_newverbosity)
    3536  {}
    36   int verbosity;
     37  int oldverbosity;
     38  int newverbosity;
    3739};
    3840
     
    6163
    6264Action::state_ptr CommandLineVerboseAction::performCall() {
    63   int verbosity = 2;
     65  int oldverbosity = getVerbosity();
     66  int newverbosity = 2;
    6467
    65   ValueStorage::getInstance().queryCurrentValue(NAME, verbosity);
     68  ValueStorage::getInstance().queryCurrentValue(NAME, newverbosity);
    6669
    67   setVerbosity(verbosity);
    68   DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
    69   return Action::success;
     70  if (oldverbosity != newverbosity) {
     71    CommandLineVerboseState *UndoState = new CommandLineVerboseState(oldverbosity, newverbosity);
     72    setVerbosity(newverbosity);
     73    DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << oldverbosity << " to " << newverbosity << "." << endl);
     74    return Action::state_ptr(UndoState);
     75  } else {
     76    DoLog(0) && (Log() << Verbose(0) << "Verbosity remains unchanged at " << oldverbosity << "." << endl);
     77    return Action::failure;
     78  }
    7079}
    7180
     
    7382  CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get());
    7483
    75   int verbosity = 2;
    76   ValueStorage::getInstance().queryCurrentValue(NAME, verbosity);
     84  DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->newverbosity << " to " << state->oldverbosity << "." << endl);
     85  setVerbosity(state->oldverbosity);
    7786
    78   setVerbosity(state->verbosity);
    79   return Action::state_ptr(new CommandLineVerboseState(verbosity));
     87  return Action::state_ptr(_state);
    8088}
    8189
    8290Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){
    83   return performUndo(_state);
     91  CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get());
     92
     93  DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->oldverbosity << " to " << state->newverbosity << "." << endl);
     94  setVerbosity(state->newverbosity);
     95
     96  return Action::state_ptr(_state);
    8497}
    8598
  • src/Actions/WorldAction/SetDefaultNameAction.cpp

    r6b5657 r13e3c3  
    6767
    6868  defaultname = World::getInstance().getDefaultName();
     69  WorldSetDefaultNameState *UndoState = new WorldSetDefaultNameState(defaultname);
    6970  ValueStorage::getInstance().queryCurrentValue(NAME, defaultname);
    7071
    7172  World::getInstance().setDefaultName(defaultname);
    7273  DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
    73   return Action::success;
     74  return Action::state_ptr(UndoState);
    7475}
    7576
     
    7980  string newName = World::getInstance().getDefaultName();
    8081  World::getInstance().setDefaultName(state->lastName);
     82  DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
    8183
    8284  return Action::state_ptr(new WorldSetDefaultNameState(newName));
  • src/Helpers/Log.cpp

    r6b5657 r13e3c3  
    2323void setVerbosity(int verbosityLevel) {
    2424  logger::getInstance().setVerbosity(verbosityLevel);
     25}
     26
     27/**
     28 * Gets verbosity for the error logger and the standard logger.
     29 *
     30 * \param int verbosity level
     31 */
     32int getVerbosity() {
     33  return logger::getInstance().getVerbosity();
    2534}
    2635
  • src/Helpers/Log.hpp

    r6b5657 r13e3c3  
    1515class errorLogger & eLog();
    1616void setVerbosity(int verbosityLevel);
     17int getVerbosity();
    1718bool DoLog(int verbose);
    1819bool DoeLog(int verbose);
  • src/Helpers/errorlogger.cpp

    r6b5657 r13e3c3  
    4646void errorLogger::setVerbosity(int verbosityLevel) {
    4747  verbosity = verbosityLevel;
     48}
     49
     50/**
     51 * Gets the verbosity.
     52 *
     53 * \return verbosity level
     54 */
     55int errorLogger::getVerbosity()
     56{
     57  return verbosity;
    4858}
    4959
  • src/Helpers/errorlogger.hpp

    r6b5657 r13e3c3  
    2525  static bool DoOutput();
    2626  static void setVerbosity(int verbosityLevel);
     27  static int getVerbosity();
    2728
    2829protected:
  • src/Helpers/logger.cpp

    r6b5657 r13e3c3  
    4949
    5050/**
     51 * Gets the verbosity.
     52 *
     53 * \return verbosity level
     54 */
     55int logger::getVerbosity()
     56{
     57  return verbosity;
     58}
     59
     60/**
    5161 * Operator for the Binary(arg) call.
    5262 * Constructs temporary a Verbose class object, wherein the Binary is stored.
  • src/Helpers/logger.hpp

    r6b5657 r13e3c3  
    2525  static bool DoOutput();
    2626  static void setVerbosity(int verbosityLevel);
     27  static int getVerbosity();
    2728
    2829protected:
  • src/Makefile.am

    r6b5657 r13e3c3  
    66ATOMSOURCE = \
    77  atom.cpp \
     8  AtomicInfo.cpp \
    89  atom_atominfo.cpp \
    910  atom_bondedparticle.cpp \
     
    1617ATOMHEADER = \
    1718  atom.hpp \
     19  AtomicInfo.hpp \
    1820  atom_atominfo.hpp \
    1921  atom_bondedparticle.hpp \
  • src/Shapes/BaseShapes.cpp

    r6b5657 r13e3c3  
    1616#include "Shapes/BaseShapes_impl.hpp"
    1717
     18#include <cmath>
     19
     20#include "Helpers/Assert.hpp"
    1821#include "LinearAlgebra/Vector.hpp"
    1922
     
    2124  return point.NormSquared()<=1;
    2225}
     26
     27
     28/**
     29 * algorithm taken from http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere
     30 * \param N number of points on surface
     31 */
     32std::vector<Vector> Sphere_impl::getHomogeneousPointsOnSurface(const int N) const {
     33  std::vector<Vector> PointsOnSurface;
     34
     35  const double dlength = M_PI*(3.-sqrt(5.));
     36  double length = 0;
     37  const double dz = 2.0/N;
     38  double z = 1. - dz/2.;
     39  Vector point;
     40  for (int ka = 0; ka<N; ka++){
     41    const double r = sqrt(1.-z*z);
     42    point.Zero();
     43    point[0] = cos(length)*r;
     44    point[1] = sin(length)*r;
     45    point[2] = z;
     46    PointsOnSurface.push_back(point);
     47    z = z - dz;
     48    length = length + dlength;
     49  }
     50
     51  ASSERT(PointsOnSurface.size() == N, "Sphere_impl::getHomogeneousPointsOnSurface() did not create enough points.");
     52  return PointsOnSurface;
     53}
     54
    2355
    2456Shape Sphere(){
     
    2860
    2961bool Cuboid_impl::isInside(const Vector &point){
    30   return point[0]<=1 && point[1]<=1 && point[2]<=1;
     62  return (point[0]>=0 && point[0]<=1) && (point[1]>=0 && point[1]<=1) && (point[2]>=0 && point[2]<=1);
     63}
     64
     65/**
     66 * \param N number of points on surface
     67 */
     68std::vector<Vector> Cuboid_impl::getHomogeneousPointsOnSurface(const int N) const {
     69  std::vector<Vector> PointsOnSurface;
     70  ASSERT(false, "Cuboid_impl::getHomogeneousPointsOnSurface() not implemented yet");
     71  return PointsOnSurface;
    3172}
    3273
    3374Shape Cuboid(){
    34   Shape::impl_ptr impl = Shape::impl_ptr(new Sphere_impl());
     75  Shape::impl_ptr impl = Shape::impl_ptr(new Cuboid_impl());
    3576  return Shape(impl);
    3677}
  • src/Shapes/BaseShapes_impl.hpp

    r6b5657 r13e3c3  
    1313class Sphere_impl : public Shape_impl {
    1414  virtual bool isInside(const Vector &point);
     15  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    1516};
    1617
    1718class Cuboid_impl : public Shape_impl {
    1819  virtual bool isInside(const Vector &point);
     20  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    1921};
    2022
  • src/Shapes/Shape.cpp

    r6b5657 r13e3c3  
    1616#include "Shape_impl.hpp"
    1717
     18
     19#include "Helpers/Assert.hpp"
     20#include "LinearAlgebra/Vector.hpp"
     21
    1822Shape::Shape(const Shape& src) :
    1923  impl(src.getImpl())
     
    2428bool Shape::isInside(const Vector &point) const{
    2529  return impl->isInside(point);
     30}
     31
     32std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const int N) const {
     33  return impl->getHomogeneousPointsOnSurface(N);
    2634}
    2735
     
    7280}
    7381
     82std::vector<Vector> AndShape_impl::getHomogeneousPointsOnSurface(const int N) const {
     83  std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
     84  std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
     85  std::vector<Vector> PointsOnSurface;
     86
     87  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
     88    if (rhs->isInside(*iter))
     89      PointsOnSurface.push_back(*iter);
     90  }
     91  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
     92    if (lhs->isInside(*iter))
     93      PointsOnSurface.push_back(*iter);
     94  }
     95
     96  return PointsOnSurface;
     97}
     98
     99
    74100Shape operator&&(const Shape &lhs,const Shape &rhs){
    75101  Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
     
    87113bool OrShape_impl::isInside(const Vector &point){
    88114  return rhs->isInside(point) || lhs->isInside(point);
     115}
     116
     117std::vector<Vector> OrShape_impl::getHomogeneousPointsOnSurface(const int N) const {
     118  std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
     119  std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
     120  std::vector<Vector> PointsOnSurface;
     121
     122  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
     123    if (!rhs->isInside(*iter))
     124      PointsOnSurface.push_back(*iter);
     125  }
     126  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
     127    if (!lhs->isInside(*iter))
     128      PointsOnSurface.push_back(*iter);
     129  }
     130
     131  return PointsOnSurface;
    89132}
    90133
     
    106149}
    107150
     151std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const int N) const {
     152  // surfaces are the same, only normal direction is different
     153  return arg->getHomogeneousPointsOnSurface(N);
     154}
     155
    108156Shape operator!(const Shape &arg){
    109157  Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
  • src/Shapes/Shape.hpp

    r6b5657 r13e3c3  
    1010
    1111#include <boost/shared_ptr.hpp>
     12
     13#include <vector>
    1214
    1315class Vector;
     
    2527
    2628  bool isInside(const Vector &point) const;
     29  std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    2730
    2831  Shape &operator=(const Shape& rhs);
  • src/Shapes/ShapeOps.cpp

    r6b5657 r13e3c3  
    3232}
    3333
     34std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const int N) const {
     35  std::vector<Vector> PointsOnSurface = arg->getHomogeneousPointsOnSurface(N);
     36  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     37    *iter *= size;
     38  }
     39  return PointsOnSurface;
     40}
     41
     42
    3443Shape resize(const Shape &arg,double size){
    3544  Shape::impl_ptr impl = Shape::impl_ptr(new Resize_impl(getShapeImpl(arg),size));
     
    4756bool Translate_impl::isInside(const Vector& point){
    4857  return arg->isInside(point-offset);
     58}
     59
     60std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const int N) const {
     61  std::vector<Vector> PointsOnSurface = arg->getHomogeneousPointsOnSurface(N);
     62  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     63    *iter += offset;
     64  }
     65  return PointsOnSurface;
    4966}
    5067
     
    7592}
    7693
     94std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const int N) const {
     95  std::vector<Vector> PointsOnSurface = arg->getHomogeneousPointsOnSurface(N);
     96  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     97    (*iter).ScaleAll(reciFactors);
     98  }
     99  return PointsOnSurface;
     100}
     101
    77102Shape stretch(const Shape &arg, const Vector &factors){
    78103  Shape::impl_ptr impl = Shape::impl_ptr(new Stretch_impl(getShapeImpl(arg),factors));
     
    94119}
    95120
     121std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const int N) const {
     122  std::vector<Vector> PointsOnSurface = arg->getHomogeneousPointsOnSurface(N);
     123  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
     124    *iter = transformation * (*iter);
     125  }
     126  return PointsOnSurface;
     127}
     128
    96129Shape transform(const Shape &arg, const Matrix &transformation){
    97130  Shape::impl_ptr impl = Shape::impl_ptr(new Transform_impl(getShapeImpl(arg),transformation));
  • src/Shapes/ShapeOps_impl.hpp

    r6b5657 r13e3c3  
    1919  virtual ~Resize_impl();
    2020  virtual bool isInside(const Vector& point);
     21  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    2122private:
    2223  Shape::impl_ptr arg;
     
    3031  virtual ~Translate_impl();
    3132  virtual bool isInside(const Vector& point);
     33  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    3234private:
    3335  Shape::impl_ptr arg;
     
    4143  virtual ~Stretch_impl();
    4244  virtual bool isInside(const Vector& point);
     45  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    4346private:
    4447  Shape::impl_ptr arg;
     
    5356  virtual ~Transform_impl();
    5457  virtual bool isInside(const Vector& point);
     58  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    5559private:
    5660  Shape::impl_ptr arg;
  • src/Shapes/Shape_impl.hpp

    r6b5657 r13e3c3  
    99#define SHAPE_IMPL_HPP_
    1010
     11#include <vector>
     12
    1113#include "Shapes/Shape.hpp"
     14
     15class Vector;
    1216
    1317class Shape_impl {
     
    1620  virtual ~Shape_impl(){};
    1721  virtual bool isInside(const Vector &point)=0;
     22  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const=0;
    1823};
    1924
     
    2328    return true;
    2429  }
     30  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const {
     31    std::vector<Vector> PointsOnSurface;
     32    return PointsOnSurface;
     33  }
    2534};
    2635
     
    2837  virtual bool isInside(const Vector &point){
    2938    return false;
     39  }
     40  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const {
     41    std::vector<Vector> PointsOnSurface;
     42    return PointsOnSurface;
    3043  }
    3144};
     
    3649  virtual ~AndShape_impl();
    3750  virtual bool isInside(const Vector &point);
     51  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    3852private:
    3953  Shape::impl_ptr lhs;
     
    4660  virtual ~OrShape_impl();
    4761  virtual bool isInside(const Vector &point);
     62  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    4863private:
    4964  Shape::impl_ptr lhs;
     
    5671  virtual ~NotShape_impl();
    5772  virtual bool isInside(const Vector &point);
     73  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const int N) const;
    5874private:
    5975  Shape::impl_ptr arg;
  • src/atom.cpp

    r6b5657 r13e3c3  
    358358}
    359359
    360 molecule* atom::getMolecule(){
     360molecule* atom::getMolecule() const {
    361361  return mol;
    362362}
  • src/atom.hpp

    r6b5657 r13e3c3  
    9292
    9393   void setMolecule(molecule*);
    94    molecule* getMolecule();
     94   molecule* getMolecule() const;
    9595   void removeFromMolecule();
    9696
  • src/unittests/Makefile.am

    r6b5657 r13e3c3  
    1616  atomsCalculationTest \
    1717  AtomDescriptorTest \
     18  BaseShapesUnitTest \
    1819  BondGraphUnitTest \
    1920  BoxUnittest \
     
    7374  AtomDescriptorTest.cpp \
    7475  atomsCalculationTest.cpp \
     76  BaseShapesUnittest.cpp \
    7577  bondgraphunittest.cpp \
    7678  BoxUnittest.cpp \
     
    111113  AtomDescriptorTest.hpp \
    112114  atomsCalculationTest.hpp \
     115  BaseShapesUnittest.hpp \
    113116  bondgraphunittest.hpp \
    114117  BoxUnittest.hpp \
     
    164167AtomDescriptorTest_LDADD = ${ALLLIBS}
    165168
     169BaseShapesUnitTest_SOURCES = UnitTestMain.cpp BaseShapesUnittest.cpp BaseShapesUnittest.hpp
     170BaseShapesUnitTest_LDADD = ${ALLLIBS}
     171
    166172BondGraphUnitTest_SOURCES = UnitTestMain.cpp bondgraphunittest.cpp bondgraphunittest.hpp
    167173BondGraphUnitTest_LDADD = ${ALLLIBS}
  • src/unittests/ShapeUnittest.cpp

    r6b5657 r13e3c3  
    1717#include <cppunit/ui/text/TestRunner.h>
    1818
     19#include <cmath>
     20
    1921#ifdef HAVE_TESTRUNNER
    2022#include "UnitTestMain.hpp"
     
    2325#include "LinearAlgebra/Vector.hpp"
    2426#include "Shapes/Shape.hpp"
     27
     28#include "Shapes/BaseShapes.hpp"
    2529
    2630// Registers the fixture into the 'registry'
     
    184188
    185189}
     190
    186191void ShapeUnittest::operatorTest(){
    187192  {
  • tests/regression/Simple_configuration/5/pre/test.conf

    r6b5657 r13e3c3  
    2828OutSrcStep      5       # Output "restart" data every ..th step
    2929TargetTemp      0.000950045     # Target temperature
    30 MaxPsiStep      0       # number of Minimisation steps per state (0 - default)
     30MaxPsiStep      3       # number of Minimisation steps per state (0 - default)
    3131EpsWannier      1e-07   # tolerance value for spread minimisation of orbitals
    3232
     
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
    38 MaxMinGapStopStep       0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
     38MaxMinGapStopStep       1       # check every ..th steps
    3939
    4040# Values specifying when to stop for INIT, otherwise same as above
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
    45 InitMaxMinGapStopStep   0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
     45InitMaxMinGapStopStep   1       # check every ..th steps
    4646
    4747BoxLength                       # (Length of a unit cell)
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/testsuite-simple_configuration.at

    r6b5657 r13e3c3  
    3131AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --position "0., 0., -1."], 134, [ignore], [ignore])
    3232AT_CLEANUP
     33AT_SETUP([Simple configuration - adding atom with Undo/Redo])
     34AT_KEYWORDS([configuration])
     35AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 --position "10., 10., 10." --undo], 0, [ignore], [ignore])
     36AT_CHECK([file=empty.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
     37AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 --position "10., 10., 10." --undo --redo], 0, [ignore], [ignore])
     38AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
     39AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
     40AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
     41AT_CLEANUP
    3342
    3443# 4. change the element
     
    3746AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
    3847AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 ], 0, [ignore], [ignore])
     48AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
     49AT_CLEANUP
     50AT_SETUP([Simple configuration - Changing element with Undo/Redo])
     51AT_KEYWORDS([configuration])
     52AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
     53AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo], 0, [ignore], [ignore])
     54AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/$file], 0, [ignore], [ignore])
     55AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
     56AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo --redo], 0, [ignore], [ignore])
    3957AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
    4058AT_CLEANUP
     
    4866AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
    4967AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
     68AT_CLEANUP
     69AT_SETUP([Simple configuration - Atom removal with Undo/Redo])
     70AT_KEYWORDS([configuration])
     71AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/test.conf .], 0)
     72AT_CHECK([../../molecuilder -i test.conf --select-atom-by-id 0 -r --undo], 0, [ignore], [ignore])
     73AT_CHECK([file=test.conf; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/$file], 0, [ignore], [ignore])
     74AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/test.conf .], 0)
     75AT_CHECK([../../molecuilder -i test.conf --select-atom-by-id 0 -r --undo --redo], 0, [ignore], [ignore])
     76AT_CHECK([file=test.conf; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
    5077AT_CLEANUP
    5178
     
    86113AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
    87114AT_CLEANUP
     115AT_SETUP([Simple configuration - Removing sphere of atoms with Undo/Redo])
     116AT_KEYWORDS([configuration])
     117AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
     118AT_CHECK([../../molecuilder -i test.xyz --select-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" -r --undo], 0, [stdout], [stderr])
     119AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
     120AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutsphere.xyz], 0)
     121AT_CHECK([../../molecuilder -i test-withoutsphere.xyz --select-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" -r --undo --redo], 0, [stdout], [stderr])
     122AT_CHECK([sort -n test-withoutsphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutsphere.xyz-sorted], 0, [ignore], [ignore])
     123AT_CHECK([file=test-withoutsphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     124AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
     125AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms --unselect-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" -r --undo], 0, [stdout], [stderr])
     126AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
     127AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-sphere.xyz], 0)
     128AT_CHECK([../../molecuilder -i test-sphere.xyz --select-all-atoms --unselect-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" -r --undo --redo], 0, [stdout], [stderr])
     129AT_CHECK([sort -n test-sphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-sphere.xyz-sorted], 0, [ignore], [ignore])
     130AT_CHECK([file=test-sphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     131AT_CHECK([cat test-sphere.xyz-sorted test-withoutsphere.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
     132AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     133AT_CLEANUP
    88134
    89135AT_SETUP([Simple configuration - Removing cuboid of atoms])
     
    95141AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-cuboid.xyz], 0)
    96142AT_CHECK([../../molecuilder -i test-cuboid.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" -r], 0, [stdout], [stderr])
     143AT_CHECK([sort -n test-cuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-cuboid.xyz-sorted], 0, [ignore], [ignore])
     144AT_CHECK([file=test-cuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     145AT_CHECK([cat test-cuboid.xyz-sorted test-withoutcuboid.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
     146AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     147AT_CLEANUP
     148AT_SETUP([Simple configuration - Removing cuboid of atoms with Undo/Redo])
     149AT_KEYWORDS([configuration])
     150AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
     151AT_CHECK([../../molecuilder -i test.xyz --select-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" -r --undo], 0, [stdout], [stderr])
     152AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
     153AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutcuboid.xyz], 0)
     154AT_CHECK([../../molecuilder -i test-withoutcuboid.xyz --select-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" -r --undo --redo], 0, [stdout], [stderr])
     155AT_CHECK([sort -n test-withoutcuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutcuboid.xyz-sorted], 0, [ignore], [ignore])
     156AT_CHECK([file=test-withoutcuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
     157AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
     158AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" -r --undo], 0, [stdout], [stderr])
     159AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
     160AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-cuboid.xyz], 0)
     161AT_CHECK([../../molecuilder -i test-cuboid.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" -r --undo --redo], 0, [stdout], [stderr])
    97162AT_CHECK([sort -n test-cuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-cuboid.xyz-sorted], 0, [ignore], [ignore])
    98163AT_CHECK([file=test-cuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
  • tests/regression/testsuite-standard_options.at

    r6b5657 r13e3c3  
    55AT_CHECK([pwd],[ignore],[ignore])
    66AT_CHECK([../../molecuilder -v 1], 0, [stdout], [ignore])
    7 AT_CHECK([fgrep olecuilder stdout], 0, [ignore], [ignore])
     7AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
     8AT_CLEANUP
     9AT_SETUP([Standard Options - verbosity with Undo/Redo])
     10AT_KEYWORDS([options])
     11AT_CHECK([../../molecuilder -v 1 --undo], 0, [stdout], [ignore])
     12AT_CHECK([grep "Setting verbosity from 1 to .*" stdout], 0, [ignore], [ignore])
     13AT_CHECK([../../molecuilder -v 1 --undo --redo], 0, [stdout], [ignore])
     14AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
    815AT_CLEANUP
    916
     
    5360AT_CHECK([fgrep "I won't parse trajectories" stdout], 0, [ignore], [ignore])
    5461AT_CLEANUP
     62AT_SETUP([Standard Options - fast trajectories with Undo/Redo])
     63AT_KEYWORDS([options])
     64AT_CHECK([../../molecuilder -i test.conf -n 1 --undo], 0, [stdout], [stderr])
     65AT_CHECK([fgrep "I will parse trajectories." stdout], 0, [ignore], [ignore])
     66AT_CHECK([../../molecuilder -i test.conf -n 1 --undo --redo], 0, [stdout], [stderr])
     67AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, 2
     68, [ignore])
     69AT_CLEANUP
    5570
    5671# 7. molecule default name
     
    6075AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
    6176AT_CLEANUP
     77AT_SETUP([Standard Options - molecule default name with Undo/Redo])
     78AT_KEYWORDS([options])
     79AT_CHECK([../../molecuilder -i test.conf -X test --undo], 0, [stdout], [stderr])
     80AT_CHECK([fgrep "Default name of new molecules set to none." stdout], 0, [ignore], [ignore])
     81AT_CHECK([../../molecuilder -i test.conf -X test --undo --redo], 0, [stdout], [stderr])
     82AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
     83AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.