Mercurial > fem-fenics-eugenio
comparison inst/import_ufl_Problem.m @ 268:61830a4f9ab9
Improve formatting
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Thu, 14 Aug 2014 12:26:55 +0200 |
parents | 072aee55bb75 |
children | 897e312cb440 |
comparison
equal
deleted
inserted
replaced
267:53039ac90368 | 268:61830a4f9ab9 |
---|---|
11 ## details. | 11 ## details. |
12 ## | 12 ## |
13 ## You should have received a copy of the GNU General Public License along with | 13 ## You should have received a copy of the GNU General Public License along with |
14 ## this program; if not, see <http://www.gnu.org/licenses/>. | 14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 | |
16 ## -*- texinfo -*- | 17 ## -*- texinfo -*- |
17 ## @deftypefn {Function File} {} = import_ufl_Problem (@var{myproblem}) | 18 ## @deftypefn {Function File} {} = import_ufl_Problem (@var{myproblem}) |
18 ## Import a Variational Problem from a ufl file. | 19 ## Import a Variational Problem from a ufl file. |
19 ## | 20 ## |
20 ## @var{myproblem} is the name of the ufl file where | 21 ## @var{myproblem} is the name of the ufl file where |
25 ## @end deftypefn | 26 ## @end deftypefn |
26 | 27 |
27 function import_ufl_Problem (var_prob) | 28 function import_ufl_Problem (var_prob) |
28 | 29 |
29 if (is_master_node ()) | 30 if (is_master_node ()) |
30 if nargin != 1 | 31 if (nargin != 1) |
31 error ("import_ufl_Problem: wrong number of input parameters."); | 32 error ("import_ufl_Problem: wrong number of input parameters."); |
32 elseif ! ischar (var_prob) | 33 elseif (! ischar (var_prob)) |
33 error ("import_ufl_Problem: first argument is not a valid string"); | 34 error ("import_ufl_Problem: first argument is not a valid string"); |
34 endif | 35 endif |
35 | 36 |
36 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Problem")) | 37 if (check_hash (var_prob) || ! check_oct_files (var_prob, "Problem")) |
37 n = length (mfilename ("fullpath")) - length (mfilename()); | 38 n = length (mfilename ("fullpath")) - length (mfilename ()); |
38 path = strtrunc(mfilename ("fullpath"), n); | 39 path = strtrunc (mfilename ("fullpath"), n); |
39 | 40 |
40 private = fullfile (path, "include/"); | 41 private = fullfile (path, "include/"); |
41 output = generate_fs (var_prob); | 42 output = generate_fs (var_prob); |
42 output += generate_rhs (var_prob); | 43 output += generate_rhs (var_prob); |
43 output += generate_lhs (var_prob); | 44 output += generate_lhs (var_prob); |
44 output += generate_makefile (var_prob, private); | 45 output += generate_makefile (var_prob, private); |
45 if output != 0 | 46 if (output != 0) |
46 error ("Compilation failed"); | 47 error ("Compilation failed"); |
47 else | 48 else |
48 [output, textfile] = system (sprintf ("make -f Makefile_%s all", var_prob)); | 49 [output, textfile] = system (sprintf ("make -f Makefile_%s all", var_prob)); |
49 if output != 0 | 50 if (output != 0) |
50 display (text); | 51 display (text); |
51 error ("Compilation failed"); | 52 error ("Compilation failed"); |
52 endif | 53 endif |
53 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | 54 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); |
54 if output != 0 | 55 if (output != 0) |
55 display (text); | 56 display (text); |
56 error ("Compilation failed"); | 57 error ("Compilation failed"); |
57 endif | 58 endif |
58 save_hash (var_prob); | 59 save_hash (var_prob); |
59 endif | 60 endif |