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< ComponentID, std::shared_ptr< Parameter > >
 A stored parameter together with 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")
 
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 clearPositionSensitiveCaches ()
 Clears the location, rotation & bounding box caches.
 
void setCachedLocation (const IComponent *comp, const Kernel::V3D &location) const
 Sets a cached location on the location cache.
 
bool getCachedLocation (const IComponent *comp, Kernel::V3D &location) const
 Attempts to retrieve a location from the location cache.
 
void setCachedRotation (const IComponent *comp, const Kernel::Quat &rotation) const
 Sets a cached rotation on the rotation cache.
 
bool getCachedRotation (const IComponent *comp, Kernel::Quat &rotation) const
 Attempts to retrieve a rotation from the rotation cache.
 
void saveNexus (Nexus::File *file, const std::string &group) const
 Persist a representation of the Parameter map to the open Nexus file.
 
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 owning component, 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 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.

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::unordered_map< Geometry::IComponent const *, size_t > m_idToIndex
 Component pointer to index translation.
 
std::vector< ComponentID > m_indexToId
 Reverse of m_idToIndex.
 
std::unique_ptr< Kernel::Cache< const ComponentID, Kernel::V3D > > m_cacheLocMap
 internal cache map instance for cached position values
 
std::unique_ptr< Kernel::Cache< const ComponentID, Kernel::Quat > > m_cacheRotMap
 internal cache map instance for cached rotation values
 
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 (const std::unordered_map< Geometry::IComponent const *, size_t > &idToIndex)
 Rekey this map's parameters from the synthetic staging indices onto an instrument's real component indices, returning 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.
 
bool relErr (double x1, double x2, double errorVal) const
 calculate relative error for use in diff
 
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 new index for a component seen for the first time.
 
ComponentID componentIdAt (const size_t index) const
 The component an index refers to. Only valid for an index this map issued.
 

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 44 of file ParameterMap.h.

Member Typedef Documentation

◆ Entry

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

A stored parameter together with the component it belongs to.

Definition at line 47 of file ParameterMap.h.

Constructor & Destructor Documentation

◆ ParameterMap() [1/2]

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

Default constructor.

Definition at line 67 of file ParameterMap.cpp.

◆ ParameterMap() [2/2]

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

Const constructor.

Definition at line 72 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 442 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 428 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(), addV3D(), and Mantid::Algorithms::CopyInstrumentParameters::exec().

◆ 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 126 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 687 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 674 of file ParameterMap.cpp.

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

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

◆ 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 618 of file ParameterMap.cpp.

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

Referenced by addRotationParam(), and Mantid::API::ExperimentInfo::populateWithParameter().

◆ 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 632 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 484 of file ParameterMap.cpp.

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

Referenced by addFittingParameter(), and Mantid::API::ExperimentInfo::populateWithParameter().

◆ 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 646 of file ParameterMap.cpp.

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

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

◆ 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 660 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 1090 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 518 of file ParameterMap.cpp.

References addV3D(), clearPositionSensitiveCaches(), 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 760 of file ParameterMap.cpp.

References add(), clearPositionSensitiveCaches(), 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 564 of file ParameterMap.cpp.

References addDouble(), addQuat(), clearPositionSensitiveCaches(), 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 719 of file ParameterMap.cpp.

References name, pString(), and value.

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

◆ 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 746 of file ParameterMap.cpp.

References add(), clearPositionSensitiveCaches(), 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 732 of file ParameterMap.cpp.

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

Referenced by addPositionCoordinate().

◆ asString()

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 983 of file ParameterMap.cpp.

References entries(), and Mantid::Geometry::IDetector::getID().

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

◆ buildInstrumentMetadata()

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

◆ clear()

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

Clears the map.

Definition at line 86 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 392 of file ParameterMap.cpp.

References clearPositionSensitiveCaches(), m_parameterInfo, name, PARALLEL_CRITICAL, pos(), and rot().

◆ 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 406 of file ParameterMap.cpp.

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

◆ clearPositionSensitiveCaches()

void Mantid::Geometry::ParameterMap::clearPositionSensitiveCaches ( )

Clears the location, rotation & bounding box caches.

Definition at line 1006 of file ParameterMap.cpp.

References m_cacheLocMap, and m_cacheRotMap.

Referenced by addPositionCoordinate(), addQuat(), addRotationParam(), addV3D(), addV3D(), clearParametersByName(), and clearParametersByName().

