403 #if 0 //mtoc++: 'set.DataDirectory'
406 error(
" DataDirectory must be a char array ");
407 elseif ~isempty(value) && ~isdir(value)
408 fprintf(
" Creating directory %s\n ",value);
418 #if 0 //mtoc++: 'set.Workspace'
421 error("
Workspace must be a
char array ");
422 elseif ~isempty(value) && ~isdir(value)
423 fprintf(" Creating directory %s\n ",value);
433 #if 0 //mtoc++: 'set.DesktopLayout'
435 setpref(this.getPrefTag,
" DESKLAYOUT ",value);
442 #if 0 //mtoc++: 'set.rbmatlabDirectory'
446 error(" Invalid directory: %s ",value);
448 if ~exist(fullfile(value," startup_rbmatlab.m ")," file ")
449 error(" Invalid rbmatlab directory (no startup script found): %s ",value);
452 setpref(this.getPrefTag," RBMATLABDIR ",value);
466 #if 0 //mtoc++: 'set.JKerMorSourceDirectory'
470 error(" Invalid directory: %s ",value);
472 chk = fullfile(value,[" kermor " filesep " ReducedModel.java "]);
473 if ~exist(chk," file ")
474 error(" Invalid JKerMor directory (no ReducedModel.java found): %s ",value);
477 setpref(this.getPrefTag," JKERMORDIR ",value);
491 #if 0 //mtoc++: 'get.HomeDirectory'
503 #if 0 //mtoc++: 'get.DataDirectory'
505 h = getpref(this.getPrefTag,
" DATASTORE ",);
512 #if 0 //mtoc++: 'get.Workspace'
514 h = getpref(this.getPrefTag,
" WORKSPACE ",);
525 #if 0 //mtoc++: 'get.TempDirectory'
527 h = fullfile(this.DataDirectory,
" tmp ");
528 if ~exist(h,
" file ")
543 #if 0 //mtoc++: 'get.DesktopLayout'
545 d = getpref(this.getPrefTag,
" DESKLAYOUT ",);
552 #if 0 //mtoc++: 'get.rbmatlabDirectory'
554 h = getpref(this.getPrefTag,
" RBMATLABDIR ",);
561 #if 0 //mtoc++: 'get.JKerMorSourceDirectory'
563 h = getpref(this.getPrefTag,
" JKERMORDIR ",);
570 #if 0 //mtoc++: 'get.Hasrbmatlab'
574 flag = ~isempty(which(" rbmatlabhome "));
576 warning(" KerMor:
App ",...
577 [" rbmatlab directory is set, but script "...
578 " "" rbmatlabhome "" could not be found in current path.\n "...
579 " Unsure if rbmatlab-dependent models will work, "...
580 " check if rbmatlab version has changed! "]);
597 #if 0 //mtoc++: 'get.DefaultFigurePosition'
599 value = getpref(this.getPrefTag,
" DefFigPos ",...
600 get(0,
" DefaultFigurePosition "));
607 #if 0 //mtoc++: 'set.DefaultFigurePosition'
610 error(
" The figure position must be a four element vector ");
612 setpref(this.getPrefTag,
" DefFigPos ",value);
613 set(0,
" DefaultFigurePosition ",value);
620 #if 0 //mtoc++: 'get.UseDPCM'
622 value = getpref(this.getPrefTag,
" UseDPCM ",
false);
629 #if 0 //mtoc++: 'set.UseDPCM'
632 error(" The
UseDPCM flag must be
boolean. ");
634 setpref(this.getPrefTag,"
UseDPCM ",value);
641 #if 0 //mtoc++: 'get.BlockSize'
643 value = getpref(this.getPrefTag,
" BlockSize ", data.FileMatrix.BLOCK_SIZE);
650 #if 0 //mtoc++: 'set.BlockSize'
653 error(" The
BlockSize property must be a positive real scalar. ");
655 setpref(this.getPrefTag,"
BlockSize ",value);
662 #if 0 //mtoc++: 'get.UseDiary'
664 value = getpref(this.getPrefTag,
" UseDiary ",
false);
671 #if 0 //mtoc++: 'set.UseDiary'
674 error(" The
UseDiary flag must be
boolean. ");
676 setpref(this.getPrefTag,"
UseDiary ",value);
683 #if 0 //mtoc++: 'get.Verbose'
685 value = getpref(this.getPrefTag,
" Verbose ",1);
692 #if 0 //mtoc++: 'set.Verbose'
697 setpref(this.getPrefTag,"
Verbose ",value);
706 function initialize() {
708 disp(
" <<<<<<<<< Welcome to KerMor! >>>>>>>>>> ");
711 disp(
" Checking environment... ")
712 pset = ~isempty(getpref(this.getPrefTag," DATASTORE ",[]));
717 error(" You must run KerMor.
setup on each machine you want to run parallel jobs with KerMor! ");
719 fprintf(2," No KerMor preferences on this host found. Searching for settings from other hosts...\n ");
725 fprintf(" Do you want to copy the following preferences from host '%s'?\n ",fn[i](length(KerMor.PrefTagPrefix)+1:end));
727 r = lower(input(" (
Y)es, (N)o or (C)ancel and
start KerMor
setup: "," s "));
733 localp = phome.(fn[i]);
736 setpref(this.getPrefTag,pfn[
k],localp.(pfn[k]));
748 fprintf(2," No preferences copied from other hosts. Have to run setup.\n ");
750 fprintf(2," Entering KerMor setup...\n ");
755 fprintf(" KerMor preferences/settings found for tag '%s'...\n ",this.getPrefTag);
758 disp(" Initializing environment... ");
760 warning off MATLAB:dispatcher:nameConflict;
763 if exist(" numlabs "," builtin ") == 5 && numlabs == 1
765 setpref(" Internet "," SMTP_Server "," localhost ");
768 if usejava(" desktop ")
775 fprintf(" Applying desktop layout %s..\n ",this.
DesktopLayout);
776 desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
777 desktop.restoreLayout(this.DesktopLayout);
781 disp(" Calling "" dbstop if error "" .. ");
785 phome = this.HomeDirectory;
788 pcore = fullfile(phome," core ");
791 initextern(phome, pcore);
795 addpath(fullfile(phome," documentation "));
796 addpath(fullfile(pcore," visual "));
797 addpath(fullfile(pcore," tools "));
798 addpath(fullfile(pcore," interfaces "));
804 clear(" phome "," pcore ");
808 if isunix || ~isempty(which(" ppid "))
813 dfile = sprintf(" %s_KerMor%s.%s_pid%d_diary.txt ",datestr(now," yyyy-mm-dd "),...
816 fprintf(" Initializing diary in %s..\n ",dfile);
823 warning on MATLAB:dispatcher:nameConflict;
825 disp(" <<<<<<<<< Ready to go. >>>>>>>>>> ");
827 function initextern(phome, pcore)
835 disp(" <<<<<<<<< Starting rbmatlab >>>>>>>>>> ");
836 setenv(" RBMATLABTEMP ", this.TempDirectory);
838 addpath(this.rbmatlabDirectory);
840 evalin(" base "," startup_rbmatlab; ");
841 evalin(" base "," clear
all; ");
843 disp(" <<<<<<<<< Done Starting rbmatlab >>>>>>>>>> ");
847 disp(" Initializing external tools... ")
848 addpath(fullfile(pcore," extern "));
849 addpath(fullfile(pcore," extern ","
export_fig "));
850 addpath(fullfile(pcore," extern "," compat "));
851 addpath(fullfile(phome," matlabtojarmos "));
852 addpath(fullfile(phome," matlabtools "));
853 addpath(fullfile(phome," dpcm "));
856 d = fullfile(pcore," extern "," calcmd5 ");
858 if ~exist(fullfile(d,["
CalcMD5. " mexext])," file ")
859 warning(" KerMor:init "," No compiled
CalcMD5 mex file found. Did you run KerMor.setup completely?\nKerMor might not run properly. ");
863 d = fullfile(pcore," extern ","
typecastx ");
865 if ~exist(fullfile(d,[" typecastx. " mexext])," file ")
866 warning(" KerMor:init "," No compiled typecastx mex file found. Did you run KerMor.setup completely?\nKerMor might not run properly. ");
870 function initParallelization
883 setenv(" OMP_NUM_THREADS ",num2str(feature(" numCores ")));
893 function shutdown() {
896 disp(
" Disabling diary.. ");
910 static function KerMortheinstance =
App() {
915 theinstance = instance;
929 disp(
" <<<<<<<<<< Welcome to the KerMor setup script. >>>>>>>>>> ");
932 addpath(a.HomeDirectory);
933 addpath(genpath(fullfile(a.HomeDirectory,
" documentation ")));
937 ds = a.DataDirectory;
940 ds = fullfile(a.HomeDirectory,
" data ");
943 str = sprintf(
" Do you want to %s %s as your KerMor data file directory? Choosing 'No' opens a directory selection dialog.\n(Y)es/(N)o?: ",word,strrep(ds,
" \ ",
" \\ "));
944 if isequal(lower(input(str,
" s ")),
" n ")
945 d = uigetdir(ds,
" Please specify the KerMor data file directory ");
947 error(
" No KerMor data file directory specified. Aborting setup. ");
954 if isempty(getpref(
" KERMOR_DEVEL ",
" author ",))
955 str = sprintf(
" Do you want to develop KerMor on this machine?\n(Y)es/(N)o: ");
956 ds = lower(input(str,
" s "));
958 addpath(fullfile(a.HomeDirectory,
" core ",
" tools "));
962 addpath(fullfile(a.HomeDirectory,
" core ",
" extern "));
963 MatlabDocMaker.setup;
970 disp(
" <<<<<<<<<< Setup complete. You can now start KerMor by running 'KerMor.start;'. >>>>>>>>>> ");
988 static function KerMorapp =
start() {
1010 KerMor.App.shutdown;
1025 host =
char(getHostName(java.net.InetAddress.getLocalHost));
1030 host = regexprep(strtrim(host),
" [^\d\w] ",);
1041 dir = KerMor.App.HomeDirectory;
1046 [s, msg] = system(
" git log -n 1 --pretty=format:'%H: %s%+ai by %an<%ae>' > .gitbranch ");
1048 b = fileread(
" .gitbranch ");
1051 fprintf(2,
" KerMor.getGitBranch: %s\n ",strrep(msg,
char(10),));
1065 d = MatlabDocMaker.getOutputDirectory;
1066 if isempty(d) || ~exist(fullfile(d,
" index.html "),
" file ")
1067 d =
" http://www.morepas.org/software/kermor/index.html ";
1085 [
X,
Y] = meshgrid(-10:.5:10);
1086 Z = exp(-(
X.^2+
Y.^2-2*
X" *Y)/20);% + .5*exp(-(X2.^2+Y2.^2-2*X2 "*Y2)/5);
1087 surfl(
X,
Y,Z,
" Parent ",h);
1099 tag = [KerMor.PrefTagPrefix KerMor.getHost];
1115 t = KerMor.getPrefTag;
1116 path = getpref(
t,
" LASTPATH ",KerMor.App.HomeDirectory);
1117 if exist(path,
" dir ") ~= 7
1118 path = fileparts(path);
1119 if exist(path,
" dir ") ~= 7
1123 d = uigetdir(path,
" Select directory ");
1124 if ~isequal(d, 0) && exist(d,
" dir ") == 7
1125 setpref(
t,
" LASTPATH ",d);
1141 static function setupextern() {
1145 rbmat = a.rbmatlabDirectory;
1147 str = sprintf(" Do you want to keep the local rbmatlab version at %s with KerMor?\n(
Y)es/(N)o: ",strrep(rbmat," \ "," \\ "));
1150 str = sprintf(" Do you want to register a local rbmatlab version with KerMor?\n(
Y)es/(N)o: ");
1153 ds = lower(input(str," s "));
1155 rbmat = uigetdir(pwd," Please select the rbmatlab source root folder. ");
1157 warning(" KerMor:
setup ",[" No rbmatlab directory specified. Continuing witout using rbmatlab.\n "...
1158 " You can still register a local version of rbmatlab by setting the KerMor.App.
rbmatlabDirectory manually. "]);
1167 str = sprintf(" Do you want to keep the local JKerMor version at %s with KerMor?\n(
Y)es/(N)o: ",strrep(jk," \ "," \\ "));
1170 str = sprintf(" Do you want to register a local JKerMor version with KerMor?\n(
Y)es/(N)o: ");
1173 ds = lower(input(str," s "));
1175 jk = uigetdir(pwd," Please select the JKerMor source root folder. ");
1177 warning(" KerMor:setup ",[" No JKerMor directory specified. Continuing witout using JKerMor.\n "...
1178 " You can still register a local version of JKerMor by setting the KerMor.App.JKerMorSourceDirectory manually. "]);
1180 a.JKerMorSourceDirectory= jk;
1185 warning off MATLAB:dispatcher:nameConflict
1189 cd(fullfile(a.HomeDirectory," core "," extern "," calcmd5 "));
1190 mex CFLAGS="\$CFLAGS -std=c99" CalcMD5.c
1194 cd(fullfile(a.HomeDirectory," core "," extern ","
typecastx "));
1199 disp(" Compliling ppid.. ");
1200 cd(fullfile(a.HomeDirectory," core "," extern "));
1203 warning(" KerMor:setup "," No ppid function available (win32 platform) ");
1206 warning on MATLAB:dispatcher:nameConflict
1211 static function app = loadobj(unused1) {
1233 function obj = saveobj() {
static function host = getHost()
Returns the hostname of the current machine.
static function tag = getPrefTag()
Returns the tag used to store the KerMor preferences and settings.
rowvec DefaultFigurePosition
The default figure position to use.
function varargout = typecast(varargin)
static function setup()
Setup variables for Kermor Development when Kermor is setup for the first time or any other time manu...
function MD5 = CalcMD5(Data, InClass, OutClass)
128 bit MD5 checksum: file, string, byte stream [MEX] This function calculates a 128 bit checksum for...
static function char d = DocumentationLocation()
Returns the location of the kermor documentation.
char DataDirectory
The directory to use for simulation data storage.
static function stop()
Ends the KerMor application.
char JKerMorSourceDirectory
The source directory for JKerMor, if available.
char TempDirectory
The directory to use for temporary simulation data.
function [ im , alpha ] = export_fig(varargin)
Make sure the figure is rendered correctly now so that properties like axes limits are up-to-date...
integer Verbose
Verbose output level.
Matlab's base handle class (documentation generation substitute)
static function KerMor app = start()
Starts the KerMor application.
static const .char SubVersion
The current KerMor sub version number.
function varargout = typecastx(varargin)
static function setup()
Performs installation of KerMor on a system.
fieldnames
Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames f...
double BlockSize
The default block size (in MB) for FileMatrix instances.
Hasrbmatlab
Flag if rbmatlab wrapping functionalities are enabled.
static function b = getGitBranch(dir)
Returns the current git commit in a descriptive string.
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
char DesktopLayout
The preferred desktop layout to work with.
logical UseDiary
Flag that determines if KerMor also enables the diary function upon startup.
logical UseDPCM
Switch to determine if the Default Property Changed System shall be used or not.
HomeDirectory
The KerMor home directory.
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
Global configuration class for all KerMor run-time settings.
static function KerMor theinstance = App()
The singleton KerMor instance.
static function createLogo()
Creates the KerMor logo.
A MatLab character array.
function res = isposrealscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
char rbmatlabDirectory
The source directory for a copy of rbmatlab.
char Workspace
The base directory where KerMor stores and looks for data from models etc.
static const .char MainVersion
The current KerMor main version number.
static function d = getDir()
Returns a folder selected by a uigetdir command. Remembers the last selected folder (if successful & ...
static const .char PrefTagPrefix
The prefix for the host-dependent preference tags.