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

ObjCryst::RefinablePar Class Reference

Generic class for parameters of refinable objects. More...

Inheritance diagram for ObjCryst::RefinablePar:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

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

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

Destructor & Constructors
 RefinablePar ()
 Default Constructor.

 RefinablePar (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 (const RefinablePar &ref)
 Copy Constructor.

 ~RefinablePar ()
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.

void CopyAttributes (const RefinablePar &)
 Copy all attributes (limits, flags, etc...) from another RefinablePar object.

Access & change the current value of the parameter
REAL GetValue () const
 of the parameter.

void SetValue (const REAL value)
 of the parameter.

const REAL & GetHumanValue () const
 Current value of parameter, scaled if necessary (for angles) to a human-understandable value.

void SetHumanValue (const REAL &)
 Current value of parameter, scaled if necessary (for angles) to a human-understandable value.

void Mutate (const REAL mutateValue)
 Add the given amount to the parameter current value.

void MutateTo (const REAL newValue)
 Change the current value to the given one.

REAL GetSigma () const
REAL GetHumanSigma () const
void SetSigma (const REAL)
General info
string GetName () const
 Get the parameter's name.

void SetName (const string &)
 Set the name of the parameter. It should be unique in the RefinableObj.

void Print () const
bool IsFixed () const
void SetIsFixed (const bool)
bool IsLimited () const
void SetIsLimited (const bool)
bool IsUsed () const
 Is the parameter used (if not, it is simply irrelevant in the model) ?

void SetIsUsed (const bool)
 Is the parameter used (if not, it is simply irrelevant in the model) ?

bool IsPeriodic () const
void SetIsPeriodic (const bool, REAL period=1)
REAL GetHumanScale () const
 Human scale for this parameter : for angles, this is equal to 180/pi.

void SetHumanScale (const REAL)
 Human scale for this parameter : for angles, this is equal to 180/pi.

Min, max values
REAL GetMin () const
 Minimum value allowed (if limited or periodic).

void SetMin (const REAL)
 Set the Minimum value allowed (if limited).

REAL GetHumanMin () const
 Get the minimum value allowed (if limited).

void SetHumanMin (const REAL)
 Set the minimum value allowed (if limited).

REAL GetMax () const
 Get the maximum value allowed (if limited).

void SetMax (const REAL)
 Get the maximum value allowed (if limited).

REAL GetHumanMax () const
 Get the maximum value allowed (if limited).

void SetHumanMax (const REAL)
 Get the maximum value allowed (if limited).

REAL GetPeriod () const
 Get the period (if periodic).

void SetPeriod (const REAL)
 Set the period value (if periodic).

Steps during refinement
REAL GetDerivStep () const
 Fixed step to use to compute numerical derivative.

void SetDerivStep (const REAL)
 Fixed step to use to compute numerical derivative.

REAL GetGlobalOptimStep () const
 Maximum step to use during Global Optimization algorithms.

void SetGlobalOptimStep (const REAL)
 Maximum step to use during Global Optimization algorithms.

Parameter's Clock
void AssignClock (RefinableObjClock &clock)
Change Limits
void SetLimitsAbsolute (const REAL min, const REAL max)
 Change the limits for this object, giving absolute new limits.

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.

void SetLimitsProportional (const REAL min, const REAL max)
 Change the limits for this object, proportionnaly to the current value.


Private Member Functions

void Click ()
 Click the Clock ! to telle the RefinableObj it has been modified.


Private Attributes

string mName
 name of the refinable parameter

REAL * mpValue
 Pointer to the refinable value.

REAL mMin
 Hard lower and upper limits.

REAL mMax
 Hard lower and upper limits.

bool mHasLimits
 Does the refinable parameter need limits (min and max) ?

bool mIsFixed
 is the parameter currently fixed ?

bool mIsUsed
 Is the parameter currently used ?

bool mIsPeriodic
 Is the parameter periodic ? If this is the case, then when using the RefinablePar::Mutate() function, if the parameter goes beyond its limits, it will be shifted by the value of its period.

REAL mPeriod
 Period value (if relevant).

REAL mGlobalOptimStep
 Step to use for global method search (simulated annealing,...).

REAL mDerivStep
 Step to use for numerical derivative calculation.

RefParDerivStepModel mRefParDerivStepModel
 Model followed for derivation.

REAL mSigma
 Calculated sigma on value.

REAL mHumanScale
 Scale to be used to display 'human' value.

bool mHasAssignedClock
 Is there a clock associated with this parameter ? If yes, then it must Click() it each time it is modified.

RefinableObjClockmpClock

Friends

class RefinableObj

Detailed Description

Generic class for parameters of refinable objects.

These must be continuous.

Todo:
: define parameters using equations between parameters.

: for complex objects with lots of parameters, give the possibility to define vectors of parameters, all with the same properties, to reduce memory usage.


Constructor & Destructor Documentation

ObjCryst::RefinablePar::RefinablePar  ) 
 

