Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Mantid::Geometry::ParameterMap Class Reference

Parameter map iterator typedef. More...

#include <ParameterMap.h>

Public Types

using Entry = std::pair< size_t, std::shared_ptr< Parameter > >
 A stored parameter together with the component index of the component it belongs to.
 

Public Member Functions

void add (const IComponent *comp, const std::shared_ptr< Parameter > &par, const std::string *const pDescription=nullptr)
 Method for adding a parameter providing shared pointer to it.
 
void add (const std::string &type, const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &visible="true")
 Method for adding a parameter providing its value as a string.
 
template<class T >
void add (const std::string &type, const IComponent *comp, const std::string &name, const T &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Method for adding a parameter providing its value of a particular type.
 
void addFittingParameter (const IComponent *comp, const std::string &name, const std::string &fittingFunction, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Add a fitting parameter.
 
void clear ()
 Clears the map.
 
void clearParametersByName (const std::string &name)
 Clear any parameters with the given name.
 
void clearParametersByName (const std::string &name, const IComponent *comp)
 Clear any parameters with the given name for a specified component.
 
const std::string diff (const ParameterMap &rhs, const bool &firstDiffOnly=false, const bool relative=false, const double doubleTolerance=Kernel::Tolerance) const
 Output information that helps understanding the mismatch between two parameter maps.
 
bool empty () const
 Returns true if the map is empty, false otherwise.
 
size_t getMemorySize () const
 Get the footprint in memory in bytes.
 
bool operator!= (const ParameterMap &rhs) const
 Inquality comparison operator.
 
bool operator== (const ParameterMap &rhs) const
 Equality comparison operator.
 
 ParameterMap ()
 Default constructor.
 
 ParameterMap (const ParameterMap &other)
 Const constructor.
 
int size () const
 Return the size of the map.
 
void swap (ParameterMap &other)
 method swaps two parameter maps contents each other
 
 ~ParameterMap ()
 
Index-addressed mutators

The same operations addressed by component index instead of by a legacy component pointer, for callers that already hold an index.

These are the primary implementations; the pointer-based overloads above translate and delegate to them. A componentIndex of ComponentInfo::invalidIndex is ignored, so a caller whose lookup failed need not branch.

void add (const std::string &type, const size_t componentIndex, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 
void add (const size_t componentIndex, const std::shared_ptr< Parameter > &par, const std::string *const pDescription=nullptr)
 
void addFittingParameter (const size_t componentIndex, const std::string &name, const std::string &fittingFunction, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 

Static Public Member Functions

static const std::string & pBool ()
 
static const std::string & pDouble ()
 
static const std::string & pInt ()
 
static const std::string & pos ()
 Return string to be used in the map.
 
static const std::string & posx ()
 
static const std::string & posy ()
 
static const std::string & posz ()
 
static const std::string & pQuat ()
 
static const std::string & pString ()
 
static const std::string & pV3D ()
 
static const std::string & rot ()
 
static const std::string & rotx ()
 
static const std::string & roty ()
 
static const std::string & rotz ()
 
static const std::string & scale ()
 

Shared ownership of the 2.0 layers, for ExperimentInfo only.

ExperimentInfo takes co-ownership of whatever setInstrument() built, so that it can serve componentInfo()/detectorInfo()/instrumentMetadata() directly instead of reaching through this map.

Null before setInstrument() has run.

using ComponentIDs = std::vector< Geometry::IComponent * >
 The components of one instrument, by index, as held by its ComponentInfo.
 
using ComponentIndices = std::unordered_map< Geometry::IComponent const *, size_t >
 The reverse of ComponentIDs.
 
std::vector< std::string > m_parameterFileNames
 internal list of parameter files loaded
 
std::shared_ptr< ParameterInfo > m_parameterInfo
 The parameter store, owner of the parameter info.
 
std::shared_ptr< const ComponentIDs > m_domainIds
 The index domain: the components of the instrument this map is attached to, shared with that instrument's ComponentInfo.
 
std::shared_ptr< const ComponentIndices > m_domainIndices
 
std::unordered_map< Geometry::IComponent const *, size_t > m_stagedIndices
 Staging indices, for the components of a detached map, which has no component indices yet.
 
std::vector< ComponentID > m_stagedIds
 
std::shared_ptr< Geometry::DetectorInfo > m_detectorInfo
 The 2.0 instrument layers, co-owned with the ExperimentInfo that built them.
 
std::shared_ptr< Geometry::ComponentInfo > m_componentInfo
 
std::shared_ptr< Geometry::InstrumentMetadata > m_instrumentMetadata
 
const Instrument * m_instrument {nullptr}
 Pointer to the owning instrument for translating detector IDs into detector indices when accessing the DetectorInfo object.
 
const std::shared_ptr< ParameterInfo > & sharedParameterInfo () const
 The parameter store this map owns.
 
const std::shared_ptr< Geometry::ComponentInfo > & sharedComponentInfo () const
 
const std::shared_ptr< Geometry::DetectorInfo > & sharedDetectorInfo () const
 
const std::shared_ptr< Geometry::InstrumentMetadata > & sharedInstrumentMetadata () const
 
std::shared_ptr< ParameterInfo > rekey (std::shared_ptr< const ComponentIDs > componentIds, std::shared_ptr< const ComponentIndices > componentIndices)
 Attach this map to an instrument's component index domain, rekeying its parameters onto the instrument's component indices, and return the resulting store.
 
std::shared_ptr< Parameter > create (const std::string &className, const std::string &name, const std::string &visible="true") const
 Wrapper for ParameterFactory::create to avoid include in header.
 
ParameterMap & operator= (ParameterMap *rhs)
 Assignment operator.
 
void buildInstrumentMetadata ()
 Builds m_instrumentMetadata from m_instrument. Requires m_instrument to be set.
 
void seedLogfileParameters ()
 Copies m_instrument's logfile parameters into the store. Requires the beamline to be built.
 
bool relErr (double x1, double x2, double errorVal) const
 calculate relative error for use in diff
 
size_t domainSize () const
 The number of components in the index domain.
 
size_t indexOf (const IComponent *comp) const
 Index for a component, or ComponentInfo::invalidIndex if this map holds nothing for it.
 
size_t indexForWrite (const IComponent *comp)
 As indexOf(), but allocating a staging index for a component of a detached map seen for the first time.
 
std::string componentName (const size_t index) const
 The name of the component with this store index.
 
std::string componentFullName (const size_t index) const
 The full name of the component with this store index.
 

Helper methods for adding and updating parameter types <br>

void addPositionCoordinate (const IComponent *comp, const std::string &name, const double value, const std::string *const pDescription=nullptr)
 Create or adjust "pos" parameter for a component.
 
void addRotationParam (const IComponent *comp, const std::string &name, const double deg, const std::string *const pDescription=nullptr)
 Create or adjust "rot" parameter for a component.
 
void addDouble (const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds a double value to the parameter map.
 
void addDouble (const IComponent *comp, const std::string &name, double value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds a double value to the parameter map.
 
void addInt (const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds an int value to the parameter map.
 
void addInt (const IComponent *comp, const std::string &name, int value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds an int value to the parameter map.
 
void addBool (const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds a bool value to the parameter map.
 
void addBool (const IComponent *comp, const std::string &name, bool value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds a bool value to the parameter map.
 
void addString (const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
 Adds a std::string value to the parameter map.
 
void addV3D (const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr)
 Adds a Kernel::V3D value to the parameter map.
 
void addV3D (const IComponent *comp, const std::string &name, const Kernel::V3D &value, const std::string *const pDescription=nullptr)
 Adds a Kernel::V3D value to the parameter map.
 
void addQuat (const IComponent *comp, const std::string &name, const Kernel::Quat &value, const std::string *const pDescription=nullptr)
 Adds a Kernel::Quat value to the parameter map.
 
void forceUnsafeSetMasked (const IComponent *comp, bool value)
 Force adding masking information.
 
bool contains (const IComponent *comp, const std::string &name, const std::string &type="") const
 Does the named parameter exist for the given component and type (std::string version)
 
bool contains (const IComponent *comp, const char *name, const char *type="") const
 Does the named parameter exist for the given component (c-string version)
 
bool contains (const IComponent *comp, const Parameter &parameter) const
 Does the given parameter & component combination exist.
 
std::shared_ptr< Parameter > get (const IComponent *comp, const std::string &name, const std::string &type="") const
 Get a parameter with a given name and type (std::string version)
 
std::shared_ptr< Parameter > get (const IComponent *comp, const char *name, const char *type="") const
 Get a parameter with a given name and type (c-string version)
 
std::shared_ptr< Parameter > getByType (const IComponent *comp, const std::string &type) const
 Finds the parameter in the map via the parameter type.
 
std::shared_ptr< Parameter > getRecursive (const IComponent *comp, const std::string &name, const std::string &type="") const
 Use get() recursively to see if can find param in all parents of comp and given type (std::string version)
 
std::shared_ptr< Parameter > getRecursive (const IComponent *comp, const char *name, const char *type="") const
 Use get() recursively to see if can find param in all parents of comp and given type (const char type)
 
std::shared_ptr< Parameter > getRecursiveByType (const IComponent *comp, const std::string &type) const
 Looks recursively upwards in the component tree for the first instance of a parameter with a specified type.
 
std::shared_ptr< Parameter > getRecursiveFittingParameter (const IComponent *comp, const std::string &name, const std::string &fittingFunction) const
 Look for a fitting parameter recursively, picking the one whose embedded FitParameter function name matches fittingFunction.
 
template<class T >
std::vector< T > getType (const std::string &compName, const std::string &name) const
 Get the values of a given parameter of all the components that have the name: compName.
 
const std::string getDescription (const std::string &compName, const std::string &name) const
 Get the component description by name.
 
const std::string getShortDescription (const std::string &compName, const std::string &name) const
 Get the component tooltip by name.
 
std::string getString (const IComponent *comp, const std::string &name, bool recursive=false) const
 Return the value of a parameter as a string.
 
std::vector< std::string > getString (const std::string &compName, const std::string &name) const
 Returns a string parameter as vector's first element if exists and an empty vector if it doesn't.
 
std::vector< double > getDouble (const std::string &compName, const std::string &name) const
 Returns a double parameter as vector's first element if exists and an empty vector if it doesn't.
 
std::vector< Kernel::V3D > getV3D (const std::string &compName, const std::string &name) const
 Returns a Kernel::V3D parameter as vector's first element if exists and an empty vector if it doesn't.
 
std::set< std::string > names (const IComponent *comp) const
 Returns a set with all parameter names for component.
 
std::string asString () const
 Returns a string with all component names, parameter names and values.
 
void copyFromParameterMap (const IComponent *oldComp, const IComponent *newComp, const ParameterMap *oldPMap)
 Copy pairs (oldComp->id,Parameter) to the m_map assigning the new newComp->id.
 
const std::vector< std::string > & getParameterFilenames () const
 Returns a list of all the parameter files loaded.
 
void addParameterFilename (const std::string &filename)
 adds a parameter filename that has been loaded
 
std::vector< Entry > entries () const
 Every stored parameter with its component's index in the instrument this map belongs to, in component-index order.
 
bool hasDetectorInfo (const Instrument *instrument) const
 Only for use by ExperimentInfo.
 
bool hasComponentInfo (const Instrument *instrument) const
 Only for use by ExperimentInfo.
 
const Geometry::DetectorInfo & detectorInfo () const
 Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.
 
Geometry::DetectorInfo & mutableDetectorInfo ()
 Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.
 
const Geometry::ComponentInfo & componentInfo () const
 Only for use by ExperimentInfo. Returns a reference to the ComponentInfo.
 
Geometry::ComponentInfo & mutableComponentInfo ()
 Only for use by ExperimentInfo. Returns a reference to the ComponentInfo.
 
Geometry::InstrumentMetadata const & instrumentMetadata () const
 Only for use by ExperimentInfo. Returns a reference to the InstrumentMetadata.
 
size_t detectorIndex (const detid_t detID) const
 Only for use by Detector. Returns a detector index for a detector ID.
 
size_t componentIndex (const Geometry::ComponentID componentId) const
 
const std::vector< Geometry::ComponentID > & componentIds () const
 
void setInstrument (const Instrument *instrument)
 Only for use by Instrument. Sets the pointer to the owning instrument.
 
void rebuildBeamlineFrom (const ParameterMap &source)
 Rebuild the 2.0 layers for a map that was copy-constructed from source.
 
static std::string asString (const std::vector< Entry > &entries, const ComponentInfo &componentInfo, const DetectorInfo &detectorInfo)
 Returns the same for the given parameters, naming their components from the given layers.
 
static std::string asStringEntry (const std::string &component, const Parameter &parameter)
 Returns the asString() entry for one parameter of a component, given as "detID:<id>" or by full name.
 
static void saveNexus (Nexus::File *file, const std::string &group, const std::string &contents)
 Persist a representation of a Parameter map, as given by asString(), to the open Nexus file.
 

Detailed Description

Parameter map iterator typedef.

ParameterMap class.

Holds the parameters of modified (parametrized) instrument components. ParameterMap has a number of 'add' methods for adding parameters of different types.

Author
Roman Tolchenov, Tessella Support Services plc
Date
2/12/2008

Definition at line 41 of file ParameterMap.h.

Member Typedef Documentation

◆ ComponentIDs

The components of one instrument, by index, as held by its ComponentInfo.

Definition at line 342 of file ParameterMap.h.

◆ ComponentIndices

using Mantid::Geometry::ParameterMap::ComponentIndices = std::unordered_map<Geometry::IComponent const *, size_t>

The reverse of ComponentIDs.

Definition at line 344 of file ParameterMap.h.

◆ Entry

using Mantid::Geometry::ParameterMap::Entry = std::pair<size_t, std::shared_ptr<Parameter> >

A stored parameter together with the component index of the component it belongs to.

Definition at line 44 of file ParameterMap.h.

Constructor & Destructor Documentation

◆ ParameterMap() [1/2]

Mantid::Geometry::ParameterMap::ParameterMap ( )

Default constructor.

Definition at line 66 of file ParameterMap.cpp.

◆ ParameterMap() [2/2]

Mantid::Geometry::ParameterMap::ParameterMap ( const ParameterMap &  other)

Const constructor.

Definition at line 68 of file ParameterMap.cpp.

◆ ~ParameterMap()

Mantid::Geometry::ParameterMap::~ParameterMap ( )
default

Member Function Documentation

◆ add() [1/5]

void Mantid::Geometry::ParameterMap::add ( const IComponent *  comp,
const std::shared_ptr< Parameter > &  par,
const std::string *const  pDescription = nullptr 
)

Method for adding a parameter providing shared pointer to it.

Method for adding/replacing a parameter providing shared pointer to it.

The class stores share pointer and increment ref count to it

Parameters
comp:: A pointer to the component that this parameter is attached to
par:: a shared pointer to existing parameter. The ParameterMap stores share pointer and increment ref count to it
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory

Definition at line 456 of file ParameterMap.cpp.

References add(), and indexForWrite().

◆ add() [2/5]

void Mantid::Geometry::ParameterMap::add ( const size_t  componentIndex,
const std::shared_ptr< Parameter > &  par,
const std::string *const  pDescription = nullptr 
)

◆ add() [3/5]

void Mantid::Geometry::ParameterMap::add ( const std::string &  type,
const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Method for adding a parameter providing its value as a string.

Add a value into the map.

Parameters
type:: A string denoting the type, e.g. double, string, fitting
comp:: A pointer to the component that this parameter is attached to
name:: The name of the parameter
value:: The parameter's value
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 442 of file ParameterMap.cpp.

References add(), Mantid::Geometry::ParameterFactory::create(), name, and value.

Referenced by add(), add(), add(), addBool(), addBool(), addDouble(), addDouble(), addInt(), addInt(), addQuat(), addV3D(), and addV3D().

◆ add() [4/5]

template<class T >
void Mantid::Geometry::ParameterMap::add ( const std::string &  type,
const IComponent *  comp,
const std::string &  name,
const T &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)
inline

Method for adding a parameter providing its value of a particular type.

If a parameter already exists then it is replaced with a new one of the given type and value

Template Parameters
TThe concrete type
Parameters
type:: A string denoting the type, e.g. double, string, fitting
comp:: A pointer to the component that this parameter is attached to
name:: The name of the parameter
value:: The parameter's value
pDescription:: if present, the constant pointer to a constant string, containing parameter's description.
pVisible:: if present, defines whether the parameter should be visible in InstrumentViewer

Definition at line 122 of file ParameterMap.h.

References Mantid::DataObjects::create(), name, and value.

◆ add() [5/5]

void Mantid::Geometry::ParameterMap::add ( const std::string &  type,
const size_t  componentIndex,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

◆ addBool() [1/2]

void Mantid::Geometry::ParameterMap::addBool ( const IComponent *  comp,
const std::string &  name,
bool  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds a bool value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a bool
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 696 of file ParameterMap.cpp.

References add(), name, pBool(), and value.

◆ addBool() [2/2]

void Mantid::Geometry::ParameterMap::addBool ( const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds a bool value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a string
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 683 of file ParameterMap.cpp.

References add(), name, pBool(), and value.

◆ addDouble() [1/2]

void Mantid::Geometry::ParameterMap::addDouble ( const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds a double value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a string
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 627 of file ParameterMap.cpp.

References add(), name, pDouble(), and value.

Referenced by addRotationParam().

◆ addDouble() [2/2]

void Mantid::Geometry::ParameterMap::addDouble ( const IComponent *  comp,
const std::string &  name,
double  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds a double value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a double
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 641 of file ParameterMap.cpp.

References add(), name, pDouble(), and value.

◆ addFittingParameter() [1/2]

void Mantid::Geometry::ParameterMap::addFittingParameter ( const IComponent *  comp,
const std::string &  name,
const std::string &  fittingFunction,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Add a fitting parameter.

Add a fitting parameter, deduplicating by (name, fittingFunction) instead of name alone.

Dedupes by (name, fittingFunction) rather than just name so that two functions attached to the same component sharing a parameter name (e.g. IkedaCarpenterPV:Alpha0 and IkedaCarpenterMD:Alpha0) can coexist in the map.

Two different fitting functions attached to the same component can declare a parameter with the same short name (e.g. Bk2BkExpConvPV:Gamma and IkedaCarpenterPV:Gamma). The regular add() path uses positionOf() which only matches by name and would let one entry silently overwrite the other.

Parameters
comp:: Component the parameter is attached to
name:: Parameter short name (e.g. "Gamma")
fittingFunction:: Name of the fitting function this parameter applies to (may be empty)
value:: Serialised FitParameter value string (as built by ExperimentInfo)
pDescription:: Optional description
pVisible:: Visibility flag

Definition at line 498 of file ParameterMap.cpp.

References addFittingParameter(), indexForWrite(), name, and value.

Referenced by addFittingParameter().

◆ addFittingParameter() [2/2]

void Mantid::Geometry::ParameterMap::addFittingParameter ( const size_t  componentIndex,
const std::string &  name,
const std::string &  fittingFunction,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

◆ addInt() [1/2]

void Mantid::Geometry::ParameterMap::addInt ( const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds an int value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a string
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 655 of file ParameterMap.cpp.

References add(), name, pInt(), and value.

◆ addInt() [2/2]

void Mantid::Geometry::ParameterMap::addInt ( const IComponent *  comp,
const std::string &  name,
int  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds an int value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as an int
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 669 of file ParameterMap.cpp.

References add(), name, pInt(), and value.

◆ addParameterFilename()

void Mantid::Geometry::ParameterMap::addParameterFilename ( const std::string &  filename)

adds a parameter filename that has been loaded

Parameters
filenamethe filename to add

Definition at line 1080 of file ParameterMap.cpp.

References m_parameterFileNames.

◆ addPositionCoordinate()

void Mantid::Geometry::ParameterMap::addPositionCoordinate ( const IComponent *  comp,
const std::string &  name,
const double  value,
const std::string *const  pDescription = nullptr 
)

Create or adjust "pos" parameter for a component.

Create or adjust "pos" parameter for a component Assumed that name either equals "x", "y" or "z" otherwise this method will not add or modify "pos" parameter.

Parameters
comp:: Component
name:: name of the parameter
value:: value
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameters memory

Definition at line 532 of file ParameterMap.cpp.

References addV3D(), Mantid::Geometry::g_log, get(), Mantid::Geometry::IComponent::getPos(), name, pos(), position, posx(), posy(), posz(), Mantid::Kernel::V3D::setX(), value, and Mantid::Kernel::Logger::warning().

◆ addQuat()

void Mantid::Geometry::ParameterMap::addQuat ( const IComponent *  comp,
const std::string &  name,
const Kernel::Quat &  value,
const std::string *const  pDescription = nullptr 
)

Adds a Kernel::Quat value to the parameter map.

Adds a Quat value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a Quat
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory

Definition at line 767 of file ParameterMap.cpp.

References add(), name, pQuat(), and value.

Referenced by addRotationParam().

◆ addRotationParam()

void Mantid::Geometry::ParameterMap::addRotationParam ( const IComponent *  comp,
const std::string &  name,
const double  deg,
const std::string *const  pDescription = nullptr 
)

Create or adjust "rot" parameter for a component.

Create or adjust "rot" parameter for a component Assumed that name either equals "rotx", "roty" or "rotz" otherwise this method will not add/modify "rot" parameter.

Parameters
comp:: Component
name:: Parameter name
deg:: Parameter value in degrees
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory

Definition at line 576 of file ParameterMap.cpp.

References addDouble(), addQuat(), Mantid::Geometry::g_log, get(), name, rot(), rotx(), roty(), rotz(), and Mantid::Kernel::Logger::warning().

◆ addString()

void Mantid::Geometry::ParameterMap::addString ( const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr,
const std::string &  pVisible = "true" 
)

Adds a std::string value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory
pVisible:: Whether the parameter should be visible in InstrumentViewer

Definition at line 728 of file ParameterMap.cpp.

References name, pString(), and value.

◆ addV3D() [1/2]

void Mantid::Geometry::ParameterMap::addV3D ( const IComponent *  comp,
const std::string &  name,
const Kernel::V3D &  value,
const std::string *const  pDescription = nullptr 
)

Adds a Kernel::V3D value to the parameter map.

Adds a V3D value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a V3D
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory

Definition at line 754 of file ParameterMap.cpp.

References add(), name, pV3D(), and value.

◆ addV3D() [2/2]

void Mantid::Geometry::ParameterMap::addV3D ( const IComponent *  comp,
const std::string &  name,
const std::string &  value,
const std::string *const  pDescription = nullptr 
)

Adds a Kernel::V3D value to the parameter map.

Adds a V3D value to the parameter map.

Parameters
comp:: Component to which the new parameter is related
name:: Name for the new parameter
value:: Parameter value as a string
pDescription:: a pointer (may be NULL) to a string, containing parameter's description. If provided, the contents of the string is copied to the parameter's memory

Definition at line 741 of file ParameterMap.cpp.

References add(), name, pV3D(), and value.

Referenced by addPositionCoordinate().

◆ asString() [1/2]

std::string Mantid::Geometry::ParameterMap::asString ( ) const

Returns a string with all component names, parameter names and values.

Return a string representation of the parameter map.

The format is either: |detID:id-value;param-type;param-name;param-value| for a detector or |comp-name;param-type;param-name;param-value| for other components.

Returns
A string containing the contents of the parameter map.

Definition at line 989 of file ParameterMap.cpp.

References asString(), componentInfo(), detectorInfo(), entries(), and m_parameterInfo.

Referenced by asString(), diff(), and Mantid::Geometry::Instrument::saveNexus().

◆ asString() [2/2]

std::string Mantid::Geometry::ParameterMap::asString ( const std::vector< Entry > &  entries,
const ComponentInfo &  componentInfo,
const DetectorInfo &  detectorInfo 
)
static

Returns the same for the given parameters, naming their components from the given layers.

Return the asString() representation of the given parameters.

Parameters
entries:: The parameters, by component index
componentInfo:: The ComponentInfo the component indices refer to
detectorInfo:: The DetectorInfo that goes with it
Returns
A string containing the parameters.

Definition at line 1003 of file ParameterMap.cpp.

References asStringEntry(), componentInfo(), Mantid::Geometry::DetectorInfo::detectorIDs(), detectorInfo(), entries(), Mantid::Geometry::ComponentInfo::fullName(), index, Mantid::Geometry::ComponentInfo::isDetector(), and std::to_string().

◆ asStringEntry()

std::string Mantid::Geometry::ParameterMap::asStringEntry ( const std::string &  component,
const Parameter &  parameter 
)
static

Returns the asString() entry for one parameter of a component, given as "detID:<id>" or by full name.

Return the asString() representation of one parameter.

Parameters
component:: The component, as "detID:id-value" for a detector or its full name otherwise
parameter:: The parameter
Returns
The entry, including its terminating '|'

Definition at line 1025 of file ParameterMap.cpp.

References Mantid::Geometry::Parameter::asString(), Mantid::Geometry::Parameter::name(), Mantid::Geometry::Parameter::type(), and Mantid::Geometry::Parameter::visible().

Referenced by asString(), and Mantid::Algorithms::CopyInstrumentParameters::exec().

◆ buildInstrumentMetadata()

void Mantid::Geometry::ParameterMap::buildInstrumentMetadata ( )
private

◆ clear()

void Mantid::Geometry::ParameterMap::clear ( )
inline

Clears the map.

Definition at line 83 of file ParameterMap.h.

◆ clearParametersByName() [1/2]

void Mantid::Geometry::ParameterMap::clearParametersByName ( const std::string &  name)

Clear any parameters with the given name.

Parameters
name:: The name of the parameter

Definition at line 413 of file ParameterMap.cpp.

References m_parameterInfo, name, and PARALLEL_CRITICAL.

◆ clearParametersByName() [2/2]

void Mantid::Geometry::ParameterMap::clearParametersByName ( const std::string &  name,
const IComponent *  comp 
)

Clear any parameters with the given name for a specified component.

Parameters
name:: The name of the parameter
comp:: The component to clear parameters from

Definition at line 424 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_parameterInfo, name, and PARALLEL_CRITICAL.

◆ componentFullName()

std::string Mantid::Geometry::ParameterMap::componentFullName ( const size_t  index) const
private

The full name of the component with this store index.

Definition at line 134 of file ParameterMap.cpp.

References componentInfo(), Mantid::Geometry::ComponentInfo::fullName(), and index.

Referenced by diff().

◆ componentIds()

const std::vector< Geometry::ComponentID > & Mantid::Geometry::ParameterMap::componentIds ( ) const

Referenced by rekey().

◆ componentIndex()

size_t Mantid::Geometry::ParameterMap::componentIndex ( const Geometry::ComponentID  componentId) const

Definition at line 1150 of file ParameterMap.cpp.

References m_componentInfo.

Referenced by add(), add(), addFittingParameter(), and Mantid::Geometry::Component::index().

◆ componentInfo()

const Geometry::ComponentInfo & Mantid::Geometry::ParameterMap::componentInfo ( ) const

◆ componentName()

std::string Mantid::Geometry::ParameterMap::componentName ( const size_t  index) const
private

The name of the component with this store index.

Definition at line 132 of file ParameterMap.cpp.

References componentInfo(), index, and Mantid::Geometry::ComponentInfo::name().

Referenced by getDescription(), and getShortDescription().

◆ contains() [1/3]

bool Mantid::Geometry::ParameterMap::contains ( const IComponent *  comp,
const char *  name,
const char *  type = "" 
) const

Does the named parameter exist for the given component (c-string version)

Avoids having to instantiate temporary std::string in method below when called with a string directly.

Parameters
comp:: The component to be searched as a c-string
name:: The name of the parameter
type:: The type of the component
Returns
A boolean indicating if the map contains the named parameter.

Definition at line 791 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_parameterInfo, and name.

◆ contains() [2/3]

bool Mantid::Geometry::ParameterMap::contains ( const IComponent *  comp,
const Parameter &  parameter 
) const

Does the given parameter & component combination exist.

Parameters
compA pointer to a component
parameterA Parameter object
Returns
true if the combination exists in the map, false otherwise

Definition at line 802 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_parameterInfo, and Mantid::Geometry::Parameter::name().

◆ contains() [3/3]

bool Mantid::Geometry::ParameterMap::contains ( const IComponent *  comp,
const std::string &  name,
const std::string &  type = "" 
) const

Does the named parameter exist for the given component and type (std::string version)

Does the named parameter exist for the given component and given type.

Parameters
comp:: The component to be searched
name:: The name of the parameter
type:: The type of the component as a string
Returns
A boolean indicating if the map contains the named parameter. If the type is given then this must also match

Definition at line 779 of file ParameterMap.cpp.

References contains(), and name.

Referenced by contains(), Mantid::Geometry::GridDetector::getBoundingBoxAtXYZ(), Mantid::Geometry::Component::getRelativePos(), Mantid::Geometry::GridDetector::getRelativePosAtXYZ(), Mantid::Geometry::Component::getRelativeRot(), Mantid::Geometry::Component::hasParameter(), Mantid::Geometry::GridDetector::xsize(), Mantid::Geometry::GridDetector::xstart(), Mantid::Geometry::GridDetector::xstep(), Mantid::Geometry::GridDetector::ysize(), Mantid::Geometry::GridDetector::ystart(), Mantid::Geometry::GridDetector::ystep(), Mantid::Geometry::GridDetector::zsize(), Mantid::Geometry::GridDetector::zstart(), and Mantid::Geometry::GridDetector::zstep().

◆ copyFromParameterMap()

void Mantid::Geometry::ParameterMap::copyFromParameterMap ( const IComponent *  oldComp,
const IComponent *  newComp,
const ParameterMap *  oldPMap 
)

Copy pairs (oldComp->id,Parameter) to the m_map assigning the new newComp->id.

Parameters
oldComp:: Old component
newComp:: New component
oldPMap:: Old map corresponding to the Old component

Definition at line 1038 of file ParameterMap.cpp.

References get(), indexForWrite(), m_parameterInfo, and names().

◆ create()

std::shared_ptr< Parameter > Mantid::Geometry::ParameterMap::create ( const std::string &  className,
const std::string &  name,
const std::string &  visible = "true" 
) const
private

Wrapper for ParameterFactory::create to avoid include in header.

Definition at line 1083 of file ParameterMap.cpp.

References Mantid::Geometry::ParameterFactory::create(), and name.

Referenced by forceUnsafeSetMasked().

◆ detectorIndex()

size_t Mantid::Geometry::ParameterMap::detectorIndex ( const detid_t  detID) const

Only for use by Detector. Returns a detector index for a detector ID.

Definition at line 1148 of file ParameterMap.cpp.

References Mantid::Geometry::Instrument::detectorIndex(), and m_instrument.

Referenced by Mantid::Geometry::Detector::index().

◆ detectorInfo()

const Geometry::DetectorInfo & Mantid::Geometry::ParameterMap::detectorInfo ( ) const

Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.

Definition at line 1110 of file ParameterMap.cpp.

References hasDetectorInfo(), m_detectorInfo, and m_instrument.

Referenced by asString(), asString(), and Mantid::Geometry::Instrument::makeBeamline().

◆ diff()

const std::string Mantid::Geometry::ParameterMap::diff ( const ParameterMap &  rhs,
const bool &  firstDiffOnly = false,
const bool  relative = false,
const double  doubleTolerance = Kernel::Tolerance 
) const

Output information that helps understanding the mismatch between two parameter maps.

To loop through the difference between two very large parameter map can take time, in which you can a hit to what causes the difference faster setting firstDiffOnly to true

Parameters
rhsA reference to a ParameterMap object to compare it to
firstDiffOnlyIf true return only first difference found
relativeIndicates whether to treat the error as relative or absolute
doubleToleranceThe tolerance to use when comparing parameter values of type double
Returns
diff as a string

Definition at line 327 of file ParameterMap.cpp.

References asString(), componentFullName(), index, m_parameterInfo, name, relErr(), rhs, size(), and std::to_string().

Referenced by Mantid::Algorithms::CompareWorkspaces::checkInstrument(), and operator==().

◆ domainSize()

size_t Mantid::Geometry::ParameterMap::domainSize ( ) const
inlineprivate

The number of components in the index domain.

Definition at line 366 of file ParameterMap.h.

◆ empty()

bool Mantid::Geometry::ParameterMap::empty ( ) const
inline

Returns true if the map is empty, false otherwise.

Definition at line 52 of file ParameterMap.h.

Referenced by Mantid::Geometry::InstrumentVisitor::walkInstrument().

◆ entries()

std::vector< ParameterMap::Entry > Mantid::Geometry::ParameterMap::entries ( ) const

Every stored parameter with its component's index in the instrument this map belongs to, in component-index order.

Throws for a detached map, which has no component indices yet.

Definition at line 136 of file ParameterMap.cpp.

References index, m_domainIds, and m_parameterInfo.

Referenced by asString(), asString(), and Mantid::API::ExperimentInfo::populateInstrumentParameters().

◆ forceUnsafeSetMasked()

void Mantid::Geometry::ParameterMap::forceUnsafeSetMasked ( const IComponent *  comp,
bool  value 
)

Force adding masking information.

ONLY FOR INTERNAL USE by class Instrument.

ParameterMap usually rejects "legacy style" masking information since it is now stored in DetectorInfo. However, for the purpose of writing files class Instrument needs to insert masking information. This method is only for internal use by class Instrument. ParameterMaps modified by this method are only for use as a temporary.

Definition at line 708 of file ParameterMap.cpp.

References create(), indexForWrite(), m_parameterInfo, name, pBool(), and value.

◆ get() [1/2]

std::shared_ptr< Parameter > Mantid::Geometry::ParameterMap::get ( const IComponent *  comp,
const char *  name,
const char *  type = "" 
) const

Get a parameter with a given name and type (c-string version)

Return a named parameter of a given type.

Avoids allocating std::string temporaries

Parameters
comp:: Component to which parameter is related
name:: Parameter name
type:: An optional type string
Returns
The named parameter of the given type if it exists or a NULL shared pointer if not

Definition at line 835 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_parameterInfo, and name.

◆ get() [2/2]

Parameter_sptr Mantid::Geometry::ParameterMap::get ( const IComponent *  comp,
const std::string &  name,
const std::string &  type = "" 
) const

◆ getByType()

Parameter_sptr Mantid::Geometry::ParameterMap::getByType ( const IComponent *  comp,
const std::string &  type 
) const

Finds the parameter in the map via the parameter type.

Look for a parameter in the given component by the type of the parameter.

Parameters
comp:: Component to which parameter is related
type:: Parameter type
Returns
The typed parameter if it exists or a NULL shared pointer if not

Definition at line 846 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, and m_parameterInfo.

Referenced by getRecursiveByType().

◆ getDescription()

const std::string Mantid::Geometry::ParameterMap::getDescription ( const std::string &  compName,
const std::string &  name 
) const

Get the component description by name.

Parameters
compName:: The name of the component
name:: The name of the parameter
Returns
:: the description for the first parameter found and having non-empty description, or empty string if no description found.

Definition at line 251 of file ParameterMap.cpp.

References componentName(), index, m_parameterInfo, and name.

◆ getDouble()

std::vector< double > Mantid::Geometry::ParameterMap::getDouble ( const std::string &  compName,
const std::string &  name 
) const
inline

Returns a double parameter as vector's first element if exists and an empty vector if it doesn't.

Parameters
compName:: Component name
name:: Parameter name
Returns
a double parameter from component with the requested name

Definition at line 268 of file ParameterMap.h.

References name.

Referenced by Mantid::WorkflowAlgorithms::SofTwoThetaTOF::clarifyAngleStep().

◆ getMemorySize()

size_t Mantid::Geometry::ParameterMap::getMemorySize ( ) const

Get the footprint in memory in bytes.

Return memory used by the parameter map, in bytes.

Returns
bytes used.

Definition at line 1219 of file ParameterMap.cpp.

References m_componentInfo, m_detectorInfo, m_parameterFileNames, m_parameterInfo, m_stagedIds, and m_stagedIndices.

◆ getParameterFilenames()

const std::vector< std::string > & Mantid::Geometry::ParameterMap::getParameterFilenames ( ) const

Returns a list of all the parameter files loaded.

Returns
a vector of the filenames

Definition at line 1075 of file ParameterMap.cpp.

References m_parameterFileNames.

Referenced by Mantid::API::ExperimentInfo::toString().

◆ getRecursive() [1/2]

Parameter_sptr Mantid::Geometry::ParameterMap::getRecursive ( const IComponent *  comp,
const char *  name,
const char *  type = "" 
) const

Use get() recursively to see if can find param in all parents of comp and given type (const char type)

Find a parameter by name, recursively going up the component tree to higher parents.

Parameters
comp:: The component to start the search with
name:: Parameter name
type:: An optional type string
Returns
the first matching parameter.

Definition at line 891 of file ParameterMap.cpp.

References get(), Mantid::Geometry::IComponent::getComponentID(), Mantid::Geometry::IComponent::getParent(), and name.

◆ getRecursive() [2/2]

Parameter_sptr Mantid::Geometry::ParameterMap::getRecursive ( const IComponent *  comp,
const std::string &  name,
const std::string &  type = "" 
) const

Use get() recursively to see if can find param in all parents of comp and given type (std::string version)

Find a parameter by name, recursively going up the component tree to higher parents.

Parameters
comp:: The component to start the search with
name:: Parameter name
type:: An optional type string
Returns
the first matching parameter.

Definition at line 878 of file ParameterMap.cpp.

References getRecursive(), and name.

Referenced by Mantid::API::ExperimentInfo::getEFixedForIndirect(), Mantid::Geometry::Component::getFittingParameter(), Mantid::Geometry::Component::getParamDescription(), Mantid::Geometry::Component::getParameter(), Mantid::Geometry::Component::getParamShortDescription(), getRecursive(), getString(), and Mantid::Geometry::Component::setDescription().

◆ getRecursiveByType()

Parameter_sptr Mantid::Geometry::ParameterMap::getRecursiveByType ( const IComponent *  comp,
const std::string &  type 
) const

Looks recursively upwards in the component tree for the first instance of a parameter with a specified type.

Looks recursively upwards in the component tree for the first instance of a component with a matching type.

Parameters
comp:: The component to start the search with
type:: Parameter type
Returns
the first matching parameter.

Definition at line 857 of file ParameterMap.cpp.

References getByType().

◆ getRecursiveFittingParameter()

Parameter_sptr Mantid::Geometry::ParameterMap::getRecursiveFittingParameter ( const IComponent *  comp,
const std::string &  name,
const std::string &  fittingFunction 
) const

Look for a fitting parameter recursively, picking the one whose embedded FitParameter function name matches fittingFunction.

Find a fitting parameter recursively, picking the one whose embedded FitParameter function name matches the requested fittingFunction.

Multiple fitting parameters can share a short name on the same component (one per function) — getRecursive() would short-circuit on the first match, this walks them all.

When two functions attached to the same component share a parameter short name (e.g. Bk2BkExpConvPV:Gamma and IkedaCarpenterPV:Gamma), getRecursive() short-circuits on the first match and may return the wrong function's parameter. This method walks every entry on each level of the component tree so it can disambiguate by function name.

Parameters
comp:: The component to start the search with
name:: Parameter short name (e.g. "Gamma")
fittingFunction:: The fitting function name this parameter must belong to
Returns
the matching parameter, or a null shared pointer if none is found

Definition at line 920 of file ParameterMap.cpp.

References Mantid::Geometry::FitParameter::getFunction(), Mantid::Geometry::IComponent::getParent(), index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_parameterInfo, and name.

◆ getShortDescription()

const std::string Mantid::Geometry::ParameterMap::getShortDescription ( const std::string &  compName,
const std::string &  name 
) const

Get the component tooltip by name.

Get the component short description by name.

Parameters
compName:: The name of the component
name:: The name of the parameter
Returns
:: the short description for the first parameter found and having non-empty description, or empty string if no description found.

Definition at line 273 of file ParameterMap.cpp.

References componentName(), index, m_parameterInfo, and name.

◆ getString() [1/2]

std::string Mantid::Geometry::ParameterMap::getString ( const IComponent *  comp,
const std::string &  name,
bool  recursive = false 
) const

Return the value of a parameter as a string.

Parameters
comp:: Component to which parameter is related
name:: Parameter name
recursive:: Whether to travel up the instrument tree if not found at this level
Returns
string representation of the parameter

Definition at line 961 of file ParameterMap.cpp.

References get(), getRecursive(), and name.

◆ getString() [2/2]

std::vector< std::string > Mantid::Geometry::ParameterMap::getString ( const std::string &  compName,
const std::string &  name 
) const
inline

Returns a string parameter as vector's first element if exists and an empty vector if it doesn't.

Definition at line 258 of file ParameterMap.h.

References name.

◆ getType()

template<class T >
std::vector< T > Mantid::Geometry::ParameterMap::getType ( const std::string &  compName,
const std::string &  name 
) const
inline

Get the values of a given parameter of all the components that have the name: compName.

Template Parameters
Theparameter type
Parameters
compName:: The name of the component
name:: The name of the parameter
Returns
all component values from the given component name

Definition at line 235 of file ParameterMap.h.

References index, and name.

◆ getV3D()

std::vector< Kernel::V3D > Mantid::Geometry::ParameterMap::getV3D ( const std::string &  compName,
const std::string &  name 
) const
inline

Returns a Kernel::V3D parameter as vector's first element if exists and an empty vector if it doesn't.

Parameters
compName:: Component name
name:: Parameter name
Returns
a Kernel::V3D parameter from component with the requested name

Definition at line 278 of file ParameterMap.h.

References name.

◆ hasComponentInfo()

bool Mantid::Geometry::ParameterMap::hasComponentInfo ( const Instrument *  instrument) const

Only for use by ExperimentInfo.

Returns returns true if this instrument contains a ComponentInfo.

Definition at line 1103 of file ParameterMap.cpp.

References m_componentInfo, and m_instrument.

Referenced by componentInfo(), Mantid::Geometry::Instrument::getBoundingBox(), Mantid::Geometry::Component::hasComponentInfo(), Mantid::Geometry::Instrument::makeBeamline(), and mutableComponentInfo().

◆ hasDetectorInfo()

bool Mantid::Geometry::ParameterMap::hasDetectorInfo ( const Instrument *  instrument) const

Only for use by ExperimentInfo.

Returns returns true if this instrument contains a DetectorInfo.

The instrument argument is needed for the special case of having a neutronic and* a physical instrument. Instrument uses the same parameter map for both, but the DetectorInfo is only for the neutronic instrument.

Definition at line 1094 of file ParameterMap.cpp.

References m_detectorInfo, and m_instrument.

Referenced by detectorInfo(), Mantid::Geometry::Detector::hasDetectorInfo(), and mutableDetectorInfo().

◆ indexForWrite()

size_t Mantid::Geometry::ParameterMap::indexForWrite ( const IComponent *  comp)
private

As indexOf(), but allocating a staging index for a component of a detached map seen for the first time.

Throws for a component outside the index domain of an attached map.

Definition at line 116 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), Mantid::Geometry::IComponent::getFullName(), indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_domainIndices, m_stagedIds, and m_stagedIndices.

Referenced by add(), addFittingParameter(), copyFromParameterMap(), and forceUnsafeSetMasked().

◆ indexOf()

size_t Mantid::Geometry::ParameterMap::indexOf ( const IComponent *  comp) const
private

◆ instrumentMetadata()

const Geometry::InstrumentMetadata & Mantid::Geometry::ParameterMap::instrumentMetadata ( ) const

Only for use by ExperimentInfo. Returns a reference to the InstrumentMetadata.

Definition at line 1140 of file ParameterMap.cpp.

References m_instrumentMetadata.

◆ mutableComponentInfo()

Geometry::ComponentInfo & Mantid::Geometry::ParameterMap::mutableComponentInfo ( )

Only for use by ExperimentInfo. Returns a reference to the ComponentInfo.

Definition at line 1132 of file ParameterMap.cpp.

References hasComponentInfo(), m_componentInfo, and m_instrument.

◆ mutableDetectorInfo()

Geometry::DetectorInfo & Mantid::Geometry::ParameterMap::mutableDetectorInfo ( )

Only for use by ExperimentInfo. Returns a reference to the DetectorInfo.

Definition at line 1117 of file ParameterMap.cpp.

References hasDetectorInfo(), m_detectorInfo, and m_instrument.

◆ names()

std::set< std::string > Mantid::Geometry::ParameterMap::names ( const IComponent *  comp) const

Returns a set with all parameter names for component.

Returns a set with all the parameter names for the given component.

Parameters
comp:: A pointer to the component of interest
Returns
A set of names of parameters for the given component

Definition at line 978 of file ParameterMap.cpp.

References index, indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, and m_parameterInfo.

Referenced by copyFromParameterMap(), and Mantid::Geometry::Component::getParameterNames().

◆ operator!=()

bool Mantid::Geometry::ParameterMap::operator!= ( const ParameterMap &  rhs) const

Inquality comparison operator.

Compares the values in this object with that given for inequality The order of the values in the map is not important.

Parameters
rhsA reference to a ParameterMap object to compare it to
Returns
true if the objects are considered not equal, false otherwise

Definition at line 234 of file ParameterMap.cpp.

References operator==().

◆ operator=()

ParameterMap & Mantid::Geometry::ParameterMap::operator= ( ParameterMap *  rhs)
private

Assignment operator.

◆ operator==()

bool Mantid::Geometry::ParameterMap::operator== ( const ParameterMap &  rhs) const

Equality comparison operator.

Compares the values in this object with that given for equality The order of the values in the map is not important.

Parameters
rhsA reference to a ParameterMap object to compare it to
Returns
true if the objects are considered equal, false otherwise

Definition at line 242 of file ParameterMap.cpp.

References diff(), and rhs.

Referenced by operator!=().

◆ pBool()

const std::string & Mantid::Geometry::ParameterMap::pBool ( )
static

◆ pDouble()

const std::string & Mantid::Geometry::ParameterMap::pDouble ( )
static

◆ pInt()

const std::string & Mantid::Geometry::ParameterMap::pInt ( )
static

Definition at line 215 of file ParameterMap.cpp.

Referenced by addInt(), addInt(), and Mantid::Geometry::ComponentInfo::addInt().

◆ pos()

const std::string & Mantid::Geometry::ParameterMap::pos ( )
static

Return string to be used in the map.

Return string to be inserted into the parameter map.

Definition at line 195 of file ParameterMap.cpp.

Referenced by addPositionCoordinate(), and Mantid::Geometry::Instrument::legacyParameters().

◆ posx()

const std::string & Mantid::Geometry::ParameterMap::posx ( )
static

Definition at line 197 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ posy()

const std::string & Mantid::Geometry::ParameterMap::posy ( )
static

Definition at line 199 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ posz()

const std::string & Mantid::Geometry::ParameterMap::posz ( )
static

Definition at line 201 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ pQuat()

const std::string & Mantid::Geometry::ParameterMap::pQuat ( )
static

◆ pString()

const std::string & Mantid::Geometry::ParameterMap::pString ( )
static

Definition at line 219 of file ParameterMap.cpp.

Referenced by addString(), and Mantid::Geometry::ComponentInfo::addString().

◆ pV3D()

const std::string & Mantid::Geometry::ParameterMap::pV3D ( )
static

◆ rebuildBeamlineFrom()

void Mantid::Geometry::ParameterMap::rebuildBeamlineFrom ( const ParameterMap &  source)

Rebuild the 2.0 layers for a map that was copy-constructed from source.

The copy constructor deliberately leaves them null; ExperimentInfo calls this after copying, because it is the owner and the only caller that needs them. A map whose instrument is not set is left alone.

Definition at line 78 of file ParameterMap.cpp.

References buildInstrumentMetadata(), m_componentInfo, m_detectorInfo, m_instrument, m_instrumentMetadata, and Mantid::Geometry::Instrument::makeBeamline().

◆ rekey()

std::shared_ptr< ParameterInfo > Mantid::Geometry::ParameterMap::rekey ( std::shared_ptr< const ComponentIDs >  componentIds,
std::shared_ptr< const ComponentIndices >  componentIndices 
)

Attach this map to an instrument's component index domain, rekeying its parameters onto the instrument's component indices, and return the resulting store.

Parameters of components outside the domain are dropped. A map already attached to this domain is left as it is.

Definition at line 154 of file ParameterMap.cpp.

References componentIds(), m_domainIds, m_domainIndices, m_parameterInfo, m_stagedIds, and m_stagedIndices.

Referenced by Mantid::Geometry::InstrumentVisitor::makeParameterInfo().

◆ relErr()

bool Mantid::Geometry::ParameterMap::relErr ( double  x1,
double  x2,
double  errorVal 
) const
private

calculate relative error for use in diff

Function which calculates relative error between two values and analyses if this error is within the limits requested.

When the absolute value of the difference is smaller then the value of the error requested, absolute error is used instead of relative error.

Parameters
x1– first value to check difference
x2– second value to check difference
errorVal– the value of the error, to check against. Should be large then 0
Returns
true if error or false if the value is within the limits requested

Definition at line 303 of file ParameterMap.cpp.

Referenced by diff().

◆ rot()

const std::string & Mantid::Geometry::ParameterMap::rot ( )
static

◆ rotx()

const std::string & Mantid::Geometry::ParameterMap::rotx ( )
static

Definition at line 206 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ roty()

const std::string & Mantid::Geometry::ParameterMap::roty ( )
static

Definition at line 208 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ rotz()

const std::string & Mantid::Geometry::ParameterMap::rotz ( )
static

Definition at line 210 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ saveNexus()

void Mantid::Geometry::ParameterMap::saveNexus ( Nexus::File *  file,
const std::string &  group,
const std::string &  contents 
)
static

Persist a representation of a Parameter map, as given by asString(), to the open Nexus file.

Save a parameter map to an open NeXus file.

Parameters
file:: open NeXus file
group:: name of the group to create
contents:: the parameter map, as given by asString()

Definition at line 1056 of file ParameterMap.cpp.

References group.

Referenced by Mantid::Geometry::Instrument::saveNexus().

◆ scale()

const std::string & Mantid::Geometry::ParameterMap::scale ( )
static

◆ seedLogfileParameters()

void Mantid::Geometry::ParameterMap::seedLogfileParameters ( )
private

Copies m_instrument's logfile parameters into the store. Requires the beamline to be built.

Copies the instrument definition's logfile parameters into this map's store, by component index.

Only a newly attached map is seeded; a copied map already carries its source's logfile parameters, including any added since from a parameter file.

Definition at line 1190 of file ParameterMap.cpp.

References Mantid::Geometry::Instrument::getLogfileCache(), index, Mantid::Geometry::ComponentInfo::invalidIndex, m_componentInfo, m_instrument, and m_parameterInfo.

Referenced by setInstrument().

◆ setInstrument()

void Mantid::Geometry::ParameterMap::setInstrument ( const Instrument *  instrument)

◆ sharedComponentInfo()

const std::shared_ptr< Geometry::ComponentInfo > & Mantid::Geometry::ParameterMap::sharedComponentInfo ( ) const
inline

Definition at line 336 of file ParameterMap.h.

◆ sharedDetectorInfo()

const std::shared_ptr< Geometry::DetectorInfo > & Mantid::Geometry::ParameterMap::sharedDetectorInfo ( ) const
inline

Definition at line 337 of file ParameterMap.h.

◆ sharedInstrumentMetadata()

const std::shared_ptr< Geometry::InstrumentMetadata > & Mantid::Geometry::ParameterMap::sharedInstrumentMetadata ( ) const
inline

Definition at line 338 of file ParameterMap.h.

◆ sharedParameterInfo()

const std::shared_ptr< ParameterInfo > & Mantid::Geometry::ParameterMap::sharedParameterInfo ( ) const
inline

The parameter store this map owns.

Instrument::makeWrappers() installs it into a freshly cloned ComponentInfo, so that the clone reads this map's parameters rather than the ones belonging to whichever ComponentInfo it was cloned from.

Definition at line 335 of file ParameterMap.h.

◆ size()

int Mantid::Geometry::ParameterMap::size ( ) const
inline

Return the size of the map.

Definition at line 54 of file ParameterMap.h.

Referenced by diff().

◆ swap()

void Mantid::Geometry::ParameterMap::swap ( ParameterMap &  other)
inline

method swaps two parameter maps contents each other

Definition at line 89 of file ParameterMap.h.

Member Data Documentation

◆ m_componentInfo

std::shared_ptr<Geometry::ComponentInfo> Mantid::Geometry::ParameterMap::m_componentInfo
private

◆ m_detectorInfo

std::shared_ptr<Geometry::DetectorInfo> Mantid::Geometry::ParameterMap::m_detectorInfo
private

The 2.0 instrument layers, co-owned with the ExperimentInfo that built them.

ExperimentInfo is the primary owner and serves its own accessors from its copies of these pointers rather than reaching through this map. They are co-owned here, rather than merely pointed at, because a parametrized legacy Component reaches ComponentInfo ONLY through its ParameterMap (Component::getPos() -> m_map->componentInfo().position(index())), and ExperimentInfo::getInstrument() hands out parametrized instruments that share this map and may outlive the ExperimentInfo. Shared ownership is what keeps those from dangling.

All NULL unless the instrument is associated with an ExperimentInfo object.

Definition at line 404 of file ParameterMap.h.

Referenced by detectorInfo(), getMemorySize(), hasDetectorInfo(), mutableDetectorInfo(), rebuildBeamlineFrom(), and setInstrument().

◆ m_domainIds

std::shared_ptr<const ComponentIDs> Mantid::Geometry::ParameterMap::m_domainIds
private

The index domain: the components of the instrument this map is attached to, shared with that instrument's ComponentInfo.

Within it, a component's store index is its component index. Both null for a detached map.

Definition at line 386 of file ParameterMap.h.

Referenced by entries(), and rekey().

◆ m_domainIndices

std::shared_ptr<const ComponentIndices> Mantid::Geometry::ParameterMap::m_domainIndices
private

Definition at line 387 of file ParameterMap.h.

Referenced by indexForWrite(), indexOf(), and rekey().

◆ m_instrument

const Instrument* Mantid::Geometry::ParameterMap::m_instrument {nullptr}
private

Pointer to the owning instrument for translating detector IDs into detector indices when accessing the DetectorInfo object.

If the workspace distinguishes between a neutronic instrument and a physical instrument the owning instrument is the neutronic one.

Definition at line 412 of file ParameterMap.h.

Referenced by buildInstrumentMetadata(), componentInfo(), detectorIndex(), detectorInfo(), hasComponentInfo(), hasDetectorInfo(), mutableComponentInfo(), mutableDetectorInfo(), rebuildBeamlineFrom(), seedLogfileParameters(), and setInstrument().

◆ m_instrumentMetadata

std::shared_ptr<Geometry::InstrumentMetadata> Mantid::Geometry::ParameterMap::m_instrumentMetadata
private

◆ m_parameterFileNames

std::vector<std::string> Mantid::Geometry::ParameterMap::m_parameterFileNames
private

internal list of parameter files loaded

Definition at line 378 of file ParameterMap.h.

Referenced by addParameterFilename(), getMemorySize(), and getParameterFilenames().

◆ m_parameterInfo

std::shared_ptr<ParameterInfo> Mantid::Geometry::ParameterMap::m_parameterInfo
private

◆ m_stagedIds

std::vector<ComponentID> Mantid::Geometry::ParameterMap::m_stagedIds
private

Definition at line 392 of file ParameterMap.h.

Referenced by getMemorySize(), indexForWrite(), and rekey().

◆ m_stagedIndices

std::unordered_map<Geometry::IComponent const *, size_t> Mantid::Geometry::ParameterMap::m_stagedIndices
private

Staging indices, for the components of a detached map, which has no component indices yet.

Staging index i is m_stagedIds[i]. rekey() converts them to component indices and clears them.

Definition at line 391 of file ParameterMap.h.

Referenced by getMemorySize(), indexForWrite(), indexOf(), and rekey().


The documentation for this class was generated from the following files: