Mercurial > fem-fenics-eugenio
annotate inst/private/check_oct_files.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 | |
children |
rev | line source |
---|---|
231
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
1 ## Copyright (C) 2014 Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
2 ## |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify it under |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
4 ## the terms of the GNU General Public License as published by the Free Software |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
5 ## Foundation; either version 3 of the License, or (at your option) any later |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
6 ## version. |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
7 ## |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, but WITHOUT |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
11 ## details. |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
12 ## |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License along with |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
15 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
16 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
17 ## -*- texinfo -*- |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
18 ## function for internal usage only |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
19 ## @end deftypefn |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
20 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
21 function found = check_oct_files (ufl_name, type) |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
22 persistent opts = {"BilinearForm", |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
23 "Functional", |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
24 "FunctionSpace", |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
25 "LinearForm", |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
26 "Problem"}; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
27 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
28 if (! ischar (ufl_name)) |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
29 error ("check_oct_files: invalid argument"); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
30 endif |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
31 type = validatestring (type, opts, "check_oct_files", "type"); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
32 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
33 [~, err, ~] = stat ([ufl_name, "_BilinearForm.oct"]); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
34 bilinearform = (err == 0); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
35 [~, err, ~] = stat ([ufl_name, "_FunctionSpace.oct"]); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
36 functionspace = (err == 0); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
37 [~, err, ~] = stat ([ufl_name, "_LinearForm.oct"]); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
38 linearform = (err == 0); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
39 [~, err, ~] = stat ([ufl_name, "_Functional.oct"]); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
40 functional = (err == 0); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
41 |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
42 switch (type) |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
43 case "BilinearForm" |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
44 found = bilinearform; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
45 case "Functional" |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
46 found = functional; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
47 case "FunctionSpace" |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
48 found = functionspace; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
49 case "LinearForm" |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
50 found = linearform; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
51 case "Problem" |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
52 found = bilinearform && linearform && functionspace; |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
53 otherwise |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
54 error ("check_oct_files: unrecognized option"); |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
55 endswitch |
e3f57f92fa66
Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff
changeset
|
56 endfunction |