Skip to content

Commit

Permalink
Refs #10135. Using SymmetryOperationFactory in PointGroup-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wedel committed Sep 10, 2014
1 parent a0d868a commit d27e30f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 38 deletions.
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/Geometry/CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
70 changes: 36 additions & 34 deletions Code/Mantid/Framework/Geometry/src/Crystal/PointGroup.cpp
Expand Up @@ -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
{
Expand Down Expand Up @@ -160,7 +162,7 @@ namespace Geometry
PointGroupLaue1::PointGroupLaue1() :
PointGroup("-1")
{
addSymmetryOperation(boost::make_shared<const SymOpInversion>());
addSymmetryOperation(SymmetryOperationFactory::Instance().createSymOp("-1"));

setTransformationMatrices(generateTransformationMatrices(getSymmetryOperations()));
}
Expand All @@ -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()));
}
Expand All @@ -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()));
}
Expand All @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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()));
}
Expand Down
26 changes: 26 additions & 0 deletions Code/Mantid/Framework/Geometry/src/Crystal/SymmetryOperation.cpp
Expand Up @@ -73,6 +73,8 @@ SymOpIdentity::SymOpIdentity() :

}

DECLARE_SYMMETRY_OPERATION(SymOpIdentity)

/// Inversion
SymOpInversion::SymOpInversion() :
SymmetryOperation(2, Kernel::IntMatrix(3, 3, true), "-1")
Expand All @@ -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]")
Expand All @@ -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]")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -139,6 +149,8 @@ SymOpRotationTwoFold210Hexagonal::SymOpRotationTwoFold210Hexagonal() :
setMatrixFromArray(rotTwoFold210Hexagonal);
}

DECLARE_SYMMETRY_OPERATION(SymOpRotationTwoFold210Hexagonal)

/* 4-fold rotation axes */
/// 4-fold rotation around z-axis
SymOpRotationFourFoldZ::SymOpRotationFourFoldZ() :
Expand All @@ -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() :
Expand All @@ -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]")
Expand All @@ -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() :
Expand All @@ -186,6 +204,8 @@ SymOpRotationSixFoldZHexagonal::SymOpRotationSixFoldZHexagonal() :
setMatrixFromArray(rotSixFoldZHexagonal);
}

DECLARE_SYMMETRY_OPERATION(SymOpRotationSixFoldZHexagonal)

/* Mirror planes */
/// Mirror plane perpendicular to y-axis
SymOpMirrorPlaneY::SymOpMirrorPlaneY() :
Expand All @@ -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]")
Expand All @@ -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")
Expand All @@ -220,5 +244,7 @@ SymOpMirrorPlane210Hexagonal::SymOpMirrorPlane210Hexagonal() :
setMatrixFromArray(mirrorPlane210Hexagonal);
}

DECLARE_SYMMETRY_OPERATION(SymOpMirrorPlane210Hexagonal)

} // namespace Geometry
} // namespace Mantid

0 comments on commit d27e30f

Please sign in to comment.