Cosmetic changes, minor corrections to formulae, added getInstance static method.

This commit is contained in:
Karthik 2021-07-14 20:09:15 +02:00
parent b0184e1576
commit 043b4e61ba

View File

@ -6,8 +6,7 @@ classdef MOTSimulator < handle & matlab.mixin.Copyable
SimulationTime; SimulationTime;
NumberOfAtoms; NumberOfAtoms;
InitialPositions; ParticleDynamicalQuantities;
InitialVelocities;
NozzleLength; NozzleLength;
NozzleRadius; NozzleRadius;
@ -188,17 +187,11 @@ classdef MOTSimulator < handle & matlab.mixin.Copyable
ret = this.NumberOfAtoms; ret = this.NumberOfAtoms;
end end
function set.InitialPositions(this,val) function set.ParticleDynamicalQuantities(this,val)
this.InitialPositions = val; this.ParticleDynamicalQuantities = val;
end end
function ret = get.InitialPositions(this) function ret = get.ParticleDynamicalQuantities(this)
ret = this.InitialPositions; ret = this.ParticleDynamicalQuantities;
end
function set.InitialVelocities(this,val)
this.InitialVelocities = val;
end
function ret = get.InitialVelocities(this)
ret = this.InitialVelocities;
end end
function set.NozzleLength(this,val) function set.NozzleLength(this,val)
@ -603,7 +596,7 @@ classdef MOTSimulator < handle & matlab.mixin.Copyable
function ret = get.AverageVelocity(this) function ret = get.AverageVelocity(this)
%See Background collision probability section in Barbiero %See Background collision probability section in Barbiero
ret = sqrt((8*Helper.PhysicsConstants.BoltzmannConstant*this.OvenTemperatureinKelvin)/ (pi*Helper.PhysicsConstants.Dy164Mass)); ret = sqrt((8 * pi *Helper.PhysicsConstants.BoltzmannConstant*this.OvenTemperatureinKelvin)/ (9 * Helper.PhysicsConstants.Dy164Mass));
end end
function ret = get.AtomicBeamDensity(this) function ret = get.AtomicBeamDensity(this)
@ -624,6 +617,8 @@ classdef MOTSimulator < handle & matlab.mixin.Copyable
end % - getters for dependent properties end % - getters for dependent properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
methods(Access = protected) methods(Access = protected)
function cp = copyElement(this) function cp = copyElement(this)
% Shallow copy object % Shallow copy object
@ -642,4 +637,18 @@ classdef MOTSimulator < handle & matlab.mixin.Copyable
end end
end end
methods (Static)
% Creates an Instance of Class, ensures singleton behaviour (that there
% can only be one Instance of this class
function singleObj = getInstance(varargin)
% Creates an Instance of Class, ensures singleton behaviour
persistent localObj;
if isempty(localObj) || ~isvalid(localObj)
localObj = MOTSimulator(varargin{:});
end
singleObj = localObj;
end
end
end end