Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ObjCryst::RefinableObj Class Reference

Generic Refinable Object. More...

Inheritance diagram for ObjCryst::RefinableObj:

Inheritance graph
[legend]
Collaboration diagram for ObjCryst::RefinableObj:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RefinableObj ()
 Constructor.

 RefinableObj (const bool internalUseOnly)
 Constructor.

 RefinableObj (const RefinableObj &old)
 Defined not implemented...

virtual ~RefinableObj ()
 Destructor.

virtual const string & GetClassName () const
 Name for this class ("RefinableObj", "Crystal",...).

virtual const string & GetName () const
 Name of the object.

virtual void SetName (const string &name)
 Name of the object.

void operator= (const RefinableObj &old)
 Defined not implemented...

void PrepareForRefinement () const
 Find which parameters are used and not fixed, for a refinement /optimization.

void FixAllPar ()
 Fix All parameters.

void UnFixAllPar ()
 UnFix All parameters.

void SetParIsFixed (const long parIndex, const bool fix)
 Fix/un-fix one parameter from its #.

void SetParIsFixed (const string &parName, const bool fix)
 Fix/un-fix one parameter from its name.

void SetParIsFixed (const RefParType *type, const bool fix)
 Fix/un-fix one family of parameters.

void SetParIsUsed (const string &parName, const bool use)
 Set whether a parameter is used.

void SetParIsUsed (const RefParType *type, const bool use)
 Set whether a family of parameters is used.

long GetNbPar () const
 Total number of refinable parameter in the object.

long GetNbParNotFixed () const
 Total number of non-fixed parameters. Is initialized by PrepareForRefinement().

RefinableParGetPar (const long i)
 Access all parameters in the order they were inputted.

const RefinableParGetPar (const long i) const
 Access all parameters in the order they were inputted.

RefinableParGetPar (const string &name)
 Access all parameters from their name.

const RefinableParGetPar (const string &name) const
 Access all parameters from their name.

RefinableParGetPar (const REAL *)
 Access parameter from its adress.

const RefinableParGetPar (const REAL *) const
 Access parameter from its adress.

RefinableParGetParNotFixed (const long i)
 Access all parameters in the order they were inputted, skipping fixed parameters.

const RefinableParGetParNotFixed (const long i) const
 Access all parameters in the order they were inputed, skipping fixed parameters.

void AddPar (const RefinablePar &newRefPar)
 Add a refinable parameter.

void AddPar (RefinablePar *newRefPar)
 Add a refinable parameter.

void AddPar (RefinableObj &newRefParList)
 Add all the parameters in another RefinableObj.

vector< RefinablePar
* >::iterator 
RemovePar (RefinablePar *refPar)
 Remove a refinable parameter.

virtual void Print () const
unsigned long CreateParamSet (const string name="") const
 Save the current set of refined values in a new set.

void ClearParamSet (const unsigned long id) const
 Erase the param set with the given id, releasing memory.

void SaveParamSet (const unsigned long id) const
 Save the current set of refined values over a previously-created set of saved values.

void RestoreParamSet (const unsigned long id)
 Restore a saved set of values.

const CrystVector_REAL & GetParamSet (const unsigned long setId) const
 Access one save refpar set.

CrystVector_REAL & GetParamSet (const unsigned long setId)
 Access one save refpar set.

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.

const void EraseAllParamSet ()
 Erase all saved refpar sets.

const string & GetParamSetName (const unsigned long setId) const
 Get the name associated to a refpar set.

void SetLimitsAbsolute (const string &parName, const REAL min, const REAL max)
 Change the limits for a given parameter, giving absolute new limits.

