source: src/UIElements/Dialog.cpp@ 61ea5b

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 61ea5b was 4e10f5, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Merge branch 'stable' into StructureRefactoring

Conflicts:

src/Actions/WorldAction/CenterOnEdgeAction.cpp
src/Actions/WorldAction/ChangeBoxAction.cpp
src/Actions/WorldAction/RepeatBoxAction.cpp
src/Actions/WorldAction/ScaleBoxAction.cpp
src/World.cpp
src/boundary.cpp

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 * Dialog.cpp
3 *
4 * Created on: Jan 5, 2010
5 * Author: crueger
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include "Dialog.hpp"
11
12#include "verbose.hpp"
13#include "atom.hpp"
14#include "element.hpp"
15#include "molecule.hpp"
16#include "vector.hpp"
17#include "Matrix.hpp"
18#include "Box.hpp"
19
20using namespace std;
21
22Dialog::Dialog()
23{
24}
25
26Dialog::~Dialog()
27{
28 list<Query*>::iterator iter;
29 for(iter=queries.begin();iter!=queries.end();iter++){
30 delete (*iter);
31 }
32}
33
34void Dialog::registerQuery(Query *query){
35 queries.push_back(query);
36}
37
38bool Dialog::display(){
39 if(checkAll()){
40 setAll();
41 return true;
42 }
43 else{
44 return false;
45 }
46}
47
48bool Dialog::checkAll(){
49 list<Query*>::iterator iter;
50 bool retval = true;
51 for(iter=queries.begin(); iter!=queries.end(); iter++){
52 retval &= (*iter)->handle();
53 // if any query fails (is canceled), we can end the handling process
54 if(!retval) {
55 DoeLog(1) && (eLog() << Verbose(1) << "The following query failed: " << (**iter).getTitle() << "." << endl);
56 break;
57 }
58 }
59 return retval;
60}
61
62void Dialog::setAll(){
63 list<Query*>::iterator iter;
64 for(iter=queries.begin(); iter!=queries.end(); iter++) {
65 (*iter)->setResult();
66 }
67}
68
69/****************** Query types Infrastructure **************************/
70
71// Base class
72Dialog::Query::Query(string _title, string _description) :
73 title(_title),
74 description(_description)
75{}
76
77Dialog::Query::~Query() {}
78
79const std::string Dialog::Query::getTitle() const{
80 return title;
81}
82
83const std::string Dialog::Query::getDescription() const{
84 return description;
85}
86// empty Queries
87
88Dialog::EmptyQuery::EmptyQuery(string title, std::string description) :
89 Query(title, description)
90{}
91
92Dialog::EmptyQuery::~EmptyQuery() {}
93
94void Dialog::EmptyQuery::setResult() {
95}
96
97// Int Queries
98
99Dialog::IntQuery::IntQuery(string title,int *_target, std::string description) :
100 Query(title, description), target(_target)
101{}
102
103Dialog::IntQuery::~IntQuery() {}
104
105void Dialog::IntQuery::setResult() {
106 *target = tmp;
107}
108
109// Int Queries
110
111Dialog::BooleanQuery::BooleanQuery(string title,bool *_target, std::string description) :
112 Query(title, description), target(_target)
113{}
114
115Dialog::BooleanQuery::~BooleanQuery() {}
116
117void Dialog::BooleanQuery::setResult() {
118 *target = tmp;
119}
120
121// String Queries
122
123Dialog::StringQuery::StringQuery(string title,string *_target, std::string _description) :
124 Query(title, _description), target(_target)
125{}
126
127Dialog::StringQuery::~StringQuery() {};
128
129void Dialog::StringQuery::setResult() {
130 *target = tmp;
131}
132
133// Strings Queries
134
135Dialog::StringsQuery::StringsQuery(string title,vector<string> *_target, std::string _description) :
136 Query(title, _description), target(_target)
137{}
138
139Dialog::StringsQuery::~StringsQuery() {};
140
141void Dialog::StringsQuery::setResult() {
142 *target = tmp;
143}
144
145// Double Queries
146
147Dialog::DoubleQuery::DoubleQuery(string title,double *_target, std::string _description) :
148 Query(title, _description), target(_target)
149{}
150
151Dialog::DoubleQuery::~DoubleQuery() {};
152
153void Dialog::DoubleQuery::setResult() {
154 *target = tmp;
155}
156
157
158// Atom Queries
159
160Dialog::AtomQuery::AtomQuery(string title, atom **_target, std::string _description) :
161 Query(title, _description),
162 tmp(0),
163 target(_target)
164
165{}
166
167Dialog::AtomQuery::~AtomQuery() {}
168
169void Dialog::AtomQuery::setResult() {
170 *target = tmp;
171}
172
173// Molecule Queries
174
175Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, std::string _description) :
176 Query(title, _description),
177 tmp(0),
178 target(_target)
179
180{}
181
182Dialog::MoleculeQuery::~MoleculeQuery() {}
183
184void Dialog::MoleculeQuery::setResult() {
185 *target = tmp;
186}
187
188// Vector Queries
189
190Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,bool _check, std::string _description) :
191 Query(title, _description),
192 check(_check),
193 target(_target)
194{
195 tmp = new Vector();
196}
197
198Dialog::VectorQuery::~VectorQuery()
199{
200 delete tmp;
201}
202
203void Dialog::VectorQuery::setResult() {
204 *target = *tmp;
205}
206
207// Box Queries
208
209Dialog::BoxQuery::BoxQuery(std::string title, Box* _cellSize, std::string _description) :
210 Query(title, _description),
211 target(_cellSize)
212{
213 tmp = new double[6];
214}
215
216Dialog::BoxQuery::~BoxQuery()
217{
218 delete[] tmp;
219}
220
221void Dialog::BoxQuery::setResult() {
222 (*target)= ReturnFullMatrixforSymmetric(tmp);
223}
224
225// Element Queries
226Dialog::ElementQuery::ElementQuery(std::string title, std::vector<element *> *_target, std::string _description) :
227 Query(title, _description),
228 target(_target)
229 {}
230
231Dialog::ElementQuery::~ElementQuery(){}
232
233void Dialog::ElementQuery::setResult(){
234 *target=elements;
235}
Note: See TracBrowser for help on using the repository browser.