Default Constructor.

ObjCryst::RefinablePar::RefinablePar 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.

name: the name of the parameter
refPar: the address of the refined parameter
min,max: the minimum & maximum value for this parameter. Only used
if the parameter is limited.
type: the type (category) of refinable parameter. This is used to (de)activate
groups of parameters.
derivMode: to compute numerical (partial) derivatives, the step used is either
an absolute (fixed) value, or it can be proportionnal to the current value of the parameter.
hasLimits: if true, then the parameter cannot exceed its limits.
isFixed: if true, the parameter cannot be refined.
isUsed: if false, then the parameter does not affect in any way the refined object,
and thus is simply ignored and should never appear to the user.
isPeriodic: if true, then when the parameter exceeds one of its limits, it is
shifted by the period (=max-min), in order to be back to the allowed [min,max] range.
humanScale:this is the scale which should be used to display the value to the
end program user. This is mostly used for angles: the values are stored in radians, so that a scale equal to 180/pi must be used for a 'human-understandable' value. Use the RefinablePar::HumanValue() in order to get this value. By default it is equal to 1.0 (no scaling required).

ObjCryst::RefinablePar::RefinablePar const RefinablePar ref  ) 
 

Copy Constructor.

ObjCryst::RefinablePar::~RefinablePar  ) 
 


Member Function Documentation

void ObjCryst::RefinablePar::AssignClock RefinableObjClock clock  ) 
 

For internal use only.

Assign a clock to this parameter. Any time this parameter is modified, the clock will be ticked !

void ObjCryst::RefinablePar::Click  )  [private]
 

Click the Clock ! to telle the RefinableObj it has been modified.

void ObjCryst::RefinablePar::CopyAttributes const RefinablePar  ) 
 

Copy all attributes (limits, flags, etc...) from another RefinablePar object.

This is useful in RefinableObj copy constructors. Everything is copied but the pointer to the value refined, and the pointer to the clock.

REAL ObjCryst::RefinablePar::GetDerivStep  )  const
 

Fixed step to use to compute numerical derivative.

REAL ObjCryst::RefinablePar::GetGlobalOptimStep  )  const
 

Maximum step to use during Global Optimization algorithms.

REAL ObjCryst::RefinablePar::GetHumanMax  )  const
 

Get the maximum value allowed (if limited).

REAL ObjCryst::RefinablePar::GetHumanMin  )  const
 

Get the minimum value allowed (if limited).

REAL ObjCryst::RefinablePar::GetHumanScale  )  const
 

Human scale for this parameter : for angles, this is equal to 180/pi.

REAL ObjCryst::RefinablePar::GetHumanSigma  )  const
 

const REAL& ObjCryst::RefinablePar::GetHumanValue  )  const
 

Current value of parameter, scaled if necessary (for angles) to a human-understandable value.

