Mercurial > fem-fenics-eugenio
annotate inst/fem_create_fs.m @ 52:0aefa30d4ce0
New function for the creation of the functionalspace
* fem_create_fs: create a function fem_fs_name based on a problem defined
from the user. name is the name of the problem.
* fem_ffc.m: function replaced from fem_create_fs
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Thu, 25 Jul 2013 11:36:57 +0200 |
parents | |
children | 5a781e79bee1 |
rev | line source |
---|---|
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 Marco Vassallo |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
2 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify it under |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
4 ## the terms of the GNU General Public License as published by the Free Software |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
5 ## Foundation; either version 2 of the License, or (at your option) any later |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
6 ## version. |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
7 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, but WITHOUT |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
11 ## details. |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
12 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License along with |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
15 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
16 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
17 ## -*- texinfo -*- |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
18 ## @deftypefn {Function File} {} = fem_ffc (myproblem.ufl) |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
19 ## This function take as input the name of the .ufl file where |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
20 ## the Variational Problem is defined. |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
21 ## @example |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 ## |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 ## @end example |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
24 ## @seealso{} |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
25 ## @end deftypefn |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
27 function fem_create_fs (var_prob) |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
29 if nargin != 1 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 error ("fem_create_fs: wrong number of input parameters."); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 elseif ! ischar (var_prob) |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
32 error ("fem_create_fs: first argument is not a valid string"); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
33 endif |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
34 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
35 n = length (mfilename ("fullpath")) - length (mfilename()); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 path = strtrunc(mfilename ("fullpath"), n); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
37 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
38 private = fullfile (path, "private/"); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 program = fullfile (path, "bin/create_fs.py"); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 [output, text] = python (program, var_prob, private); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
41 if output != 0 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
42 display (text); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
43 error ("Compilation failed"); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
44 endif |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
45 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
46 endfunction |