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