FOX/ObjCryst++  1.10.X (development)
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin
3  2000-2001 University of Geneva (Switzerland)
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  GNU General Public License for more details.
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
23 #include "ObjCryst/wxCryst/wxCryst.h"
24 #include "ObjCryst/wxCryst/wxMultiGraph.h"
25 namespace ObjCryst
26 {
27  class WXOptimizationObj;
28  class WXMonteCarloObj;
29 }
30 #include "ObjCryst/RefinableObj/GlobalOptimObj.h"
31 namespace ObjCryst
32 {
33 class WXGlobalOptimRunThread;
37 {
38  public:
39  WXOptimizationObj(wxWindow *parent, OptimizationObj*);
40  virtual void CrystUpdate(const bool updateUI=false,const bool mutexlock=false);
41  virtual bool OnChangeName(const int id);
42  virtual void OnSave();
43  virtual void OnLoad();
45  virtual void OnAddRefinedObject(wxCommandEvent & WXUNUSED(event));
47  virtual void AddRefinedObject(RefinableObj &obj);
49  virtual void OnRemoveRefinedObject(wxCommandEvent & WXUNUSED(event));
51  virtual void OnRunOptimization(wxCommandEvent & WXUNUSED(event))=0;
52  virtual void OnStopOptimization(wxCommandEvent & WXUNUSED(event));
53  virtual OptimizationObj & GetOptimizationObj()=0;
54  virtual const OptimizationObj & GetOptimizationObj()const=0;
55  virtual void OnUpdateUI(wxUpdateUIEvent& event);
56  virtual void UpdateUI(const bool mutexlock=false);
58  virtual void OnBrowseParamSet(wxCommandEvent & WXUNUSED(event));
60  virtual void OnSelectParamSet(wxCommandEvent & WXUNUSED(event));
61  protected:
62  WXCrystMenuBar* mpMenuBar;
63  WXGlobalOptimRunThread *mpGlobalOptimRunThread;
64  WXFieldPar<long> *mpWXFieldNbTrial;
68  wxListBox *mpwxParamSetList;
69 };
72 class WXGlobalOptimRunThread: public wxThread
73 {
74  public:
75  WXGlobalOptimRunThread(OptimizationObj &globalOptObj,long &nbTrial,
76  const REAL finalCost,long &nbRun,const bool multiple=true);
77  virtual void *Entry();
78  virtual void OnExit();
79  private:
80  OptimizationObj *mpGlobalOptObj;
82  long *mpNbTrial;
84  long *mpNbRun;
87  const REAL mFinalCost;
89  const bool mDoMultiple;
90 };
97 {
98  public:
99  WXMonteCarloObj(wxWindow *parent, MonteCarloObj*);
100  //virtual void CrystUpdate();
101  virtual void OnRunOptimization(wxCommandEvent &event);
103  void UpdateDisplayNbTrial();
104  virtual OptimizationObj & GetOptimizationObj();
105  virtual const OptimizationObj & GetOptimizationObj()const;
106  void OnLSQRefine(wxCommandEvent &event);
107  protected:
111  long mNbRun;
112  WXFieldPar<long> *mpWXFieldNbTrial;
114 };
117 } //namespace
RefinableObjClock mClockParamSetWindow
Record when the window giving the list of recorded parameter set was created.
virtual void AddRefinedObject(RefinableObj &obj)
Added by the library.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Definition: RefinableObj.h:138
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual void OnRemoveRefinedObject(wxCommandEvent &WXUNUSED(event))
From the menu.
long mNbRun
The number of cycles.
void UpdateDisplayNbTrial()
Called during optimization, to show the user something's still going on...
long * mpNbTrial
This points to OptimizationObj::mNbTrialPerRun.
Generic Refinable Object.
Definition: RefinableObj.h:752
virtual void OnBrowseParamSet(wxCommandEvent &WXUNUSED(event))
Opens a window where the stored parameter set can be selected.
Base object for Monte-Carlo Global Optimization methods.
const REAL mFinalCost
The value of the cost below which the optimization should stop (0 by default) even if the desired num...
MonteCarloObj * mpMonteCarloObj
The algorithm object.
wxListBox * mpwxParamSetList
Window giving the list of recorded parameter sets.
Class for a GlobalOptimization thread.
virtual void OnAddRefinedObject(wxCommandEvent &WXUNUSED(event))
From the menu.
Base class for all displayed ObjCryst objects (with a title, and a sizer to stack objects)...
Definition: wxCryst.h:248
long * mpNbRun
This points to the mNbRun member in WXOptimizationObj.
virtual bool OnChangeName(const int id)
When a WXFieldName has been changed by the user, it is handled here.
Class for Graphical interface to Monte-Carlo objects (Simulated Annealing, Parallel Tempering) ...
Base object for Optimization methods.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
WX Class for a Global Optimization objects.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
virtual void OnRunOptimization(wxCommandEvent &WXUNUSED(event))=0
Launches the optimization run.
const bool mDoMultiple
Use multiple Runs ?
virtual void OnSelectParamSet(wxCommandEvent &WXUNUSED(event))
Restore one parameter set.
Our own local menu bar, using buttons and Popup menus.
Definition: wxCryst.h:503