Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_Problem.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 |
---|---|
24 ## Functional} | 24 ## Functional} |
25 ## @end deftypefn | 25 ## @end deftypefn |
26 | 26 |
27 function import_ufl_Problem (var_prob) | 27 function import_ufl_Problem (var_prob) |
28 | 28 |
29 if nargin != 1 | 29 if (is_master_node ()) |
30 error ("import_ufl_Problem: wrong number of input parameters."); | 30 if nargin != 1 |
31 elseif ! ischar (var_prob) | 31 error ("import_ufl_Problem: wrong number of input parameters."); |
32 error ("import_ufl_Problem: first argument is not a valid string"); | 32 elseif ! ischar (var_prob) |
33 endif | 33 error ("import_ufl_Problem: first argument is not a valid string"); |
34 endif | |
34 | 35 |
35 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Problem")) | 36 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Problem")) |
36 n = length (mfilename ("fullpath")) - length (mfilename()); | 37 n = length (mfilename ("fullpath")) - length (mfilename()); |
37 path = strtrunc(mfilename ("fullpath"), n); | 38 path = strtrunc(mfilename ("fullpath"), n); |
38 | 39 |
39 private = fullfile (path, "include/"); | 40 private = fullfile (path, "include/"); |
40 output = generate_fs (var_prob); | 41 output = generate_fs (var_prob); |
41 output += generate_rhs (var_prob); | 42 output += generate_rhs (var_prob); |
42 output += generate_lhs (var_prob); | 43 output += generate_lhs (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 all", var_prob)); | |
48 if output != 0 | 45 if output != 0 |
49 display (text); | |
50 error ("Compilation failed"); | 46 error ("Compilation failed"); |
47 else | |
48 [output, textfile] = system (sprintf ("make -f Makefile_%s all", 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); | |
51 endif | 59 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 | 60 endif |
59 endif | 61 endif |
60 | 62 |
63 barrier (); | |
64 | |
61 endfunction | 65 endfunction |