void SetLimitsAbsolute (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, giving absolute new limits.

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 +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0.

void SetLimitsRelative (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max).

void SetLimitsProportional (const string &parName, const REAL min, const REAL max)
 Change the limits for a given parameter, proportionnaly to the current value.

void SetLimitsProportional (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, proportionnaly to their current value.

void SetGlobalOptimStep (const RefParType *type, const REAL step)
 Change the maximum step to use during Global Optimization algorithms.

ObjRegistry< RefinableObj > & GetSubObjRegistry ()
 Access to the registry of RefinableObj used by this object.

const ObjRegistry< RefinableObj > & GetSubObjRegistry () const
 Access to the registry of RefinableObj used by this object.

virtual void RegisterClient (RefinableObj &) const
 Register a new object using this object.

virtual void DeRegisterClient (RefinableObj &) const
 Deregister an object (which not any more) using this object.

bool IsBeingRefined () const
 Is the object being refined ? (Can be refined by one algorithm at a time only.).

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.

virtual void EndOptimization ()
 This should be called by any optimization class at the end of an optimization.

virtual void RandomizeConfiguration ()
 Randomize Configuration (before a global optimization).

virtual void GlobalOptRandomMove (const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
 Make a random move of the current configuration.

void BeginGlobalOptRandomMove ()
 Raise a flag, to be sure not to make a random change more than once in each RefinableObj.

virtual REAL GetLogLikelihood () const
 Get -log(likelihood) of the current configuration for the object.

virtual unsigned int GetNbLSQFunction () const
 Number of LSQ functions.

virtual const CrystVector_REAL & GetLSQCalc (const unsigned int) const
 Get the current calculated value for the LSQ function.

virtual const CrystVector_REAL & GetLSQObs (const unsigned int) const
 Get the observed values for the LSQ function.

virtual const CrystVector_REAL & GetLSQWeight (const unsigned int) const
 Get the weight values for the LSQ function.

virtual const CrystVector_REAL & GetLSQDeriv (const unsigned int, RefinablePar &)
 Get the first derivative values for the LSQ function, for a given parameter.

void ResetParList ()
 Re-init the list of refinable parameters, removing all parameters.

virtual void XMLOutput (ostream &os, int indent=0) const
 Output to stream in well-formed XML.

virtual void XMLInput (istream &is, const XMLCrystTag &tag)
 Input From stream.

virtual void UpdateDisplay () const
 If there is an interface, this should be automatically be called each time there is a 'new, significant' configuration to report.

unsigned int GetNbOption () const
 Number of Options for this object.

RefObjOptGetOption (const unsigned int i)
 Access to the options.

const RefObjOptGetOption (const unsigned int i) const
 const access to the options

virtual void GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
 Get the gene group assigned to each parameter.

void SetDeleteRefParInDestructor (const bool b)
 Set this object not to delete its list of parameters when destroyed.

const RefinableObjClockGetRefParListClock () const
 What was the last time a RefinablePar was added/removed ?

virtual REAL GetRestraintCost () const
 Get the restraint cost (overall penalty of all restraints).

void AddRestraint (Restraint *pNewRestraint)
 Add a new restraint.

vector< Restraint * >::iterator RemoveRestraint (Restraint *pRestraint)
 Remove a restraint from the list of known restraints.

virtual void TagNewBestConfig () const
 During a global optimization, tells the object that the current config is the latest "best" config.

const RefinableObjClockGetClockMaster () const
 This clocks records _any_ change in the object. See refinableObj::mClockMaster.


Protected Member Functions

long FindPar (const string &name) const
 Find a refinable parameter with a given name.

long FindPar (const REAL *) const
 Find a refinable parameter from the adress of its value.

void AddSubRefObj (RefinableObj &)
 Add an object in the registry of used objects.

void RemoveSubRefObj (RefinableObj &)
 Remove an object in the registry of used objects.

void AddOption (RefObjOpt *opt)
 Add an option for this parameter.

virtual void Prepare ()
 Prepare everything (if necessary) for an optimization/calculation.

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).


Protected Attributes

string mName
 Name for this RefinableObject. Should be unique, at least in the same scope.+.

vector< RefinablePar * > mvpRefPar
 Vector of pointers to the refinable parameters.

vector< Restraint * > mvpRestraint
 Vector of pointers to the restraints for this object.

map< unsigned long, pair<
CrystVector_REAL, string > > 
mvpSavedValuesSet
 Map of (index,pointers to arrays) used to save sets of values for all parameters.

long mNbRefParNotFixed
 Total of not-fixed parameters.

CrystVector_long mRefparNotFixedIndex
 Index of not-fixed parameters.

bool mIsbeingRefined
 Is the object being refined ?

ObjRegistry< RefinableObjmSubObjRegistry
 Registry of RefinableObject needed for this object (owned by this object or not).

ObjRegistry< RefinableObjmClientObjRegistry
 Registry of RefinableObject using this object.

ObjRegistry< RefObjOptmOptionRegistry
 List of options for this object.

bool mDeleteRefParInDestructor
 If true (the default), then all RefinablePar will be deleted when the the object is deleted.

RefinableObjClock mRefParListClock
 Last time the RefinableParList was modified (a parameter added or removed).

bool mRandomMoveIsDone
CrystVector_REAL mLSQDeriv
 Temporary array used to return derivative values of the LSQ function for given parameters.

RefinableObjClock mClockMaster
 Master clock, which is changed whenever the object has been altered.


Detailed Description

Generic Refinable Object.

This is basically a list of refinable parameters, with other basic common properties such as a name,. etc... This allows optimization/refinement algorithms to access the parameters without knowing what the object really is.

Todo:
Define more clearly which operations are recursive (ie also modify sub-objects).


Constructor & Destructor Documentation

ObjCryst::RefinableObj::RefinableObj  ) 
 

Constructor.

ObjCryst::RefinableObj::RefinableObj const bool  internalUseOnly  ) 
 

