forked from csdms-contrib/topotoolbox
-
Notifications
You must be signed in to change notification settings - Fork 90
/
compilemexfiles.m
executable file
·62 lines (49 loc) · 1.31 KB
/
compilemexfiles.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function compilemexfiles
%COMPILEMEXFILES compile mex-functions that come with TopoToolbox 2
%
% Syntax
%
% compilemexfiles
%
% Description
%
% TopoToolbox 2 comes with a few mex-functions that have been
% written in C and that must be compiled prior to usage. While all
% functions have been written in plain m-code, the usage of
% mex-functions enhances the speed at which some functions are
% evaluated. compilemexfiles compiles all these files to run on your
% system. Prior to running compilemexfiles run
%
% mex -setup
%
% and locate a compiler on your system.
%
% Available mex-functions
%
% All mex-functions are located in private directories
%
% @FLOWobj/private
% dependencemap_mex.c
% drainagebasins_mex.c
% flowacc_mex.c
% steepestneighbor_mex.c
% tsort_mex.c
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 30. January, 2013
location = which('compilemexfiles');
[pathstr,~,~] = fileparts(location);
newFolder = [pathstr filesep '@FLOWobj' filesep 'private'];
oldFolder = cd(newFolder);
files = dir('*.c');
try
for r = 1:numel(files)
funname = files(r).name;
mex('-largeArrayDims',funname)
% mex('-R2018a',funname)
end
catch err
cd(oldFolder);
rethrow(err)
end
cd(oldFolder);