Last change
on this file since 13975 was 13975, checked in by Mathieu Morlighem, 12 years ago |
merged trunk-jpl and trunk for revision 13974
|
File size:
775 bytes
|
Line | |
---|
1 | function flag=ispetsc()
|
---|
2 | %ISPETSC - figure out if PETSC package was compiled with ISSM
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % flag=ispetsc();
|
---|
6 |
|
---|
7 | configfile=[issmdir() '/bin/config.h']; %should find it in the install target
|
---|
8 | if ~exist(configfile,'file'),
|
---|
9 | error(['File ' configfile ' not found. ISSM has not been configured yet!']);
|
---|
10 | end
|
---|
11 |
|
---|
12 | %go through the file, and recover the line we want
|
---|
13 | flag=2;
|
---|
14 | fid=fopen(configfile,'r');
|
---|
15 | if(fid==-1), error(['could not open file: ' configfile]); end
|
---|
16 |
|
---|
17 | while(true),
|
---|
18 | tline=fgets(fid);
|
---|
19 | if ~ischar(tline), break, end
|
---|
20 | if strncmp(tline,'/* #undef _HAVE_PETSC_ */',25),
|
---|
21 | flag=0;
|
---|
22 | break;
|
---|
23 | end
|
---|
24 | if strncmp(tline,'#define _HAVE_PETSC_',20),
|
---|
25 | flag=1;
|
---|
26 | break;
|
---|
27 | end
|
---|
28 | end
|
---|
29 | fclose(fid);
|
---|
30 | if flag==2,
|
---|
31 | error('could not determine whether PETSC was or was not compiled');
|
---|
32 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.