Mercurial > fem-fenics-eugenio
annotate inst/import_ufl_Functional.m @ 179:8190736845fe
Update the Function description for the code release.
author | gedeone-octave <marcovass89@hotmail.it> |
---|---|
date | Thu, 07 Nov 2013 23:31:05 +0000 |
parents | 262c9d7bda1c |
children | 0de6ca5e31a2 |
rev | line source |
---|---|
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
148
diff
changeset
|
1 ## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net> |
148
f2193e825ad7
Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
136
diff
changeset
|
2 ## |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify it under |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
4 ## the terms of the GNU General Public License as published by the Free Software |
152
1dbe146bff03
Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents:
148
diff
changeset
|
5 ## Foundation; either version 3 of the License, or (at your option) any later |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
6 ## version. |
148
f2193e825ad7
Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
136
diff
changeset
|
7 ## |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, but WITHOUT |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
11 ## details. |
148
f2193e825ad7
Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents:
136
diff
changeset
|
12 ## |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License along with |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
15 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
16 ## -*- texinfo -*- |
179
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
17 ## @deftypefn {Function File} {[]} = import_ufl_Functional (@var{myproblem}) |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
18 ## Import a Functional from a ufl file. |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
19 ## @var{myproblem} is the name of the ufl file where |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
20 ## the Functional is defined. This function creates in the pwd a file |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
21 ## called @var{myproblem_Functional.oct}. |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
22 ## @seealso{import_ufl_Problem, FunctionSpace, BilinearForm, LinearForm, |
8190736845fe
Update the Function description for the code release.
gedeone-octave <marcovass89@hotmail.it>
parents:
154
diff
changeset
|
23 ## Functional} |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
24 ## @end deftypefn |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
109
diff
changeset
|
25 function import_ufl_Functional (var_prob) |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
26 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
27 if nargin != 1 |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
109
diff
changeset
|
28 error ("import_ufl_Functional: wrong number of input parameters."); |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
29 elseif ! ischar (var_prob) |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
109
diff
changeset
|
30 error ("import_ufl_Functional: first argument is not a valid string"); |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
31 endif |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
32 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
33 n = length (mfilename ("fullpath")) - length (mfilename()); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
34 path = strtrunc(mfilename ("fullpath"), n); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
35 |
154
262c9d7bda1c
Call the header file from the /include directories
gedeone-octave <marcovass89@hotmail.it>
parents:
152
diff
changeset
|
36 private = fullfile (path, "include/"); |
109
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
37 output = generate_fun (var_prob); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
38 output += generate_makefile (var_prob, private); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
39 if output != 0 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
40 error ("Compilation failed"); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
41 else |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
42 [output, textfile] = system (sprintf ("make -f Makefile_%s fun", var_prob)); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
43 if output != 0 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
44 display (text); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
45 error ("Compilation failed"); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
46 endif |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
47 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
48 if output != 0 |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
49 display (text); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
50 error ("Compilation failed"); |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
51 endif |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
52 endif |
50753c3cb0b6
New function for dealing with form of rank 0.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
53 endfunction |