Constructor.

Using internalUseOnly=true will avoid registering the the object to any registry, and thus (for example) no display will be created, nor will this object be automatically be saved.

ObjCryst::RefinableObj::RefinableObj const RefinableObj old  ) 
 

Defined not implemented...

Should never be called (copying the refinable parameters would allow you to modify the input object). Use the default constructor and RefinableObj::AddPar(RefinableObj&) instead.

virtual ObjCryst::RefinableObj::~RefinableObj  )  [virtual]
 

Destructor.


Member Function Documentation

void ObjCryst::RefinableObj::AddOption RefObjOpt opt  )  [protected]
 

Add an option for this parameter.

void ObjCryst::RefinableObj::AddPar RefinableObj newRefParList  ) 
 

Add all the parameters in another RefinableObj.

Parameters are copied, so they should be allocated in the heap.

Warning:
If a copy of another RefinableObj parameter list is made, such as in the OptimizationObj class, make sure that upon deletion of this object the parameters will not be destroyed. To do this use RefinableObj::SetDeleteRefParInDestructor(false).

void ObjCryst::RefinableObj::AddPar RefinablePar newRefPar  ) 
 

Add a refinable parameter.

The parameter is not copied, so it should be allocated in the heap.

void ObjCryst::RefinableObj::AddPar const RefinablePar newRefPar  ) 
 

Add a refinable parameter.

The parameter is copied, so it need only be allocated temporarily.

Deprecated:
Use the next function, which supplies the parameter as a pointer, and avoids a useless copy.

void ObjCryst::RefinableObj::AddRestraint Restraint pNewRestraint  ) 
 

Add a new restraint.

This returns an iterator pointing to the next Restraint in the vector.

void ObjCryst::RefinableObj::AddSubRefObj RefinableObj  )  [protected]
 

Add an object in the registry of used objects.

void ObjCryst::RefinableObj::BeginGlobalOptRandomMove  ) 
 

Raise a flag, to be sure not to make a random change more than once in each RefinableObj.

This calls recursively all sub-objects.

This is necessary since one object may be included in several others. This must be called before making a random configuration change on a list of objects.

virtual void ObjCryst::RefinableObj::BeginOptimization const bool  allowApproximations = false,
const bool  enableRestraints = false
[virtual]
 

This should be called by any optimization class at the begining of an optimization.

This will also check that everything is ready, eg call the RefinableObj::Prepare() function. This also affects all sub-objects.

Note:
this may be called several time for some objects which are used by several other objects.
Parameters:
allowApproximations: if true, then the object can use faster but less precise functions during the optimization. This is useful for global optimization not using derivatives.
enableRestraints: if true, then restrained parameters will be allowed to go beyond theur hard limits. This implies that the algorithm will take into account the cost (penalty) related to the restraints. Objects which do not use restraints will simply ignore this. WARNING: this parameter may be removed with the new likelihood scheme.

Reimplemented in ObjCryst::Crystal, ObjCryst::Molecule, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::TextureMarchDollase, and ObjCryst::ScatteringData.

void ObjCryst::RefinableObj::ClearParamSet const unsigned long  id  )  const
 

Erase the param set with the given id, releasing memory.

