Mercurial > fem-fenics-eugenio
annotate inst/LinearForm.m @ 134:286930e440cf
New functions used to call the DLD-functions created from the user.
author | gedeone-octave <marcovass89@hotmail.it> |
---|---|
date | Fri, 06 Sep 2013 13:16:33 +0200 |
parents | |
children | 3a0f952a79ec |
rev | line source |
---|---|
134
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 Marco Vassallo |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
2 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify it under |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
4 ## the terms of the GNU General Public License as published by the Free Software |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
5 ## Foundation; either version 2 of the License, or (at your option) any later |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
6 ## version. |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
7 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, but WITHOUT |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
11 ## details. |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
12 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License along with |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
14 ## this program; if not, see <http://www.gnu.org/licenses/>. |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
15 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
16 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
17 ## -*- texinfo -*- |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
18 ## @deftypefn {Function File} {V} = ResidualForm (name, V, [coefficients]) |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
19 ## This function takes as input the name of the problem that you want to solve |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
20 ## and the FunctionSpace where it is defined and return a Form defined with |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
21 ## the coefficients passed as optional argument. |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
22 ## @seealso{FunctionSpace, BilinearForm, ResidualForm} |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
23 ## @end deftypefn |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
24 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
25 function a = LinearForm (name, V, varargin) |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
26 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
27 if nargin < 2 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
28 error ("LinearForm: wrong number of input parameters."); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
29 elseif ! ischar (name) |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
30 error ("LinearForm: second argument is not a valid string"); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
31 endif |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
32 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
33 program = sprintf ("%s_LinearForm(V", name); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
34 for k = 1:length (varargin) |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
35 eval(['f_' num2str(k) '=varargin{k};']); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
36 program = strjoin ({ program, strcat('f_',num2str(k))}, ','); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
37 end |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
38 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
39 program = strjoin ({program, ');'}) |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
40 a = eval (program); |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
41 |
286930e440cf
New functions used to call the DLD-functions created from the user.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff
changeset
|
42 endfunction |