diff --git a/Code/Mantid/Framework/Geometry/CMakeLists.txt b/Code/Mantid/Framework/Geometry/CMakeLists.txt index cdcd19d898d5add04c36c036f7b8f36447edb85a..e4aa2703bb51ad9c3601eb449e574f234789e323 100644 --- a/Code/Mantid/Framework/Geometry/CMakeLists.txt +++ b/Code/Mantid/Framework/Geometry/CMakeLists.txt @@ -5,13 +5,13 @@ set ( SRC_FILES src/Crystal/IndexingUtils.cpp src/Crystal/NiggliCell.cpp src/Crystal/OrientedLattice.cpp + src/Crystal/SymmetryOperation.cpp + src/Crystal/SymmetryOperationFactory.cpp src/Crystal/PointGroup.cpp src/Crystal/PointGroupFactory.cpp src/Crystal/ReducedCell.cpp src/Crystal/ReflectionCondition.cpp src/Crystal/ScalarUtils.cpp - src/Crystal/SymmetryOperation.cpp - src/Crystal/SymmetryOperationFactory.cpp src/Crystal/UnitCell.cpp src/IObjComponent.cpp src/Instrument.cpp @@ -108,13 +108,13 @@ set ( INC_FILES inc/MantidGeometry/Crystal/IndexingUtils.h inc/MantidGeometry/Crystal/NiggliCell.h inc/MantidGeometry/Crystal/OrientedLattice.h + inc/MantidGeometry/Crystal/SymmetryOperation.h + inc/MantidGeometry/Crystal/SymmetryOperationFactory.h inc/MantidGeometry/Crystal/PointGroup.h inc/MantidGeometry/Crystal/PointGroupFactory.h inc/MantidGeometry/Crystal/ReducedCell.h inc/MantidGeometry/Crystal/ReflectionCondition.h inc/MantidGeometry/Crystal/ScalarUtils.h - inc/MantidGeometry/Crystal/SymmetryOperation.h - inc/MantidGeometry/Crystal/SymmetryOperationFactory.h inc/MantidGeometry/Crystal/UnitCell.h inc/MantidGeometry/DllConfig.h inc/MantidGeometry/ICompAssembly.h diff --git a/Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp b/Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp index 98b9d3837de098d0900f3e879a9de2abeb421860..8da40298559eba328551bbc021ae1190c261afe4 100644 --- a/Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp +++ b/Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp @@ -3,8 +3,10 @@ #include <set> #include <boost/make_shared.hpp> +#include <iostream> #include "MantidGeometry/Crystal/PointGroupFactory.h" +#include "MantidGeometry/Crystal/SymmetryOperationFactory.h" namespace Mantid { @@ -160,7 +162,7 @@ namespace Geometry PointGroupLaue1::PointGroupLaue1() : PointGroup("-1") { - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -187,8 +189,8 @@ namespace Geometry PointGroupLaue2::PointGroupLaue2() : PointGroup("2/m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldY>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneY>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [010]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [010]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -215,8 +217,8 @@ namespace Geometry PointGroupLaue3::PointGroupLaue3() : PointGroup("112/m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldZ>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneZ>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [001]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -243,9 +245,9 @@ namespace Geometry PointGroupLaue4::PointGroupLaue4() : PointGroup("mmm") { - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldX>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldY>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneZ>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [100]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [010]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [001]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -274,8 +276,8 @@ namespace Geometry PointGroupLaue5::PointGroupLaue5() : PointGroup("4/m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationFourFoldZ>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneZ>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("4 [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [001]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -304,9 +306,9 @@ namespace Geometry PointGroupLaue6::PointGroupLaue6() : PointGroup("4/mmm") { - addSymmetryOperation(boost::make_shared<const SymOpRotationFourFoldZ>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldX>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneZ>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("4 [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [100]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -338,8 +340,8 @@ namespace Geometry PointGroupLaue7::PointGroupLaue7() : PointGroup("-3") { - addSymmetryOperation(boost::make_shared<const SymOpRotationThreeFoldZHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("3 [001]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -367,9 +369,9 @@ namespace Geometry PointGroupLaue8::PointGroupLaue8() : PointGroup("-3m1") { - addSymmetryOperation(boost::make_shared<const SymOpRotationThreeFoldZHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlane210Hexagonal>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("3 [001]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [210]h")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -399,9 +401,9 @@ namespace Geometry PointGroupLaue9::PointGroupLaue9() : PointGroup("-31m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationThreeFoldZHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFold210Hexagonal>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("3 [001]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [210]h")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -431,8 +433,8 @@ namespace Geometry PointGroupLaue10::PointGroupLaue10() : PointGroup("6/m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationSixFoldZHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("6 [001]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -462,9 +464,9 @@ namespace Geometry PointGroupLaue11::PointGroupLaue11() : PointGroup("6/mmm") { - addSymmetryOperation(boost::make_shared<const SymOpRotationSixFoldZHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldXHexagonal>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneZ>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("6 [001]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [100]h")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [001]")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -498,10 +500,10 @@ namespace Geometry PointGroupLaue12::PointGroupLaue12() : PointGroup("m-3") { - addSymmetryOperation(boost::make_shared<const SymOpRotationThreeFold111>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationTwoFoldZ>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneY>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("3 [111]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("2 [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [010]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } @@ -535,10 +537,10 @@ namespace Geometry PointGroupLaue13::PointGroupLaue13() : PointGroup("m-3m") { - addSymmetryOperation(boost::make_shared<const SymOpRotationThreeFold111>()); - addSymmetryOperation(boost::make_shared<const SymOpRotationFourFoldZ>()); - addSymmetryOperation(boost::make_shared<const SymOpMirrorPlaneY>()); - addSymmetryOperation(boost::make_shared<const SymOpInversion>()); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("3 [111]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("4 [001]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("m [010]")); + addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1")); setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations())); } diff --git a/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryOperation.cpp b/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryOperation.cpp index 7204bea2baa187f25d9d4bc841eec1a42bdcde10..a6c55926dec17a4a66e810443fc1a91992cbba1b 100644 --- a/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryOperation.cpp +++ b/Code/Mantid/Framework/Geometry/src/Crystal/SymmetryOperation.cpp @@ -73,6 +73,8 @@ SymOpIdentity::SymOpIdentity() : } +DECLARE_SYMMETRY_OPERATION(SymOpIdentity) + /// Inversion SymOpInversion::SymOpInversion() : SymmetryOperation(2, Kernel::IntMatrix(3, 3, true), "-1") @@ -95,6 +97,8 @@ SymOpRotationTwoFoldX::SymOpRotationTwoFoldX() : setMatrixFromArray(rotTwoFoldX); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFoldX) + /// 2-fold rotation around y-axis SymOpRotationTwoFoldY::SymOpRotationTwoFoldY() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "2 [010]") @@ -106,6 +110,8 @@ SymOpRotationTwoFoldY::SymOpRotationTwoFoldY() : setMatrixFromArray(rotTwoFoldY); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFoldY) + /// 2-fold rotation around z-axis SymOpRotationTwoFoldZ::SymOpRotationTwoFoldZ() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "2 [001]") @@ -117,6 +123,8 @@ SymOpRotationTwoFoldZ::SymOpRotationTwoFoldZ() : setMatrixFromArray(rotTwoFoldZ); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFoldZ) + /// 2-fold rotation around x-axis, hexagonal coordinate system SymOpRotationTwoFoldXHexagonal::SymOpRotationTwoFoldXHexagonal() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "2 [100]h") @@ -128,6 +136,8 @@ SymOpRotationTwoFoldXHexagonal::SymOpRotationTwoFoldXHexagonal() : setMatrixFromArray(rotTwoFoldXHexagonal); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFoldXHexagonal) + /// 2-fold rotation around [210]-axis, hexagonal coordinate system SymOpRotationTwoFold210Hexagonal::SymOpRotationTwoFold210Hexagonal() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "2 [210]h") @@ -139,6 +149,8 @@ SymOpRotationTwoFold210Hexagonal::SymOpRotationTwoFold210Hexagonal() : setMatrixFromArray(rotTwoFold210Hexagonal); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFold210Hexagonal) + /* 4-fold rotation axes */ /// 4-fold rotation around z-axis SymOpRotationFourFoldZ::SymOpRotationFourFoldZ() : @@ -151,6 +163,8 @@ SymOpRotationFourFoldZ::SymOpRotationFourFoldZ() : setMatrixFromArray(rotFourFoldZ); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationFourFoldZ) + /* 3-fold rotation axes */ /// 3-fold rotation around z-axis, hexagonal coordinate system SymOpRotationThreeFoldZHexagonal::SymOpRotationThreeFoldZHexagonal() : @@ -163,6 +177,8 @@ SymOpRotationThreeFoldZHexagonal::SymOpRotationThreeFoldZHexagonal() : setMatrixFromArray(rotThreeFoldZHexagonal); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationThreeFoldZHexagonal) + /// 3-fold rotation around [111]-axis SymOpRotationThreeFold111::SymOpRotationThreeFold111() : SymmetryOperation(3, Kernel::IntMatrix(3, 3), "3 [111]") @@ -174,6 +190,8 @@ SymOpRotationThreeFold111::SymOpRotationThreeFold111() : setMatrixFromArray(rotThreeFold111); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationThreeFold111) + /* 6-fold rotation axes */ /// 6-fold rotation around z-axis, hexagonal coordinate system SymOpRotationSixFoldZHexagonal::SymOpRotationSixFoldZHexagonal() : @@ -186,6 +204,8 @@ SymOpRotationSixFoldZHexagonal::SymOpRotationSixFoldZHexagonal() : setMatrixFromArray(rotSixFoldZHexagonal); } +DECLARE_SYMMETRY_OPERATION(SymOpRotationSixFoldZHexagonal) + /* Mirror planes */ /// Mirror plane perpendicular to y-axis SymOpMirrorPlaneY::SymOpMirrorPlaneY() : @@ -198,6 +218,8 @@ SymOpMirrorPlaneY::SymOpMirrorPlaneY() : setMatrixFromArray(mirrorPlaneY); } +DECLARE_SYMMETRY_OPERATION(SymOpMirrorPlaneY) + /// Mirror plane perpendicular to z-axis SymOpMirrorPlaneZ::SymOpMirrorPlaneZ() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "m [001]") @@ -209,6 +231,8 @@ SymOpMirrorPlaneZ::SymOpMirrorPlaneZ() : setMatrixFromArray(mirrorPlaneZ); } +DECLARE_SYMMETRY_OPERATION(SymOpMirrorPlaneZ) + /// Mirror plane perpendicular to [210]-axis SymOpMirrorPlane210Hexagonal::SymOpMirrorPlane210Hexagonal() : SymmetryOperation(2, Kernel::IntMatrix(3, 3), "m [210]h") @@ -220,5 +244,7 @@ SymOpMirrorPlane210Hexagonal::SymOpMirrorPlane210Hexagonal() : setMatrixFromArray(mirrorPlane210Hexagonal); } +DECLARE_SYMMETRY_OPERATION(SymOpMirrorPlane210Hexagonal) + } // namespace Geometry } // namespace Mantid