REAL ObjCryst::RefinablePar::GetMax  )  const
 

Get the maximum value allowed (if limited).

REAL ObjCryst::RefinablePar::GetMin  )  const
 

Minimum value allowed (if limited or periodic).

string ObjCryst::RefinablePar::GetName  )  const
 

Get the parameter's name.

REAL ObjCryst::RefinablePar::GetPeriod  )  const
 

Get the period (if periodic).

REAL ObjCryst::RefinablePar::GetSigma  )  const
 

REAL ObjCryst::RefinablePar::GetValue  )  const
 

of the parameter.

Use the The Mutate() and MutateTo() function to change this value.

void ObjCryst::RefinablePar::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.

name: the name of the parameter
refPar: the address of the refined parameter
min,max: the minimum & maximum value for this parameter. Only used
if the parameter is limited.
type: the type (category) of refinable parameter. This is used to (de)activate
groups of parameters.
derivMode: to compute numerical (partial) derivatives, the step used is either
an absolute (fixed) value, or it can be proportionnal to the current value of the parameter.
hasLimits: if true, then the parameter cannot exceed its limits.
isFixed: if true, the parameter cannot be refined.
isUsed: if false, then the parameter does not affect in any way the refined object,
and thus is simply ignored and should never appear to the user.
isPeriodic: if true, then when the parameter exceeds one of its limits, it is
shifted by the period (=max-min), in order to be back to the allowed [min,max] range.
humanScale:this is the scale which should be used to display the value to the
end program user. This is mostly used for angles: the values are stored in radians, so that a scale equal to 180/pi must be used for a 'human-understandable' value. Use the RefinablePar::HumanValue() in order to get this value. By default it is equal to 1.0 (no scaling required).

bool ObjCryst::RefinablePar::IsFixed  )  const
 

bool ObjCryst::RefinablePar::IsLimited  )  const
 

bool ObjCryst::RefinablePar::IsPeriodic  )  const
 

bool ObjCryst::RefinablePar::IsUsed  )  const
 

Is the parameter used (if not, it is simply irrelevant in the model) ?

void ObjCryst::RefinablePar::Mutate const REAL  mutateValue  ) 
 

Add the given amount to the parameter current value.

If limit is hit, set to limit. If the limit is hit and the parameter is periodic, shift by period to bring back to allowed values.

Warning:
Will throw an exception if the parameter is defined by an equation.

void ObjCryst::RefinablePar::MutateTo const REAL  newValue  ) 
 

Change the current value to the given one.

If the limit is hit, then set to the limit (unless the pameter is periodic, then shift by the period amount back to allowed values).

Warning:
Will throw an exception if the parameter is defined by an equation.

void ObjCryst::RefinablePar::Print  )  const
 

void ObjCryst::RefinablePar::SetDerivStep const  REAL  ) 
 

Fixed step to use to compute numerical derivative.

void ObjCryst::RefinablePar::SetGlobalOptimStep const  REAL  ) 
 

Maximum step to use during Global Optimization algorithms.

void ObjCryst::RefinablePar::SetHumanMax const  REAL  ) 
 

Get the maximum value allowed (if limited).

void ObjCryst::RefinablePar::SetHumanMin const  REAL  ) 
 

Set the minimum value allowed (if limited).

void ObjCryst::RefinablePar::SetHumanScale const  REAL  ) 
 

Human scale for this parameter : for angles, this is equal to 180/pi.

void ObjCryst::RefinablePar::SetHumanValue const REAL &   ) 
 

Current value of parameter, scaled if necessary (for angles) to a human-understandable value.

void ObjCryst::RefinablePar::SetIsFixed const  bool  ) 
 

void ObjCryst::RefinablePar::SetIsLimited const  bool  ) 
 

void ObjCryst::RefinablePar::SetIsPeriodic const  bool,
REAL  period = 1
 

void ObjCryst::RefinablePar::SetIsUsed const  bool  ) 
 