◆ componentIdAt()

ComponentID Mantid::Geometry::ParameterMap::componentIdAt ( const size_t  index) const
private

The component an index refers to. Only valid for an index this map issued.

Definition at line 131 of file ParameterMap.cpp.

References index, and m_indexToId.

Referenced by entries(), and rekey().

◆ componentIds()

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

◆ componentIndex()

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

Definition at line 1160 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

◆ 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 785 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 796 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 773 of file ParameterMap.cpp.

References contains(), and name.

Referenced by contains(), Mantid::Geometry::GridDetector::getBoundingBoxAtXYZ(), Mantid::API::ExperimentInfo::getEMode(), 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 1048 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 1093 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 1158 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 1120 of file ParameterMap.cpp.

References hasDetectorInfo(), m_detectorInfo, and m_instrument.

Referenced by 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 311 of file ParameterMap.cpp.

References asString(), entries(), name, relErr(), rhs, size(), and std::to_string().

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

◆ empty()

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

Returns true if the map is empty, false otherwise.

Definition at line 55 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 owning component, in component-index order.

Definition at line 135 of file ParameterMap.cpp.

References componentIdAt(), index, and m_parameterInfo.

Referenced by asString(), diff(), getDescription(), getShortDescription(), 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 699 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 829 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 840 of file ParameterMap.cpp.

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

Referenced by getRecursiveByType().

◆ getCachedLocation()

bool Mantid::Geometry::ParameterMap::getCachedLocation ( const IComponent *  comp,
Kernel::V3D &  location 
) const

Attempts to retrieve a location from the location cache.

Parameters
comp:: The Component to find the location of
location:: If the location is found it's value will be set here
Returns
true if the location is in the map, otherwise false

Definition at line 1022 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), and m_cacheLocMap.

Referenced by Mantid::Geometry::CompAssembly::getPos(), Mantid::Geometry::Component::getPos(), and Mantid::Geometry::ObjCompAssembly::getPos().

◆ getCachedRotation()

bool Mantid::Geometry::ParameterMap::getCachedRotation ( const IComponent *  comp,
Kernel::Quat &  rotation 
) const

Attempts to retrieve a rotation from the rotation cache.

Parameters
comp:: The Component to find the rotation of
rotation:: If the rotation is found it's value will be set here
Returns
true if the rotation is in the map, otherwise false

Definition at line 1037 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), m_cacheRotMap, and rotation.

Referenced by Mantid::Geometry::Component::getPos(), Mantid::Geometry::CompAssembly::getRotation(), Mantid::Geometry::Component::getRotation(), and Mantid::Geometry::ObjCompAssembly::getRotation().

◆ 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 237 of file ParameterMap.cpp.

References entries(), get(), 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 271 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 1214 of file ParameterMap.cpp.

References m_cacheLocMap, m_cacheRotMap, m_componentInfo, m_detectorInfo, m_idToIndex, m_indexToId, m_parameterFileNames, and m_parameterInfo.

◆ 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 1085 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 885 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 872 of file ParameterMap.cpp.

References getRecursive(), and name.

Referenced by Mantid::Algorithms::DetectorEfficiencyCor::correctForEfficiency(), Mantid::API::TimeAtSampleStrategyIndirect::getEfixed(), 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 851 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 914 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 258 of file ParameterMap.cpp.

References entries(), get(), 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 955 of file ParameterMap.cpp.

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

Referenced by Mantid::API::ExperimentInfo::getLog(), and Mantid::API::ExperimentInfo::getLogAsSingleValue().

◆ 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 261 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 239 of file ParameterMap.h.

References 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 281 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 1113 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 1104 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 new index for a component seen for the first time.

Definition at line 114 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), Mantid::Geometry::ComponentInfo::invalidIndex, m_idToIndex, and m_indexToId.

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 1150 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 1142 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 1127 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 972 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 220 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 228 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 201 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 181 of file ParameterMap.cpp.

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

◆ posx()

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

Definition at line 183 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ posy()

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

Definition at line 185 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ posz()

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

Definition at line 187 of file ParameterMap.cpp.

Referenced by addPositionCoordinate().

◆ pQuat()

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

Definition at line 209 of file ParameterMap.cpp.

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

◆ pString()

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

Definition at line 205 of file ParameterMap.cpp.

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

