Skip to content

Commit

Permalink
Refs #11006. Compatibility with old code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wedel committed Mar 2, 2015
1 parent 8cd2cc3 commit 50af9fa
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 36 deletions.
Expand Up @@ -35,7 +35,7 @@ class MANTID_GEOMETRY_DLL PointGroup : public Group {
};

PointGroup(const std::string &symbolHM, const Group &group,
const std::string &name);
const std::string &description = "");

PointGroup(const PointGroup &other);
PointGroup &operator=(const PointGroup &other);
Expand Down
Expand Up @@ -14,12 +14,14 @@ namespace Geometry {
class MANTID_GEOMETRY_DLL PointGroupGenerator {
public:
PointGroupGenerator(const std::string &hmSymbol,
const std::string &generatorInformation);
const std::string &generatorInformation,
const std::string &description);

~PointGroupGenerator() {}

inline std::string getHMSymbol() const { return m_hmSymbol; }
inline std::string getGeneratorString() const { return m_generatorString; }
inline std::string getDescription() const { return m_description; }

PointGroup_sptr getPrototype();

Expand All @@ -32,6 +34,7 @@ class MANTID_GEOMETRY_DLL PointGroupGenerator {

std::string m_hmSymbol;
std::string m_generatorString;
std::string m_description;

PointGroup_sptr m_prototype;
};
Expand Down Expand Up @@ -87,7 +90,8 @@ class MANTID_GEOMETRY_DLL PointGroupFactoryImpl {
getPointGroupSymbols(const PointGroup::CrystalSystem &crystalSystem) const;

void subscribePointGroup(const std::string &hmSymbol,
const std::string &generatorString);
const std::string &generatorString,
const std::string &description);

/// Unsubscribes a point group from the factory
void unsubscribePointGroup(const std::string &hmSymbol) {
Expand Down Expand Up @@ -135,13 +139,13 @@ PointGroupFactory;
#define PGF_CONCAT_IMPL(x, y) x##y
#define PGF_CONCAT(x, y) PGF_CONCAT_IMPL(x, y)

#define DECLARE_POINTGROUP(hmSymbol, generators) \
#define DECLARE_POINTGROUP(hmSymbol, generators, description) \
namespace { \
Mantid::Kernel::RegistrationHelper \
PGF_CONCAT(register_pointgroup, \
__COUNTER__)(((Mantid::Geometry::PointGroupFactory::Instance() \
.subscribePointGroup(hmSymbol, generators)), \
0)); \
Mantid::Kernel::RegistrationHelper PGF_CONCAT(register_pointgroup, \
__COUNTER__)( \
((Mantid::Geometry::PointGroupFactory::Instance().subscribePointGroup( \
hmSymbol, generators, description)), \
0)); \
}

#endif /* MANTID_GEOMETRY_POINTGROUPFACTORY_H_ */
9 changes: 4 additions & 5 deletions Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp
Expand Up @@ -66,13 +66,12 @@ bool PointGroup::groupHasNoTranslations(const Group &group) const {

/// Protected constructor - can not be used directly.
PointGroup::PointGroup(const std::string &symbolHM, const Group &group,
const std::string &name)
: Group(group), m_symbolHM(symbolHM), m_name(name) {
}
const std::string &description)
: Group(group), m_symbolHM(symbolHM),
m_name(symbolHM + " (" + description + ")") {}

PointGroup::PointGroup(const PointGroup &other)
: Group(other), m_symbolHM(other.m_symbolHM), m_name(other.m_name) {
}
: Group(other), m_symbolHM(other.m_symbolHM), m_name(other.m_name) {}

PointGroup &PointGroup::operator=(const PointGroup &other) {
Group::operator=(other);
Expand Down
49 changes: 27 additions & 22 deletions Code/Mantid/Framework/Geometry/src/Crystal/PointGroupFactory.cpp
Expand Up @@ -33,7 +33,7 @@ std::vector<std::string>
PointGroupFactoryImpl::getAllPointGroupSymbols() const {
std::vector<std::string> pointGroups;

for (auto it = m_crystalSystemMap.begin(); it != m_crystalSystemMap.end();
for (auto it = m_generatorMap.begin(); it != m_generatorMap.end();
++it) {
pointGroups.push_back(it->first);
}
Expand All @@ -59,14 +59,15 @@ std::vector<std::string> PointGroupFactoryImpl::getPointGroupSymbols(

void
PointGroupFactoryImpl::subscribePointGroup(const std::string &hmSymbol,
const std::string &generatorString) {
const std::string &generatorString,
const std::string &description) {
if (isSubscribed(hmSymbol)) {
throw std::invalid_argument(
"Point group with this symbol is already registered.");
}

PointGroupGenerator_sptr generator =
boost::make_shared<PointGroupGenerator>(hmSymbol, generatorString);
PointGroupGenerator_sptr generator = boost::make_shared<PointGroupGenerator>(
hmSymbol, generatorString, description);

subscribe(generator);
}
Expand Down Expand Up @@ -157,8 +158,10 @@ PointGroupFactoryImpl::removeFromCrystalSystemMap(const std::string &hmSymbol) {
}

PointGroupGenerator::PointGroupGenerator(
const std::string &hmSymbol, const std::string &generatorInformation)
: m_hmSymbol(hmSymbol), m_generatorString(generatorInformation) {}
const std::string &hmSymbol, const std::string &generatorInformation,
const std::string &description)
: m_hmSymbol(hmSymbol), m_generatorString(generatorInformation),
m_description(description) {}

PointGroup_sptr PointGroupGenerator::getPrototype() {
if (!hasValidPrototype()) {
Expand All @@ -177,24 +180,26 @@ PointGroup_sptr PointGroupGenerator::generatePrototype() {
"Could not create group from supplied symmetry operations.");
}

return boost::make_shared<PointGroup>(m_hmSymbol, *generatingGroup, "");
return boost::make_shared<PointGroup>(m_hmSymbol, *generatingGroup,
m_description);
}

DECLARE_POINTGROUP("1", "x,y,z")
DECLARE_POINTGROUP("-1", "-x,-y,-z")
DECLARE_POINTGROUP("2/m", "-x,y,-z; x,-y,z")
DECLARE_POINTGROUP("112/m", "-x,-y,z; x,y,-z")
DECLARE_POINTGROUP("mmm", "x,-y,-z; -x,y,-z; x,y,-z")
DECLARE_POINTGROUP("4/m", "-y,x,z; x,y,-z")
DECLARE_POINTGROUP("4/mmm", "-y,x,z; x,y,-z; x,-y,-z")
DECLARE_POINTGROUP("-3", "-y,x-y,z; -x,-y,-z")
DECLARE_POINTGROUP("-3m1", "-y,x-y,z; -x,-y,-z; -x,y-x,z")
DECLARE_POINTGROUP("-31m", "-y,x-y,z; -x,-y,-z; -x,y-x,z")
DECLARE_POINTGROUP("6/m", "x-y,x,z; -x,-y,-z")
DECLARE_POINTGROUP("6/mmm", "x-y,x,z; x-y,-y,-z; x,y,-z")
DECLARE_POINTGROUP("m-3", "z,x,y; -x,-y,z; x,-y,z; -x,-y,-z")
DECLARE_POINTGROUP("m-3m", "z,x,y; -y,x,z; x,-y,z; -x,-y,-z")

DECLARE_POINTGROUP("1", "x,y,z", "Triclinic")
DECLARE_POINTGROUP("-1", "-x,-y,-z", "Triclinic")
DECLARE_POINTGROUP("2/m", "-x,y,-z; x,-y,z", "Monoclinic, unique axis b")
DECLARE_POINTGROUP("112/m", "-x,-y,z; x,y,-z", "Monoclinic, unique axis c")
DECLARE_POINTGROUP("mmm", "x,-y,-z; -x,y,-z; x,y,-z", "Orthorombic")
DECLARE_POINTGROUP("4/m", "-y,x,z; x,y,-z", "Tetragonal")
DECLARE_POINTGROUP("4/mmm", "-y,x,z; x,y,-z; x,-y,-z", "Tetragonal")
DECLARE_POINTGROUP("-3", "-y,x-y,z; -x,-y,-z", "Trigonal - Hexagonal")
DECLARE_POINTGROUP("-3m1", "-y,x-y,z; -x,-y,-z; -x,y-x,z",
"Trigonal - Rhombohedral")
DECLARE_POINTGROUP("-31m", "-y,x-y,z; -x,-y,-z; -x,y-x,z",
"Trigonal - Rhombohedral")
DECLARE_POINTGROUP("6/m", "x-y,x,z; -x,-y,-z", "Hexagonal")
DECLARE_POINTGROUP("6/mmm", "x-y,x,z; x-y,-y,-z; x,y,-z", "Hexagonal")
DECLARE_POINTGROUP("m-3", "z,x,y; -x,-y,z; x,-y,z; -x,-y,-z", "Cubic")
DECLARE_POINTGROUP("m-3m", "z,x,y; -y,x,z; x,-y,z; -x,-y,-z", "Cubic")

} // namespace Geometry
} // namespace Mantid

0 comments on commit 50af9fa

Please sign in to comment.