unsigned long ObjCryst::RefinableObj::CreateParamSet const string  name = ""  )  const
 

Save the current set of refined values in a new set.

Parameters:
name : the name associated to this set of values. Names should be unique.
Returns:
an number identifying the set of saved values.
Warning:
: there is no limit to the number of parameters sets, so try to release them when you don't need them.

virtual void ObjCryst::RefinableObj::DeRegisterClient RefinableObj  )  const [virtual]
 

Deregister an object (which not any more) using this object.

virtual void ObjCryst::RefinableObj::EndOptimization  )  [virtual]
 

This should be called by any optimization class at the end of an optimization.

This also affects all sub-objects.

Note:
this may be called several time for some objects which are used by several other objects.

Reimplemented in ObjCryst::PowderPatternDiffraction, ObjCryst::ScatteringData, and ObjCryst::ZScatterer.

const void ObjCryst::RefinableObj::EraseAllParamSet  ) 
 

Erase all saved refpar sets.

long ObjCryst::RefinableObj::FindPar const REAL *   )  const [protected]
 

Find a refinable parameter from the adress of its value.

long ObjCryst::RefinableObj::FindPar const string &  name  )  const [protected]
 

Find a refinable parameter with a given name.

map<unsigned long,pair<CrystVector_REAL,string> >::iterator ObjCryst::RefinableObj::FindParamSet unsigned long  id  )  const [protected]
 

Find a parameter set with a given id (and check if it is there).

void ObjCryst::RefinableObj::FixAllPar  ) 
 

Fix All parameters.

virtual const string& ObjCryst::RefinableObj::GetClassName  )  const [virtual]
 

Name for this class ("RefinableObj", "Crystal",...).

This is only useful to distinguish different classes when picking up objects from the RefinableObj Global Registry

Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::Molecule, ObjCryst::PowderPatternComponent, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::PowderPatternBackgroundBayesianMinimiser, ObjCryst::ReflectionProfilePseudoVoigt, ObjCryst::ReflectionProfileDoubleExponentialPseudoVoigt, ObjCryst::Scatterer, ObjCryst::TextureMarchDollase, ObjCryst::Radiation, ObjCryst::ScatteringPower, ObjCryst::ScatteringPowerAtom, ObjCryst::ScatteringPowerSphere, ObjCryst::UnitCell, and ObjCryst::ZScatterer.

const RefinableObjClock& ObjCryst::RefinableObj::GetClockMaster  )  const
 

This clocks records _any_ change in the object. See refinableObj::mClockMaster.

virtual void ObjCryst::RefinableObj::GetGeneGroup const RefinableObj obj,
CrystVector_uint &  groupIndex,
unsigned int &  firstGroup
const [virtual]
 

Get the gene group assigned to each parameter.

Each parameter (a gene in terms of genetic algorithms) can be assigned to a gene group. Thus when mating two configurations, genes will be exchanged by groups. By default (in the base RefinabeObj class), each parameter is alone in its group. Derived classes can group genes for a better s** life.

The number identifying a gene group only has a meaning in a given object. It can also change on subsequent calls, and thus is not unique.

Parameters:
obj the , supplied by an algorithm class (OptimizationObj,..), which contains a list of parameters, some of which (but possibly all or none) are parameters belonging to this object.
groupIndex a vector of unsigned integers, one for each parameter in the input object, giving an unsigned integer value as gene group index. At the beginning this vector should contain only zeros (no group assigned).
firstGroup this is the number of groups which have already been assigned, plus one. The gene groups returned by this object will start from this value, and increment firstGroup for each gene group used, so that different RefinableObj cannot share a gene group.
Note:
this function is not optimized, and should only be called at the beginning of a refinement.

Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::ScatteringPower, and ObjCryst::ZScatterer.

virtual REAL ObjCryst::RefinableObj::GetLogLikelihood  )  const [virtual]
 

Get -log(likelihood) of the current configuration for the object.

By default (no likelihood evaluation available), this is equal to 0.

This call should not be recursive, it is the task of the algorithm to get the sum of likelihoods for all objects invlolved.

Note:
contrary to the old "Cost Function" approach, with log(Likelihood) there is no 'choice' of cost function, so that it is the task of the object to give the optimized likelihood (possibly with user options).
Warning:
: this is in under heavy development, so expect changes...

