Changes in / [a61dbb:d8821e]
- Location:
- src
- Files:
-
- 5 added
- 83 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
ra61dbb rd8821e 177 177 } 178 178 179 void Action::pushStatus(const std::string& _msg) 180 { 181 ActionQueue::getInstance().pushStatus(_msg); 182 } 183 -
src/Actions/Action.hpp
ra61dbb rd8821e 24 24 */ 25 25 #define NOPARAM_DEFAULT BOOST_PP_NIL 26 27 /** Nicely visible short-hand for push a status message 28 * 29 */ 30 #ifndef STATUS 31 #define STATUS(msg) pushStatus(msg) 32 #endif 26 33 27 34 // forward declaration … … 270 277 static void insertAction(Action *_action, enum Action::QueryOptions state); 271 278 279 /** Proxy function to grant all derived Actions access to 280 * ActionQueue::pushStatus(). 281 * 282 * \param _msg status message to push 283 */ 284 void pushStatus(const std::string& _msg); 285 272 286 private: 273 287 -
src/Actions/ActionQueue.cpp
ra61dbb rd8821e 162 162 try { 163 163 actionqueue[CurrentAction]->call(); 164 pushStatus("SUCCESS: Action "+actionqueue[CurrentAction]->getName()+" successful."); 164 165 lastActionOk = true; 165 166 } catch(ActionFailureException &e) { 166 std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl;167 pushStatus("FAIL: Action "+*boost::get_error_info<ActionNameString>(e)+" has failed."); 167 168 World::getInstance().setExitFlag(5); 168 169 actionqueue.clear(); -
src/Actions/ActionQueue.hpp
ra61dbb rd8821e 24 24 #include "Actions/Action.hpp" 25 25 #include "Actions/ActionState.hpp" 26 #include "Actions/ActionStatusList.hpp" 26 27 27 28 #ifdef HAVE_ACTION_THREAD … … 134 135 #endif 135 136 137 /** Getter to ref to list of status messages. 138 * 139 * This is meant for UIs to registers as Observables. 140 * 141 * \return ref to StatusList variable 142 */ 143 ActionStatusList& getStatusList() 144 { return StatusList; } 145 136 146 private: 137 147 //!> grant Action access to internal history functions. … … 145 155 void addElement(Action* _Action, ActionState::ptr _state); 146 156 157 /** Advocate function to add status message to the list. 158 * 159 */ 160 void pushStatus(const std::string &_msg) 161 { StatusList.pushMessage(_msg); } 162 147 163 /** Wrapper function to clear ActionHistory. 148 164 * … … 231 247 boost::mutex mtx_idle; 232 248 #endif 249 250 //!> internal list of status messages from Actions for UIs to display 251 ActionStatusList StatusList; 233 252 }; 234 253 -
src/Actions/AnalysisAction/DipoleAngularCorrelationAction.cpp
ra61dbb rd8821e 83 83 std::vector<atom *> atoms = World::getInstance().getSelectedAtoms(); 84 84 if (atoms.empty()) { 85 ELOG(2,"Formula "+toString(DipoleFormula)+" selects no atoms.");85 STATUS("Formula "+toString(DipoleFormula)+" selects no atoms."); 86 86 return Action::failure; 87 87 } … … 139 139 140 140 // exit 141 STATUS("Dipole angular correlation calculation successful."); 141 142 return Action::success; 142 143 } -
src/Actions/AnalysisAction/DipoleCorrelationAction.cpp
ra61dbb rd8821e 67 67 DipoleCorrelationMap *correlationmap = NULL; 68 68 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 69 LOG(0, "STATUS: There are " << molecules.size() <<" selected molecules.");69 STATUS("There are "+toString(molecules.size())+" selected molecules."); 70 70 ASSERT(!params.periodic.get(), "AnalysisDipoleCorrelationAction() - periodic case not implemented."); 71 71 correlationmap = DipoleCorrelation(molecules); -
src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
ra61dbb rd8821e 84 84 } 85 85 if ( atoms.size() == 0) { 86 ELOG(1,"You have not select any atoms.");86 STATUS("You have not select any atoms."); 87 87 return Action::failure; 88 88 } -
src/Actions/AtomAction/AddAction.cpp
ra61dbb rd8821e 93 93 } 94 94 if (first->getId() != state->id) 95 if (!first->changeId(state->id)) 95 if (!first->changeId(state->id)) { 96 STATUS("Could not change atom id "+toString(first->getId())+"->"+toString(state->id)+"."); 96 97 return Action::failure; 98 } 99 97 100 return ActionState::ptr(_state); 98 101 } -
src/Actions/AtomAction/RemoveAction.cpp
ra61dbb rd8821e 81 81 if (AddAtomsFromAtomicInfo(state->Walkers)) 82 82 return ActionState::ptr(_state); 83 else 83 else { 84 STATUS("Failed to re-add removed atoms."); 84 85 return Action::failure; 86 } 85 87 } 86 88 -
src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp
ra61dbb rd8821e 59 59 60 60 // check whether Axis is valid 61 if (params.Axis.get().IsZero()) 61 if (params.Axis.get().IsZero()) { 62 STATUS("Specified Rotation axis is zero."); 62 63 return Action::failure; 64 } 63 65 64 66 // convert from degrees to radian -
src/Actions/AtomAction/SaveSelectedAtomsAction.cpp
ra61dbb rd8821e 63 63 FilenamePrefix = params.filename.get().stem().string(); 64 64 } else { 65 ELOG(1, "Output filedoes not have a suffix, cannot recognize format.");65 STATUS("Output file "+params.filename.get().string()+"does not have a suffix, cannot recognize format."); 66 66 return Action::failure; 67 67 } … … 74 74 FormatParserStorage::getInstance().saveSelectedAtoms(output, FilenameSuffix); 75 75 } else { 76 ELOG(1, "Could not open file " << params.filename.get() << "."); 76 STATUS("Could not open file "+params.filename.get().string()+"."); 77 return Action::failure; 77 78 } 78 79 output.close(); … … 84 85 // ParserSaveXyzState *state = assert_cast<ParserSaveXyzState*>(_state.get()); 85 86 86 return Action:: failure;87 return Action::success; 87 88 // string newName = state->mol->getName(); 88 89 // state->mol->setName(state->lastName); … … 92 93 93 94 ActionState::ptr AtomSaveSelectedAtomsAction::performRedo(ActionState::ptr _state){ 94 return Action:: failure;95 return Action::success; 95 96 // // Undo and redo have to do the same for this action 96 97 // return performUndo(_state); -
src/Actions/BondAction/BondAddAction.cpp
ra61dbb rd8821e 58 58 // check preconditions 59 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 ELOG(1,"Exactly two atoms must be selected for BondAction Add.");60 STATUS("Exactly two atoms must be selected for BondAction Add."); 61 61 return Action::failure; 62 62 } 63 63 const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms(); 64 64 if (selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) { 65 ELOG(2,"There already is a bond in between the two selected atoms.");65 STATUS("There already is a bond in between the two selected atoms."); 66 66 return Action::failure; 67 67 } -
src/Actions/BondAction/BondRemoveAction.cpp
ra61dbb rd8821e 58 58 // check preconditions 59 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 ELOG(1,"Exactly two atoms must be selected for BondAction Remove.");60 STATUS("Exactly two atoms must be selected for BondAction Remove."); 61 61 return Action::failure; 62 62 } 63 63 const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms(); 64 64 if (!selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) { 65 ELOG(2,"There is no bond in between the two selected atoms.");65 STATUS("There is no bond in between the two selected atoms."); 66 66 return Action::failure; 67 67 } -
src/Actions/CommandAction/BondLengthTableAction.cpp
ra61dbb rd8821e 76 76 std::ifstream input(params.BondGraphFileName.get().string().c_str()); 77 77 if ((input.good()) && (BG->LoadBondLengthTable(input))) { 78 LOG( 0, "Bond length table parsed successfully.");78 LOG(1, "Bond length table parsed successfully."); 79 79 input.close(); 80 80 return ActionState::ptr(UndoState); 81 81 } else { 82 ELOG(1, "Bond length table parsing failed."); 82 STATUS("Bond length table "+params.BondGraphFileName.get().string() 83 +" parsing failed."); 83 84 input.close(); 84 85 } 85 86 } else { 86 ELOG(1, "Bond length table loading failed."); 87 STATUS("Bond length table "+params.BondGraphFileName.get().string() 88 +" loading failed."); 87 89 } 88 90 // recover bond graph -
src/Actions/CommandAction/ElementDbAction.cpp
ra61dbb rd8821e 81 81 periode->CleanupPeriodtable(); 82 82 if (periode->LoadPeriodentafel(configuration->databasepath)) { 83 LOG(0,"Element list loaded successfully.");83 STATUS("Element list loaded successfully."); 84 84 //periode->Output(); 85 85 return ActionState::ptr(UndoState); 86 86 } else { 87 LOG(0,"Element list loading failed.");87 STATUS("Element list loading failed."); 88 88 delete UndoState; 89 89 return Action::failure; … … 118 118 periode->CleanupPeriodtable(); 119 119 if (periode->LoadPeriodentafel(configuration->databasepath)) { 120 LOG(0, "Element list loaded successfully.");120 STATUS("Redoing Element list loaded successfully."); 121 121 //periode->Output(); 122 122 return ActionState::ptr(_state); 123 123 } else { 124 LOG(0, "Element list loading failed.");124 STATUS("Redoing Element list loading failed."); 125 125 return Action::failure; 126 126 } -
src/Actions/CommandAction/HelpAction.cpp
ra61dbb rd8821e 98 98 std::cout << std::endl; 99 99 } else { 100 ELOG(1, "No action is known by the name " << params.actionname.get() <<".");100 STATUS("No action is known by the name "+params.actionname.get()+"."); 101 101 return Action::failure; 102 102 } -
src/Actions/CommandAction/LoadSessionAction.cpp
ra61dbb rd8821e 60 60 if (executePythonScript(params.filename.get().string())) 61 61 return Action::success; 62 else 62 else { 63 STATUS("Failed executing python script."); 63 64 return Action::failure; 65 } 64 66 #else 65 ELOG(1,"Python capabilities have not been compiled in.");67 STATUS("Python capabilities have not been compiled in."); 66 68 return Action::failure; 67 69 #endif -
src/Actions/CommandAction/VersionAction.cpp
ra61dbb rd8821e 49 49 /** =========== define the function ====================== */ 50 50 ActionState::ptr CommandVersionAction::performCall() { 51 LOG(1, "STATUS: Version of the program is " << MOLECUILDERVERSION <<".");51 STATUS("Version of the program is "+toString(MOLECUILDERVERSION)+"."); 52 52 return Action::success; 53 53 } -
src/Actions/FillAction/FillRegularGridAction.cpp
ra61dbb rd8821e 84 84 const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules(); 85 85 if (molecules.size() != 1) { 86 ELOG(1,"No exactly one molecule selected, aborting,");86 STATUS("No exactly one molecule selected, aborting,"); 87 87 return Action::failure; 88 88 } … … 99 99 if (params.SphereRadius.get() != 0.) { 100 100 if ( atoms.size() == 0) { 101 ELOG(1, "You have given a sphere radius " << params.SphereRadius.get()102 <<" != 0, but have not select any atoms.");101 STATUS("You have given a sphere radius "+toString(params.SphereRadius.get()) 102 +" != 0, but have not select any atoms."); 103 103 return Action::failure; 104 104 } … … 168 168 169 169 if (!successflag) { 170 ELOG(1,"Insertion failed, removing inserted clusters, translating original one back");170 STATUS("Insertion failed, removing inserted clusters, translating original one back"); 171 171 RemoveAtomsFromAtomicInfo(clonedatominfos); 172 172 clonedatoms.clear(); … … 191 191 if (successflag) 192 192 return ActionState::ptr(UndoState); 193 else 193 else { 194 194 return Action::failure; 195 } 195 196 } 196 197 … … 220 221 if (statusflag) 221 222 return ActionState::ptr(_state); 222 else 223 else { 224 STATUS("Failed re-adding filled in atoms."); 223 225 return Action::failure; 226 } 224 227 } 225 228 -
src/Actions/FillAction/FillSurfaceAction.cpp
ra61dbb rd8821e 72 72 std::vector<AtomicInfo> movedatoms; 73 73 if (molecules.size() != 1) { 74 ELOG(1,"No exactly one molecule selected, aborting,");74 STATUS("No exactly one molecule selected, aborting,"); 75 75 return Action::failure; 76 76 } … … 112 112 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 113 113 if (selectedShapes.size() != 1){ 114 ELOG(1, "FillSurfaceAction::performCall(): there has to be exactly 1 selected shape.");114 STATUS("There has to be exactly 1 selected shape."); 115 115 return Action::failure; 116 116 } … … 150 150 151 151 if (!successflag) { 152 ELOG(1,"Insertion failed, removing inserted clusters, translating original one back");152 STATUS("Insertion failed, removing inserted clusters, translating original one back"); 153 153 RemoveAtomsFromAtomicInfo(clonedatominfos); 154 154 clonedatoms.clear(); … … 198 198 if (statusflag) 199 199 return ActionState::ptr(_state); 200 else 200 else { 201 STATUS("Failed to re-added filled in atoms."); 201 202 return Action::failure; 203 } 202 204 } 203 205 -
src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp
ra61dbb rd8821e 537 537 538 538 if (keysets.KeySets.empty()) { 539 ELOG(2,"There are no results in the container.");539 STATUS("There are no results in the container."); 540 540 return Action::failure; 541 541 } … … 625 625 if (DoLongrange) { 626 626 if ( World::getInstance().getAllAtoms().size() == 0) { 627 ELOG(1,"Please load the full molecule intostd::map<JobId_t, VMGData> longrangeData the world before starting this action.");627 STATUS("Please load the full molecule intostd::map<JobId_t, VMGData> longrangeData the world before starting this action."); 628 628 return Action::failure; 629 629 } -
src/Actions/FragmentationAction/ClearFragmentationResultsAction.cpp
ra61dbb rd8821e 56 56 LOG(1, "STATUS: Fragmentation results cleared."); 57 57 return Action::success; 58 } else 58 } else { 59 STATUS("Failed to clear fragmentation results."); 59 60 return Action::failure; 61 } 60 62 } 61 63 -
src/Actions/FragmentationAction/FragmentationAction.cpp
ra61dbb rd8821e 87 87 // check for selected atoms 88 88 if (world.beginAtomSelection() == world.endAtomSelection()) { 89 ELOG(1,"There are no atoms selected for fragmentation.");89 STATUS("There are no atoms selected for fragmentation."); 90 90 return Action::failure; 91 91 } -
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
ra61dbb rd8821e 193 193 if (params.DoLongrange.get()) { 194 194 if ( World::getInstance().getAllAtoms().size() == 0) { 195 ELOG(1,"Please load the full molecule into the world before starting this action.");195 STATUS("Please load the full molecule into the world before starting this action."); 196 196 return Action::failure; 197 197 } … … 237 237 params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly, 238 238 params.DoPrintDebug.get(), 239 OpenBoundaryConditions)) 239 OpenBoundaryConditions)) { 240 STATUS("Could not create long-range jobs for electronic charge distribution."); 240 241 return Action::failure; 242 } 241 243 242 244 // Phase Six a: calculate result … … 263 265 params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly, 264 266 params.DoPrintDebug.get(), 265 OpenBoundaryConditions)) 267 OpenBoundaryConditions)) { 268 STATUS("Could not create long-range jobs for nuclei charge distribution."); 266 269 return Action::failure; 270 } 267 271 268 272 // Phase Six b: calculate result … … 296 300 debugcontroller.setPort(params.port.get()); 297 301 debugcontroller.requestIds(full_sample.size()); 298 if (!debugcontroller.createDebugJobs(full_sample, OpenBoundaryConditions)) 302 if (!debugcontroller.createDebugJobs(full_sample, OpenBoundaryConditions)) { 303 STATUS("Could not create debug jobs."); 299 304 return Action::failure; 305 } 300 306 debugcontroller.waitforResults(full_sample.size()); 301 307 debugcontroller.getResults(debugData); … … 327 333 } 328 334 335 if (Exitflag != 0) 336 STATUS("Controller has returned failure."); 329 337 return (Exitflag == 0) ? Action::success : Action::failure; 330 338 } -
src/Actions/FragmentationAction/ParseFragmentJobsAction.cpp
ra61dbb rd8821e 53 53 // check for present jobs 54 54 if (params.jobfiles.get().empty()) { 55 ELOG(2,"Given vector of jobfiles is empty!");55 STATUS("Given vector of jobfiles is empty!"); 56 56 return Action::failure; 57 57 } … … 60 60 if(!FragmentJobQueue::getInstance().addJobsFromFiles( 61 61 params.jobfiles.get(), 62 params.level.get())) 62 params.level.get())) { 63 STATUS("Could not parse all given jobs files."); 63 64 return Action::failure; 65 } 64 66 size_t FragmentCounter = FragmentJobQueue::getInstance().size(); 65 67 LOG(1, "STATUS: I parsed " << FragmentCounter << " fragment files."); -
src/Actions/FragmentationAction/StoreSaturatedFragmentAction.cpp
ra61dbb rd8821e 60 60 // check for selected atoms 61 61 if (world.beginAtomSelection() == world.endAtomSelection()) { 62 ELOG(1,"There are not atoms selected for storing.");62 STATUS("There are not atoms selected for storing."); 63 63 return Action::failure; 64 64 } -
src/Actions/GraphAction/DestroyAdjacencyAction.cpp
ra61dbb rd8821e 72 72 World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection()); 73 73 if (Set.empty()) { 74 ELOG(2,"No atoms selected.");74 STATUS("No atoms selected."); 75 75 return Action::failure; 76 76 } -
src/Actions/GraphAction/UpdateMoleculesAction.cpp
ra61dbb rd8821e 92 92 if (World::getInstance().numMolecules() == 0) { 93 93 //World::getInstance().destroyMolecule(mol); 94 ELOG(1,"There are no molecules.");94 STATUS("There are no molecules."); 95 95 return Action::failure; 96 96 } -
src/Actions/Makefile.am
ra61dbb rd8821e 8 8 Actions/ActionRegistry.cpp \ 9 9 Actions/ActionSequence.cpp \ 10 Actions/ActionStatusList.cpp \ 10 11 Actions/ActionTrait.cpp \ 11 12 Actions/ErrorAction.cpp \ … … 33 34 Actions/ActionSequence.hpp \ 34 35 Actions/ActionState.hpp \ 36 Actions/ActionStatusList.hpp \ 35 37 Actions/ActionTrait.hpp \ 36 38 Actions/ActionTraits.hpp \ -
src/Actions/MoleculeAction/BondFileAction.cpp
ra61dbb rd8821e 67 67 mol->getBondCount(); 68 68 return Action::success; 69 } else 69 } else { 70 STATUS("There is not exactly one molecule selected."); 70 71 return Action::failure; 72 } 71 73 } 72 74 … … 77 79 // state->mol->setName(state->lastName); 78 80 81 STATUS("Undo for MoleculeBondFileAction not implemented."); 79 82 return Action::failure; 80 83 } 81 84 82 85 ActionState::ptr MoleculeBondFileAction::performRedo(ActionState::ptr _state){ 86 STATUS("Redo for MoleculeBondFileAction not implemented."); 83 87 return Action::failure; 84 88 } -
src/Actions/MoleculeAction/ChangeBondAngleAction.cpp
ra61dbb rd8821e 120 120 const std::vector< atom *> atoms = World::getInstance().getSelectedAtoms(); 121 121 if (atoms.size() != 3) { 122 ELOG(1,"Exactly three atoms must be selected.");122 STATUS("Exactly three atoms must be selected."); 123 123 return Action::failure; 124 124 } 125 125 // check precondition: linearly bonded atoms 126 126 const std::vector<size_t> indices = sortIndicesFromCentralAtom(atoms); 127 if (indices.size() != 3) 127 if (indices.size() != 3) { 128 STATUS("Selected atoms must be linearly bonded/form a chain"); 128 129 return Action::failure; 130 } 129 131 const molecule *mol = atoms[0]->getMolecule(); 130 132 if ((mol != atoms[1]->getMolecule()) || (mol != atoms[2]->getMolecule())) { 131 ELOG(1,"The two selected atoms must belong to the same molecule.");133 STATUS("The two selected atoms must belong to the same molecule."); 132 134 return Action::failure; 133 135 } -
src/Actions/MoleculeAction/ChangeNameAction.cpp
ra61dbb rd8821e 57 57 mol->setName(params.name.get()); 58 58 return ActionState::ptr(new MoleculeChangeNameState(mol,params)); 59 } else 59 } else { 60 STATUS("There must be exactly one molecule selected."); 60 61 return Action::failure; 62 } 61 63 } 62 64 -
src/Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp
ra61dbb rd8821e 62 62 ActionState::ptr MoleculeFillVoidWithMoleculeAction::performCall() { 63 63 if (!boost::filesystem::exists(params.fillername.get())) { 64 ELOG(1, "File with filler molecule " << params.fillername.get() <<" does not exist!");64 STATUS("File with filler molecule "+params.fillername.get().string()+" does not exist!"); 65 65 return Action::failure; 66 66 } … … 152 152 //MoleculeFillVoidWithMoleculeState *state = assert_cast<MoleculeFillVoidWithMoleculeState*>(_state.get()); 153 153 154 STATUS("Redo for MoleculeFillVoidWithMoleculeAction not implemented."); 154 155 return Action::failure; 155 156 //return ActionState::ptr(_state); -
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
ra61dbb rd8821e 156 156 //MoleculeFillWithMoleculeState *state = assert_cast<MoleculeFillWithMoleculeState*>(_state.get()); 157 157 158 STATUS("Redo of MoleculeFillWithMoleculeAction not implemented."); 158 159 return Action::failure; 159 160 //return ActionState::ptr(_state); -
src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp
ra61dbb rd8821e 74 74 // state->mol->setName(state->lastName); 75 75 76 STATUS("Undo of MoleculeLinearInterpolationofTrajectoriesAction not implemented."); 76 77 return Action::failure; 77 78 } -
src/Actions/MoleculeAction/LoadAction.cpp
ra61dbb rd8821e 60 60 // parsing file if present 61 61 if (!boost::filesystem::exists(params.filename.get())) { 62 LOG(1, "Specified input file " << params.filename.get() <<" not found.");62 STATUS("Specified input file "+params.filename.get().string()+" not found."); 63 63 return Action::failure; 64 64 } else { … … 73 73 FilenamePrefix = params.filename.get().stem().string(); 74 74 } else { 75 ELOG(1,"Input file does not have a suffix, cannot recognize format.");75 STATUS("Input file does not have a suffix, cannot recognize format."); 76 76 return Action::failure; 77 77 } -
src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp
ra61dbb rd8821e 57 57 // check whether a molecule is selected 58 58 std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules(); 59 if (selectedMolecules.size() == 0) 59 if (selectedMolecules.size() == 0) { 60 STATUS("There are need to be some molecules selected."); 60 61 return Action::failure; 62 } 61 63 62 64 // go through all selected molecules 63 65 BOOST_FOREACH(molecule *mol, selectedMolecules) { 64 66 // check whether Axis is valid 65 if (params.Axis.get().IsZero()) 67 if (params.Axis.get().IsZero()) { 68 STATUS("Rotation Axis must not be zero."); 66 69 return Action::failure; 70 } 67 71 68 72 // convert from degrees to radian -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
ra61dbb rd8821e 78 78 // state->mol->setName(state->lastName); 79 79 80 STATUS("Undo of MoleculeRotateToPrincipalAxisSystemAction not implemented."); 80 81 return Action::failure; 81 82 } 82 83 83 84 ActionState::ptr MoleculeRotateToPrincipalAxisSystemAction::performRedo(ActionState::ptr _state){ 85 STATUS("Redo of MoleculeRotateToPrincipalAxisSystemAction not implemented."); 84 86 return Action::failure; 85 87 } -
src/Actions/MoleculeAction/SaveAdjacencyAction.cpp
ra61dbb rd8821e 82 82 // state->mol->setName(state->lastName); 83 83 84 STATUS("Undo of MoleculeSaveAdjacencyAction not implemented."); 84 85 return Action::failure; 85 86 } -
src/Actions/MoleculeAction/SaveBondsAction.cpp
ra61dbb rd8821e 70 70 // state->mol->setName(state->lastName); 71 71 72 STATUS("Undo of MoleculeSaveBondsAction not implemented."); 72 73 return Action::failure; 73 74 } -
src/Actions/MoleculeAction/SaveSelectedMoleculesAction.cpp
ra61dbb rd8821e 63 63 FilenamePrefix = params.filename.get().stem().string(); 64 64 } else { 65 ELOG(1,"Output file does not have a suffix, cannot recognize format.");65 STATUS("Output file does not have a suffix, cannot recognize format."); 66 66 return Action::failure; 67 67 } … … 74 74 FormatParserStorage::getInstance().saveSelectedMolecules(output, FilenameSuffix); 75 75 } else { 76 ELOG(1, "Could not open file " << params.filename.get() <<".");76 STATUS("Could not open file "+params.filename.get().string()+"."); 77 77 } 78 78 output.close(); … … 84 84 // ParserSaveXyzState *state = assert_cast<ParserSaveXyzState*>(_state.get()); 85 85 86 return Action:: failure;86 return Action::success; 87 87 // string newName = state->mol->getName(); 88 88 // state->mol->setName(state->lastName); … … 92 92 93 93 ActionState::ptr MoleculeSaveSelectedMoleculesAction::performRedo(ActionState::ptr _state){ 94 return Action:: failure;94 return Action::success; 95 95 // // Undo and redo have to do the same for this action 96 96 // return performUndo(_state); -
src/Actions/MoleculeAction/SaveTemperatureAction.cpp
ra61dbb rd8821e 63 63 const size_t MDSteps = set.getMaxTrajectorySize(); 64 64 OutputTemperature<std::vector<atom *> > writer(set); 65 if (output.fail() || !writer((ofstream * const) &output, 0, MDSteps)) 66 LOG(2, "File could not be written."); 67 else 65 if (output.fail() || !writer((ofstream * const) &output, 0, MDSteps)) { 66 STATUS("File could not be written."); 67 return Action::failure; 68 } else 68 69 LOG(2, "File stored."); 69 70 output.close(); … … 77 78 // state->mol->setName(state->lastName); 78 79 79 return Action:: failure;80 return Action::success; 80 81 } 81 82 -
src/Actions/MoleculeAction/StretchBondAction.cpp
ra61dbb rd8821e 58 58 const std::vector< atom *> atoms = World::getInstance().getSelectedAtoms(); 59 59 if (atoms.size() != 2) { 60 ELOG(1,"Exactly two atoms must be selected.");60 STATUS("Exactly two atoms must be selected."); 61 61 return Action::failure; 62 62 } 63 63 const molecule *mol = atoms[0]->getMolecule(); 64 64 if (mol != atoms[1]->getMolecule()) { 65 ELOG(1,"The two selected atoms must belong to the same molecule.");65 STATUS("The two selected atoms must belong to the same molecule."); 66 66 return Action::failure; 67 67 } -
src/Actions/MoleculeAction/SuspendInWaterAction.cpp
ra61dbb rd8821e 74 74 // state->mol->setName(state->lastName); 75 75 76 STATUS("Undo of MoleculeSuspendInWaterAction not implemented."); 76 77 return Action::failure; 77 78 } -
src/Actions/MoleculeAction/VerletIntegrationAction.cpp
ra61dbb rd8821e 89 89 // state->mol->setName(state->lastName); 90 90 91 STATUS("Undo of MoleculeVerletIntegrationAction not implemented."); 91 92 return Action::failure; 92 93 } 93 94 94 95 ActionState::ptr MoleculeVerletIntegrationAction::performRedo(ActionState::ptr _state){ 96 STATUS("Rddo of MoleculeVerletIntegrationAction not implemented."); 95 97 return Action::failure; 96 98 } -
src/Actions/ParserAction/ParseTremoloPotentialsAction.cpp
ra61dbb rd8821e 58 58 // parsing file if present 59 59 if (!boost::filesystem::exists(params.filename.get())) { 60 LOG(1, "Specified potentials file " << params.filename.get() <<" not found.");60 STATUS("Specified potentials file "+params.filename.get().string()+" not found."); 61 61 // DONT FAIL: it's just empty we re-create default id-mapping 62 62 parser.createKnownTypesByIdentity(); 63 63 return Action::failure; 64 64 } else { 65 65 LOG(1, "Specified potentials file found, parsing ... "); … … 77 77 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 78 78 79 STATUS("Undo of ParserParseTremoloPotentialsAction not implemented."); 79 80 return Action::failure; 80 81 // string newName = state->mol->getName(); … … 85 86 86 87 ActionState::ptr ParserParseTremoloPotentialsAction::performRedo(ActionState::ptr _state){ 88 STATUS("Redo of ParserParseTremoloPotentialsAction not implemented."); 87 89 return Action::failure; 88 90 } -
src/Actions/ParserAction/SaveSelectedAtomsAsExtTypesAction.cpp
ra61dbb rd8821e 56 56 ActionState::ptr ParserSaveSelectedAtomsAsExtTypesAction::performCall() { 57 57 if (boost::filesystem::exists(params.filename.get())) { 58 ELOG(1, "Specified exttypes file " << params.filename.get() <<" already exists.");58 STATUS("Specified exttypes file "+params.filename.get().string()+" already exists."); 59 59 60 60 return Action::failure; … … 70 70 if (status) 71 71 return Action::success; 72 else 72 else { 73 STATUS("Failed to write ext file."); 73 74 return Action::failure; 75 } 74 76 } 75 77 } -
src/Actions/ParserAction/SetOutputFormatsAction.cpp
ra61dbb rd8821e 56 56 for (vector<std::string>::const_iterator iter = params.FormatList.get().begin(); iter != params.FormatList.get().end(); ++iter) { 57 57 if (!FormatParserStorage::getInstance().add(*iter)) { 58 ELOG(1, "Unknown parser format in ParserSetOutputFormatsAction: '" << *iter <<"'");58 STATUS("Unknown parser format in ParserSetOutputFormatsAction: '"+*iter+"'"); 59 59 return Action::failure; 60 60 } else { … … 68 68 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 69 69 70 STATUS("Undo of ParserSetOutputFormatsAction not implemented."); 70 71 return Action::failure; 71 72 // string newName = state->mol->getName(); … … 76 77 77 78 ActionState::ptr ParserSetOutputFormatsAction::performRedo(ActionState::ptr _state){ 79 STATUS("Redo of ParserSetOutputFormatsAction not implemented."); 78 80 return Action::failure; 79 81 } -
src/Actions/PotentialAction/FitParticleChargesAction.cpp
ra61dbb rd8821e 126 126 // for the moment just use the very first fragment 127 127 if (range.first == range.second) { 128 ELOG(1,"HomologyContainer does not contain specified fragment.");128 STATUS("HomologyContainer does not contain specified fragment."); 129 129 return Action::failure; 130 130 } … … 132 132 // average partial charges over all fragments 133 133 HomologyContainer::const_iterator iter = range.first; 134 if (!iter->second.containsGrids) { 135 STATUS("This HomologyGraph does not contain sampled grids."); 136 return Action::failure; 137 } 134 138 PartialNucleiChargeFitter::charges_t averaged_charges; 135 139 averaged_charges.resize(iter->second.fragment.getCharges().size(), 0.); -
src/Actions/PotentialAction/FitPotentialAction.cpp
ra61dbb rd8821e 137 137 } catch (SerializablePotentialMissingValueException &e) { 138 138 if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e)) 139 ELOG(1, "Missing value when parsing information for potential " 140 << *key << "."); 139 STATUS("Missing value when parsing information for potential "+*key+"."); 141 140 else 142 ELOG(1,"Missing value parsing information for potential with unknown key.");141 STATUS("Missing value parsing information for potential with unknown key."); 143 142 return Action::failure; 144 143 } catch (SerializablePotentialIllegalKeyException &e) { 145 144 if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e)) 146 ELOG(1, "Illegal key parsing information for potential " 147 << *key << "."); 145 STATUS("Illegal key parsing information for potential "+*key+"."); 148 146 else 149 ELOG(1,"Illegal key parsing information for potential with unknown key.");147 STATUS("Illegal key parsing information for potential with unknown key."); 150 148 return Action::failure; 151 149 } 152 150 } else { 153 ELOG(0, "Failed to parse from " << params.potential_file.get().string() <<".");151 STATUS("Failed to parse from "+params.potential_file.get().string()+"."); 154 152 return Action::failure; 155 153 } … … 162 160 } else { 163 161 if (params.charges.get().empty()) { 164 ELOG(1,"Neither charges nor potential file given!");162 STATUS("Neither charges nor potential file given!"); 165 163 return Action::failure; 166 164 } else { … … 222 220 << fragmentnumbers << " is " << graph << "."); 223 221 } else { 224 ELOG(1, "Specific fragment " << fragmentnumbers <<" not found in homologies!");222 STATUS("Specific fragment "+toString(fragmentnumbers)+" not found in homologies!"); 225 223 return Action::failure; 226 224 } … … 305 303 << l2error << " are " << model->getParameters() << "."); 306 304 } else { 307 ELOG(0, "We require parameter derivatives for a box constraint minimization.");305 STATUS("No required parameter derivatives for a box constraint minimization known."); 308 306 return Action::failure; 309 307 } -
src/Actions/PotentialAction/ParseHomologiesAction.cpp
ra61dbb rd8821e 81 81 if (!params.homology_file.get().empty()) { 82 82 const boost::filesystem::path &homology_file = params.homology_file.get(); 83 if (homology_file.string() != "") { 84 LOG(1, "INFO: Parsing HomologyGraphs from file " << homology_file.string() << "."); 85 parseHomologiesFromFile(homology_file); 86 return Action::success; 87 } 83 LOG(1, "INFO: Parsing HomologyGraphs from file " << homology_file.string() << "."); 84 parseHomologiesFromFile(homology_file); 85 return Action::success; 86 } else { 87 STATUS("Homology file name is empty."); 88 return Action::failure; 88 89 } 90 } 89 91 92 ActionState::ptr PotentialParseHomologiesAction::performUndo(ActionState::ptr _state) { 93 STATUS("Undo of PotentialParseHomologiesAction not implemented."); 90 94 return Action::failure; 91 95 } 92 96 93 ActionState::ptr PotentialParseHomologiesAction::performUndo(ActionState::ptr _state) {94 return Action::success;95 }96 97 97 ActionState::ptr PotentialParseHomologiesAction::performRedo(ActionState::ptr _state){ 98 return Action::success; 98 STATUS("Redo of PotentialParseHomologiesAction not implemented."); 99 return Action::failure; 99 100 } 100 101 -
src/Actions/PotentialAction/SaveHomologiesAction.cpp
ra61dbb rd8821e 83 83 if (!params.homology_file.get().empty()) { 84 84 const boost::filesystem::path &homology_file = params.homology_file.get(); 85 if (homology_file.string() != "") {86 LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << ".");87 if (!writeHomologiesToFile(homology_file))88 85 LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << "."); 86 if (!writeHomologiesToFile(homology_file)) { 87 STATUS("Failed to write homology file."); 88 return Action::failure; 89 89 } 90 return Action::success; 91 } else { 92 STATUS("Homology file name empty."); 93 return Action::failure; 90 94 } 91 92 return Action::success;93 95 } 94 96 -
src/Actions/SelectionAction/Atoms/AllAtomsInsideVolumeAction.cpp
ra61dbb rd8821e 61 61 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 62 62 if (selectedShapes.size() != 1){ 63 ELOG(1, "SelectionAllAtomsInsideVolumeAction::performCall(): there has to be exactly 1 selected shape.");63 STATUS("There has to be exactly 1 selected shape."); 64 64 return Action::failure; 65 65 } … … 74 74 75 75 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 76 if (selectedShapes.size() != 1)77 return Action::failure;78 76 World::getInstance().unselectAllAtoms(AtomsByShape(*selectedShapes[0])); 79 77 BOOST_FOREACH(atom *_atom, state->selectedAtoms) … … 87 85 88 86 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 89 if (selectedShapes.size() != 1)90 return Action::failure;91 87 World::getInstance().selectAllAtoms(AtomsByShape(*selectedShapes[0])); 92 88 -
src/Actions/SelectionAction/Atoms/AtomByIdAction.cpp
ra61dbb rd8821e 85 85 switch (status) { 86 86 case AtomMissing: 87 STATUS("Cannot find all atoms with given ids."); 87 88 return Action::failure; 88 89 break; -
src/Actions/SelectionAction/Atoms/AtomByOrderAction.cpp
ra61dbb rd8821e 65 65 } 66 66 } else { 67 STATUS("Cannot find atom by given order of "+toString(params.order.get())+"."); 67 68 return Action::failure; 68 69 } -
src/Actions/SelectionAction/Atoms/NotAllAtomsInsideVolumeAction.cpp
ra61dbb rd8821e 60 60 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 61 61 if (selectedShapes.size() != 1){ 62 ELOG(1, "SelectionNotAllAtomsInsideVolumeAction::performCall(): there has to be exactly 1 selected shape.");62 STATUS("There has to be exactly 1 selected shape."); 63 63 return Action::failure; 64 64 } … … 73 73 74 74 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 75 if (selectedShapes.size() != 1)76 return Action::failure;77 75 World::getInstance().selectAllAtoms(AtomsByShape(*selectedShapes[0])); 78 76 BOOST_FOREACH(atom *_atom, state->unselectedAtoms) … … 86 84 87 85 std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes(); 88 if (selectedShapes.size() != 1)89 return Action::failure;90 86 World::getInstance().unselectAllAtoms(AtomsByShape(*selectedShapes[0])); 91 87 -
src/Actions/SelectionAction/Atoms/NotAtomByIdAction.cpp
ra61dbb rd8821e 85 85 switch (status) { 86 86 case AtomMissing: 87 STATUS("Cannot find all atoms by given ids."); 87 88 return Action::failure; 88 89 break; -
src/Actions/SelectionAction/Atoms/NotAtomByOrderAction.cpp
ra61dbb rd8821e 65 65 } 66 66 } else { 67 STATUS("Cannot find atom by given order of "+toString(params.order.get())+"."); 67 68 return Action::failure; 68 69 } -
src/Actions/SelectionAction/Molecules/MoleculeByIdAction.cpp
ra61dbb rd8821e 64 64 } 65 65 } else { 66 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 66 67 return Action::failure; 67 68 } -
src/Actions/SelectionAction/Molecules/MoleculeByOrderAction.cpp
ra61dbb rd8821e 66 66 } 67 67 } else { 68 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 68 69 return Action::failure; 69 70 } -
src/Actions/SelectionAction/Molecules/NotMoleculeByIdAction.cpp
ra61dbb rd8821e 64 64 } 65 65 } else { 66 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 66 67 return Action::failure; 67 68 } -
src/Actions/SelectionAction/Molecules/NotMoleculeByOrderAction.cpp
ra61dbb rd8821e 66 66 } 67 67 } else { 68 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 68 69 return Action::failure; 69 70 } -
src/Actions/SelectionAction/Shapes/NotShapeByNameAction.cpp
ra61dbb rd8821e 62 62 } 63 63 } else { 64 STATUS("Cannot find shape by given name "+toString(params.shapeName.get())+"."); 64 65 return Action::failure; 65 66 } -
src/Actions/SelectionAction/Shapes/ShapeByNameAction.cpp
ra61dbb rd8821e 62 62 } 63 63 } else { 64 STATUS("Cannot find shape by given name "+toString(params.shapeName.get())+"."); 64 65 return Action::failure; 65 66 } -
src/Actions/ShapeAction/CombineShapesAction.cpp
ra61dbb rd8821e 61 61 if (op == "AND"){ 62 62 if (selectedShapes.size() != 2){ 63 ELOG(1,"Operation AND requires exactly 2 selected shapes.");63 STATUS("Operation AND requires exactly 2 selected shapes."); 64 64 return Action::failure; 65 65 } … … 67 67 }else if (op == "OR"){ 68 68 if (selectedShapes.size() != 2){ 69 ELOG(1,"Operation OR requires exactly 2 selected shapes.");69 STATUS("Operation OR requires exactly 2 selected shapes."); 70 70 return Action::failure; 71 71 } … … 73 73 }else if (op == "NOT"){ 74 74 if (selectedShapes.size() != 1){ 75 ELOG(1,"Operation NOT requires exactly 1 selected shape.");75 STATUS("Operation NOT requires exactly 1 selected shape."); 76 76 return Action::failure; 77 77 } … … 116 116 std::string op = params.shape_op.get(); 117 117 if (op == "AND"){ 118 if (selectedShapes.size() != 2){119 ELOG(1, "Operation AND requires exactly 2 selected shapes.");120 return Action::failure;121 }122 118 s = (*selectedShapes[0]) && (*selectedShapes[1]); 123 119 }else if (op == "OR"){ 124 if (selectedShapes.size() != 2){125 ELOG(1, "Operation OR requires exactly 2 selected shapes.");126 return Action::failure;127 }128 120 s = (*selectedShapes[0]) || (*selectedShapes[1]); 129 121 }else if (op == "NOT"){ 130 if (selectedShapes.size() != 1){131 ELOG(1, "Operation NOT requires exactly 1 selected shape.");132 return Action::failure;133 }134 122 s = ! (*selectedShapes[0]); 135 123 }else{ -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
ra61dbb rd8821e 72 72 //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]); 73 73 // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests 74 FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.get().string().c_str());74 Success &= FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.get().string().c_str()); 75 75 //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]); 76 76 const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.get().string().c_str()); … … 83 83 if (Success) 84 84 return Action::success; 85 else 85 else { 86 STATUS("Failed to find the non convex border."); 86 87 return Action::failure; 88 } 87 89 } 88 90 … … 93 95 // state->mol->setName(state->lastName); 94 96 97 STATUS("Undo of TesselationConvexEnvelopeAction not implemented."); 95 98 return Action::failure; 96 99 } -
src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
ra61dbb rd8821e 88 88 // state->mol->setName(state->lastName); 89 89 90 STATUS("Undo of TesselationNonConvexEnvelopeAction not implemented."); 90 91 return Action::failure; 91 92 } -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
ra61dbb rd8821e 117 117 return ActionState::ptr(UndoState); 118 118 } else { 119 ELOG(2,"There must be atoms present for AddingEmptyBoundary.");119 STATUS("There must be atoms present for AddingEmptyBoundary."); 120 120 return Action::failure; 121 121 } -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
ra61dbb rd8821e 80 80 // get maximum and minimum 81 81 if (AllAtoms.empty()) { 82 ELOG(2, "For WorldCenterOnEdgeAction atoms must bepresent.");82 STATUS("There are no atoms present."); 83 83 return Action::failure; 84 84 } -
src/Actions/WorldAction/InputAction.cpp
ra61dbb rd8821e 72 72 parsers.SetOutputPrefixForAll(FilenamePrefix); 73 73 } else { 74 ELOG(1,"Input file does not have a suffix, cannot recognize format.");74 STATUS("Input file does not have a suffix, cannot recognize format."); 75 75 return Action::failure; 76 76 } … … 103 103 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 104 104 105 STATUS("Undo of WorldInputAction not implemented."); 105 106 return Action::failure; 106 107 // string newName = state->mol->getName(); … … 111 112 112 113 ActionState::ptr WorldInputAction::performRedo(ActionState::ptr _state){ 114 STATUS("Redo of WorldInputAction not implemented."); 113 115 return Action::failure; 114 116 } -
src/Actions/WorldAction/OutputAction.cpp
ra61dbb rd8821e 60 60 // Parser configured to save anything? 61 61 if (!FormatParserStorage::getInstance().isAbleToSave()){ 62 ELOG(1,"No parser or file prefix selected.");62 STATUS("No parser or file prefix selected."); 63 63 return Action::failure; 64 64 } … … 73 73 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 74 74 75 STATUS("Undo of WorldOutputAction not implemented."); 75 76 return Action::failure; 76 77 // string newName = state->mol->getName(); … … 81 82 82 83 ActionState::ptr WorldOutputAction::performRedo(ActionState::ptr _state){ 84 STATUS("Redo of WorldOutputAction not implemented."); 83 85 return Action::failure; 84 86 } -
src/Actions/WorldAction/OutputAsAction.cpp
ra61dbb rd8821e 64 64 FilenamePrefix = params.filename.get().stem().string(); 65 65 } else { 66 ELOG(1,"Output file does not have a suffix, cannot recognize format.");66 STATUS("Output file does not have a suffix, cannot recognize format."); 67 67 return Action::failure; 68 68 } … … 75 75 FormatParserStorage::getInstance().saveWorld(output, FilenameSuffix); 76 76 } else { 77 ELOG(1, "Could not open file " << params.filename.get() << "."); 77 STATUS("Could not open file "+params.filename.get().string()+"."); 78 return Action::failure; 78 79 } 79 80 output.close(); … … 85 86 // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); 86 87 88 STATUS("Undo of WorldOutputAsAction not implemented."); 87 89 return Action::failure; 88 90 // string newName = state->mol->getName(); … … 93 95 94 96 ActionState::ptr WorldOutputAsAction::performRedo(ActionState::ptr _state){ 97 STATUS("Redo of WorldOutputAsAction not implemented."); 95 98 return Action::failure; 96 99 } -
src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp
ra61dbb rd8821e 34 34 35 35 #include "CodePatterns/MemDebug.hpp" 36 #include "CodePatterns/Observer/Notification.hpp" 37 #include "CodePatterns/Observer/Observable.hpp" 36 38 37 39 #include "CommandLineUI/CommandLineStatusIndicator.hpp" … … 39 41 #include <iostream> 40 42 43 #include "Actions/ActionQueue.hpp" 44 #include "Actions/ActionStatusList.hpp" 41 45 #include "Actions/Process.hpp" 42 #include "CodePatterns/Observer/Observable.hpp"43 46 44 47 using namespace MoleCuilder; 45 48 46 49 CommandLineStatusIndicator::CommandLineStatusIndicator() : 47 Observer("CommandLineStatusIndicator") 50 Observer("CommandLineStatusIndicator"), 51 StatusList(ActionQueue::getInstance().getStatusList()), 52 StatusList_signedOn(false) 48 53 { 49 54 Process::AddObserver(this); 55 56 StatusList.signOn(this, ActionStatusList::StatusAdded); 57 StatusList_signedOn = true; 50 58 } 51 59 … … 53 61 { 54 62 Process::RemoveObserver(this); 63 64 if (StatusList_signedOn) { 65 // print all remaining messages prior to exit 66 while (StatusList.size() != 0) 67 displayStatusMessage(); 68 StatusList.signOff(this, ActionStatusList::StatusAdded); 69 } 55 70 } 56 71 57 72 void CommandLineStatusIndicator::update(Observable *subject){ 58 Process *proc; 59 // we are only observing Processes 60 if((proc=dynamic_cast<Process*>(subject))){ 61 // see what kind of progress we have to display 62 if(proc->getMaxSteps()>0){ 63 if(!proc->doesStop()){ 64 std::cout << "Busy (" << proc->getName() << ") "; 65 // we can show a percentage done 66 std::cout << (int)proc->getDoneRatio() << "% done" << std::endl; 73 if (subject == &StatusList) { 74 // we do not react to general updates from StatusList 75 } else { 76 Process *proc; 77 // we are only observing Processes 78 if((proc=dynamic_cast<Process*>(subject))){ 79 // see what kind of progress we have to display 80 if(proc->getMaxSteps()>0){ 81 if(!proc->doesStop()){ 82 std::cout << "Busy (" << proc->getName() << ") "; 83 // we can show a percentage done 84 std::cout << (int)proc->getDoneRatio() << "% done" << std::endl; 85 } 67 86 } 68 }69 else{70 // we only show some kind of busy animation71 if(proc->doesStart()){72 std::cout << "Busy (" << proc->getName() << ")";73 }74 if(!proc->doesStop()){75 std::cout << ".";76 }77 else {78 std::cout << std::endl;87 else{ 88 // we only show some kind of busy animation 89 if(proc->doesStart()){ 90 std::cout << "Busy (" << proc->getName() << ")"; 91 } 92 if(!proc->doesStop()){ 93 std::cout << "."; 94 } 95 else { 96 std::cout << std::endl; 97 } 79 98 } 80 99 } … … 82 101 } 83 102 84 void CommandLineStatusIndicator::subjectKilled(Observable *subject){ 85 103 void CommandLineStatusIndicator::subjectKilled(Observable *subject) 104 { 105 if (subject == &StatusList) { 106 // print all remaining messages 107 while (StatusList.size() != 0) 108 displayStatusMessage(); 109 // don't need to sign off, just note down that we are 110 StatusList_signedOn = false; 111 } 86 112 } 87 113 114 void CommandLineStatusIndicator::displayStatusMessage() const 115 { 116 const std::string message = StatusList.popFirstMessage(); 117 std::cout << message << std::endl; 118 } 119 120 void CommandLineStatusIndicator::recieveNotification(Observable *_publisher, Notification *_notification) 121 { 122 if (_publisher == &StatusList) { 123 switch(_notification->getChannelNo()) { 124 case ActionStatusList::StatusAdded: 125 displayStatusMessage(); 126 break; 127 } 128 } 129 } 130 -
src/UIElements/CommandLineUI/CommandLineStatusIndicator.hpp
ra61dbb rd8821e 17 17 #include "CodePatterns/Observer/Observer.hpp" 18 18 19 namespace MoleCuilder { 20 class ActionStatusList; 21 } 22 19 23 class Observable; 20 24 … … 27 31 void update(Observable *subject); 28 32 void subjectKilled(Observable *subject); 33 void recieveNotification(Observable *_publisher, Notification *_notification); 29 34 30 35 private: 36 void displayStatusMessage() const; 31 37 38 private: 39 //!> reference to the StatusList we are signed on 40 MoleCuilder::ActionStatusList& StatusList; 41 //!> indicates whether we are currently signed on 42 bool StatusList_signedOn; 32 43 }; 33 44 -
src/UIElements/CommandLineUI/CommandLineWindow.cpp
ra61dbb rd8821e 43 43 #include "CodePatterns/Verbose.hpp" 44 44 45 #include "cleanUp.hpp" 45 46 #include "Actions/Action.hpp" 46 47 #include "Actions/ActionQueue.hpp" … … 80 81 } 81 82 } 83 #ifdef HAVE_ACTION_THREAD 84 // wait for all Actions to finish before we quit the UI 85 waitQueue(); 86 #endif 82 87 } 83 88 -
src/UIElements/Makefile.am
ra61dbb rd8821e 172 172 UIElements/Views/Qt4/QtHomologyList.cpp \ 173 173 UIElements/Views/Qt4/QtInfoBox.cpp \ 174 UIElements/Views/Qt4/QtLogBox.cpp \ 174 175 UIElements/Views/Qt4/QtMoleculeList.cpp \ 175 176 UIElements/Views/Qt4/QtShapeController.cpp \ … … 192 193 UIElements/Qt4/Query/QtQuery.hpp \ 193 194 UIElements/Menu/Qt4/QtMenuPipe.hpp \ 195 UIElements/Views/Qt4/QDebugStream.hpp \ 194 196 UIElements/Views/Qt4/QtElementList.hpp \ 195 197 UIElements/Views/Qt4/QtFragmentList.hpp \ 196 198 UIElements/Views/Qt4/QtHomologyList.hpp \ 197 199 UIElements/Views/Qt4/QtInfoBox.hpp \ 200 UIElements/Views/Qt4/QtLogBox.hpp \ 198 201 UIElements/Views/Qt4/QtMoleculeList.hpp \ 199 202 UIElements/Views/Qt4/QtShapeController.hpp \ -
src/UIElements/Menu/TextMenu/TxMenu.cpp
ra61dbb rd8821e 39 39 #include <iostream> 40 40 #include <cmath> 41 #include "cleanUp.hpp" 41 42 #include "Menu/TextMenu/TxMenu.hpp" 42 43 #include "Menu/TextMenu/MenuItem.hpp" … … 149 150 outputter << "Invalid Choice!" << std::endl; 150 151 } 151 } 152 } 153 #ifdef HAVE_ACTION_THREAD 154 // wait for actions to finish 155 waitQueue(); 156 #endif 152 157 }while (!hasQuit()); 153 158 } -
src/UIElements/Qt4/QtMainWindow.cpp
ra61dbb rd8821e 57 57 #include "Views/Qt4/QtFragmentList.hpp" 58 58 #include "Views/Qt4/QtHomologyList.hpp" 59 #include "Views/Qt4/QtLogBox.hpp" 59 60 #include "Views/Qt4/QtShapeController.hpp" 60 61 #include "Views/Qt4/QtInfoBox.hpp" … … 98 99 homologyList = new QtHomologyList(worldTab); 99 100 fragmentList = new QtFragmentList(worldTab); 101 logBox = new QtLogBox(worldTab); 100 102 shapeController = new QtShapeController(worldTab); 101 103 … … 130 132 worldTab->addTab(fragmentList, "All Fragments"); 131 133 worldTab->addTab(homologyList, "All Homologies"); 134 worldTab->addTab(logBox, "Log"); 132 135 133 136 statusBar = new QtStatusBar(this); -
src/UIElements/Qt4/QtMainWindow.hpp
ra61dbb rd8821e 23 23 #include "Menu/Qt4/QtMenu.hpp" 24 24 25 class QtElementList; 26 class QtFragmentList; 27 class QtHomologyList; 28 class QtLogBox; 25 29 class QtMoleculeList; 26 class QtElementList;27 class QtHomologyList;28 class QtFragmentList;29 30 class QtShapeController; 30 31 class StringView; … … 64 65 QtToolBar *toolbar; 65 66 QSlider *timeline; 67 QtLogBox *logBox; 66 68 67 69 }; -
src/UIElements/TextUI/TextStatusIndicator.cpp
ra61dbb rd8821e 34 34 35 35 #include "CodePatterns/MemDebug.hpp" 36 #include "CodePatterns/Observer/Notification.hpp" 36 37 37 38 #include "TextUI/TextStatusIndicator.hpp" … … 39 40 #include <iostream> 40 41 42 #include "Actions/ActionQueue.hpp" 43 #include "Actions/ActionStatusList.hpp" 41 44 #include "Actions/Process.hpp" 42 45 … … 44 47 45 48 TextStatusIndicator::TextStatusIndicator() : 46 Observer("TextStatusIndicator") 49 Observer("TextStatusIndicator"), 50 StatusList(ActionQueue::getInstance().getStatusList()), 51 StatusList_signedOn(false) 47 52 { 48 53 Process::AddObserver(this); 54 55 StatusList.signOn(this, ActionStatusList::StatusAdded); 56 StatusList_signedOn = true; 49 57 } 50 58 … … 52 60 { 53 61 Process::RemoveObserver(this); 62 63 if (StatusList_signedOn) 64 StatusList.signOff(this, ActionStatusList::StatusAdded); 54 65 } 55 66 56 67 void TextStatusIndicator::update(Observable *subject){ 57 Process *proc; 58 // we are only observing Processes 59 if((proc=dynamic_cast<Process*>(subject))){ 60 // see what kind of progress we have to display 61 if(proc->getMaxSteps()>0){ 62 if(!proc->doesStop()){ 63 std::cout << "Busy (" << proc->getName() << ") "; 64 // we can show a percentage done 65 std::cout << (int)proc->getDoneRatio() << "% done" << std::endl; 68 if (subject == &StatusList) { 69 // we do not react to general updates from StatusList 70 } else { 71 Process *proc; 72 // we are otherwise only observing Processes 73 if((proc=dynamic_cast<Process*>(subject))){ 74 // see what kind of progress we have to display 75 if(proc->getMaxSteps()>0){ 76 if(!proc->doesStop()){ 77 std::cout << "Busy (" << proc->getName() << ") "; 78 // we can show a percentage done 79 std::cout << (int)proc->getDoneRatio() << "% done" << std::endl; 80 } 66 81 } 67 }68 else{69 // we only show some kind of busy animation70 if(proc->doesStart()){71 std::cout << "Busy (" << proc->getName() << ")";72 }73 if(!proc->doesStop()){74 std::cout << ".";75 }76 else {77 std::cout << std::endl;82 else{ 83 // we only show some kind of busy animation 84 if(proc->doesStart()){ 85 std::cout << "Busy (" << proc->getName() << ")"; 86 } 87 if(!proc->doesStop()){ 88 std::cout << "."; 89 } 90 else { 91 std::cout << std::endl; 92 } 78 93 } 79 94 } … … 81 96 } 82 97 83 void TextStatusIndicator::subjectKilled(Observable *subject){ 84 98 void TextStatusIndicator::subjectKilled(Observable *subject) 99 { 100 if (subject == &StatusList) { 101 // print all remaining messages 102 while (StatusList.size() != 0) 103 displayStatusMessage(); 104 // don't need to sign off, just note down that we are 105 StatusList_signedOn = false; 106 } 85 107 } 86 108 109 void TextStatusIndicator::displayStatusMessage() const 110 { 111 const std::string message = StatusList.popFirstMessage(); 112 std::cout << message << std::endl; 113 } 114 115 void TextStatusIndicator::recieveNotification(Observable *_publisher, Notification *_notification) 116 { 117 if (_publisher == &StatusList) { 118 switch(_notification->getChannelNo()) { 119 case MoleCuilder::ActionStatusList::StatusAdded: 120 // if timer is not already running 121 displayStatusMessage(); 122 break; 123 } 124 } 125 } -
src/UIElements/TextUI/TextStatusIndicator.hpp
ra61dbb rd8821e 17 17 #include "CodePatterns/Observer/Observer.hpp" 18 18 19 namespace MoleCuilder { 20 class ActionStatusList; 21 } 22 23 19 24 class TextStatusIndicator : public Observer 20 25 { … … 25 30 void update(Observable *subject); 26 31 void subjectKilled(Observable *subject); 32 void recieveNotification(Observable *_publisher, Notification *_notification); 27 33 28 34 private: 35 void displayStatusMessage() const; 29 36 37 private: 38 //!> reference to the StatusList we are signed on 39 MoleCuilder::ActionStatusList& StatusList; 40 //!> indicates whether we are currently signed on 41 bool StatusList_signedOn; 30 42 }; 31 43 -
src/UIElements/Views/Qt4/QtStatusBar.cpp
ra61dbb rd8821e 39 39 #include <QtCore/QMetaType> 40 40 #include <QtGui/QProgressBar> 41 #include <QtCore/QTimer> 41 42 42 43 #include "QtStatusBar.hpp" 43 44 44 45 #include "CodePatterns/MemDebug.hpp" 46 #include "CodePatterns/Observer/Notification.hpp" 45 47 46 48 #include "World.hpp" 49 #include "Actions/ActionQueue.hpp" 50 #include "Actions/ActionStatusList.hpp" 47 51 #include "Actions/Process.hpp" 48 52 … … 57 61 moleculeCount(World::getInstance().numMolecules()), 58 62 parent(_parent), 59 activeProcess("") 63 activeProcess(""), 64 StatusList(ActionQueue::getInstance().getStatusList()), 65 StatusList_signedOn(false), 66 timer(NULL), 67 timer_interval(1500) 60 68 { 61 69 World::getInstance().signOn(this); 62 70 Process::AddObserver(this); 71 StatusList.signOn(this, ActionStatusList::StatusAdded); 72 StatusList_signedOn = true; 63 73 statusLabel = new QLabel(this); 64 74 statusLabel->setFrameStyle(QFrame::NoFrame | QFrame::Plain); … … 66 76 redrawStatus(); 67 77 78 // connect the timer 79 timer = new QTimer(this); 80 timer->stop(); 81 connect(timer, SIGNAL(timeout()), this, SLOT(updateStatusMessage())); 82 68 83 qRegisterMetaType<std::string>("std::string"); 69 84 connect( … … 74 89 QtStatusBar::~QtStatusBar() 75 90 { 91 // stop the timer if it is running 92 if (timer->isActive()) 93 timer->stop(); 94 76 95 Process::RemoveObserver(this); 77 96 World::getInstance().signOff(this); 97 if (StatusList_signedOn) 98 StatusList.signOff(this, ActionStatusList::StatusAdded); 78 99 } 79 100 80 101 void QtStatusBar::update(Observable *subject){ 81 if (subject ==World::getPointer()){102 if (subject == World::getPointer()){ 82 103 atomCount = World::getInstance().numAtoms(); 83 104 moleculeCount = World::getInstance().numMolecules(); 84 redrawStatus(); 85 } 86 else { 105 // redraw only if no timer updates messages 106 if (!timer->isActive()) 107 redrawStatus(); 108 } else if (subject == &StatusList) { 109 // we do not react to general updates from StatusList 110 } else { 87 111 // we probably have some process 88 112 // as notify comes from ActionQueue's thread, we have to use signal/slots … … 97 121 } 98 122 99 void QtStatusBar::subjectKilled(Observable *subject){ 123 void QtStatusBar::startTimer() 124 { 125 timer->start(timer_interval); 126 } 127 128 void QtStatusBar::stopTimer() 129 { 130 timer->stop(); 131 } 132 133 void QtStatusBar::updateStatusMessage() 134 { 135 if (StatusList.size() != 0) { 136 // get oldest message from the StatusList 137 const std::string message = StatusList.popFirstMessage(); 138 statusLabel->setText(QString(message.c_str())); 139 } else { 140 // just send the standard message 141 redrawStatus(); 142 // and stop the timer 143 stopTimer(); 144 } 145 } 146 147 void QtStatusBar::recieveNotification(Observable *_publisher, Notification *_notification) 148 { 149 if (_publisher == &StatusList) { 150 switch(_notification->getChannelNo()) { 151 case MoleCuilder::ActionStatusList::StatusAdded: 152 if (!timer->isActive()) { 153 // if timer is not already running 154 updateStatusMessage(); 155 startTimer(); 156 } 157 break; 158 } 159 } 160 } 161 162 void QtStatusBar::subjectKilled(Observable *subject) 163 { 100 164 // Processes don't notify when they are killed 101 atomCount = World::getInstance().numAtoms(); 102 moleculeCount = World::getInstance().numMolecules(); 103 World::getInstance().signOn(this); 104 redrawStatus(); 165 if (subject == &StatusList) { 166 // print all remaining messages 167 while (StatusList.size() != 0) 168 updateStatusMessage(); 169 // don't need to sign off, just note down that we are 170 StatusList_signedOn = false; 171 } else { 172 atomCount = World::getInstance().numAtoms(); 173 moleculeCount = World::getInstance().numMolecules(); 174 World::getInstance().signOn(this); 175 redrawStatus(); 176 } 105 177 } 106 178 -
src/UIElements/Views/Qt4/QtStatusBar.hpp
ra61dbb rd8821e 22 22 #include "CodePatterns/Observer/Observer.hpp" 23 23 24 class QBoxLayout; 24 25 class QLabel; 25 26 class QProgressBar; 26 class Q BoxLayout;27 class QTimer; 27 28 28 29 namespace MoleCuilder { 30 class ActionStatusList; 29 31 class Process; 30 32 } … … 48 50 void update(Observable *subject); 49 51 void subjectKilled(Observable *subject); 52 void recieveNotification(Observable *_publisher, Notification *_notification); 50 53 51 54 private slots: … … 55 58 const unsigned int currentstep, 56 59 const bool StopStatus); 60 void updateStatusMessage(); 57 61 58 62 signals: … … 66 70 void redrawStatus(); 67 71 72 void startTimer(); 73 void stopTimer(); 74 68 75 int atomCount; 69 76 int moleculeCount; … … 74 81 progressBars_t progressBars; 75 82 std::string activeProcess; 83 //!> reference to the StatusList we are signed on 84 MoleCuilder::ActionStatusList& StatusList; 85 //!> indicates whether we are currently signed on 86 bool StatusList_signedOn; 87 //!> QTimer instance that causes regular updates of status messages 88 QTimer *timer; 89 //!> time interval in milliseconds 90 const int timer_interval; 76 91 }; 77 92
Note:
See TracChangeset
for help on using the changeset viewer.