Skip to content

Commit

Permalink
Pass matrices/unit cell by reference to const in constructors.
Browse files Browse the repository at this point in the history
Refs #7994
  • Loading branch information
martyngigg committed Sep 30, 2013
1 parent b6f39c2 commit 9043e6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ namespace Geometry
{
public:
// Default constructor. a = b = c = 1, alpha = beta = gamma = 90 degrees
OrientedLattice(Kernel::DblMatrix Umatrix=Kernel::DblMatrix(3,3,true));
OrientedLattice(const Kernel::DblMatrix & Umatrix = Kernel::DblMatrix(3,3,true));
//Copy constructor
OrientedLattice(const OrientedLattice& other);
// a,b,c constructor
OrientedLattice(const double _a,const double _b,const double _c,Kernel::DblMatrix Umatrix=Kernel::DblMatrix(3,3,true));
OrientedLattice(const double _a,const double _b,const double _c,
const Kernel::DblMatrix & Umatrix = Kernel::DblMatrix(3,3,true));
//a,b,c,alpha,beta,gamma constructor
OrientedLattice(const double _a,const double _b,const double _c,const double _alpha,const double _beta,const double _gamma,Kernel::DblMatrix Umatrix=Kernel::DblMatrix(3,3,true),const int angleunit=angDegrees);
OrientedLattice(const double _a,const double _b,const double _c,const double _alpha,const double _beta,
const double _gamma, const Kernel::DblMatrix & Umatrix = Kernel::DblMatrix(3,3,true),
const int angleunit=angDegrees);
//UnitCell constructor
OrientedLattice(UnitCell uc ,Kernel::DblMatrix Umatrix=Kernel::DblMatrix(3,3,true));
OrientedLattice(const UnitCell & uc , const Kernel::DblMatrix & Umatrix = Kernel::DblMatrix(3,3,true));
// Destructor
virtual ~OrientedLattice();

Expand Down
15 changes: 10 additions & 5 deletions Code/Mantid/Framework/Geometry/src/Crystal/OrientedLattice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Geometry
/** Default constructor
@param Umatrix :: orientation matrix U. By default this will be identity matrix
*/
OrientedLattice::OrientedLattice(DblMatrix Umatrix):UnitCell()
OrientedLattice::OrientedLattice(const DblMatrix & Umatrix) : UnitCell()
{
if (Umatrix.isRotation()==true)
{
Expand All @@ -23,7 +23,7 @@ namespace Geometry
/** Copy constructor
@param other :: The OrientedLattice from which to copy information
*/
OrientedLattice::OrientedLattice(const OrientedLattice& other):UnitCell(other),U(other.U),UB(other.UB)
OrientedLattice::OrientedLattice(const OrientedLattice& other) : UnitCell(other),U(other.U),UB(other.UB)
{
}

Expand All @@ -33,7 +33,8 @@ namespace Geometry
@param _c :: lattice parameter \f$ c \f$ with \f$\alpha = \beta = \gamma = 90^\circ \f$
@param Umatrix :: orientation matrix U
*/
OrientedLattice::OrientedLattice(const double _a,const double _b,const double _c,DblMatrix Umatrix):UnitCell(_a,_b,_c)
OrientedLattice::OrientedLattice(const double _a,const double _b,const double _c,
const DblMatrix &Umatrix) : UnitCell(_a,_b,_c)
{
if (Umatrix.isRotation()==true)
{
Expand All @@ -53,7 +54,10 @@ namespace Geometry
@param angleunit :: units for angle, of type #AngleUnits. Default is degrees.
@param Umatrix :: orientation matrix U
*/
OrientedLattice::OrientedLattice(const double _a,const double _b,const double _c,const double _alpha,const double _beta,const double _gamma,DblMatrix Umatrix, const int angleunit):UnitCell(_a,_b,_c,_alpha,_beta,_gamma,angleunit)
OrientedLattice::OrientedLattice(const double _a,const double _b,const double _c,const double _alpha,
const double _beta,const double _gamma, const DblMatrix &Umatrix,
const int angleunit)
:UnitCell(_a,_b,_c,_alpha,_beta,_gamma,angleunit)
{
if (Umatrix.isRotation()==true)
{
Expand All @@ -67,7 +71,8 @@ namespace Geometry
@param uc :: UnitCell
@param Umatrix :: orientation matrix U. By default this will be identity matrix
*/
OrientedLattice::OrientedLattice(UnitCell uc,DblMatrix Umatrix):UnitCell(uc),U(Umatrix)
OrientedLattice::OrientedLattice(const UnitCell & uc, const DblMatrix & Umatrix)
: UnitCell(uc),U(Umatrix)
{
if (Umatrix.isRotation()==true)
{
Expand Down

0 comments on commit 9043e6b

Please sign in to comment.