Reimplemented in ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::Molecule, ObjCryst::PowderPattern, ObjCryst::PowderPatternBackgroundBayesianMinimiser, and ObjCryst::ZMoveMinimizer.

virtual const CrystVector_REAL& ObjCryst::RefinableObj::GetLSQCalc const unsigned  int  )  const [virtual]
 

Get the current calculated value for the LSQ function.

Reimplemented in ObjCryst::DiffractionDataSingleCrystal, and ObjCryst::PowderPattern.

virtual const CrystVector_REAL& ObjCryst::RefinableObj::GetLSQDeriv const unsigned  int,
RefinablePar
[virtual]
 

Get the first derivative values for the LSQ function, for a given parameter.

Note that the default method in the base RefinableObj class is to use numerical derivatives, so it should be overridden for better precision.

Todo:
This should be a const method, and the given RefPar should be const too...

virtual const CrystVector_REAL& ObjCryst::RefinableObj::GetLSQObs const unsigned  int  )  const [virtual]
 

Get the observed values for the LSQ function.

Reimplemented in ObjCryst::DiffractionDataSingleCrystal, and ObjCryst::PowderPattern.

virtual const CrystVector_REAL& ObjCryst::RefinableObj::GetLSQWeight const unsigned  int  )  const [virtual]
 

Get the weight values for the LSQ function.

Reimplemented in ObjCryst::DiffractionDataSingleCrystal, and ObjCryst::PowderPattern.

virtual const string& ObjCryst::RefinableObj::GetName  )  const [virtual]
 

Name of the object.

Reimplemented in ObjCryst::TextureMarchDollase.

virtual unsigned int ObjCryst::RefinableObj::GetNbLSQFunction  )  const [virtual]
 

Number of LSQ functions.

Reimplemented in ObjCryst::DiffractionDataSingleCrystal, and ObjCryst::PowderPattern.

unsigned int ObjCryst::RefinableObj::GetNbOption  )  const
 

Number of Options for this object.

long ObjCryst::RefinableObj::GetNbPar  )  const
 

Total number of refinable parameter in the object.

Note that some may be actually fixed or even not used !! For refinement use PrepareForRefinement(), NbRefParNotFixed(), and ParNotFixed(i)

long ObjCryst::RefinableObj::GetNbParNotFixed  )  const
 

Total number of non-fixed parameters. Is initialized by PrepareForRefinement().

const RefObjOpt& ObjCryst::RefinableObj::GetOption const unsigned int  i  )  const
 

const access to the options

RefObjOpt& ObjCryst::RefinableObj::GetOption const unsigned int  i  ) 
 

Access to the options.

const RefinablePar& ObjCryst::RefinableObj::GetPar const REAL *   )  const
 

Access parameter from its adress.

RefinablePar& ObjCryst::RefinableObj::GetPar const REAL *   ) 
 

Access parameter from its adress.

const RefinablePar& ObjCryst::RefinableObj::GetPar const string &  name  )  const
 

Access all parameters from their name.

RefinablePar& ObjCryst::RefinableObj::GetPar const string &  name  ) 
 

Access all parameters from their name.

const RefinablePar& ObjCryst::RefinableObj::GetPar const long  i  )  const
 

Access all parameters in the order they were inputted.

RefinablePar& ObjCryst::RefinableObj::GetPar const long  i  ) 
 

Access all parameters in the order they were inputted.

CrystVector_REAL& ObjCryst::RefinableObj::GetParamSet const unsigned long  setId  ) 
 

Access one save refpar set.

Parameters:
setId : the number identifying the set.

const CrystVector_REAL& ObjCryst::RefinableObj::GetParamSet const unsigned long  setId  )  const
 

Access one save refpar set.

Parameters:
setId : the number identifying the set.

REAL ObjCryst::RefinableObj::GetParamSet_ParNotFixedHumanValue const unsigned long  setId,
const long  parNumber
const
 

Access the (human) value of one refined parameter in a saved set of parameters.

For internal use only.

Parameters:
setId : the number identifying the set.
parNumber : the number identifying the parameter in the list of refined parameters
Returns:
if parNumber=5 and setId=37, then the returned value will be the value (scaled if it is an angle) value of the 5th not-fixed parameter in the saved set #37.

