Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_LinearForm.m @ 255:072aee55bb75
Import UFL in a parallel-safe fashion
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Wed, 30 Jul 2014 18:09:13 +0200 |
parents | e3f57f92fa66 |
children | 61830a4f9ab9 |
comparison
equal
deleted
inserted
replaced
254:2b51546a28f7 | 255:072aee55bb75 |
---|---|
25 ## Functional} | 25 ## Functional} |
26 ## @end deftypefn | 26 ## @end deftypefn |
27 | 27 |
28 function import_ufl_LinearForm (var_prob) | 28 function import_ufl_LinearForm (var_prob) |
29 | 29 |
30 if nargin != 1 | 30 if (is_master_node ()) |
31 error ("import_ufl_LinearForm: wrong number of input parameters."); | 31 if nargin != 1 |
32 elseif ! ischar (var_prob) | 32 error ("import_ufl_LinearForm: wrong number of input parameters."); |
33 error ("import_ufl_LinearForm: first argument is not a valid string"); | 33 elseif ! ischar (var_prob) |
34 error ("import_ufl_LinearForm: first argument is not a valid string"); | |
35 endif | |
36 | |
37 if (check_hash (var_prob) || ! check_oct_files (var_prob, "LinearForm")) | |
38 n = length (mfilename ("fullpath")) - length (mfilename()); | |
39 path = strtrunc(mfilename ("fullpath"), n); | |
40 | |
41 private = fullfile (path, "include/"); | |
42 | |
43 output = generate_lhs (var_prob); | |
44 output += generate_makefile (var_prob, private); | |
45 if output != 0 | |
46 error ("Compilation failed"); | |
47 else | |
48 [output, textfile] = system (sprintf ("make -f Makefile_%s lhs", var_prob)); | |
49 if output != 0 | |
50 display (text); | |
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); | |
59 endif | |
60 endif | |
34 endif | 61 endif |
35 | 62 |
36 if (check_hash (var_prob) || ! check_oct_files (var_prob, "LinearForm")) | 63 barrier (); |
37 n = length (mfilename ("fullpath")) - length (mfilename()); | |
38 path = strtrunc(mfilename ("fullpath"), n); | |
39 | 64 |
40 private = fullfile (path, "include/"); | |
41 | |
42 output = generate_lhs (var_prob); | |
43 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 lhs", var_prob)); | |
48 if output != 0 | |
49 display (text); | |
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); | |
58 endif | |
59 endif | |
60 endfunction | 65 endfunction |