Mercurial > fem-fenics-eugenio
annotate inst/import_ufl_FunctionSpace.m @ 136:c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
author | gedeone-octave <marcovass89@hotmail.it> |
---|---|
date | Fri, 06 Sep 2013 13:42:20 +0200 |
parents | inst/fem_create_fs.m@6dbe66dcf1c5 |
children | f2193e825ad7 |
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 -*- |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
18 ## @deftypefn {Function File} {} = import_ufl_FunctionSpace (myproblem) |
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
19 ## This function takes as input the name of the .ufl file where |
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
20 ## the FunctionSpace is defined and import it inside Octave |
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
21 ## @seealso{import_ufl_Problem, FunctionSpace, BilinearForm, LinearForm} |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 ## @end deftypefn |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
24 function import_ufl_FunctionSpace (var_prob) |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
25 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 if nargin != 1 |
136
c445cdf36fb1
Fix new naming convention for the generation of the problem from .ufl file.
gedeone-octave <marcovass89@hotmail.it>
parents:
69
diff
changeset
|
27 error ("import_ufl_FunctionSpace: wrong number of input parameters."); |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 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:
69
diff
changeset
|
29 error ("import_ufl_FunctionSpace: first argument is not a valid string"); |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 endif |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
32 n = length (mfilename ("fullpath")) - length (mfilename()); |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
33 path = strtrunc(mfilename ("fullpath"), n); |
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 private = fullfile (path, "private/"); |
67
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
36 output = generate_fs (var_prob); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
37 output += generate_makefile (var_prob, private); |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
38 if output != 0 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 error ("Compilation failed"); |
67
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
40 else |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
41 [output, textfile] = system (sprintf ("make -f Makefile_%s fs", var_prob)); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
42 if output != 0 |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
43 display (text); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
44 error ("Compilation failed"); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
45 endif |
69
6dbe66dcf1c5
Add call to make clean inside octave script
gedeone-octave <marco.vassallo@outlook.com>
parents:
67
diff
changeset
|
46 [output, textfile] = system (sprintf ("make -f Makefile_%s clean", var_prob)); |
67
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
47 if output != 0 |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
48 display (text); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
49 error ("Compilation failed"); |
5a781e79bee1
Call new octave script instead of python script
gedeone-octave <marco.vassallo@outlook.com>
parents:
52
diff
changeset
|
50 endif |
52
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
51 endif |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
52 |
0aefa30d4ce0
New function for the creation of the functionalspace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
53 endfunction |