const string& ObjCryst::RefinableObj::GetParamSetName const unsigned long  setId  )  const
 

Get the name associated to a refpar set.

Parameters:
setId : the number identifying the set.

const RefinablePar& ObjCryst::RefinableObj::GetParNotFixed const long  i  )  const
 

Access all parameters in the order they were inputed, skipping fixed parameters.

Must call PrepareForRefinement() before !

RefinablePar& ObjCryst::RefinableObj::GetParNotFixed const long  i  ) 
 

Access all parameters in the order they were inputted, skipping fixed parameters.

Must call PrepareForRefinement() before !

const RefinableObjClock& ObjCryst::RefinableObj::GetRefParListClock  )  const
 

What was the last time a RefinablePar was added/removed ?

virtual REAL ObjCryst::RefinableObj::GetRestraintCost  )  const [virtual]
 

Get the restraint cost (overall penalty of all restraints).

By default this returns 0, so this must be overloaded by any object which actually uses restraint.

Note:
Instead, we could return by default the sum of the restraints, but this is dangerous since we want to have derived objects fully responsible for handling restraints.

const ObjRegistry<RefinableObj>& ObjCryst::RefinableObj::GetSubObjRegistry  )  const
 

Access to the registry of RefinableObj used by this object.

ObjRegistry<RefinableObj>& ObjCryst::RefinableObj::GetSubObjRegistry  ) 
 

Access to the registry of RefinableObj used by this object.

virtual void ObjCryst::RefinableObj::GlobalOptRandomMove const REAL  mutationAmplitude,
const RefParType type = gpRefParTypeObjCryst
[virtual]
 

Make a random move of the current configuration.

This is for global optimization algorithms. the moves for each parameter are less than their global optimization step, multiplied by the mutation amplitude.

Warning:
: this makes a random move for the parameter declared for this object, and it is the duty of the object to decide whether the included objects should be moved and how. (eg an algorithm should only call for a move with the top object, and this object decides how he and his sub-objects moves). By default (RefinableObj implementation) all included objects are moved recursively.
RefinableObj::
Parameters:
mutationAmplitude: multiplier for the maximum move amplitude, for all parameters
type: restrain the change exclusively to parameters of a given type (same type or descendant from this RefParType).

Reimplemented in ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::Molecule, ObjCryst::PowderPattern, ObjCryst::TextureMarchDollase, and ObjCryst::ZScatterer.

bool ObjCryst::RefinableObj::IsBeingRefined  )  const
 

Is the object being refined ? (Can be refined by one algorithm at a time only.).

void ObjCryst::RefinableObj::operator= const RefinableObj old  ) 
 

Defined not implemented...

Should never be called

virtual void ObjCryst::RefinableObj::Prepare  )  [protected, virtual]
 

Prepare everything (if necessary) for an optimization/calculation.

Reimplemented in ObjCryst::PowderPatternComponent, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, and ObjCryst::PowderPattern.

void ObjCryst::RefinableObj::PrepareForRefinement  )  const
 

Find which parameters are used and not fixed, for a refinement /optimization.

This must be called before any refinement...

virtual void ObjCryst::RefinableObj::Print  )  const [virtual]
 

Reimplemented in ObjCryst::Atom, ObjCryst::Molecule, ObjCryst::Scatterer, ObjCryst::Radiation, ObjCryst::ScatteringPowerAtom, ObjCryst::ScatteringPowerSphere, and ObjCryst::ZScatterer.

virtual void ObjCryst::RefinableObj::RandomizeConfiguration  )  [virtual]
 

Randomize Configuration (before a global optimization).

This Affects only parameters which are limited and not fixed. The randomization also affects all sub-objects (recursive).

Reimplemented in ObjCryst::Molecule.

virtual void ObjCryst::RefinableObj::RegisterClient RefinableObj  )  const [virtual]
 

Register a new object using this object.

Todo:
: the clients should be const, but are not... This need to be fixed...

vector<RefinablePar *>::iterator ObjCryst::RefinableObj::RemovePar RefinablePar refPar  ) 
 

Remove a refinable parameter.

This returns an iterator to the next parameter in the vector.

vector<Restraint*>::iterator ObjCryst::RefinableObj::RemoveRestraint Restraint pRestraint  ) 
 

