Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_Problem.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 | 66071811eef8 |
children | 072aee55bb75 |
comparison
equal
deleted
inserted
replaced
230:1a3674836579 | 231:e3f57f92fa66 |
---|---|
30 error ("import_ufl_Problem: wrong number of input parameters."); | 30 error ("import_ufl_Problem: wrong number of input parameters."); |
31 elseif ! ischar (var_prob) | 31 elseif ! ischar (var_prob) |
32 error ("import_ufl_Problem: first argument is not a valid string"); | 32 error ("import_ufl_Problem: 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, "Problem")) |
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_fs (var_prob); | 40 output = generate_fs (var_prob); |
40 output += generate_rhs (var_prob); | 41 output += generate_rhs (var_prob); |
41 output += generate_lhs (var_prob); | 42 output += generate_lhs (var_prob); |
42 output += generate_makefile (var_prob, private); | 43 output += generate_makefile (var_prob, private); |
43 if output != 0 | |
44 error ("Compilation failed"); | |
45 else | |
46 [output, textfile] = system (sprintf ("make -f Makefile_%s all", var_prob)); | |
47 if output != 0 | 44 if output != 0 |
48 display (text); | |
49 error ("Compilation failed"); | 45 error ("Compilation failed"); |
50 endif | 46 else |
51 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | 47 [output, textfile] = system (sprintf ("make -f Makefile_%s all", var_prob)); |
52 if output != 0 | 48 if output != 0 |
53 display (text); | 49 display (text); |
54 error ("Compilation failed"); | 50 error ("Compilation failed"); |
51 endif | |
52 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | |
53 if output != 0 | |
54 display (text); | |
55 error ("Compilation failed"); | |
56 endif | |
57 save_hash (var_prob); | |
55 endif | 58 endif |
56 endif | 59 endif |
57 | 60 |
58 endfunction | 61 endfunction |