annotate inst/Functional.m @ 184:66071811eef8

Improve the documentation for the pkg releae.
author gedeone-octave <marcovass89@hotmail.it>
date Sat, 09 Nov 2013 10:44:51 +0000
parents 1dbe146bff03
children 0e6d1d79244a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
152
1dbe146bff03 Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents: 148
diff changeset
1 ## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
148
f2193e825ad7 Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents: 147
diff changeset
2 ##
147
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
3 ## This program is free software; you can redistribute it and/or modify it under
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
4 ## the terms of the GNU General Public License as published by the Free Software
152
1dbe146bff03 Update license to gpl v3
gedeone-octave <marcovass89@hotmail.it>
parents: 148
diff changeset
5 ## Foundation; either version 3 of the License, or (at your option) any later
147
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
6 ## version.
148
f2193e825ad7 Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents: 147
diff changeset
7 ##
147
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
11 ## details.
148
f2193e825ad7 Maint: update copyright notice
gedeone-octave <marcovass89@hotmail.it>
parents: 147
diff changeset
12 ##
147
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
13 ## You should have received a copy of the GNU General Public License along with
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
15
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
16 ## -*- texinfo -*-
184
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
17 ## @deftypefn {Function File} {[@var{L}]} = @
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
18 ## Functional (@var{my_problem}, @var{U}, @var{coefficient_1}, @
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
19 ## @var{coefficient_2},...)
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
20 ##
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
21 ## Construct a Functional previously imported from a ufl file.
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
22 ##
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
23 ## The compulsory arguments are:
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
24 ## @itemize @bullet
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
25 ## @item @var{my_problem} the name of the problem to solve.
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
26 ## @item the FunctionSpace @var{U} where the problem is defined.
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
27 ## @enditemize
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
28 ##
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
29 ## The optional arguments are the @var{coefficient_1}, @var{coefficient_2}
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
30 ## which specify the parameters for the Functional with the same name which
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
31 ## was used in the ufl file.
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
32 ## They can be either a Constant, a Function or an Expression.
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
33 ##
66071811eef8 Improve the documentation for the pkg releae.
gedeone-octave <marcovass89@hotmail.it>
parents: 152
diff changeset
34 ## @seealso{import_ufl_Functional, LinearForm, ResidualForm, BilinearForm}
147
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
35 ## @end deftypefn
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
36
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
37 function a = Functional (name, V, varargin)
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
38
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
39 if nargin < 2
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
40 error ("Functional: wrong number of input parameters.");
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
41 elseif ! ischar (name)
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
42 error ("Functional: second argument is not a valid string");
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
43 endif
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
44
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
45 program = sprintf ("%s_Functional(V", name);
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
46 for k = 1:length (varargin)
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
47 eval(['f_' num2str(k) '=varargin{k};']);
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
48 program = strjoin ({ program, strcat('f_',num2str(k))}, ',');
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
49 end
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
50
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
51 program = strjoin ({program, ');'});
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
52 a = eval (program);
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
53
41c1811a6dd6 New function for the creation of a functional.
gedeone-octave <marcovass89@hotmail.it>
parents:
diff changeset
54 endfunction