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