Changes in / [b1ac7a:9c27b0]
- Files:
-
- 9 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/CopyAction.cpp
rb1ac7a r9c27b0 59 59 MoleculeCopyState *state = assert_cast<MoleculeCopyState*>(_state.get()); 60 60 61 for (molecule::iterator AtomRunner = state->copy->begin(); 62 !state->copy->empty(); 63 AtomRunner = state->copy->begin()) { 64 (*AtomRunner)->removeAllBonds(); 65 // BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 66 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 67 // !ListOfBonds.empty(); 68 // BondRunner = ListOfBonds.begin()) { 69 // delete(*BondRunner); 70 // } 71 atom *Walker = *AtomRunner; 72 World::getInstance().destroyAtom(Walker); 73 } 61 state->copy->removeAtomsinMolecule(); 74 62 World::getInstance().destroyMolecule(state->copy); 75 63 -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
rb1ac7a r9c27b0 18 18 #endif 19 19 20 // include headers that implement a archive in simple text format 21 #include <boost/archive/text_oarchive.hpp> 22 #include <boost/archive/text_iarchive.hpp> 23 #include "boost/serialization/vector.hpp" 24 20 25 #include "CodePatterns/MemDebug.hpp" 21 26 22 27 #include "atom.hpp" 28 #include "Box.hpp" 23 29 #include "CodePatterns/Log.hpp" 30 #include "LinearAlgebra/MatrixContent.hpp" 24 31 #include "LinearAlgebra/RealSpaceMatrix.hpp" 25 32 #include "LinearAlgebra/Vector.hpp" … … 46 53 getParametersfromValueStorage(); 47 54 55 // create undo domain 56 std::stringstream undostream; 57 boost::archive::text_oarchive oa(undostream); 58 const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM(); 59 oa << matrix; 60 48 61 // get maximum and minimum 49 vector<atom *> AllAtoms = World::getInstance().getAllAtoms();62 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 50 63 ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary."); 51 vector<atom *>::iterator AtomRunner = AllAtoms.begin();64 std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 52 65 Min = (*AtomRunner)->getPosition(); 53 66 Max = (*AtomRunner)->getPosition(); … … 73 86 // translate all atoms, such that Min is aty (0,0,0) 74 87 AtomRunner = AllAtoms.begin(); 75 for (; AtomRunner != AllAtoms.end(); ++AtomRunner) 88 for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 89 AtomRunner != AllAtoms.end(); 90 ++AtomRunner) 76 91 *(*AtomRunner) -= Min - params.boundary; 77 92 … … 79 94 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 80 95 81 return Action::success; 96 // create undo state 97 WorldAddEmptyBoundaryState *UndoState = 98 new WorldAddEmptyBoundaryState( 99 undostream.str(), 100 World::getInstance().getDomain().getM(), 101 Min, 102 params 103 ); 104 105 return Action::state_ptr(UndoState); 82 106 } 83 107 84 108 Action::state_ptr WorldAddEmptyBoundaryAction::performUndo(Action::state_ptr _state) { 85 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());109 WorldAddEmptyBoundaryState *state = assert_cast<WorldAddEmptyBoundaryState*>(_state.get()); 86 110 87 return Action::failure; 88 // string newName = state->mol->getName(); 89 // state->mol->setName(state->lastName); 90 // 91 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 111 // restore domain 112 RealSpaceMatrix matrix; 113 std::stringstream undostream(state->undostring); 114 boost::archive::text_iarchive ia(undostream); 115 ia >> matrix; 116 World::getInstance().setDomain(matrix); 117 118 // give final box size 119 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 120 121 // restore atoms 122 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 123 for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 124 AtomRunner != AllAtoms.end(); 125 ++AtomRunner) 126 *(*AtomRunner) += state->Min - state->params.boundary; 127 128 return Action::state_ptr(_state); 92 129 } 93 130 94 131 Action::state_ptr WorldAddEmptyBoundaryAction::performRedo(Action::state_ptr _state){ 95 return Action::failure; 132 WorldAddEmptyBoundaryState *state = assert_cast<WorldAddEmptyBoundaryState*>(_state.get()); 133 134 World::getInstance().setDomain(state->newdomain); 135 136 // give final box size 137 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 138 139 // shift atoms 140 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 141 for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 142 AtomRunner != AllAtoms.end(); 143 ++AtomRunner) 144 *(*AtomRunner) -= state->Min - state->params.boundary; 145 146 return Action::state_ptr(_state); 96 147 } 97 148 98 149 bool WorldAddEmptyBoundaryAction::canUndo() { 99 return false;150 return true; 100 151 } 101 152 102 153 bool WorldAddEmptyBoundaryAction::shouldUndo() { 103 return false;154 return true; 104 155 } 105 156 /** =========== end of function ====================== */ -
src/Actions/WorldAction/AddEmptyBoundaryAction.def
rb1ac7a r9c27b0 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "Actions/Values.hpp" 10 #include "LinearAlgebra/RealSpaceMatrix.hpp" 10 11 #include "LinearAlgebra/Vector.hpp" 11 12 … … 19 20 #define paramreferences (boundary) 20 21 21 # undef statetypes22 # undef statereferences22 #define statetypes (std::string)(RealSpaceMatrix)(Vector) 23 #define statereferences (undostring)(newdomain)(Min) 23 24 24 25 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/BoundInBoxAction.cpp
rb1ac7a r9c27b0 20 20 #include "CodePatterns/MemDebug.hpp" 21 21 22 #include <boost/shared_ptr.hpp> 23 22 24 #include "CodePatterns/Log.hpp" 23 25 #include "molecule.hpp" … … 40 42 getParametersfromValueStorage(); 41 43 44 // create undo state 45 std::vector< boost::shared_ptr<Vector> > OldPositions; 46 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 47 for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); 48 MolRunner != AllMolecules.end(); 49 ++MolRunner) { 50 for(molecule::const_iterator AtomRunner = (*MolRunner)->begin(); 51 AtomRunner != (*MolRunner)->end(); 52 ++AtomRunner) { 53 OldPositions.push_back( 54 boost::shared_ptr<Vector>(new Vector( 55 (*AtomRunner)->getPosition() 56 )) 57 ); 58 } 59 } 60 WorldBoundInBoxState *undoState = new WorldBoundInBoxState(OldPositions, params); 61 42 62 // center 43 vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 44 for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 63 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 45 64 (*MolRunner)->BoundInBox(); 46 65 } 47 return Action::s uccess;66 return Action::state_ptr(undoState); 48 67 } 49 68 50 69 Action::state_ptr WorldBoundInBoxAction::performUndo(Action::state_ptr _state) { 51 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());70 WorldBoundInBoxState *state = assert_cast<WorldBoundInBoxState*>(_state.get()); 52 71 53 return Action::failure; 54 // string newName = state->mol->getName(); 55 // state->mol->setName(state->lastName); 56 // 57 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 72 // place atoms on old positions 73 std::vector< boost::shared_ptr<Vector> >::const_iterator OldPositionsIter = state->OldPositions.begin(); 74 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 75 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); 76 MolRunner != AllMolecules.end(); 77 ++MolRunner) { 78 for(molecule::const_iterator AtomRunner = (*MolRunner)->begin(); 79 AtomRunner != (*MolRunner)->end(); 80 ++AtomRunner) { 81 ASSERT(OldPositionsIter != state->OldPositions.end(), 82 "WorldBoundInBoxAction::performUndo() - too few positions stored in UndoState."); 83 (*AtomRunner)->setPosition(**(OldPositionsIter++)); 84 } 85 } 86 87 return Action::state_ptr(_state); 58 88 } 59 89 60 90 Action::state_ptr WorldBoundInBoxAction::performRedo(Action::state_ptr _state){ 61 return Action::failure; 91 // WorldBoundInBoxState *state = assert_cast<WorldBoundInBoxState*>(_state.get()); 92 93 // center 94 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 95 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); 96 MolRunner != AllMolecules.end(); 97 ++MolRunner) { 98 (*MolRunner)->BoundInBox(); 99 } 100 101 return Action::state_ptr(_state); 62 102 } 63 103 64 104 bool WorldBoundInBoxAction::canUndo() { 65 return false;105 return true; 66 106 } 67 107 68 108 bool WorldBoundInBoxAction::shouldUndo() { 69 return false;109 return true; 70 110 } 71 111 /** =========== end of function ====================== */ -
src/Actions/WorldAction/BoundInBoxAction.def
rb1ac7a r9c27b0 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <boost/shared_ptr.hpp> 10 #include "LinearAlgebra/Vector.hpp" 9 11 10 12 … … 18 20 #undef paramreferences 19 21 20 # undef statetypes21 # undef statereferences22 #define statetypes (std::vector< boost::shared_ptr<Vector> >) 23 #define statereferences (OldPositions) 22 24 23 25 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/CenterInBoxAction.cpp
rb1ac7a r9c27b0 18 18 #endif 19 19 20 // include headers that implement a archive in simple text format 21 #include <boost/archive/text_oarchive.hpp> 22 #include <boost/archive/text_iarchive.hpp> 23 #include "boost/serialization/vector.hpp" 24 20 25 #include "CodePatterns/MemDebug.hpp" 26 27 #include <boost/shared_ptr.hpp> 21 28 22 29 #include "Box.hpp" 23 30 #include "CodePatterns/Log.hpp" 31 #include "LinearAlgebra/MatrixContent.hpp" 24 32 #include "LinearAlgebra/RealSpaceMatrix.hpp" 25 33 #include "molecule.hpp" … … 28 36 #include <iostream> 29 37 #include <string> 38 #include <vector> 30 39 31 40 #include "Actions/WorldAction/CenterInBoxAction.hpp" … … 41 50 getParametersfromValueStorage(); 42 51 52 // create undo state 53 std::stringstream undostream; 54 boost::archive::text_oarchive oa(undostream); 55 RealSpaceMatrix matrix(World::getInstance().getDomain().getM()); 56 oa << matrix; 57 std::vector< boost::shared_ptr<Vector> > OldPositions; 58 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 59 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); 60 MolRunner != AllMolecules.end(); 61 ++MolRunner) { 62 for(molecule::const_iterator AtomRunner = (*MolRunner)->begin(); 63 AtomRunner != (*MolRunner)->end(); 64 ++AtomRunner) { 65 OldPositions.push_back( 66 boost::shared_ptr<Vector>(new Vector( 67 (*AtomRunner)->getPosition() 68 )) 69 ); 70 } 71 } 72 73 // set new domain 43 74 World::getInstance().setDomain(params.cell_size.getM()); 44 75 45 // center 46 vector<molecule *> AllMolecules = World::getInstance().getAllMolecules(); 47 for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 76 // center atoms 77 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 48 78 (*MolRunner)->CenterInBox(); 49 79 } … … 52 82 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 53 83 54 return Action::success; 84 // create undo state 85 WorldCenterInBoxState *UndoState = 86 new WorldCenterInBoxState( 87 undostream.str(), 88 OldPositions, 89 params 90 ); 91 92 return Action::state_ptr(UndoState); 55 93 } 56 94 57 95 Action::state_ptr WorldCenterInBoxAction::performUndo(Action::state_ptr _state) { 58 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());96 WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get()); 59 97 60 return Action::failure; 61 // string newName = state->mol->getName(); 62 // state->mol->setName(state->lastName); 63 // 64 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 98 // restore domain 99 RealSpaceMatrix matrix; 100 std::stringstream undostream(state->undostring); 101 boost::archive::text_iarchive ia(undostream); 102 ia >> matrix; 103 World::getInstance().setDomain(matrix); 104 105 // place atoms on old positions 106 std::vector< boost::shared_ptr<Vector> >::const_iterator OldPositionsIter = state->OldPositions.begin(); 107 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules(); 108 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); 109 MolRunner != AllMolecules.end(); 110 ++MolRunner) { 111 for(molecule::const_iterator AtomRunner = (*MolRunner)->begin(); 112 AtomRunner != (*MolRunner)->end(); 113 ++AtomRunner) { 114 ASSERT(OldPositionsIter != state->OldPositions.end(), 115 "WorldBoundInBoxAction::performUndo() - too few positions stored in UndoState."); 116 (*AtomRunner)->setPosition(**(OldPositionsIter++)); 117 } 118 } 119 120 // give final box size 121 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 122 123 return Action::state_ptr(_state); 65 124 } 66 125 67 126 Action::state_ptr WorldCenterInBoxAction::performRedo(Action::state_ptr _state){ 68 return Action::failure; 127 WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get()); 128 129 // set new domain 130 World::getInstance().setDomain(state->params.cell_size.getM()); 131 132 // center atoms 133 std::vector<molecule *> AllMolecules = World::getInstance().getAllMolecules(); 134 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 135 (*MolRunner)->CenterInBox(); 136 } 137 138 // give final box size 139 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 140 141 return Action::state_ptr(_state); 69 142 } 70 143 71 144 bool WorldCenterInBoxAction::canUndo() { 72 return false;145 return true; 73 146 } 74 147 75 148 bool WorldCenterInBoxAction::shouldUndo() { 76 return false;149 return true; 77 150 } 78 151 /** =========== end of function ====================== */ -
src/Actions/WorldAction/CenterInBoxAction.def
rb1ac7a r9c27b0 9 9 #include "Actions/Values.hpp" 10 10 #include "Box.hpp" 11 #include "LinearAlgebra/Vector.hpp" 12 #include <boost/shared_ptr.hpp> 11 13 12 14 // i.e. there is an integer with variable name Z that can be found in … … 19 21 #define paramreferences (cell_size) 20 22 21 # undef statetypes22 # undef statereferences23 #define statetypes (std::string)(std::vector< boost::shared_ptr<Vector> >) 24 #define statereferences (undostring)(OldPositions) 23 25 24 26 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
rb1ac7a r9c27b0 18 18 #endif 19 19 20 // include headers that implement a archive in simple text format 21 #include <boost/archive/text_oarchive.hpp> 22 #include <boost/archive/text_iarchive.hpp> 23 #include "boost/serialization/vector.hpp" 24 20 25 #include "CodePatterns/MemDebug.hpp" 21 26 22 27 #include "atom.hpp" 23 28 #include "CodePatterns/Log.hpp" 29 #include "LinearAlgebra/MatrixContent.hpp" 30 #include "LinearAlgebra/RealSpaceMatrix.hpp" 24 31 #include "LinearAlgebra/Vector.hpp" 32 #include "molecule.hpp" 25 33 #include "World.hpp" 26 #include "LinearAlgebra/RealSpaceMatrix.hpp"27 34 28 35 #include <iostream> 29 36 #include <string> 37 #include <vector> 30 38 31 39 #include "Actions/WorldAction/CenterOnEdgeAction.hpp" … … 44 52 getParametersfromValueStorage(); 45 53 54 // create undo state 55 std::stringstream undostream; 56 boost::archive::text_oarchive oa(undostream); 57 const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM(); 58 oa << matrix; 59 std::vector< boost::shared_ptr<Vector> > OldPositions; 60 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 61 for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) 62 OldPositions.push_back( 63 boost::shared_ptr<Vector>(new Vector( 64 (*AtomRunner)->getPosition() 65 )) 66 ); 67 46 68 // get maximum and minimum 47 vector<atom *> AllAtoms = World::getInstance().getAllAtoms();48 69 ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present."); 49 vector<atom *>::iterator AtomRunner = AllAtoms.begin();70 std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); 50 71 Min = (*AtomRunner)->getPosition(); 51 72 Max = (*AtomRunner)->getPosition(); … … 67 88 World::getInstance().setDomain(domain); 68 89 // translate all atoms, such that Min is aty (0,0,0) 69 for ( vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)90 for (std::vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) 70 91 *(*AtomRunner) -= Min; 71 92 … … 73 94 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 74 95 75 return Action::success; 96 // create undo state 97 WorldCenterOnEdgeState *UndoState = 98 new WorldCenterOnEdgeState( 99 undostream.str(), 100 Min, 101 Max, 102 params 103 ); 104 105 return Action::state_ptr(UndoState); 76 106 } 77 107 78 108 Action::state_ptr WorldCenterOnEdgeAction::performUndo(Action::state_ptr _state) { 79 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());109 WorldCenterOnEdgeState *state = assert_cast<WorldCenterOnEdgeState*>(_state.get()); 80 110 81 return Action::failure; 82 // string newName = state->mol->getName(); 83 // state->mol->setName(state->lastName); 84 // 85 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 111 // restore domain 112 RealSpaceMatrix matrix; 113 std::stringstream undostream(state->undostring); 114 boost::archive::text_iarchive ia(undostream); 115 ia >> matrix; 116 World::getInstance().setDomain(matrix); 117 118 // translate all atoms back 119 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 120 for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); 121 AtomRunner != AllAtoms.end(); 122 ++AtomRunner) 123 *(*AtomRunner) += state->Min; 124 125 // give final box size 126 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 127 128 return Action::state_ptr(_state); 86 129 } 87 130 88 131 Action::state_ptr WorldCenterOnEdgeAction::performRedo(Action::state_ptr _state){ 89 return Action::failure; 132 WorldCenterOnEdgeState *state = assert_cast<WorldCenterOnEdgeState*>(_state.get()); 133 134 // set new box size 135 RealSpaceMatrix rmatrix; 136 for (int i=0;i<NDIM;i++) { 137 double tmp = state->Max[i]-state->Min[i]; 138 tmp = fabs(tmp)>=1. ? tmp : 1.0; 139 rmatrix.at(i,i) = tmp; 140 } 141 World::getInstance().setDomain(rmatrix); 142 // translate all atoms, such that Min is aty (0,0,0) 143 std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms(); 144 for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); 145 AtomRunner != AllAtoms.end(); 146 ++AtomRunner) 147 *(*AtomRunner) -= state->Min; 148 149 // give final box size 150 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 151 152 return Action::state_ptr(_state); 90 153 } 91 154 92 155 bool WorldCenterOnEdgeAction::canUndo() { 93 return false;156 return true; 94 157 } 95 158 96 159 bool WorldCenterOnEdgeAction::shouldUndo() { 97 return false;160 return true; 98 161 } 99 162 /** =========== end of function ====================== */ -
src/Actions/WorldAction/CenterOnEdgeAction.def
rb1ac7a r9c27b0 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "LinearAlgebra/Vector.hpp" 10 10 11 11 // i.e. there is an integer with variable name Z that can be found in … … 18 18 #undef paramreferences 19 19 20 # undef statetypes21 # undef statereferences20 #define statetypes (std::string)(Vector)(Vector) 21 #define statereferences (undostring)(Min)(Max) 22 22 23 23 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/ChangeBoxAction.cpp
rb1ac7a r9c27b0 18 18 #endif 19 19 20 // include headers that implement a archive in simple text format 21 #include <boost/archive/text_oarchive.hpp> 22 #include <boost/archive/text_iarchive.hpp> 23 #include "boost/serialization/vector.hpp" 24 20 25 #include "CodePatterns/MemDebug.hpp" 21 26 22 27 #include "CodePatterns/Log.hpp" 23 28 #include "CodePatterns/Verbose.hpp" 29 #include "LinearAlgebra/MatrixContent.hpp" 30 #include "LinearAlgebra/RealSpaceMatrix.hpp" 24 31 #include "World.hpp" 25 32 #include "Box.hpp" 26 #include "LinearAlgebra/RealSpaceMatrix.hpp"27 33 28 34 #include <iostream> … … 41 47 getParametersfromValueStorage(); 42 48 49 // create undo state 50 std::stringstream undostream; 51 boost::archive::text_oarchive oa(undostream); 52 const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM(); 53 oa << matrix; 54 43 55 World::getInstance().setDomain(params.cell_size.getM()); // this is needed as only this function is OBSERVEd. 44 56 … … 46 58 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 47 59 48 return Action::success; 60 // create undo state 61 WorldChangeBoxState *UndoState = 62 new WorldChangeBoxState( 63 undostream.str(), 64 params 65 ); 66 67 return Action::state_ptr(UndoState); 49 68 } 50 69 51 70 Action::state_ptr WorldChangeBoxAction::performUndo(Action::state_ptr _state) { 52 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());71 WorldChangeBoxState *state = assert_cast<WorldChangeBoxState*>(_state.get()); 53 72 54 return Action::failure; 55 // string newName = state->mol->getName(); 56 // state->mol->setName(state->lastName); 57 // 58 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 73 // restore domain 74 RealSpaceMatrix matrix; 75 std::stringstream undostream(state->undostring); 76 boost::archive::text_iarchive ia(undostream); 77 ia >> matrix; 78 World::getInstance().setDomain(matrix); 79 80 // give final box size 81 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 82 83 return Action::state_ptr(_state); 59 84 } 60 85 61 86 Action::state_ptr WorldChangeBoxAction::performRedo(Action::state_ptr _state){ 62 return Action::failure; 87 World::getInstance().setDomain(params.cell_size.getM()); // this is needed as only this function is OBSERVEd. 88 89 // give final box size 90 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 91 92 return Action::state_ptr(_state); 63 93 } 64 94 65 95 bool WorldChangeBoxAction::canUndo() { 66 return false;96 return true; 67 97 } 68 98 69 99 bool WorldChangeBoxAction::shouldUndo() { 70 return false;100 return true; 71 101 } 72 102 /** =========== end of function ====================== */ -
src/Actions/WorldAction/ChangeBoxAction.def
rb1ac7a r9c27b0 19 19 #define paramreferences (cell_size) 20 20 21 # undef statetypes22 # undef statereferences21 #define statetypes (std::string) 22 #define statereferences (undostring) 23 23 24 24 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/RepeatBoxAction.cpp
rb1ac7a r9c27b0 31 31 32 32 #include <iostream> 33 #include <set> 33 34 #include <string> 34 35 #include <vector> … … 42 43 #include "Action_impl_pre.hpp" 43 44 /** =========== define the function ====================== */ 44 Action::state_ptr WorldRepeatBoxAction::performCall() { 45 46 void repeatMoleculesinDomain(Vector Repeater, const std::vector<molecule *> &AllMolecules) 47 { 45 48 int count; 46 49 const element ** Elements; 47 molecule *mol = NULL;48 50 int j = 0; 49 51 atom *Walker = NULL; 50 52 MoleculeListClass *molecules = World::getInstance().getMolecules(); 51 53 52 // obtain information 53 getParametersfromValueStorage(); 54 55 vector<molecule *> AllMolecules; 56 if (mol != NULL) { 57 DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl); 58 AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol)); 59 } else { 60 DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl); 61 AllMolecules = World::getInstance().getAllMolecules(); 62 } 63 64 (cout << "Repeating box " << params.Repeater << " times for (x,y,z) axis." << endl); 54 LOG(0, "STATUS: Repeating box " << Repeater << " times for (x,y,z) axis."); 55 56 // set new domain 65 57 RealSpaceMatrix M = World::getInstance().getDomain().getM(); 66 58 RealSpaceMatrix newM = M; … … 69 61 RealSpaceMatrix repMat; 70 62 for (int axis = 0; axis < NDIM; axis++) { 71 params.Repeater[axis] = floor(params.Repeater[axis]);72 if ( params.Repeater[axis] < 1) {73 DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor must be greater than 1!" << endl);74 params.Repeater[axis] = 1;63 Repeater[axis] = floor(Repeater[axis]); 64 if (Repeater[axis] < 1) { 65 ELOG(1, "Repetition factor must be greater than 1!"); 66 Repeater[axis] = 1; 75 67 } 76 repMat.at(axis,axis) = params.Repeater[axis];68 repMat.at(axis,axis) = Repeater[axis]; 77 69 } 78 70 newM *= repMat; 79 71 World::getInstance().setDomain(newM); 80 72 73 // add molecules in each repeated domain part 81 74 molecule *newmol = NULL; 82 75 std::vector<Vector> vectors; 83 for (n[0] = 0; n[0] < params.Repeater[0]; n[0]++) {76 for (n[0] = 0; n[0] < Repeater[0]; n[0]++) { 84 77 y[0] = n[0]; 85 for (n[1] = 0; n[1] < params.Repeater[1]; n[1]++) {78 for (n[1] = 0; n[1] < Repeater[1]; n[1]++) { 86 79 y[1] = n[1]; 87 for (n[2] = 0; n[2] < params.Repeater[2]; n[2]++) {80 for (n[2] = 0; n[2] < Repeater[2]; n[2]++) { 88 81 y[2] = n[2]; 89 82 if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0)) 90 83 continue; 91 for (vector<molecule *>:: iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {92 mol = *MolRunner;93 DoLog(1) && (Log() << Verbose(1) << "Current mol is " << mol->name << "." << endl);84 for (vector<molecule *>::const_iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 85 const molecule *mol = *MolRunner; 86 LOG(2, "INFO: Current mol is " << mol->name << "."); 94 87 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 95 88 if (count != 0) { // if there is more than none … … 97 90 vectors.resize(count); 98 91 j = 0; 99 for(molecule:: iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {92 for(molecule::const_iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) { 100 93 Elements[j] = (*AtomRunner)->getType(); 101 94 vectors[j] = (*AtomRunner)->getPosition(); … … 103 96 } 104 97 if (count != j) 105 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);98 ELOG(1, "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!"); 106 99 x = y; 107 100 x *= M; 108 101 newmol = World::getInstance().createMolecule(); 102 // TODO: Remove this when World don't has deprecated MoleculeListClass anymore 109 103 molecules->insert(newmol); 110 104 for (int k=count;k--;) { // go through every atom of the original cell … … 118 112 delete[](Elements); 119 113 } else { 120 DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);114 LOG(1, "\t ... is empty."); 121 115 } 122 116 } … … 124 118 } 125 119 } 120 } 121 122 Action::state_ptr WorldRepeatBoxAction::performCall() { 123 molecule *mol = NULL; 124 125 // obtain information 126 getParametersfromValueStorage(); 127 128 std::vector<molecule *> AllMolecules; 129 if (mol != NULL) { 130 DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl); 131 AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol)); 132 } else { 133 DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl); 134 AllMolecules = World::getInstance().getAllMolecules(); 135 } 136 137 // prepare undo state 138 RealSpaceMatrix olddomain = World::getInstance().getDomain().getM(); 139 std::set<molecule *> oldmolecules; 140 for(std::vector<molecule *>::const_iterator iter = AllMolecules.begin(); 141 iter != AllMolecules.end(); 142 ++iter) 143 oldmolecules.insert(*iter); 144 WorldRepeatBoxState *undostate = new WorldRepeatBoxState(olddomain, oldmolecules, params); 145 146 repeatMoleculesinDomain(params.Repeater, AllMolecules); 126 147 127 148 // give final box size 128 149 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 129 150 130 return Action::s uccess;151 return Action::state_ptr(undostate); 131 152 } 132 153 133 154 Action::state_ptr WorldRepeatBoxAction::performUndo(Action::state_ptr _state) { 134 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 135 136 return Action::failure; 137 // string newName = state->mol->getName(); 138 // state->mol->setName(state->lastName); 139 // 140 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 155 WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get()); 156 MoleculeListClass *molecules = World::getInstance().getMolecules(); 157 158 // set old domain 159 World::getInstance().setDomain(state->olddomain); 160 161 // remove all added molecules (and their atoms) 162 std::vector<molecule *> allmolecules = World::getInstance().getAllMolecules(); 163 for (std::vector<molecule *>::iterator iter = allmolecules.begin(); 164 iter != allmolecules.end(); 165 ++iter) { 166 if (state->oldmolecules.find(*iter) == state->oldmolecules.end()) { 167 (*iter)->removeAtomsinMolecule(); 168 // TODO: Remove this when World don't has deprecated MoleculeListClass anymore 169 molecules->erase(*iter); 170 World::getInstance().destroyMolecule(*iter); 171 } 172 } 173 174 // give final box size 175 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 176 177 return Action::state_ptr(_state); 141 178 } 142 179 143 180 Action::state_ptr WorldRepeatBoxAction::performRedo(Action::state_ptr _state){ 144 return Action::failure; 181 WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get()); 182 183 std::vector<molecule *> originalmolecules; 184 for(std::set<molecule *>::const_iterator iter = state->oldmolecules.begin(); 185 iter != state->oldmolecules.end(); 186 ++iter) 187 originalmolecules.push_back(*iter); 188 repeatMoleculesinDomain(state->params.Repeater, originalmolecules); 189 190 // give final box size 191 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 192 193 return Action::state_ptr(_state); 145 194 } 146 195 147 196 bool WorldRepeatBoxAction::canUndo() { 148 return false;197 return true; 149 198 } 150 199 151 200 bool WorldRepeatBoxAction::shouldUndo() { 152 return false;201 return true; 153 202 } 154 203 /** =========== end of function ====================== */ -
src/Actions/WorldAction/RepeatBoxAction.def
rb1ac7a r9c27b0 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "Actions/Values.hpp" 10 #include "LinearAlgebra/RealSpaceMatrix.hpp" 10 11 #include "LinearAlgebra/Vector.hpp" 12 #include <set> 13 14 class molecule; 11 15 12 16 // i.e. there is an integer with variable name Z that can be found in … … 19 23 #define paramreferences (Repeater) 20 24 21 # undef statetypes22 # undef statereferences25 #define statetypes (RealSpaceMatrix)(std::set< molecule *>) 26 #define statereferences (olddomain)(oldmolecules) 23 27 24 28 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/WorldAction/ScaleBoxAction.cpp
rb1ac7a r9c27b0 22 22 #include "atom.hpp" 23 23 #include "CodePatterns/Log.hpp" 24 #include "LinearAlgebra/RealSpaceMatrix.hpp" 24 25 #include "LinearAlgebra/Vector.hpp" 25 #include "CodePatterns/Verbose.hpp"26 26 #include "World.hpp" 27 27 #include "Box.hpp" 28 #include "LinearAlgebra/RealSpaceMatrix.hpp"29 28 30 29 #include <iostream> 31 30 #include <string> 31 #include <vector> 32 32 33 33 #include "Actions/WorldAction/ScaleBoxAction.hpp" … … 45 45 getParametersfromValueStorage(); 46 46 47 DoLog(1) && (Log() << Verbose(1) << "Scaling all atomic positions by factor." << endl);47 // scale atoms 48 48 for (int i=0;i<NDIM;i++) 49 49 x[i] = params.Scaler[i]; 50 vector<atom*> AllAtoms = World::getInstance().getAllAtoms();51 for( vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {50 std::vector<atom*> AllAtoms = World::getInstance().getAllAtoms(); 51 for(std::vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) { 52 52 (*AtomRunner)->ScaleAll(x); 53 53 } 54 54 55 // scale box 55 56 RealSpaceMatrix M = World::getInstance().getDomain().getM(); 56 57 RealSpaceMatrix scale; 57 58 58 for (int i=0;i<NDIM;i++) { 59 scale.at(i,i) = x[i];59 scale.at(i,i) = params.Scaler[i]; 60 60 } 61 61 M *= scale; … … 65 65 LOG(0, "Box domain is now " << World::getInstance().getDomain().getM()); 66 66 67 return Action::success; 67 // create undo state 68 WorldScaleBoxState *UndoState = new WorldScaleBoxState(params); 69 70 return Action::state_ptr(UndoState); 68 71 } 69 72 70 73 Action::state_ptr WorldScaleBoxAction::performUndo(Action::state_ptr _state) { 71 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());74 WorldScaleBoxState *state = assert_cast<WorldScaleBoxState*>(_state.get()); 72 75 73 return Action::failure; 74 // string newName = state->mol->getName(); 75 // state->mol->setName(state->lastName); 76 // 77 // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); 76 // scale back atoms 77 double x[NDIM]; 78 for (int i=0;i<NDIM;i++) 79 x[i] = 1./state->params.Scaler[i]; 80 vector<atom*> AllAtoms = World::getInstance().getAllAtoms(); 81 for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) { 82 (*AtomRunner)->ScaleAll(x); 83 } 84 85 // scale back box 86 RealSpaceMatrix M = World::getInstance().getDomain().getM(); 87 RealSpaceMatrix scale; 88 for (int i=0;i<NDIM;i++) { 89 scale.at(i,i) = 1./state->params.Scaler[i]; 90 } 91 M *= scale; 92 World::getInstance().setDomain(M); 93 94 // give final box size 95 LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM()); 96 97 return Action::state_ptr(_state); 78 98 } 79 99 80 100 Action::state_ptr WorldScaleBoxAction::performRedo(Action::state_ptr _state){ 81 return Action::failure; 101 WorldScaleBoxState *state = assert_cast<WorldScaleBoxState*>(_state.get()); 102 103 // scale atoms 104 double x[NDIM]; 105 for (int i=0;i<NDIM;i++) 106 x[i] = state->params.Scaler[i]; 107 vector<atom*> AllAtoms = World::getInstance().getAllAtoms(); 108 for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) { 109 (*AtomRunner)->ScaleAll(x); 110 } 111 112 // scale box 113 RealSpaceMatrix M = World::getInstance().getDomain().getM(); 114 RealSpaceMatrix scale; 115 for (int i=0;i<NDIM;i++) { 116 scale.at(i,i) = state->params.Scaler[i]; 117 } 118 M *= scale; 119 World::getInstance().setDomain(M); 120 121 // give final box size 122 LOG(0, "Box domain is again " << World::getInstance().getDomain().getM()); 123 124 return Action::state_ptr(_state); 82 125 } 83 126 84 127 bool WorldScaleBoxAction::canUndo() { 85 return false;128 return true; 86 129 } 87 130 88 131 bool WorldScaleBoxAction::shouldUndo() { 89 return false;132 return true; 90 133 } 91 134 /** =========== end of function ====================== */ -
tests/regression/Domain/AddEmptyBoundary/testsuite-domain-add-empty-boundary.at
rb1ac7a r9c27b0 15 15 16 16 AT_SETUP([Domain - center and add empty boundary with Undo]) 17 AT_XFAIL_IF([/bin/true]) 18 AT_KEYWORDS([domain add-empty-boundar undo]) 17 AT_KEYWORDS([domain add-empty-boundary undo]) 19 18 20 19 file=test.conf … … 22 21 AT_CHECK([chmod u+w $file], 0) 23 22 AT_CHECK([../../molecuilder -i $file -c "5, 10, 15" --undo], 0, [stdout], [stderr]) 24 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/AddEmptyBoundary/post/test .conf], 0, [stdout], [stderr])23 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 24 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/AddEmptyBoundary/post/test-undo.conf], 0, [stdout], [stderr]) 26 25 27 26 AT_CLEANUP … … 29 28 30 29 AT_SETUP([Domain - center and add empty boundary with Redo]) 31 AT_XFAIL_IF([/bin/true])32 30 AT_KEYWORDS([domain add-empty-boundary redo]) 33 31 -
tests/regression/Domain/CenterInBox/testsuite-domain-center-in-box.at
rb1ac7a r9c27b0 15 15 16 16 AT_SETUP([Domain - setting and centering in domain with Undo]) 17 AT_XFAIL_IF([/bin/true])18 17 AT_KEYWORDS([domain center-in-box undo]) 19 18 … … 22 21 AT_CHECK([chmod u+w $file], 0) 23 22 AT_CHECK([../../molecuilder -i $file -b "15, 0, 15, 0, 0, 15" --undo], 0, [stdout], [stderr]) 24 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test .conf], 0, [stdout], [stderr])23 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 24 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test-undo.conf], 0, [stdout], [stderr]) 26 25 27 26 AT_CLEANUP … … 29 28 30 29 AT_SETUP([Domain - setting and centering in domain with Redo]) 31 AT_XFAIL_IF([/bin/true])32 30 AT_KEYWORDS([domain center-in-box redo]) 33 31 … … 36 34 AT_CHECK([chmod u+w $file], 0) 37 35 AT_CHECK([../../molecuilder -i $file -b "15, 0, 15, 0, 0, 15" --undo --redo], 0, [stdout], [stderr]) 38 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])36 AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore]) 39 37 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test.conf], 0, [stdout], [stderr]) 40 38 -
tests/regression/Domain/CenterOnEdge/testsuite-domain-center-on-edge.at
rb1ac7a r9c27b0 7 7 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0) 8 8 AT_CHECK([chmod u+w $file], 0) 9 AT_CHECK([../../molecuilder -i $file 9 AT_CHECK([../../molecuilder -i $file -O], 0, [stdout], [stderr]) 10 10 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore]) 11 11 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test.conf], 0, [stdout], [stderr]) … … 15 15 16 16 AT_SETUP([Domain - set domain to minimum size with Undo]) 17 AT_XFAIL_IF([/bin/true])18 17 AT_KEYWORDS([domain center-edge undo]) 19 18 … … 21 20 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0) 22 21 AT_CHECK([chmod u+w $file], 0) 23 AT_CHECK([../../molecuilder -i $file 22 AT_CHECK([../../molecuilder -i $file -O --undo], 0, [stdout], [stderr]) 24 23 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore]) 25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test .conf], 0, [stdout], [stderr])24 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test-undo.conf], 0, [stdout], [stderr]) 26 25 27 26 AT_CLEANUP … … 29 28 30 29 AT_SETUP([Domain - set domain to minimum size with Redo]) 31 AT_XFAIL_IF([/bin/true])32 30 AT_KEYWORDS([domain center-edge redo]) 33 31 … … 35 33 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0) 36 34 AT_CHECK([chmod u+w $file], 0) 37 AT_CHECK([../../molecuilder -i $file 35 AT_CHECK([../../molecuilder -i $file -O --undo --redo], 0, [stdout], [stderr]) 38 36 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore]) 39 37 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test.conf], 0, [stdout], [stderr]) -
tests/regression/Domain/ChangeBox/testsuite-domain-change-box.at
rb1ac7a r9c27b0 13 13 14 14 AT_SETUP([Domain - defining simulation domain]) 15 AT_XFAIL_IF([/bin/true])16 15 AT_KEYWORDS([domain change-box undo]) 17 16 … … 25 24 26 25 AT_SETUP([Domain - defining simulation domain]) 27 AT_XFAIL_IF([/bin/true])28 26 AT_KEYWORDS([domain change-box redo]) 29 27 -
tests/regression/Domain/RepeatBox/testsuite-domain-repeat-box.at
rb1ac7a r9c27b0 44 44 45 45 AT_SETUP([Domain - duplicating box with Undo]) 46 AT_XFAIL_IF([/bin/true])47 46 AT_KEYWORDS([domain repeat-box undo]) 48 47 … … 51 50 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 52 51 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 1, 1" --undo], 0, [stdout], [stderr]) 53 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])52 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 54 53 AT_CHECK([file=test.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 55 AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test .xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])54 AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) 56 55 AT_CHECK([file=test.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore]) 57 56 … … 60 59 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 61 60 AT_CHECK([../../molecuilder -i $file -o xyz -d "2, 1, 1" --undo], 0, [stdout], [stderr]) 62 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])61 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 63 62 AT_CHECK([file=test-x.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 64 AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test- x.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])63 AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) 65 64 AT_CHECK([file=test-x.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore]) 66 65 … … 69 68 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 70 69 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 2, 1" --undo], 0, [stdout], [stderr]) 71 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])70 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 72 71 AT_CHECK([file=test-y.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 73 AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test- y.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])72 AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) 74 73 AT_CHECK([file=test-y.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore]) 75 74 … … 78 77 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 79 78 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 1, 2" --undo], 0, [stdout], [stderr]) 80 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])79 AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore]) 81 80 AT_CHECK([file=test-z.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 82 AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test- z.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])81 AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) 83 82 AT_CHECK([file=test-z.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore]) 84 83 … … 87 86 88 87 AT_SETUP([Domain - duplicating box with Redo]) 89 AT_XFAIL_IF([/bin/true])90 88 AT_KEYWORDS([domain repeat-box redo]) 91 89 … … 94 92 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 95 93 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 1, 1" --undo --redo], 0, [stdout], [stderr]) 96 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])94 AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore]) 97 95 AT_CHECK([file=test.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 98 96 AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) … … 103 101 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 104 102 AT_CHECK([../../molecuilder -i $file -o xyz -d "2, 1, 1" --undo --redo], 0, [stdout], [stderr]) 105 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])103 AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore]) 106 104 AT_CHECK([file=test-x.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 107 105 AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-x.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) … … 112 110 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 113 111 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 2, 1" --undo --redo], 0, [stdout], [stderr]) 114 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])112 AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore]) 115 113 AT_CHECK([file=test-y.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 116 114 AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-y.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) … … 121 119 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 122 120 AT_CHECK([../../molecuilder -i $file -o xyz -d "1, 1, 2" --undo --redo], 0, [stdout], [stderr]) 123 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])121 AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore]) 124 122 AT_CHECK([file=test-z.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore]) 125 123 AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-z.xyz | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore]) -
tests/regression/Domain/ScaleBox/testsuite-domain-scale-box.at
rb1ac7a r9c27b0 15 15 16 16 AT_SETUP([Domain - scaling box with Undo]) 17 AT_XFAIL_IF([/bin/true])18 17 AT_KEYWORDS([domain scale-box undo]) 19 18 … … 23 22 AT_CHECK([../../molecuilder -i $file --scale-box "0.5, 1., 0.9" --undo], 0, [stdout], [stderr]) 24 23 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore]) 25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/ScaleBox/post/test .conf], 0, [stdout], [stderr])24 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/ScaleBox/post/test-undo.conf], 0, [stdout], [stderr]) 26 25 27 26 AT_CLEANUP … … 29 28 30 29 AT_SETUP([Domain - scaling box with Redo]) 31 AT_XFAIL_IF([/bin/true])32 30 AT_KEYWORDS([domain scale-box redo]) 33 31 -
tests/regression/Domain/testsuite-domain.at
rb1ac7a r9c27b0 3 3 # define box setting 4 4 m4_include([Domain/ChangeBox/testsuite-domain-change-box.at]) 5 6 # bound atoms in defined domain 7 m4_include([Domain/BoundInBox/testsuite-domain-bound-in-box.at]) 5 8 6 9 # center atoms in defined domain -
tests/regression/Makefile.am
rb1ac7a r9c27b0 41 41 $(srcdir)/Analysis/AngularDipoleCorrelation-DiscreteAngles/testsuite-analysis-angular-dipole-correlation-discrete-angles.at \ 42 42 $(srcdir)/Domain/testsuite-domain.at \ 43 $(srcdir)/Domain/BoundInBox/testsuite-domain-bound-in-box.at \ 43 44 $(srcdir)/Domain/ChangeBox/testsuite-domain-change-box.at \ 44 45 $(srcdir)/Domain/CenterInBox/testsuite-domain-center-in-box.at \
Note:
See TracChangeset
for help on using the changeset viewer.