24 #include "ObjCryst/RefinableObj/RefinableObj.h"
25 #include "ObjCryst/Quirks/VFNStreamFormat.h"
26 #include "ObjCryst/Quirks/VFNDebug.h"
28 #include "ObjCryst/wxCryst/wxRefinableObj.h"
29 #undef GetClassName // Conflict from wxMSW headers ? (cygwin)
33 #define POSSIBLY_UNUSED(expr) (void)(expr);
43 mpParent(0),mName(name),mId(0)
49 mpParent(parent),mName(name),mId(0)
58 VFN_DEBUG_MESSAGE(
"RefParType::IsDescendantFromOrSameAs(RefParType*): "<<
this<<
" : "<<
mpParent,1)
59 if(type->
mId==
mId)
return true;
66 if(
this==type)
return true;
73 static unsigned long nbRefParType=0;
78 long NiftyStaticGlobalObjectsInitializer_RefinableObj::mCount=0;
85 unsigned long RefinableObjClock::msTick0=0;
86 unsigned long RefinableObjClock::msTick1=0;
87 RefinableObjClock::RefinableObjClock()
93 RefinableObjClock::~RefinableObjClock()
96 set<const RefinableObjClock*> vChild=
mvChild;
97 set<RefinableObjClock*> vParent=
mvParent;
100 for(std::set<const RefinableObjClock*>::iterator pos=vChild.begin();
101 pos!=vChild.end();++pos) (*pos)->RemoveParent(*
this);
102 for(std::set<RefinableObjClock*>::iterator pos=vParent.begin();
103 pos!=vParent.end();++pos) (*pos)->RemoveChild(*
this);
108 if(mTick1<rhs.mTick1)
return true;
109 if(mTick1==rhs.mTick1) {
if(mTick0<rhs.mTick0)
return true;}
114 if(mTick1<rhs.mTick1)
return true;
115 if(mTick1==rhs.mTick1)
if(mTick0<=rhs.mTick0)
return true;
120 if(mTick1>rhs.mTick1)
return true;
121 if(mTick1==rhs.mTick1)
if(mTick0>rhs.mTick0)
return true;
126 if(mTick1>rhs.mTick1)
return true;
127 if(mTick1==rhs.mTick1)
if(mTick0>=rhs.mTick0)
return true;
133 if(++msTick0==0) ++msTick1;
136 for(std::set<RefinableObjClock*>::iterator pos=
mvParent.begin();
137 pos!=
mvParent.end();++pos) (*pos)->Click();
138 VFN_DEBUG_MESSAGE(
"RefinableObjClock::Click():"<<mTick1<<
":"<<mTick0<<
"(at "<<
this<<
")",0)
148 cout <<
"Clock():"<<mTick1<<
":"<<mTick0;
149 VFN_DEBUG_MESSAGE_SHORT(
" (at "<<
this<<
")",4)
154 cout <<
"RefinableObj class Clock():"<<msTick1<<
":"<<msTick0<<endl;
160 const unsigned int i =
mvChild.erase(&clock); POSSIBLY_UNUSED(i);
161 VFN_DEBUG_MESSAGE(
"RefinableObjClock::RemoveChild():"<<i,5)
170 if(clock.HasParent(*
this)==
true)
171 throw ObjCrystException(
"RefinableObjClock::AddParent(..) Loop in clock tree !!");
177 const unsigned int i =
mvParent.erase(&clock); POSSIBLY_UNUSED(i);
178 VFN_DEBUG_MESSAGE(
"RefinableObjClock::RemoveParent():"<<i,5)
185 for(std::set<RefinableObjClock*>::iterator pos=
mvParent.begin();
186 pos!=
mvParent.end();++pos)
if( (*
this) > (**pos) ) **pos = *
this;
191 for(std::set<RefinableObjClock*>::iterator pos=
mvParent.begin();
194 if((*pos)==&clock)
return true;
195 if((*pos)->HasParent(clock))
return true;
203 mpRefParType(gpRefParTypeObjCryst)
210 Restraint::~Restraint()
213 const RefParType* Restraint::GetType()
const{
return mpRefParType;}
215 void Restraint::SetType(
const RefParType *type){mpRefParType=type;}
225 mName(
""),mpValue(0),mMin(0),mMax(0),
226 mHasLimits(false),mIsFixed(true),mIsUsed(true),mIsPeriodic(false),
227 mPeriod(0.),mGlobalOptimStep(1.),mDerivStep(1e-5),mRefParDerivStepModel(REFPAR_DERIV_STEP_ABSOLUTE),
228 mSigma(0.),mHumanScale(1.),mHasAssignedClock(false),mpClock(0)
240 const bool hasLimits,
243 const bool isPeriodic,
244 const REAL humanScale,
247 mName(name),mpValue(refPar),mMin(min),mMax(max),
248 mHasLimits(hasLimits),mIsFixed(isFixed),mIsUsed(isUsed),mIsPeriodic(isPeriodic),mPeriod(period),
249 mGlobalOptimStep((max-min)/100.),mDerivStep(1e-5),mRefParDerivStepModel(derivMode),
250 mSigma(0.),mHumanScale(humanScale),
252 mUseEquation(false),mEquationNbRefPar(0),mEquationCoeff(0),
254 mHasAssignedClock(false),mpClock(0)
260 RefinablePar::~RefinablePar()
273 const bool hasLimits,
276 const bool isPeriodic,
277 const REAL humanScale,
284 Restraint::SetType(type);
331 mUseEquation=old.mUseEquation;
332 mEquationNbRefPar=old.mEquationNbRefPar;
333 mEquationCoeff=old.mEquationCoeff;
340 if(
true==mUseEquation)
342 VFN_DEBUG_MESSAGE(
"RefinablePar::Value():Evaluating Equation",0)
343 REAL tmp=mEquationCoeff(0);
344 for(
int i=0;i<mEquationNbRefPar;i++)
345 tmp += mEquationCoeff(i+1) * mEquationRefPar[i]->GetValue();
361 VFN_DEBUG_MESSAGE(
"RefinablePar::SetValue()",2)
363 if(
true==mUseEquation)
365 cout <<
"RefinablePar::SetValue(): this parameter is defined by an equation !!" <<endl;
385 if(this->IsLimited() ==
true)
390 else if(
true==this->IsPeriodic())
408 VFN_DEBUG_MESSAGE(
"RefinablePar::SetHumanValue()",2)
410 if(
true==mUseEquation)
412 cout <<
"RefinablePar::SetValue(): this parameter is defined by an equation !!" <<endl;
432 if(this->IsLimited() ==
true)
437 else if(
true==this->IsPeriodic())
446 if(0==mutateValue)
return;
447 VFN_DEBUG_MESSAGE(
"RefinablePar::Mutate():"<<this->
GetName(),1)
451 if(
true==mUseEquation)
453 cout <<
"RefinablePar::Mutate(): this parameter is defined by an equation !!" <<endl;
473 if(this->IsLimited() ==
true)
478 else if(
true==this->IsPeriodic())
482 if(*mpValue < 0) *mpValue +=
mPeriod;
484 VFN_DEBUG_MESSAGE(
"RefinablePar::Mutate():End",0)
489 VFN_DEBUG_MESSAGE(
"RefinablePar::MutateTo()",2)
491 if(*
mpValue == mutateValue)
return;
494 if(
true==mUseEquation)
496 cout <<
"RefinablePar::Mutate(): this parameter is defined by an equation !!" <<endl;
516 if(this->IsLimited() ==
true)
521 else if(
true==this->IsPeriodic())
528 REAL RefinablePar::GetSigma()
const {
return mSigma;}
530 void RefinablePar::SetSigma(
const REAL sigma) {
mSigma=sigma; this->
Click();}
532 void RefinablePar::Print()
const
547 bool RefinablePar::IsFixed()
const {
return mIsFixed;}
548 void RefinablePar::SetIsFixed(
const bool b)
550 VFN_DEBUG_MESSAGE(
"RefinablePar::SetIsFixed():"<<this->
GetName(),1)
555 void RefinablePar::SetIsLimited(
const bool b) {
mHasLimits=b;this->
Click();}
560 bool RefinablePar::IsPeriodic()
const {
return mIsPeriodic;}
561 void RefinablePar::SetIsPeriodic(
const bool b,REAL period)
585 if(d == 0.)
return 1e-8;
601 void RefinablePar::SetUseEquation(
const bool useItOrNot,
const REAL c0)
604 mUseEquation=useItOrNot;
605 if(
true==mUseEquation)
607 mEquationCoeff.resize(mEquationMaxRefPar);
608 mEquationCoeff(0)=c0;
612 void RefinablePar::SetUseEquation(
const bool useItOrNot,
const REAL c0,
616 mUseEquation=useItOrNot;
617 if(
true==mUseEquation)
619 mEquationCoeff.resize(mEquationMaxRefPar);
620 mEquationCoeff(0)=c0;
621 mEquationCoeff(1)=c1;
622 mEquationRefPar[0]=&refpar1;
626 void RefinablePar::SetUseEquation(
const bool useItOrNot,
const REAL c0,
631 mUseEquation=useItOrNot;
632 if(
true==mUseEquation)
634 mEquationCoeff.resize(mEquationMaxRefPar);
635 mEquationCoeff(0)=c0;
636 mEquationCoeff(1)=c1;
637 mEquationCoeff(2)=c2;
638 mEquationRefPar[0]=&refpar1;
639 mEquationRefPar[1]=&refpar2;
643 void RefinablePar::SetUseEquation(
const bool useItOrNot,
const REAL c0,
649 mUseEquation=useItOrNot;
650 if(
true==mUseEquation)
652 mEquationCoeff.resize(mEquationMaxRefPar);
653 mEquationCoeff(0)=c0;
654 mEquationCoeff(1)=c1;
655 mEquationCoeff(2)=c2;
656 mEquationCoeff(3)=c2;
657 mEquationRefPar[0]=&refpar1;
658 mEquationRefPar[1]=&refpar2;
659 mEquationRefPar[2]=&refpar2;
665 VFN_DEBUG_MESSAGE(
"RefinablePar::AssignClock() for "<<this->
GetName()<<
"at "<<&clock,4)
672 VFN_DEBUG_MESSAGE(
"RefinablePar::Click():"<<this->
GetName(),1)
687 VFN_DEBUG_MESSAGE(
"RefinablePar::SetLimitsRelative():"<<this->
GetName(),1)
691 this->SetIsLimited(
true);
698 this->SetIsLimited(
true);
703 VFN_DEBUG_MESSAGE(
"RefinablePar::WXCreate()",8)
704 if(mpWXFieldRefPar!=0)
706 throw ObjCrystException((
string)
"RefinablePar::WXCreate():"+this->
GetName()+(
string)
" WXFieldRefPar already exists !");
715 void RefinablePar::WXDelete()
717 if(0!=mpWXFieldRefPar)
719 VFN_DEBUG_MESSAGE(
"RefinablePar::WXDelete():"<<
mName,5)
720 delete mpWXFieldRefPar;
726 VFN_DEBUG_MESSAGE(
"RefinablePar::WXNotifyDelete():"<<
mName,5)
741 RefObjOpt::~RefObjOpt()
744 void RefObjOpt::Init(
const int nbChoice,
746 const string *choiceNames)
748 VFN_DEBUG_MESSAGE(
"RefObjOpt::Init()"<<*name,5)
752 mpChoiceName=choiceNames;
758 int RefObjOpt::GetChoice()
const
761 void RefObjOpt::SetChoice(
const int choice)
763 if(mChoice==choice)
return;
764 VFN_DEBUG_MESSAGE(
"RefObjOpt::SetChoice()"<<this->
GetName()<< \
765 " to "<<this->GetChoiceName(choice),5)
769 void RefObjOpt::SetChoice(const
string &choiceName)
772 for(choice=0;choice<mNbChoice;choice++)
if(choiceName==*(mpChoiceName+choice))
break;
773 if(choice==mNbChoice) choice=0;
774 this->SetChoice(choice);
777 const string& RefObjOpt::GetName()
const
782 const string& RefObjOpt::GetClassName()
const
784 static string className=
"Option";
788 const string& RefObjOpt::GetChoiceName(
const int i)
const
790 return *(mpChoiceName+i);
798 VFN_DEBUG_MESSAGE(
"RefObjOpt::WXCreate()",8)
800 return mpWXFieldOption;
804 return mpWXFieldOption;
806 void RefObjOpt::WXDelete()
808 if(0!=mpWXFieldOption)
810 VFN_DEBUG_MESSAGE(
"RefObjOpt::WXDelete()",5)
811 delete mpWXFieldOption;
817 VFN_DEBUG_MESSAGE(
"RefObjOpt::WXNotifyDelete()",5)
834 if(mChoice==choice)
return;
835 VFN_DEBUG_MESSAGE(
"RefObjOption<T>::SetChoice()"<<this->GetName()<< \
836 " to "<<this->GetChoiceName(choice),5)
839 if(mfpSetNewValue !=0) (mpObj->*mfpSetNewValue)(choice);
842 template<class T>
void RefObjOption<T>::Init(const
int nbChoice,
844 const
string *choiceNames,
845 void (T::*fp)(const
int))
847 this->RefObjOpt::Init(nbChoice,name,choiceNames);
855 bool operator==(
const wxString&wx,
const string&str)
857 return wx==str.c_str();
859 bool operator==(
const string&str,
const wxString&wx)
861 return wx==str.c_str();
866 mName(
""),mAutoUpdateUI(true)
871 VFN_DEBUG_MESSAGE(
"ObjRegistry::ObjRegistry()",5)
875 mName(name),mAutoUpdateUI(true)
880 VFN_DEBUG_MESSAGE(
"ObjRegistry::ObjRegistry(name):"<<mName,5)
886 VFN_DEBUG_MESSAGE(
"ObjRegistry::~ObjRegistry():"<<mName,5)
894 VFN_DEBUG_ENTRY(
"ObjRegistry("<<mName<<
")::Register():"<<obj.GetName(),2)
895 typename vector<T*>::iterator pos=find(mvpRegistry.begin(),mvpRegistry.end(),&obj);
896 if(pos!=mvpRegistry.end())
898 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Register():"<<obj.GetName()<<
"Already registered!",2)
901 mvpRegistry.push_back(&obj);
904 if((0!=mpWXRegistry) && mAutoUpdateUI)
905 mpWXRegistry->Add(obj.WXCreate(mpWXRegistry));
908 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Register():"<<obj.GetName(),2)
913 VFN_DEBUG_ENTRY(
"ObjRegistry("<<mName<<
")::Deregister(&obj)"<<mvpRegistry.size(),2)
914 if (mvpRegistry.size() == 0)
918 VFN_DEBUG_EXIT(
"ObjRegistry(" << mName <<
")::Deregister(&obj): EMPTY registry", 2)
922 typename vector<T*>::iterator pos=find(mvpRegistry.begin(),mvpRegistry.end(),&obj);
923 if(pos==mvpRegistry.end())
925 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Deregister(&obj):NOT FOUND !!!",2)
929 if(0!=mpWXRegistry) mpWXRegistry->Remove(obj.WXGet());
931 mvpRegistry.erase(pos);
933 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Deregister(&obj)",2)
938 VFN_DEBUG_ENTRY(
"ObjRegistry("<<mName<<
")::Deregister(name):"<<objName,2)
940 const long i=this->Find(objName);
943 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Deregister(name): NOT FOUND !!!",2)
947 typename vector<T*>::iterator pos=find(mvpRegistry.begin(),mvpRegistry.end(),mvpRegistry[i]);
950 if(0!=mpWXRegistry) mpWXRegistry->Remove((*pos)->WXGet());
952 mvpRegistry.erase(pos);
954 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::Deregister(name):",2)
959 VFN_DEBUG_ENTRY(
"ObjRegistry("<<mName<<
")::DeRegisterAll():",5)
963 typename vector<T*>::iterator pos;
964 for(pos=mvpRegistry.begin();pos!=mvpRegistry.end();++pos)
965 mpWXRegistry->Remove((*pos)->WXGet());
970 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::DeRegisterAll():",5)
975 VFN_DEBUG_ENTRY(
"ObjRegistry("<<mName<<
")::DeleteAll():",5)
976 vector<T*> reg=mvpRegistry;
977 typename vector<T*>::iterator pos;
978 for(pos=reg.begin();pos!=reg.end();++pos)
delete *pos;
981 VFN_DEBUG_EXIT(
"ObjRegistry("<<mName<<
")::DeleteAll():",5)
986 return *(mvpRegistry[i]);
991 return *(mvpRegistry[i]);
996 const long i=this->Find(objName);
997 return *(mvpRegistry[i]);
1002 const long i=this->Find(objName);
1003 return *(mvpRegistry[i]);
1007 const string& className)
1009 const long i=this->Find(objName,className);
1010 return *(mvpRegistry[i]);
1014 const string& className)
const
1016 const long i=this->Find(objName,className);
1017 return *(mvpRegistry[i]);
1024 VFN_DEBUG_MESSAGE(
"ObjRegistry::Print():",2)
1025 cout <<mName<<" :"<<this->GetNb()<<"
object registered:" <<endl;
1027 for(
long i=0;i<this->GetNb();++i)
1028 cout <<i<<"("<<this->GetObj(i).GetName()<<")"<<endl;
1031 template<class T>
void ObjRegistry<T>::SetName(const
string &name){ mName=name;}
1037 VFN_DEBUG_MESSAGE(
"ObjRegistry::Find(objName)",2)
1040 for(
long i=this->GetNb()-1;i>=0;i--)
1041 if( mvpRegistry[i]->GetName() == objName)
return i;
1051 cout <<
"ObjRegistry<T>::Find("<<objName<<
"): Not found !!"<<endl;
1058 const string &className,
1059 const bool nothrow)
const
1061 VFN_DEBUG_MESSAGE(
"ObjRegistry::Find(objName,className)",2)
1064 for(
long i=this->GetNb()-1;i>=0;i--)
1065 if( mvpRegistry[i]->GetName() == objName)
1066 if(className==mvpRegistry[i]->GetClassName())
return i;
1076 cout <<
"ObjRegistry<T>::Find("<<objName<<
","<<className<<
"): Not found !!"<<endl;
1079 throw ObjCrystException(
"ObjRegistry<T>::Find("+objName+
","+className+
"): Not found !!");
1085 VFN_DEBUG_MESSAGE(
"ObjRegistry::Find(&obj)",2)
1086 for(
long i=this->GetNb()-1;i>=0;i--)
1087 if( mvpRegistry[i]== &obj)
return i;
1094 VFN_DEBUG_MESSAGE(
"ObjRegistry::Find(&obj)",2)
1095 for(
long i=this->GetNb()-1;i>=0;i--)
1096 if( mvpRegistry[i]== pobj)
return i;
1105 mAutoUpdateUI=autoup;
1110 #ifdef __WX__CRYST__
1111 for(
unsigned int i=0;i<this->GetNb();i++)
1113 if((this->GetObj(i).WXGet()==NULL) && (0!=mpWXRegistry))
1114 mpWXRegistry->Add(this->GetObj(i).WXCreate(mpWXRegistry));
1119 #ifdef __WX__CRYST__
1122 VFN_DEBUG_MESSAGE(
"ObjRegistry<T>::WXCreate()",2)
1123 mpWXRegistry=new
WXRegistry<T> (parent,this);
1124 for(
int i=0;i<this->GetNb();i++)
1125 mpWXRegistry->Add(this->GetObj(i).WXCreate(mpWXRegistry));
1126 return mpWXRegistry;
1132 VFN_DEBUG_MESSAGE(
"ObjRegistry<T>::WXDelete()",2)
1133 delete mpWXRegistry;
1137 template<class T>
void ObjRegistry<T>::WXNotifyDelete()
1139 VFN_DEBUG_MESSAGE(
"ObjRegistry<T>::WXNotifyDelete()",2)
1149 VFN_DEBUG_MESSAGE(
"RefObjRegisterRecursive()",3)
1152 for(
int i=0;i<pObjReg->
GetNb();i++)
1163 for(
int i=0;i<reg.
GetNb();i++)
1176 mNbRefParNotFixed(-1),mOptimizationDepth(0),mDeleteRefParInDestructor(true)
1177 #ifdef __WX__CRYST__
1181 VFN_DEBUG_MESSAGE(
"RefinableObj::RefinableObj()",3)
1186 VFN_DEBUG_MESSAGE(
"RefinableObj::RefinableObj():End",2)
1190 mNbRefParNotFixed(-1),mOptimizationDepth(0),mDeleteRefParInDestructor(true)
1191 #ifdef __WX__CRYST__
1195 VFN_DEBUG_MESSAGE(
"RefinableObj::RefinableObj(bool)",3)
1200 VFN_DEBUG_MESSAGE(
"RefinableObj::RefinableObj(bool):End",2)
1225 VFN_DEBUG_MESSAGE(
"RefinableObj::~RefinableObj():"<<this->
GetName(),5)
1230 vector<RefinablePar*>::iterator pos;
1237 VFN_DEBUG_MESSAGE(
"RefinableObj::~RefinableObj():End",4)
1238 #ifdef __WX__CRYST__
1245 const static string className=
"RefinableObj";
1252 VFN_DEBUG_MESSAGE(
"RefinableObj::SetName()to :"<<name,6)
1275 VFN_DEBUG_MESSAGE(
"RefinableObj::PrepareForRefinement()",5)
1278 for(
long i=0;i<this->
GetNbPar();i++)
1285 VFN_DEBUG_MESSAGE(
"RefinableObj::PrepareForRefinement():End",5)
1290 VFN_DEBUG_ENTRY(
"RefinableObj("<<this->
GetClassName()<<
":"
1291 <<this->
GetName()<<
")::FixAllPar()",4)
1292 for(
long i=0;i<this->
GetNbPar();i++) this->
GetPar(i).SetIsFixed(
true);
1295 VFN_DEBUG_EXIT(
"RefinableObj("<<this->
GetName()<<
")::FixAllPar()",4)
1300 for(
long i=0;i<this->
GetNbPar();i++) this->
GetPar(i).SetIsFixed(
false);
1307 this->
GetPar(parIndex).SetIsFixed(fix);
1312 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1314 this->
GetPar(i).SetIsFixed(fix);
1319 for(
long i=0;i<this->
GetNbPar();i++)
1323 this->
GetPar(i).SetIsFixed(fix);
1331 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1338 for(
long i=0;i<this->
GetNbPar();i++)
1364 const long i=this->
FindPar(name);
1375 const long i=this->
FindPar(name);
1386 const long i=this->
FindPar(p);
1397 const long i=this->
FindPar(p);
1418 VFN_DEBUG_MESSAGE(
"RefinableObj::AddPar(RefPar&)",2)
1419 string name=newRefPar.
GetName();
1422 while(this->
FindPar(name)!=-1)
1424 VFN_DEBUG_MESSAGE(
"RefinableObj::AddPar(): need to change name ?! -> "<<name<<
","<<this->
FindPar(name),10)
1426 if(++ct==100)
break;
1436 VFN_DEBUG_MESSAGE(
"RefinableObj::AddPar(RefPar&)",2)
1437 string name=newRefPar->
GetName();
1440 while(this->
FindPar(name)!=-1)
1442 VFN_DEBUG_MESSAGE(
"RefinableObj::AddPar(): need to change name ?! -> "<<name<<
","<<this->
FindPar(name),10)
1444 if(++ct==100)
break;
1453 VFN_DEBUG_MESSAGE(
"RefinableObj::AddPar(RefParList&)" <<newRefParList.
GetNbPar() ,2)
1455 for(
long i=0;i<newRefParList.
GetNbPar();i++)
1458 else p=&(newRefParList.
GetPar(i));
1465 VFN_DEBUG_MESSAGE(
"RefinableObj::RemovePar(RefPar&)",2)
1470 +
"is not in this object:"+this->
GetName());
1475 void RefinableObj::Print()
const
1477 VFN_DEBUG_ENTRY(
"RefinableObj::Print()",2)
1478 cout << "Refinable Object:"<<this->
GetName()
1479 <<", with " << this->
GetNbPar() << " parameters" <<endl;
1480 for(
int i=0;i<this->
GetNbPar();i++)
1482 if(this->
GetPar(i).IsUsed() ==
false)
continue;
1485 if(
true == this->
GetPar(i).IsFixed()) cout <<
"Fixed";
1487 if(
true == this->
GetPar(i).IsLimited())
1491 if(
true == this->
GetPar(i).IsPeriodic()) cout <<
",Periodic" ;
1493 VFN_DEBUG_MESSAGE_SHORT(
" (at "<<this->
GetPar(i).mpValue<<
")",5)
1494 if(true == this->
GetPar(i).mHasAssignedClock)
1496 VFN_DEBUG_MESSAGE_SHORT(
" (Clock at "<<this->
GetPar(i).mpClock<<
")",5)
1500 VFN_DEBUG_EXIT(
"RefinableObj::Print()",2)
1505 VFN_DEBUG_ENTRY(
"RefinableObj::CreateParamSet()",3)
1510 pair< CrystVector_REAL ,string> p;
1515 VFN_DEBUG_MESSAGE(
"RefinableObj::CreateParamSet(): new parameter set with id="<<
id<<
" and name:"<<name,2)
1516 VFN_DEBUG_EXIT(
"RefinableObj::CreateParamSet()",3)
1522 VFN_DEBUG_ENTRY(
"RefinableObj::ClearParamSet()",2)
1524 VFN_DEBUG_EXIT(
"RefinableObj::ClearParamSet()",2)
1529 VFN_DEBUG_MESSAGE(
"RefinableObj::SaveRefParSet()",2)
1530 map<unsigned long,pair<CrystVector_REAL,string> >::iterator pos=this->
FindParamSet(
id);
1531 pos->second.first.resize(
mvpRefPar.size());
1532 REAL *p=pos->second.first.data();
1538 VFN_DEBUG_MESSAGE(
"RefinableObj::RestoreRefParSet()",2)
1539 map<unsigned long,pair<CrystVector_REAL,string> >::iterator pos=this->
FindParamSet(
id);
1540 REAL *p=pos->second.first.data();
1541 for(
long i=0;i<this->
GetNbPar();i++)
1552 VFN_DEBUG_MESSAGE(
"RefinableObj::GetParamSet() const",2)
1553 map<unsigned long,pair<CrystVector_REAL,string> >::const_iterator pos=this->
FindParamSet(
id);
1554 return pos->second.first;
1559 VFN_DEBUG_MESSAGE(
"RefinableObj::GetParamSet()",2)
1560 map<unsigned long,pair<CrystVector_REAL,string> >::iterator pos=this->
FindParamSet(
id);
1561 return pos->second.first;
1565 const long par)
const
1567 VFN_DEBUG_MESSAGE(
"RefinableObj::RefParSetNotFixedHumanValue()",0)
1568 map<unsigned long,pair<CrystVector_REAL,string> >::iterator pos=this->
FindParamSet(
id);
1579 VFN_DEBUG_MESSAGE(
"RefinableObj::GetParamSetName()",2)
1580 map<unsigned long,pair<CrystVector_REAL,string> >::const_iterator pos=this->
FindParamSet(
id);
1581 return pos->second.second;
1586 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1591 const REAL min,
const REAL max)
1593 for(
long i=0;i<this->
GetNbPar();i++)
1601 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1606 const REAL min,
const REAL max)
1608 VFN_DEBUG_MESSAGE(
"RefinableObj::SetLimitsRelative(RefParType*):"<<this->
GetName(),2)
1609 for(
long i=0;i<this->
GetNbPar();i++)
1611 VFN_DEBUG_MESSAGE(
"RefinableObj::SetLimitsRelative(RefParType*):par #"<<i,2)
1612 if(this->
GetPar(i).GetType()->IsDescendantFromOrSameAs(type))
1620 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1625 const REAL min,
const REAL max)
1627 for(
long i=0;i<this->
GetNbPar();i++)
1635 for(
long i=0;i<this->
GetNbPar();i++)
1659 extern const long ID_WXOBJ_ENABLE;
1660 extern const long ID_WXOBJ_DISABLE;
1662 const bool enableRestraints)
1669 #ifdef __WX__CRYST__
1672 if(
true==wxThread::IsMain()) mpWXCrystObj->Enable(
false);
1675 wxUpdateUIEvent event(ID_WXOBJ_DISABLE);
1676 wxPostEvent(mpWXCrystObj,event);
1690 #ifdef __WX__CRYST__
1693 if(
true==wxThread::IsMain()) mpWXCrystObj->Enable(
true);
1696 wxUpdateUIEvent event(ID_WXOBJ_ENABLE);
1697 wxPostEvent(mpWXCrystObj,event);
1711 VFN_DEBUG_ENTRY(
"RefinableObj::RandomizeConfiguration():"<<
mName,5)
1731 VFN_DEBUG_EXIT(
"RefinableObj::RandomizeConfiguration():Finished",5)
1738 VFN_DEBUG_ENTRY(
"RefinableObj::GlobalOptRandomMove()",2)
1743 *2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude);
1746 mSubObjRegistry.GetObj(i).GlobalOptRandomMove(mutationAmplitude,type);
1748 VFN_DEBUG_EXIT(
"RefinableObj::GlobalOptRandomMove()",2)
1761 VFN_DEBUG_ENTRY(
"RefinableObj::GetLogLikelihood()",3)
1764 VFN_DEBUG_EXIT(
"RefinableObj::GetLogLikelihood()=0",3)
1767 VFN_DEBUG_MESSAGE(
"RefinableObj::GetLogLikelihood()there are restraints...",2)
1769 vector< Restraint * >::const_iterator pos;
1772 VFN_DEBUG_MESSAGE(
"RefinableObj::GetLogLikelihood()Restraint: "<<*pos,2)
1773 loglike+= (*pos)->GetLogLikelihood();
1775 VFN_DEBUG_EXIT(
"RefinableObj::GetLogLikelihood()="<<loglike,3)
1788 CrystVector_REAL *noWarning=
new CrystVector_REAL;
1795 CrystVector_REAL *noWarning=
new CrystVector_REAL;
1802 CrystVector_REAL *noWarning=
new CrystVector_REAL;
1823 for(std::set<RefinablePar *>::const_iterator pos=vPar.begin();pos!=vPar.end();pos++)
1831 VFN_DEBUG_MESSAGE(
"RefinableObj::ResetParList()",3)
1836 vector<RefinablePar*>::iterator pos;
1843 VFN_DEBUG_MESSAGE(
"RefinableObj::ResetParList():Deleting Saved Sets....",2)
1846 VFN_DEBUG_MESSAGE(
"RefinableObj::ResetParList():End.",3)
1856 VFN_DEBUG_MESSAGE(
"RefinableObj::GetOption()"<<i,3)
1868 CrystVector_uint & groupIndex,
1869 unsigned int &first)
const
1871 VFN_DEBUG_MESSAGE(
"RefinableObj::GetGeneGroup()",4)
1873 for(
long j=0;j<this->
GetNbPar();j++)
1874 if(&(obj.
GetPar(i)) == &(this->
GetPar(j))) groupIndex(i)= first++;
1882 vector<Restraint*>::const_iterator pos;
1885 cost += (*pos)->GetLogLikelihood();
1891 VFN_DEBUG_MESSAGE(
"RefinableObj::AddRestraint(Restraint*)",2)
1897 VFN_DEBUG_MESSAGE(
"RefinableObj::RemoveRestraint(Restraint*)",2)
1905 cout <<
"RefinableObj::RemoveRestraint(..)"
1906 <<
" Whoops... tried to remove a Restraint which does not exist..."<<endl;
1919 #ifdef __WX__CRYST__
1920 VFN_DEBUG_ENTRY(
"RefinableObj::UpdateDisplay()",3)
1921 if(0!=mpWXCrystObj) mpWXCrystObj->CrystUpdate(
true,
true);
1922 VFN_DEBUG_EXIT(
"RefinableObj::UpdateDisplay()",3)
1930 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1933 if(-1 != index) warning=true ;
else index=i;
1937 throw ObjCrystException(
"RefinableObj::FindPar("+name+
"): found duplicate refinable variable name in object:"+this->
GetName());
1946 for(
long i=this->
GetNbPar()-1;i>=0;i--)
1949 if(-1 != index) warning=true ;
else index=i;
1961 VFN_DEBUG_MESSAGE(
"RefinableObj::AddSubRefObj()",3)
1968 VFN_DEBUG_MESSAGE(
"RefinableObj::RemoveSubRefObj()",3)
1975 VFN_DEBUG_MESSAGE(
"RefinableObj::AddOption()",5)
1979 VFN_DEBUG_MESSAGE(
"RefinableObj::AddOption():End",5)
1984 VFN_DEBUG_MESSAGE(
"RefinableObj::Prepare()",5)
1989 map<unsigned long,pair<CrystVector_REAL,string> >::iterator
1992 VFN_DEBUG_ENTRY(
"RefinableObj::FindParamSet()",2)
1993 map<unsigned long,pair<CrystVector_REAL,string> >::iterator pos;
1999 VFN_DEBUG_EXIT(
"RefinableObj::FindParamSet()",2)
2003 #ifdef __WX__CRYST__
2006 VFN_DEBUG_MESSAGE(
"RefinableObj::WXCreate()",8)
2008 return mpWXCrystObj;
2012 return mpWXCrystObj;
2014 void RefinableObj::WXDelete()
2018 VFN_DEBUG_MESSAGE(
"RefinableObj::WXDelete()",5)
2019 delete mpWXCrystObj;
2025 VFN_DEBUG_MESSAGE(
"RefinableObj::WXNotifyDelete():"<<
mName,5)
2035 for(
int i=0;i<reg.
GetNb();i++)
2046 #include "ObjCryst/ObjCryst/Crystal.h"
2047 #include "ObjCryst/ObjCryst/Scatterer.h"
2048 #include "ObjCryst/ObjCryst/ScatteringPower.h"
2049 #include "ObjCryst/ObjCryst/ZScatterer.h"
2050 #include "ObjCryst/ObjCryst/PowderPattern.h"
2051 #include "ObjCryst/ObjCryst/DiffractionDataSingleCrystal.h"
2052 #include "ObjCryst/ObjCryst/ScatteringCorr.h"
2053 #include "ObjCryst/RefinableObj/GlobalOptimObj.h"
2054 #include "ObjCryst/RefinableObj/IO.h"
2055 #include "ObjCryst/ObjCryst/ReflectionProfile.h"
void UpdateUI()
Manually update the UI, making sure all objects in the registry are displayed This is useful when the...
REAL mGlobalOptimStep
Step to use for global method search (simulated annealing,...)
void SetDerivStep(const REAL)
Fixed step to use to compute numerical derivative.
T & GetObj(const unsigned int i)
Get object #i in the registry.
REAL GetHumanMin() const
Get the minimum value allowed (if limited)
void Print() const
Print clock value. Only for debugging purposes.
virtual REAL GetRestraintCost() const
Get the restraint cost (overall penalty of all restraints)
void AddSubRefObj(RefinableObj &)
CrystVector_long mRefparNotFixedIndex
Index of not-fixed parameters.
void AddPar(const RefinablePar &newRefPar)
Add a refinable parameter.
virtual const ObjRegistry< RefinableObj > & GetClientRegistry() const
Get the list of clients.
RefinableObjClock mRefParListClock
Last time the RefinableParList was modified (a parameter added or removed).
virtual void UpdateDisplay() const
If there is an interface, this should be automatically be called each time there is a 'new...
REAL GetMin() const
Minimum value allowed (if limited or periodic)
void SetLimitsRelative(const string &parName, const REAL min, const REAL max)
Change the limits for a given parameter, giving relative new limits (eg giving -.1 and +...
bool mIsFixed
is the parameter currently fixed ?
const RefinableObjClock & GetRegistryClock() const
Last time an object was added or removed from the registry.
void SetParIsUsed(const string &parName, const bool use)
Set whether a parameter is used.
WX representation of a RefObj option. This displays the names of the different choices.
void AutoUpdateUI(const bool autoup=true)
Enable the UI automatic update, so that objects in the registry are automatically added to the UI...
long GetNb() const
Get the index of an object in the registry, from its name Warning: it can change if an object is remo...
string GetName() const
Get the parameter's name.
void Register(T &obj)
Register a new object. Already registered objects are skipped.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
bool IsBeingRefined() const
Is the object being refined ? (Can be refined by one algorithm at a time only.)
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
REAL * mpValue
Pointer to the refinable value.
const REAL * GetPointer() const
Access to a const pointer to the refined value.
void FixAllPar()
Fix All parameters.
virtual void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
This should be called by any optimization class at the begining of an optimization.
void SaveParamSet(const unsigned long id) const
Save the current set of refined values over a previously-created set of saved values.
void RemoveParent(RefinableObjClock &) const
remove a parent clock
A field for a RefinablePar.
const string & GetName() const
Get the name for this parameter.
map< unsigned long, pair< CrystVector_REAL, string > >::iterator FindParamSet(unsigned long id) const
Find a parameter set with a given id (and check if it is there)
void SetParIsFixed(const long parIndex, const bool fix)
Fix/un-fix one parameter from its #.
void operator=(const RefinableObjClock &rhs)
This will (i) set the clock to the same values as the rhs clock, but will not change the list of chil...
long Find(const string &objName) const
Find the number of an object in the registry from its name (slow !) The search starts at the end of t...
RefParType(const string &name)
Create a top parameter type.
void RefObjRegisterRecursive(T &obj, ObjRegistry< T > ®)
Register a new object in a registry, and recursively include all included (sub)objects.
void Click()
Record an event for this clock (generally, the 'time' an object has been modified, or some computation has been made)
vector< Restraint * >::iterator RemoveRestraint(Restraint *pRestraint)
Remove a restraint from the list of known restraints.
void RemoveSubRefObj(RefinableObj &)
long GetNbPar() const
Total number of refinable parameter in the object.
void AddChild(const RefinableObjClock &)
Add a 'child' clock.
long mNbRefParNotFixed
Total of not-fixed parameters.
Class for options of RefinableObj, templated so that we can warn the object that something has been c...
const CrystVector_REAL & GetParamSet(const unsigned long setId) const
Access one save refpar set.
RefinablePar & GetParNotFixed(const long i)
Access all parameters in the order they were inputted, skipping fixed parameters. ...
void SetLimitsRelative(const REAL min, const REAL max)
Change the limits for this object, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0.
long GetNbParNotFixed() const
Total number of non-fixed parameters. Is initialized by PrepareForRefinement()
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted.
std::set< RefinableObjClock * > mvParent
List of parent clocks, which will be clicked whenever this one is.
unsigned long mId
The unique number identifying this type.
void SetIsUsed(const bool)
Is the parameter used (if not, it is simply irrelevant in the model) ?
void PrintStatic() const
Print current general clock value. Only for debugging purposes.
REAL mDerivStep
Step to use for numerical derivative calculation.
void InitId()
Get a Unique id (RefParType::mId)
void BeginGlobalOptRandomMove()
Raise a flag, to be sure not to make a random change more than once in each RefinableObj.
void Mutate(const REAL mutateValue)
Add the given amount to the parameter current value.
virtual void RegisterClient(RefinableObj &) const
Register a new object using this object.
This displays all components of a ObjCryst++ Registry.
virtual REAL GetLogLikelihood() const
Get -ln(likelihood) for this restraint.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
void SetLimitsProportional(const string &parName, const REAL min, const REAL max)
Change the limits for a given parameter, proportionnaly to the current value.
ObjRegistry< RefinableObj > gTopRefinableObjRegistry("Global Top RefinableObj registry")
This is a special registry for 'top' object for an optimization.
RefinableObjClock mClockMaster
Master clock, which is changed whenever the object has been altered.
virtual void SetApproximationFlag(const bool allow)
Enable or disable numerical approximations.
unsigned int GetNbOption() const
Number of Options for this object.
const REAL & GetHumanValue() const
Current value of parameter, scaled if necessary (for angles) to a human-understandable value...
RefObjOpt & GetOption(const unsigned int i)
Access to the options.
RefParDerivStepModel
How do we compute steps h for numerical derivative calculation : d=f(x+h)-f(x-h)/h/2 either h is fixe...
REAL mHumanScale
Scale to be used to display 'human' value.
Generic Refinable Object.
void SetMin(const REAL)
Set the Minimum value allowed (if limited)
REAL mPeriod
Period value (if relevant)
void SetLimitsProportional(const REAL min, const REAL max)
Change the limits for this object, proportionnaly to the current value.
void ResetParList()
Re-init the list of refinable parameters, removing all parameters.
const RefinableObjClock & GetClockMaster() const
This clocks records any change in the object. See refinableObj::mClockMaster.
virtual std::map< RefinablePar *, CrystVector_REAL > & GetLSQ_FullDeriv(const unsigned int, std::set< RefinablePar * > &vPar)
Get the first derivative for the LSQ function for each parameter supplied in a list.
ObjRegistry< RefinableObj > gRefinableObjRegistry("Global RefinableObj registry")
Global Registry for all RefinableObj.
RefObjOption(T *obj)
Constructor for the option.
Abstract base class for all objects in wxCryst.
map< unsigned long, pair< CrystVector_REAL, string > > mvpSavedValuesSet
Map of (index,pointers to arrays) used to save sets of values for all parameters. ...
void GetRefParListClockRecursive(ObjRegistry< RefinableObj > ®, RefinableObjClock &clock)
Get the last time any RefinablePar was added in a recursive list of objects.
string mName
Name for this RefinableObject. Should be unique, at least in the same scope.+.
void PrepareForRefinement() const
Find which parameters are used and not fixed, for a refinement /optimization.
virtual const CrystVector_REAL & GetLSQDeriv(const unsigned int, RefinablePar &)
Get the first derivative values for the LSQ function, for a given parameter.
bool mHasLimits
Does the refinable parameter need limits (min and max) ?
const void EraseAllParamSet()
Erase all saved refpar sets.
bool mDeleteRefParInDestructor
If true (the default), then all RefinablePar will be deleted when the the object is deleted...
void RestoreParamSet(const unsigned long id)
Restore a saved set of values.
void AssignClock(RefinableObjClock &clock)
REAL GetMax() const
Get the maximum value allowed (if limited)
vector< Restraint * > mvpRestraint
Vector of pointers to the restraints for this object.
REAL GetPeriod() const
Get the period (if periodic)
void RemoveChild(const RefinableObjClock &)
remove a child clock. This also tells the child clock to remove the parent.
RefParDerivStepModel mRefParDerivStepModel
Model followed for derivation.
void Init(const string &name, REAL *refPar, const REAL min, const REAL max, const RefParType *type, RefParDerivStepModel derivMode=REFPAR_DERIV_STEP_RELATIVE, const bool hasLimits=true, const bool isFixed=false, const bool isUsed=true, const bool isPeriodic=false, const REAL humanScale=1., REAL period=1.)
Constructor.
RefinablePar()
Default Constructor.
bool mIsPeriodic
Is the parameter periodic ? If this is the case, then when using the RefinablePar::Mutate() function...
virtual const CrystVector_REAL & GetLSQCalc(const unsigned int) const
Get the current calculated value for the LSQ function.
const string & GetParamSetName(const unsigned long setId) const
Get the name associated to a refpar set.
const RefinableObjClock & GetRefParListClock() const
What was the last time a RefinablePar was added/removed ?
void DeRegister(T &obj)
De-register an object.
void Click()
Click the Clock ! to telle the RefinableObj it has been modified.
void AddParent(RefinableObjClock &) const
Add a 'parent' clock.
ObjRegistry< RefinableObj > & GetSubObjRegistry()
Access to the registry of RefinableObj used by this object.
void CopyAttributes(const RefinablePar &)
Copy all attributes (limits, flags, etc...) from another RefinablePar object.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
output a number as a formatted float:
bool mIsUsed
Is the parameter currently used ?
void DeleteAll()
Delete all objects in the registry.. Use with caution !!
virtual void RandomizeConfiguration()
Randomize Configuration (before a global optimization).
ObjRegistry< RefinableObj > mClientObjRegistry
Registry of RefinableObject using this object.
RefinableObj()
Constructor.
void SetHumanValue(const REAL &)
Current value of parameter, scaled if necessary (for angles) to a human-understandable value...
Restraint: generic class for a restraint of a given model.
ObjRegistry< RefinableObj > mSubObjRegistry
Registry of RefinableObject needed for this object (owned by this object or not)
The base wxCryst class for all RefinableObj objects.
CrystVector_REAL mLSQDeriv
Temporary array used to return derivative values of the LSQ function for given parameters.
const string mName
The name/description for this parameter type.
void MutateTo(const REAL newValue)
Change the current value to the given one.
void ClearParamSet(const unsigned long id) const
Erase the param set with the given id, releasing memory.
virtual const CrystVector_REAL & GetLSQWeight(const unsigned int) const
Get the weight values for the LSQ function.
void SetValue(const REAL value)
of the parameter.
REAL GetHumanScale() const
Human scale for this parameter : for angles, this is equal to 180/pi.
bool operator==(const RefParType *parent) const
returns true if the two types are the same.
bool IsDescendantFromOrSameAs(const RefParType *type) const
Returns true if the parameter is a descendant of 'type'.
void Reset()
Reset a Clock to 0, to force an update.
REAL GetHumanMax() const
Get the maximum value allowed (if limited)
Exception class for ObjCryst++ library.
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
long FindPar(const string &name) const
Find a refinable parameter with a given name.
virtual unsigned int GetNbLSQFunction() const
Number of LSQ functions.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
void SetHumanMin(const REAL)
Set the minimum value allowed (if limited)
void SetMax(const REAL)
Get the maximum value allowed (if limited)
const RefParType * mpParent
the parent for this RefParType (we could easily allow several...)
REAL GetDerivStep() const
Fixed step to use to compute numerical derivative.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
Generic class for parameters of refinable objects.
RefObjOpt()
Constructor for the option.
virtual const string & GetName() const
Name of the object.
REAL GetGlobalOptimStep() const
Maximum step to use during Global Optimization algorithms.
bool mHasAssignedClock
Is there a clock associated with this parameter ? If yes, then it must Click() it each time it is mod...
string mName
name of the refinable parameter
void SetHumanMax(const REAL)
Get the maximum value allowed (if limited)
void GetSubRefObjListClockRecursive(ObjRegistry< RefinableObj > ®, RefinableObjClock &clock)
Get the last time any object was added in the recursive list of objects.
void AddRestraint(Restraint *pNewRestraint)
Add a new restraint.
REAL GetParamSet_ParNotFixedHumanValue(const unsigned long setId, const long parNumber) const
Access the (human) value of one refined parameter in a saved set of parameters.
REAL GetValue() const
of the parameter.
vector< RefinablePar * >::iterator RemovePar(RefinablePar *refPar)
Remove a refinable parameter.
Restraint()
Default constructor, sets RefParType to gpRefParTypeObjCryst.
virtual const CrystVector_REAL & GetLSQObs(const unsigned int) const
Get the observed values for the LSQ function.
void SetGlobalOptimStep(const RefParType *type, const REAL step)
Change the maximum step to use during Global Optimization algorithms.
void SetLimitsAbsolute(const string &parName, const REAL min, const REAL max)
Change the limits for a given parameter, giving absolute new limits.
vector< RefinablePar * > mvpRefPar
Vector of pointers to the refinable parameters.
ObjRegistry< RefObjOpt > mOptionRegistry
List of options for this object.
void SetDeleteRefParInDestructor(const bool b)
Set this object not to delete its list of parameters when destroyed.
void SetPeriod(const REAL)
Set the period value (if periodic)
std::map< unsigned int, std::map< RefinablePar *, CrystVector_REAL > > mLSQ_FullDeriv
Temporary map to return the derivative of the LSQ function versus a list of parameters.
void DeRegisterAll()
De-register all objects from the list.
virtual void TagNewBestConfig() const
During a global optimization, tells the object that the current config is the latest "best" config...
void SetHumanScale(const REAL)
Human scale for this parameter : for angles, this is equal to 180/pi.
bool IsUsed() const
Is the parameter used (if not, it is simply irrelevant in the model) ?
class of refinable parameter types.
virtual ~RefinableObj()
Destructor.
virtual void DeRegisterClient(RefinableObj &) const
Deregister an object (which not any more) using this object.
unsigned long CreateParamSet(const string name="") const
Save the current set of refined values in a new set.
void SetName(const string &)
Set the name of the parameter. It should be unique in the RefinableObj.
std::set< const RefinableObjClock * > mvChild
List of 'child' clocks, which will click this clock whenever they are clicked.
int mOptimizationDepth
Is the object being refined or optimized ? if mOptimizationDepth=0, no optimization is taking place...
void UnFixAllPar()
UnFix All parameters.
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
void AddOption(RefObjOpt *opt)
void SetGlobalOptimStep(const REAL)
Maximum step to use during Global Optimization algorithms.
REAL mSigma
Calculated sigma on value.
virtual void SetName(const string &name)
Name of the object.
void SetLimitsAbsolute(const REAL min, const REAL max)
Change the limits for this object, giving absolute new limits.
REAL mMin
Hard lower and upper limits.