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