Remove a restraint from the list of known restraints.

This does not delete the Restraint object.

void ObjCryst::RefinableObj::RemoveSubRefObj RefinableObj  )  [protected]
 

Remove an object in the registry of used objects.

void ObjCryst::RefinableObj::ResetParList  ) 
 

Re-init the list of refinable parameters, removing all parameters.

This does not delete the RefinablePar if RefinableObj::mDeleteRefParInDestructor is false

void ObjCryst::RefinableObj::RestoreParamSet const unsigned long  id  ) 
 

Restore a saved set of values.

Parameters:
id : the number identifying the set.
Warning:
this only affects parameters which are used and not fixed. Others remain unchanged.

void ObjCryst::RefinableObj::SaveParamSet const unsigned long  id  )  const
 

Save the current set of refined values over a previously-created set of saved values.

Parameters:
id the number identifying the set of saved values.

void ObjCryst::RefinableObj::SetDeleteRefParInDestructor const bool  b  ) 
 

Set this object not to delete its list of parameters when destroyed.

This is used for the RefinableObj in algorithms objects (OptimizationObj), which only hold copies of parameters from the refined objects.

void ObjCryst::RefinableObj::SetGlobalOptimStep const RefParType type,
const REAL  step
 

Change the maximum step to use during Global Optimization algorithms.

void ObjCryst::RefinableObj::SetLimitsAbsolute const RefParType type,
const REAL  min,
const REAL  max
 

Change the limits for a category of parameters, giving absolute new limits.

void ObjCryst::RefinableObj::SetLimitsAbsolute const string &  parName,
const REAL  min,
const REAL  max
 

Change the limits for a given parameter, giving absolute new limits.

void ObjCryst::RefinableObj::SetLimitsProportional const RefParType type,
const REAL  min,
const REAL  max
 

Change the limits for a category of parameters, proportionnaly to their current value.

min should be < 1. and max > 1.

void ObjCryst::RefinableObj::SetLimitsProportional const string &  parName,
const REAL  min,
const REAL  max
 

Change the limits for a given parameter, proportionnaly to the current value.

min should be < 1. and max > 1.

void ObjCryst::RefinableObj::SetLimitsRelative const RefParType type,
const REAL  min,
const REAL  max
 

Change the limits for a category of parameters, 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.

void ObjCryst::RefinableObj::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 +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0.

virtual void ObjCryst::RefinableObj::SetName const string &  name  )  [virtual]
 

Name of the object.

void ObjCryst::RefinableObj::SetParIsFixed const RefParType type,
const bool  fix
 

Fix/un-fix one family of parameters.

void ObjCryst::RefinableObj::SetParIsFixed const string &  parName,
const bool  fix
 

Fix/un-fix one parameter from its name.

void ObjCryst::RefinableObj::SetParIsFixed const long  parIndex,
const bool  fix
 

Fix/un-fix one parameter from its #.

void ObjCryst::RefinableObj::SetParIsUsed const RefParType type,
const bool  use
 

Set whether a family of parameters is used.

void ObjCryst::RefinableObj::SetParIsUsed const string &  parName,
const bool  use
 

Set whether a parameter is used.

virtual void ObjCryst::RefinableObj::TagNewBestConfig  )  const [virtual]
 

During a global optimization, tells the object that the current config is the latest "best" config.

This can be used by the object to make more intellingent random moves (use with caution: highly experimental !).

Reimplemented in ObjCryst::Molecule, ObjCryst::PowderPatternBackground, and ObjCryst::TextureMarchDollase.

void ObjCryst::RefinableObj::UnFixAllPar  ) 
 

UnFix All parameters.

virtual void ObjCryst::RefinableObj::UpdateDisplay  )  const [virtual]
 

If there is an interface, this should be automatically be called each time there is a 'new, significant' configuration to report.

virtual void ObjCryst::RefinableObj::XMLInput istream &  is,
const XMLCrystTag tag
[virtual]
 

Input From stream.

