Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
Messages.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - Messages
2 % Copyright (C) 2009-2015 Peter Rakyta, Ph.D.
3 %
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published by
6 % the Free Software Foundation, either version 3 of the License, or
7 % (at your option) any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program. If not, see http://www.gnu.org/licenses/.
16 %
17 %> @addtogroup basic Basic Functionalities
18 %> @{
19 %> @file Messages.m
20 %> @brief A class containing methodes for displaying several standard messages.
21 %> @}
22 %> @brief A class containing methodes for displaying several standard messages.
23 %%
24 classdef Messages < handle
25 
26  properties ( Access = protected )
27 %> An instance of structure #Opt
28  Opt
29  end
30 
31 
32 methods
33 %% Contructor of the class
34 %> @brief Constructor of the class.
35 %> @param Opt An instance of the structure #Opt.
36 %> @return An instance of the class Messages
37  function obj = Messages( Opt )
38  if nargin > 0
39  obj.Opt = Opt;
40  else
41  obj.Opt = structures('Opt');
42  end
43  end
44 
45 %% display
46 %> @brief Displays output messages on the screen
47 %> @param message String containing the message to be displayed
48 %> @param nosilent Set true to override the silent option given in #Opt.Silent.
49  function display( obj, message, nosilent )
50 
51  if ~exist('message', 'var')
52  obj.display( ['Class ', class(obj), ' is created.']);
53  return
54  end
55 
56  if isprop('Silent', obj)
57  if ~obj.Silent || exist('nosilent', 'var')
58  disp( message )
59  end
60  else
61  if ~obj.Opt.Silent || exist('nosilent', 'var')
62  disp( message )
63  end
64  end
65 
66  if obj.Opt.debug
67  fid = fopen('debug.txt', 'a');
68  fprintf(fid, [message,'\n']);
69  fclose(fid);
70  end
71 
72  end
73 
74 
75 %% getOpt
76 %> @brief Retrives the structure containing the calculation parameters
77 %> @return Return an instance of structure #Opt.
78  function ret = getOpt( obj )
79  ret = obj.Opt;
80  end
81 
82 end % methods public
83 
84 methods (Static = true)
85 %% BadInputType
86 %> @brief Throws a "bad input type" warning, with using the default value.
87 %> @param variable A string conatining the name of the variable.
88 %> @param type A string describing the desired type.
89  function BadInputType(variable,type)
90  warning('MATLAB:BadArgument',['Argument "',variable,'" is not a(an) ',type,'. Setting it to default.']);
91  end
92 
94 %> @brief Throws a "bad input type" warning without setting it to default.
95 %> @param variable A string conatining the name of the variable.
96 %> @param type A string describing the desired type.
97  function BadInputTypeNoDefault(variable,type)
98  warning('MATLAB:BadArgument',['Argument "',variable,'" is not a(an) ',type,'.']);
99  end
100 
102 %> @brief Throws an "iteration exceeded" warning.
103  function ExceedIteration()
104  warning('MATLAB:IterExceed','Number of iteration steps reached its limit. Return with initial values!');
105  end
106 
107 
108 end % methods static
109 
110 end
function Messages(Opt)
Constructor of the class.
A class containing methodes for displaying several standard messages.
Definition: Messages.m:24
static function BadInputTypeNoDefault(variable, type)
Throws a "bad input type" warning without setting it to default.
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
function display(message, nosilent)
Displays output messages on the screen.
function Transport(Energy, B)
Calculates the conductance at a given energy value.
static function BadInputType(variable, type)
Throws a "bad input type" warning, with using the default value.
function getOpt()
Retrives the structure containing the calculation parameters.
function()
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Property Opt
An instance of structure Opt.
Definition: Messages.m:31
static function ExceedIteration()
Throws an "iteration exceeded" warning.
Silent
Set 1 in order to supress output messages.
Definition: structures.m:62
function structures(name)