|
Mantid
|
CompositeBraggScatterer accumulates scatterers, for easier calculation of structure factors. More...
#include <CompositeBraggScatterer.h>
Public Member Functions | |
| virtual void | addScatterer (const BraggScatterer_sptr &scatterer) |
| Clones the supplied scatterer, assigns the internal space group and unit cell to the clone and adds it to the composite. | |
| void | addScatterers (const std::vector< BraggScatterer_sptr > &scatterer) |
| Adds scatterers and assigns clones of the supplied ones. | |
| StructureFactor | calculateStructureFactor (const Kernel::V3D &hkl) const override |
| Calculates the structure factor for the given HKL by summing all contributions from contained scatterers. | |
| BraggScatterer_sptr | clone () const override |
| Recursively clones all contained scatterers and returns the resulting composite. | |
| CompositeBraggScatterer () | |
| Default constructor. | |
| BraggScatterer_sptr | getScatterer (size_t i) const |
| Returns the i-th scatterer or throws an std::out_of_range exception. | |
| const std::vector< BraggScatterer_sptr > & | getScatterers () const |
| Returns the scatterers. | |
| std::string | name () const override |
| size_t | nScatterers () const |
| Returns the number of scatterers contained in the composite. | |
| void | removeAllScatterers () |
| Removes all scatterers. | |
| void | removeScatterer (size_t i) |
| Removes the i-th scatterer from the composite or throws an std::out_of_range exception. | |
| void | setScatterers (const std::vector< BraggScatterer_sptr > &scatterers) |
| Clears all scatterers and assigns clones of the supplied ones. | |
Public Member Functions inherited from Mantid::Geometry::BraggScatterer | |
| BraggScatterer () | |
| Default constructor. | |
| double | calculateFSquared (const Kernel::V3D &hkl) const |
| Returns |F(hkl)|^2. | |
| void | initialize () |
| Initialization method that calls declareProperties() and sets initialized state to true. | |
| bool | isInitialized () |
| Returns whether the instance has been initialized. | |
| bool | isPropertyExposedToComposite (const std::string &propertyName) const |
| Checks whether a property with the given name is exposed to BraggScattererComposite. | |
| bool | isPropertyExposedToComposite (Kernel::Property *property) const |
| Checks if a property is exposed to BraggScattererComposite or throws std::invalid_argument if a null-pointer is supplied. | |
Public Member Functions inherited from Mantid::Kernel::PropertyManager | |
| ::Json::Value | asJson (bool withDefaultValues=false) const override |
| Return the property manager serialized as a json object. | |
| std::string | asString (bool withDefaultValues=false) const override |
| Return the property manager serialized as a string. | |
| void | clear () override final |
| Clears the whole property map. | |
| PropertyManager * | cloneInTimeROI (const Kernel::TimeROI &timeROI) |
| Create a partial copy of this object such that every time series property is cloned according to the input TimeROI. | |
| void | declareOrReplaceProperty (std::unique_ptr< Property > p, const std::string &doc="") override |
| Add or replace a property in the list of managed properties. | |
| void | declareProperty (const std::string &name, const char *value, const std::string &doc, IValidator_sptr validator=std::make_shared< NullValidator >(), const unsigned int direction=Direction::Input) |
| Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). | |
| void | declareProperty (const std::string &name, const char *value, const unsigned int direction) |
| Add a property of string type to the list of managed properties. | |
| void | declareProperty (const std::string &name, const char *value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc=std::string(), const unsigned int direction=Direction::Input) |
| Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, const std::string &doc, const unsigned int direction=Direction::Input) |
| Add a property to the list of managed properties with no validator. | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, const unsigned int direction) |
| Add a property of the template type to the list of managed properties. | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc="", const unsigned int direction=Direction::Input) |
| Add a property of the template type to the list of managed properties. | |
| void | declareProperty (std::unique_ptr< Property > p, const std::string &doc="") override |
| Add a property to the list of managed properties. | |
| virtual void | declareProperty (std::unique_ptr< Property > p, const std::string &doc="")=0 |
| Function to declare properties (i.e. store them) | |
| bool | existsProperty (const std::string &name) const override |
| Checks whether the named property is already in the list of managed property. | |
| void | filterByProperty (Mantid::Kernel::LogFilter *logFilter, const std::vector< std::string > &excludedFromFiltering=std::vector< std::string >()) override |
| Filter the managed properties by the given boolean property mask. | |
| std::vector< std::string > | getDeclaredPropertyNames () const noexcept override |
| Return the list of declared property names. | |
| Property * | getPointerToProperty (const std::string &name) const override |
| Get a property by name. | |
| const std::vector< Property * > & | getProperties () const override |
| Get the list of managed properties. | |
| TypedValue | getProperty (const std::string &name) const override |
| Get the value of a property. | |
| std::string | getPropertyValue (const std::string &name) const override |
| Get the value of a property as a string. | |
| bool | operator!= (const PropertyManager &other) const |
| PropertyManager & | operator+= (const PropertyManager &rhs) |
| Addition operator. | |
| PropertyManager & | operator= (const PropertyManager &) |
| Assignment operator - performs a deep copy. | |
| bool | operator== (const PropertyManager &other) const |
| size_t | propertyCount () const override |
| Count the number of properties under management. | |
| PropertyManager () | |
| Default constructor. | |
| PropertyManager (const PropertyManager &) | |
| copy constructor | |
| void | removeDataOutsideTimeROI (const Kernel::TimeROI &timeROI) |
| For time series properties, remove time values outside of TimeROI regions, each defined as [roi_begin,roi_end]. | |
| void | removeProperty (const std::string &name, const bool delproperty=true) override |
| removes the property from properties map | |
| void | resetProperties () override |
| Reset property values back to initial values (blank or default values) | |
| void | setProperties (const ::Json::Value &jsonValue, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) override |
| Set the ordered list of properties by a json value collection. | |
| void | setProperties (const ::Json::Value &jsonValue, IPropertyManager *targetPropertyManager, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) |
| Set the ordered list of properties by a json value collection. | |
| void | setProperties (const std::string &propertiesJson, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) override |
| Set the ordered list of properties by one string of values, separated by semicolons. | |
| void | setProperties (const std::string &propertiesJson, IPropertyManager *targetPropertyManager, const std::unordered_set< std::string > &ignoreProperties, bool createMissing=false) |
| Set the ordered list of properties by one string of values, separated by semicolons. | |
| void | setPropertiesWithString (const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >()) override |
| Sets all the declared properties from a string. | |
| void | setPropertyOrdinal (const int &index, const std::string &value) override |
| Set the value of a property by an index N.B. | |
| void | setPropertyValue (const std::string &name, const std::string &value) override |
| Set the value of a property by string N.B. | |
| void | setPropertyValueFromJson (const std::string &name, const Json::Value &value) override |
| Set the value of a property by Json::Value. | |
| std::unique_ptr< Property > | takeProperty (const size_t index) override |
| removes the property from the properties map and returns a pointer to it | |
| bool | validateProperties () const override |
| Validates all the properties in the collection. | |
| virtual | ~PropertyManager () override |
| Virtual destructor. | |
Public Member Functions inherited from Mantid::Kernel::IPropertyManager | |
| void | declareProperty (const std::string &name, const char *value, const std::string &doc, IValidator_sptr validator=std::make_shared< NullValidator >(), const unsigned int direction=Direction::Input) |
| Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). | |
| void | declareProperty (const std::string &name, const char *value, const unsigned int direction) |
| Add a property of string type to the list of managed properties. | |
| void | declareProperty (const std::string &name, const char *value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc=std::string(), const unsigned int direction=Direction::Input) |
| Specialised version of declareProperty template method to prevent the creation of a PropertyWithValue of type const char* if an argument in quotes is passed (it will be converted to a string). | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, const std::string &doc, const unsigned int direction=Direction::Input) |
| Add a property to the list of managed properties with no validator. | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, const unsigned int direction) |
| Add a property of the template type to the list of managed properties. | |
| template<typename T > | |
| void | declareProperty (const std::string &name, T value, IValidator_sptr validator=std::make_shared< NullValidator >(), const std::string &doc="", const unsigned int direction=Direction::Input) |
| Add a property of the template type to the list of managed properties. | |
| std::vector< Property * > | getPropertiesInGroup (const std::string &group) const |
| Get the list of managed properties in a given group. | |
| IPropertyManager * | setProperty (const std::string &name, const char *value) |
| Specialised version of setProperty template method to handle const char *. | |
| IPropertyManager * | setProperty (const std::string &name, const std::string &value) |
| Specialised version of setProperty template method to handle std::string. | |
| template<typename T > | |
| IPropertyManager * | setProperty (const std::string &name, const T &value) |
| Templated method to set the value of a PropertyWithValue. | |
| template<typename T > | |
| IPropertyManager * | setProperty (const std::string &name, std::unique_ptr< T > value) |
| Templated method to set the value of a PropertyWithValue from a std::unique_ptr. | |
| void | setPropertyGroup (const std::string &name, const std::string &group) |
| Set the group for a given property. | |
| void | setPropertySettings (const std::string &name, std::unique_ptr< IPropertySettings > settings) |
| void | updatePropertyValues (const IPropertyManager &other) |
| Update values of the existing properties. | |
| virtual | ~IPropertyManager ()=default |
Static Public Member Functions | |
| static CompositeBraggScatterer_sptr | create () |
| Static method that creates a new instance of CompositeBraggScatterer and returns it (wrapped by a smart pointer). | |
| static CompositeBraggScatterer_sptr | create (const std::vector< BraggScatterer_sptr > &scatterers) |
| Creates and empty CompositeBraggScatterer and adds all scatterers contained in the supplied vector. | |
Static Public Member Functions inherited from Mantid::Kernel::PropertyManager | |
| static std::string | getInvalidValuesFilterLogName (const std::string &logName) |
| Gets the correct log name for the matching invalid values log for a given log name. | |
| static std::string | getLogNameFromInvalidValuesFilter (const std::string &logName) |
| static bool | isAnInvalidValuesFilterLog (const std::string &logName) |
| Determine if the log's name has a substring indicating it should not be filtered. | |
Protected Member Functions | |
| void | addScattererImplementation (const BraggScatterer_sptr &scatterer) |
| This method performs the actual cloning and adding of a new scatterer. | |
| void | afterPropertySet (const std::string &propertyName) override |
| Makes sure that space group and unit cell are propagated to all stored scatterers. | |
| std::map< std::string, size_t > | getPropertyCountMap () const |
| Returns a map with all declared property names and 0. | |
| void | propagateProperty (const std::string &propertyName) |
| Propagates the given property to all contained scatterers that have this property. | |
| void | propagatePropertyToScatterer (BraggScatterer_sptr &scatterer, const std::string &propertyName, const std::string &propertyValue) |
| void | redeclareProperties () |
| Synchronize properties with scatterer members. | |
| void | removeScattererImplementation (size_t i) |
| This method performs the actual removal of the i-th scatterer. | |
Protected Member Functions inherited from Mantid::Geometry::BraggScatterer | |
| virtual void | declareProperties () |
| Base implementation does nothing - for implementing classes only. | |
| void | exposePropertyToComposite (const std::string &propertyName) |
| Exposes the property with the supplied name to BraggScattererComposite. | |
| const std::string & | getPropagatingGroupName () const |
| Returns the group name that is used to mark properties that are propagated. | |
| void | unexposePropertyFromComposite (const std::string &propertyName) |
| Removes exposure to composite for specified property. | |
Protected Member Functions inherited from Mantid::Kernel::PropertyManager | |
| Property * | getPointerToPropertyOrdinal (const int &index) const override |
| Get a property by an index. | |
| Property * | getPointerToPropertyOrNull (const std::string &name) const |
| Get a property by name. | |
Protected Member Functions inherited from Mantid::Kernel::IPropertyManager | |
| template<typename T > | |
| T | getValue (const std::string &name) const |
| Templated method to get the value of a property. | |
| template<> | |
| MANTID_KERNEL_DLL PropertyManager_sptr | getValue (const std::string &name) const |
| template<> | |
| MANTID_KERNEL_DLL PropertyManager_const_sptr | getValue (const std::string &name) const |
Protected Attributes | |
| std::vector< BraggScatterer_sptr > | m_scatterers |
Additional Inherited Members | |
Static Public Attributes inherited from Mantid::Kernel::PropertyManager | |
| static const std::string | INVALID_VALUES_SUFFIX = "_invalid_values" |
CompositeBraggScatterer accumulates scatterers, for easier calculation of structure factors.
Scatterers can be added through the method addScatterer. The supplied scatterer is not stored directly, it is cloned instead, so there is a new instance. The original instance is not modified at all.
For structure factor calculations, all contributions from contained scatterers are summed. Contained scatterers may be CompositeBraggScatterers themselves, so it's possible to build up elaborate structures.
There are two ways of creating instances of CompositeBraggScatterer. The first possibility is to use BraggScattererFactory, just like for other implementations of BraggScatterer. Additionally there is a static method CompositeBraggScatterer::create, which creates a composite scatterer of the supplied vector of scatterers.
CompositeBraggScatterer does not declare any methods by itself, instead it exposes some properties of the contained scatterers (those which were marked using exposePropertyToComposite). When these properties are set, their values are propagated to all members of the composite. The default behavior when new properties are declared in subclasses of BraggScatterer is not to expose them in this way.
Definition at line 49 of file CompositeBraggScatterer.h.
| Mantid::Geometry::CompositeBraggScatterer::CompositeBraggScatterer | ( | ) |
Default constructor.
Definition at line 16 of file CompositeBraggScatterer.cpp.
|
virtual |
Clones the supplied scatterer, assigns the internal space group and unit cell to the clone and adds it to the composite.
Definition at line 52 of file CompositeBraggScatterer.cpp.
References addScattererImplementation(), and redeclareProperties().
|
protected |
This method performs the actual cloning and adding of a new scatterer.
Definition at line 146 of file CompositeBraggScatterer.cpp.
References m_scatterers.
Referenced by addScatterer(), and addScatterers().
| void Mantid::Geometry::CompositeBraggScatterer::addScatterers | ( | const std::vector< BraggScatterer_sptr > & | scatterer | ) |
Adds scatterers and assigns clones of the supplied ones.
Definition at line 58 of file CompositeBraggScatterer.cpp.
References addScattererImplementation(), and redeclareProperties().
Referenced by setScatterers().
|
overrideprotectedvirtual |
Makes sure that space group and unit cell are propagated to all stored scatterers.
Reimplemented from Mantid::Kernel::IPropertyManager.
Definition at line 123 of file CompositeBraggScatterer.cpp.
References propagateProperty().
|
overridevirtual |
Calculates the structure factor for the given HKL by summing all contributions from contained scatterers.
Implements Mantid::Geometry::BraggScatterer.
Definition at line 114 of file CompositeBraggScatterer.cpp.
References m_scatterers.
|
overridevirtual |
Recursively clones all contained scatterers and returns the resulting composite.
Implements Mantid::Geometry::BraggScatterer.
Definition at line 39 of file CompositeBraggScatterer.cpp.
References Mantid::Kernel::PropertyManager::asString(), clone(), and m_scatterers.
Referenced by clone().
|
static |
Static method that creates a new instance of CompositeBraggScatterer and returns it (wrapped by a smart pointer).
Definition at line 20 of file CompositeBraggScatterer.cpp.
Referenced by create(), Mantid::Geometry::CrystalStructure::CrystalStructure(), and Mantid::Geometry::CrystalStructure::initializeScatterers().
|
static |
Creates and empty CompositeBraggScatterer and adds all scatterers contained in the supplied vector.
Definition at line 29 of file CompositeBraggScatterer.cpp.
References create().
|
protected |
Returns a map with all declared property names and 0.
Definition at line 197 of file CompositeBraggScatterer.cpp.
References Mantid::Kernel::PropertyManager::getProperties().
Referenced by redeclareProperties().
| BraggScatterer_sptr Mantid::Geometry::CompositeBraggScatterer::getScatterer | ( | size_t | i | ) | const |
Returns the i-th scatterer or throws an std::out_of_range exception.
Definition at line 75 of file CompositeBraggScatterer.cpp.
References m_scatterers, and nScatterers().
| const std::vector< BraggScatterer_sptr > & Mantid::Geometry::CompositeBraggScatterer::getScatterers | ( | ) | const |
Returns the scatterers.
Definition at line 84 of file CompositeBraggScatterer.cpp.
References m_scatterers.
|
inlineoverridevirtual |
Implements Mantid::Geometry::BraggScatterer.
Definition at line 56 of file CompositeBraggScatterer.h.
| size_t Mantid::Geometry::CompositeBraggScatterer::nScatterers | ( | ) | const |
Returns the number of scatterers contained in the composite.
Definition at line 72 of file CompositeBraggScatterer.cpp.
References m_scatterers.
Referenced by getScatterer(), removeAllScatterers(), and removeScattererImplementation().
|
protected |
Propagates the given property to all contained scatterers that have this property.
Definition at line 127 of file CompositeBraggScatterer.cpp.
References Mantid::Kernel::PropertyManager::getPropertyValue(), m_scatterers, and propagatePropertyToScatterer().
Referenced by afterPropertySet().
|
protected |
Definition at line 135 of file CompositeBraggScatterer.cpp.
Referenced by propagateProperty(), and redeclareProperties().
|
protected |
Synchronize properties with scatterer members.
This method synchronizes the properties of CompositeBraggScatterer with the properties of the contained BraggScatterer instances. It adds new properties if required and removed properties that are no longer used (for example because the member that introduced the property has been removed).
Definition at line 163 of file CompositeBraggScatterer.cpp.
References Mantid::Kernel::PropertyManager::declareProperty(), Mantid::Kernel::PropertyManager::existsProperty(), Mantid::Geometry::BraggScatterer::getPropagatingGroupName(), getPropertyCountMap(), Mantid::Kernel::PropertyManager::getPropertyValue(), m_scatterers, propagatePropertyToScatterer(), and Mantid::Kernel::PropertyManager::removeProperty().
Referenced by addScatterer(), addScatterers(), removeAllScatterers(), and removeScatterer().
| void Mantid::Geometry::CompositeBraggScatterer::removeAllScatterers | ( | ) |
Removes all scatterers.
Definition at line 104 of file CompositeBraggScatterer.cpp.
References nScatterers(), redeclareProperties(), and removeScattererImplementation().
Referenced by setScatterers().
| void Mantid::Geometry::CompositeBraggScatterer::removeScatterer | ( | size_t | i | ) |
Removes the i-th scatterer from the composite or throws an std::out_of_range exception.
Definition at line 88 of file CompositeBraggScatterer.cpp.
References redeclareProperties(), and removeScattererImplementation().
|
protected |
This method performs the actual removal of the i-th scatterer.
Definition at line 95 of file CompositeBraggScatterer.cpp.
References m_scatterers, and nScatterers().
Referenced by removeAllScatterers(), and removeScatterer().
| void Mantid::Geometry::CompositeBraggScatterer::setScatterers | ( | const std::vector< BraggScatterer_sptr > & | scatterers | ) |
Clears all scatterers and assigns clones of the supplied ones.
Definition at line 66 of file CompositeBraggScatterer.cpp.
References addScatterers(), and removeAllScatterers().
|
protected |
Definition at line 82 of file CompositeBraggScatterer.h.
Referenced by addScattererImplementation(), calculateStructureFactor(), clone(), getScatterer(), getScatterers(), nScatterers(), propagateProperty(), redeclareProperties(), and removeScattererImplementation().