Todo:
Add an bool XMLInputTag(is,tag) function to recognize all the tags from the stream. So that each inherited class can use the XMLInputTag function from its parent (ie take advantage of inheritance). The children class would first try to interpret the tag, then if unsuccessful would pass it to its parent (thus allowing overloading), etc...

Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::Molecule, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::ReflectionProfile, ObjCryst::ReflectionProfilePseudoVoigt, ObjCryst::ReflectionProfileDoubleExponentialPseudoVoigt, ObjCryst::TextureMarchDollase, ObjCryst::Radiation, ObjCryst::ScatteringPowerAtom, ObjCryst::ScatteringPowerSphere, and ObjCryst::ZScatterer.

virtual void ObjCryst::RefinableObj::XMLOutput ostream &  os,
int  indent = 0
const [virtual]
 

Output to stream in well-formed XML.

Todo:
Use inheritance.. as for XMLInputTag()...

Reimplemented in ObjCryst::Atom, ObjCryst::Crystal, ObjCryst::DiffractionDataSingleCrystal, ObjCryst::Molecule, ObjCryst::PowderPatternBackground, ObjCryst::PowderPatternDiffraction, ObjCryst::PowderPattern, ObjCryst::ReflectionProfile, ObjCryst::ReflectionProfilePseudoVoigt, ObjCryst::ReflectionProfileDoubleExponentialPseudoVoigt, ObjCryst::TextureMarchDollase, ObjCryst::Radiation, ObjCryst::ScatteringPowerAtom, ObjCryst::ScatteringPowerSphere, and ObjCryst::ZScatterer.


Member Data Documentation

ObjRegistry<RefinableObj> ObjCryst::RefinableObj::mClientObjRegistry [mutable, protected]
 

Registry of RefinableObject using this object.

This is mutable so that client can modify it (kludge?)

RefinableObjClock ObjCryst::RefinableObj::mClockMaster [protected]
 

Master clock, which is changed whenever the object has been altered.

It should be parent to all clocks recording changes in derived classes.

bool ObjCryst::RefinableObj::mDeleteRefParInDestructor [protected]
 

If true (the default), then all RefinablePar will be deleted when the the object is deleted.

The opposite option (false) should only be used in RefinableObj holding 'copies' of other objects, such as in algorithms.

bool ObjCryst::RefinableObj::mIsbeingRefined [protected]
 

Is the object being refined ?

CrystVector_REAL ObjCryst::RefinableObj::mLSQDeriv [mutable, protected]
 

Temporary array used to return derivative values of the LSQ function for given parameters.

string ObjCryst::RefinableObj::mName [protected]
 

Name for this RefinableObject. Should be unique, at least in the same scope.+.

long ObjCryst::RefinableObj::mNbRefParNotFixed [mutable, protected]
 

Total of not-fixed parameters.

ObjRegistry<RefObjOpt> ObjCryst::RefinableObj::mOptionRegistry [protected]
 

List of options for this object.

Note that these are just references, to options allocated by the object, to have a simple global access to all options

bool ObjCryst::RefinableObj::mRandomMoveIsDone [protected]
 

For internal use only.

This true is false if RefinableObj::GlobalOptRandomMove() has been called since RefinableObj::BeginGlobalOptRandomMove() was called.

RefinableObjClock ObjCryst::RefinableObj::mRefParListClock [protected]
 

Last time the RefinableParList was modified (a parameter added or removed).

CrystVector_long ObjCryst::RefinableObj::mRefparNotFixedIndex [mutable, protected]
 

Index of not-fixed parameters.

ObjRegistry<RefinableObj> ObjCryst::RefinableObj::mSubObjRegistry [protected]
 

Registry of RefinableObject needed for this object (owned by this object or not).

vector<RefinablePar *> ObjCryst::RefinableObj::mvpRefPar [protected]
 

Vector of pointers to the refinable parameters.

vector<Restraint*> ObjCryst::RefinableObj::mvpRestraint [protected]
 

Vector of pointers to the restraints for this object.

This excludes all RefinablePar declared in RefinableObj::mpRefPar, which also are Restraint.

map<unsigned long,pair<CrystVector_REAL,string> > ObjCryst::RefinableObj::mvpSavedValuesSet [mutable, protected]
 

Map of (index,pointers to arrays) used to save sets of values for all parameters.

Currently there is no limit to the number of saved sets.

This is mutable since creating/storing a param set does not affect the 'real' part of the object.


The documentation for this class was generated from the following file:
Generated on Tue Nov 14 15:06:04 2006 for ObjCryst++ by doxygen 1.3.6