Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_FunctionSpace.m @ 231:e3f57f92fa66
Avoid just-in-time compilation when not needed
* inst/private/check_hash.m: check whether the previous compilation used
the same ufl file
* inst/private/save_hash.m: save to disk ufl file's md5sum for future
comparison
* inst/private/check_oct_files.m: ensure the expected oct files are present
* inst/import_ufl_*.m: add checks using the logic above
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Sat, 14 Jun 2014 15:27:43 +0200 |
parents | 0de6ca5e31a2 |
children | 072aee55bb75 |
comparison
equal
deleted
inserted
replaced
230:1a3674836579 | 231:e3f57f92fa66 |
---|---|
31 error ("import_ufl_FunctionSpace: wrong number of input parameters."); | 31 error ("import_ufl_FunctionSpace: wrong number of input parameters."); |
32 elseif ! ischar (var_prob) | 32 elseif ! ischar (var_prob) |
33 error ("import_ufl_FunctionSpace: first argument is not a valid string"); | 33 error ("import_ufl_FunctionSpace: first argument is not a valid string"); |
34 endif | 34 endif |
35 | 35 |
36 n = length (mfilename ("fullpath")) - length (mfilename()); | 36 if (check_hash (var_prob) || ! check_oct_files (var_prob, "FunctionSpace")) |
37 path = strtrunc(mfilename ("fullpath"), n); | 37 n = length (mfilename ("fullpath")) - length (mfilename()); |
38 path = strtrunc(mfilename ("fullpath"), n); | |
38 | 39 |
39 private = fullfile (path, "include/"); | 40 private = fullfile (path, "include/"); |
40 output = generate_fs (var_prob); | 41 output = generate_fs (var_prob); |
41 output += generate_makefile (var_prob, private); | 42 output += generate_makefile (var_prob, private); |
42 if output != 0 | |
43 error ("Compilation failed"); | |
44 else | |
45 [output, textfile] = system (sprintf ("make -f Makefile_%s fs", var_prob)); | |
46 if output != 0 | 43 if output != 0 |
47 display (text); | |
48 error ("Compilation failed"); | 44 error ("Compilation failed"); |
49 endif | 45 else |
50 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | 46 [output, textfile] = system (sprintf ("make -f Makefile_%s fs", var_prob)); |
51 if output != 0 | 47 if output != 0 |
52 display (text); | 48 display (text); |
53 error ("Compilation failed"); | 49 error ("Compilation failed"); |
50 endif | |
51 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | |
52 if output != 0 | |
53 display (text); | |
54 error ("Compilation failed"); | |
55 endif | |
56 save_hash (var_prob); | |
54 endif | 57 endif |
55 endif | 58 endif |
56 | 59 |
57 endfunction | 60 endfunction |