comparison inst/import_ufl_Functional.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 ## @seealso{import_ufl_Problem, FunctionSpace, BilinearForm, LinearForm, 24 ## @seealso{import_ufl_Problem, FunctionSpace, BilinearForm, LinearForm,
25 ## Functional} 25 ## Functional}
26 ## @end deftypefn 26 ## @end deftypefn
27 function import_ufl_Functional (var_prob) 27 function import_ufl_Functional (var_prob)
28 28
29 if nargin != 1 29 if (is_master_node ())
30 error ("import_ufl_Functional: wrong number of input parameters."); 30 if nargin != 1
31 elseif ! ischar (var_prob) 31 error ("import_ufl_Functional: wrong number of input parameters.");
32 error ("import_ufl_Functional: first argument is not a valid string"); 32 elseif ! ischar (var_prob)
33 error ("import_ufl_Functional: first argument is not a valid string");
34 endif
35
36 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Functional"))
37 n = length (mfilename ("fullpath")) - length (mfilename());
38 path = strtrunc(mfilename ("fullpath"), n);
39
40 private = fullfile (path, "include/");
41 output = generate_fun (var_prob);
42 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 fun", var_prob));
47 if output != 0
48 display (text);
49 error ("Compilation failed");
50 endif
51 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob));
52 if output != 0
53 display (text);
54 error ("Compilation failed");
55 endif
56 save_hash (var_prob);
57 endif
58 endif
33 endif 59 endif
34 60
35 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Functional")) 61 barrier ();
36 n = length (mfilename ("fullpath")) - length (mfilename());
37 path = strtrunc(mfilename ("fullpath"), n);
38 62
39 private = fullfile (path, "include/");
40 output = generate_fun (var_prob);
41 output += generate_makefile (var_prob, private);
42 if output != 0
43 error ("Compilation failed");
44 else
45 [output, textfile] = system (sprintf ("make -f Makefile_%s fun", var_prob));
46 if output != 0
47 display (text);
48 error ("Compilation failed");
49 endif
50 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob));
51 if output != 0
52 display (text);
53 error ("Compilation failed");
54 endif
55 save_hash (var_prob);
56 endif
57 endif
58 endfunction 63 endfunction