Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_Functional.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 |
---|---|
30 error ("import_ufl_Functional: wrong number of input parameters."); | 30 error ("import_ufl_Functional: wrong number of input parameters."); |
31 elseif ! ischar (var_prob) | 31 elseif ! ischar (var_prob) |
32 error ("import_ufl_Functional: first argument is not a valid string"); | 32 error ("import_ufl_Functional: first argument is not a valid string"); |
33 endif | 33 endif |
34 | 34 |
35 n = length (mfilename ("fullpath")) - length (mfilename()); | 35 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Functional")) |
36 path = strtrunc(mfilename ("fullpath"), n); | 36 n = length (mfilename ("fullpath")) - length (mfilename()); |
37 path = strtrunc(mfilename ("fullpath"), n); | |
37 | 38 |
38 private = fullfile (path, "include/"); | 39 private = fullfile (path, "include/"); |
39 output = generate_fun (var_prob); | 40 output = generate_fun (var_prob); |
40 output += generate_makefile (var_prob, private); | 41 output += generate_makefile (var_prob, private); |
41 if output != 0 | |
42 error ("Compilation failed"); | |
43 else | |
44 [output, textfile] = system (sprintf ("make -f Makefile_%s fun", var_prob)); | |
45 if output != 0 | 42 if output != 0 |
46 display (text); | |
47 error ("Compilation failed"); | 43 error ("Compilation failed"); |
48 endif | 44 else |
49 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | 45 [output, textfile] = system (sprintf ("make -f Makefile_%s fun", var_prob)); |
50 if output != 0 | 46 if output != 0 |
51 display (text); | 47 display (text); |
52 error ("Compilation failed"); | 48 error ("Compilation failed"); |
49 endif | |
50 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | |
51 if output != 0 | |
52 display (text); | |
53 error ("Compilation failed"); | |
54 endif | |
55 save_hash (var_prob); | |
53 endif | 56 endif |
54 endif | 57 endif |
55 endfunction | 58 endfunction |