Is the parameter used (if not, it is simply irrelevant in the model) ?

void ObjCryst::RefinablePar::SetLimitsAbsolute const REAL  min,
const REAL  max
 

Change the limits for this object, giving absolute new limits.

void ObjCryst::RefinablePar::SetLimitsProportional const REAL  min,
const REAL  max
 

Change the limits for this object, proportionnaly to the current value.

min should be < 1. and max > 1.

void ObjCryst::RefinablePar::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.

void ObjCryst::RefinablePar::SetMax const  REAL  ) 
 

Get the maximum value allowed (if limited).

void ObjCryst::RefinablePar::SetMin const  REAL  ) 
 

Set the Minimum value allowed (if limited).

void ObjCryst::RefinablePar::SetName const string &   ) 
 

Set the name of the parameter. It should be unique in the RefinableObj.

void ObjCryst::RefinablePar::SetPeriod const  REAL  ) 
 

Set the period value (if periodic).

void ObjCryst::RefinablePar::SetSigma const  REAL  ) 
 

void ObjCryst::RefinablePar::SetValue const REAL  value  ) 
 

of the parameter.

Use the The Mutate() and MutateTo() function to change this value.

void ObjCryst::RefinablePar::XMLInput istream &  is,
const XMLCrystTag tag
 

XMLInput From stream.

void ObjCryst::RefinablePar::XMLOutput ostream &  os,
int  indent = 0
const
 

XMLOutput to stream in well-formed XML.

this will save the fixed & limited flags, as well as limits. In this function the name used is that of the RefPar.

void ObjCryst::RefinablePar::XMLOutput ostream &  os,
const string &  name,
int  indent = 0
const
 

XMLOutput to stream in well-formed XML.

this will save the fixed & limited flags, as well as limits

Parameters:
name the name to use instead of the RefPar name.


Friends And Related Function Documentation

friend class RefinableObj [friend]
 


Member Data Documentation

REAL ObjCryst::RefinablePar::mDerivStep [private]
 

Step to use for numerical derivative calculation.

REAL ObjCryst::RefinablePar::mGlobalOptimStep [private]
 

Step to use for global method search (simulated annealing,...).

bool ObjCryst::RefinablePar::mHasAssignedClock [private]
 

Is there a clock associated with this parameter ? If yes, then it must Click() it each time it is modified.

bool ObjCryst::RefinablePar::mHasLimits [private]
 

Does the refinable parameter need limits (min and max) ?

REAL ObjCryst::RefinablePar::mHumanScale [private]
 

Scale to be used to display 'human' value.

This is for angular parameters: the computer stores values in radians, whil the user only understands degrees. So a scale factor of 180/pi is necessary.

bool ObjCryst::RefinablePar::mIsFixed [private]
 

is the parameter currently fixed ?

bool ObjCryst::RefinablePar::mIsPeriodic [private]
 

Is the parameter periodic ? If this is the case, then when using the RefinablePar::Mutate() function, if the parameter goes beyond its limits, it will be shifted by the value of its period.

bool ObjCryst::RefinablePar::mIsUsed [private]
 

Is the parameter currently used ?

REAL ObjCryst::RefinablePar::mMax [private]
 

Hard lower and upper limits.

REAL ObjCryst::RefinablePar::mMin [private]
 

Hard lower and upper limits.

string ObjCryst::RefinablePar::mName [private]
 

name of the refinable parameter

RefinableObjClock* ObjCryst::RefinablePar::mpClock [private]
 

REAL ObjCryst::RefinablePar::mPeriod [private]
 

Period value (if relevant).

REAL* ObjCryst::RefinablePar::mpValue [private]
 

Pointer to the refinable value.

RefParDerivStepModel ObjCryst::RefinablePar::mRefParDerivStepModel [private]
 

Model followed for derivation.

REAL ObjCryst::RefinablePar::mSigma [private]
 

Calculated sigma on value.


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