◆ pV3D()

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

Definition at line 207 of file ParameterMap.cpp.

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

◆ 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 84 of file ParameterMap.cpp.

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

◆ rekey()

std::shared_ptr< ParameterInfo > Mantid::Geometry::ParameterMap::rekey ( const std::unordered_map< Geometry::IComponent const *, size_t > &  idToIndex)

Rekey this map's parameters from the synthetic staging indices onto an instrument's real component indices, returning the resulting store.

Definition at line 150 of file ParameterMap.cpp.

References componentIdAt(), index, m_idToIndex, m_indexToId, and m_parameterInfo.

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 287 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 192 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ roty()

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

Definition at line 194 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ rotz()

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

Definition at line 196 of file ParameterMap.cpp.

Referenced by addRotationParam().

◆ saveNexus()

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

Persist a representation of the Parameter map to the open Nexus file.

Save the object to an open NeXus file.

Parameters
file:: open NeXus file
group:: name of the group to create

Definition at line 1065 of file ParameterMap.cpp.

References asString(), and group.

◆ scale()

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

◆ setCachedLocation()

void Mantid::Geometry::ParameterMap::setCachedLocation ( const IComponent *  comp,
const Kernel::V3D &  location 
) const

Sets a cached location on the location cache.

Parameters
comp:: The Component to set the location of
location:: The location

Definition at line 1014 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), and m_cacheLocMap.

Referenced by Mantid::Geometry::CompAssembly::getPos(), and Mantid::Geometry::ObjCompAssembly::getPos().

◆ setCachedRotation()

void Mantid::Geometry::ParameterMap::setCachedRotation ( const IComponent *  comp,
const Kernel::Quat &  rotation 
) const

Sets a cached rotation on the rotation cache.

Parameters
comp:: The Component to set the rotation of
rotation:: The rotation as a quaternion

Definition at line 1029 of file ParameterMap.cpp.

References Mantid::Geometry::IComponent::getComponentID(), m_cacheRotMap, and rotation.

Referenced by Mantid::Geometry::CompAssembly::getRotation(), and Mantid::Geometry::ObjCompAssembly::getRotation().

◆ 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 343 of file ParameterMap.h.

◆ sharedDetectorInfo()

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

Definition at line 344 of file ParameterMap.h.

◆ sharedInstrumentMetadata()

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

Definition at line 345 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 342 of file ParameterMap.h.

◆ size()

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

Return the size of the map.

Definition at line 57 of file ParameterMap.h.

Referenced by diff().

◆ swap()

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

method swaps two parameter maps contents each other.

All caches contents is nullified (TO DO: it can be efficiently swapped too)

Definition at line 94 of file ParameterMap.h.

Member Data Documentation

◆ m_cacheLocMap

std::unique_ptr<Kernel::Cache<const ComponentID, Kernel::V3D> > Mantid::Geometry::ParameterMap::m_cacheLocMap
private

internal cache map instance for cached position values

Definition at line 382 of file ParameterMap.h.

Referenced by clearPositionSensitiveCaches(), getCachedLocation(), getMemorySize(), and setCachedLocation().

◆ m_cacheRotMap

std::unique_ptr<Kernel::Cache<const ComponentID, Kernel::Quat> > Mantid::Geometry::ParameterMap::m_cacheRotMap
private

internal cache map instance for cached rotation values

Definition at line 384 of file ParameterMap.h.

Referenced by clearPositionSensitiveCaches(), getCachedRotation(), getMemorySize(), and setCachedRotation().

◆ 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 396 of file ParameterMap.h.

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

◆ m_idToIndex

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

Component pointer to index translation.

Definition at line 377 of file ParameterMap.h.

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

◆ m_indexToId

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

Reverse of m_idToIndex.

Needed because several accessors (asString, diff, getType) must recover the component from a stored parameter to report its name.

Definition at line 380 of file ParameterMap.h.

Referenced by componentIdAt(), getMemorySize(), indexForWrite(), 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 404 of file ParameterMap.h.

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

◆ m_instrumentMetadata

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

Definition at line 398 of file ParameterMap.h.

Referenced by buildInstrumentMetadata(), instrumentMetadata(), and setInstrument().

◆ m_parameterFileNames

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

internal list of parameter files loaded

Definition at line 371 of file ParameterMap.h.

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

◆ m_parameterInfo

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

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