Mercurial > fem-fenics-eugenio
comparison inst/fem_create_functional.m @ 109:50753c3cb0b6
New function for dealing with form of rank 0.
* fem_create_functional: user visible function for the creation of a DLD
function which create a Functional from a given .ufl file
* generate_fun.cc: writes on the fly the code
* generate_makefile: compile also the new function
author | gedeone-octave <marcovass89@hotmail.it> |
---|---|
date | Thu, 22 Aug 2013 19:01:44 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
108:5cbc7341ded5 | 109:50753c3cb0b6 |
---|---|
1 ## Copyright (C) 2013 Marco Vassallo | |
2 | |
3 ## This program is free software; you can redistribute it and/or modify it under | |
4 ## the terms of the GNU General Public License as published by the Free Software | |
5 ## Foundation; either version 2 of the License, or (at your option) any later | |
6 ## version. | |
7 | |
8 ## This program is distributed in the hope that it will be useful, but WITHOUT | |
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
11 ## details. | |
12 | |
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/>. | |
15 | |
16 | |
17 ## -*- texinfo -*- | |
18 ## @deftypefn {Function File} {} = fem_ffc (myproblem.ufl) | |
19 ## This function take as input the name of the .ufl file where | |
20 ## the Variational Problem is defined. | |
21 ## @example | |
22 ## | |
23 ## @end example | |
24 ## @seealso{} | |
25 ## @end deftypefn | |
26 | |
27 function fem_create_functional (var_prob) | |
28 | |
29 if nargin != 1 | |
30 error ("fem_create_functional: wrong number of input parameters."); | |
31 elseif ! ischar (var_prob) | |
32 error ("fem_create_functional: first argument is not a valid string"); | |
33 endif | |
34 | |
35 n = length (mfilename ("fullpath")) - length (mfilename()); | |
36 path = strtrunc(mfilename ("fullpath"), n); | |
37 | |
38 private = fullfile (path, "private/"); | |
39 output = generate_fun (var_prob); | |
40 output += generate_makefile (var_prob, private); | |
41 if output != 0 | |
42 error ("Compilation failed"); | |
43 else | |
44 [output, textfile] = system (sprintf ("make -f Makefile_%s fun", var_prob)); | |
45 if output != 0 | |
46 display (text); | |
47 error ("Compilation failed"); | |
48 endif | |
49 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); | |
50 if output != 0 | |
51 display (text); | |
52 error ("Compilation failed"); | |
53 endif | |
54 endif | |
55 endfunction |