Mercurial > fem-fenics-eugenio
annotate inst/fem_create_lhs.m @ 53:78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
* fem_create_lhs.m: takes as input the name of the file where the variational
problem is defined. It produces a function fem_lhs_name.
* fem_create_rhs.m: as above.
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Thu, 25 Jul 2013 11:42:42 +0200 |
parents | |
children | 5a781e79bee1 |
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/"); |
78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 program = fullfile (path, "bin/create_lhs.py"); |
78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 [output, text] = python (program, var_prob, private); |
78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
41 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
|
42 display (text); |
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"); |
78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
44 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
|
45 |
78448b5c6df6
New function for the creation of the lhs/rhs based on user's problem.
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
46 endfunction |