Mercurial > fem-fenics-eugenio
annotate inst/generate_rhs.m @ 68:4ef8dbafcdfc
New octave script for creation of function on the fly
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Sat, 27 Jul 2013 17:21:03 +0200 |
parents | |
children | 602fe5295dea |
rev | line source |
---|---|
68
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
1 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
2 function output = generate_rhs (ufl_name) |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
3 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
4 STRING ="\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
5 #include ""@@UFL_NAME@@.h""\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
6 #include ""functionspace.h""\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
7 #include ""boundarycondition.h""\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
8 #include ""coefficient.h""\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
9 #include ""function.h""\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
10 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
11 DEFUN_DLD (fem_rhs_@@UFL_NAME@@, args, , ""A = fem_rhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF, BC)"")\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
12 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
13 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
14 int nargin = args.length ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
15 octave_value retval;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
16 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
17 if (nargin < 1)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
18 print_usage ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
19 else\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
20 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
21 if (! functionspace_type_loaded)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 functionspace::register_type ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
24 functionspace_type_loaded = true;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
25 mlock ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
27 if (args(0).type_id () == functionspace::static_type_id ())\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
29 const functionspace & fspo\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 = static_cast<const functionspace&> (args(0).get_rep ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
32 if (! error_state)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
33 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
34 const dolfin::FunctionSpace V = fspo.get_fsp ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
35 @@UFL_NAME@@::BilinearForm a (V, V);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 std::size_t ncoef = a.num_coefficients (), nc = 0;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
37 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
38 if (! coefficient_type_loaded)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 coefficient::register_type ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
41 coefficient_type_loaded = true;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
42 mlock ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
43 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
44 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
45 if (! function_type_loaded)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
46 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
47 function::register_type ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
48 function_type_loaded = true;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
49 mlock ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
50 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
51 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
52 for (std::size_t i = 1; i < nargin; ++i)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
53 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
54 if (args(i).type_id () == coefficient::static_type_id ())\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
55 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
56 const coefficient & cf\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
57 = static_cast <const coefficient&> (args(i).get_rep ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
58 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
59 std::size_t n = a.coefficient_number (cf.get_str ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
60 const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
61 a.set_coefficient (n, pexp);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
62 ++nc;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
63 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
64 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
65 if (args(i).type_id () == function::static_type_id ())\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
66 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
67 const function & fun\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
68 = static_cast <const function&> (args(i).get_rep ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
69 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
70 std::size_t n = a.coefficient_number (fun.get_str ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
71 const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
72 a.set_coefficient (n, pfun);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
73 ++nc;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
74 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
75 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
76 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
77 if (nc != ncoef)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
78 error (""Wrong number of coefficient"");\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
79 else\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
80 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
81 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
82 dolfin::Matrix A;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
83 dolfin::assemble (A, a);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
84 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
85 if (! boundarycondition_type_loaded)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
86 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
87 boundarycondition::register_type ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
88 boundarycondition_type_loaded = true;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
89 mlock ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
90 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
91 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
92 for (std::size_t i = 1; i < nargin; ++i)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
93 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
94 if (args(i).type_id () == boundarycondition::static_type_id ())\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
95 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
96 const boundarycondition & bc\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
97 = static_cast<const boundarycondition&> (args(i).get_rep ());\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
98 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
99 const std::vector<boost::shared_ptr <const dolfin::DirichletBC> > & pbc\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
100 = bc.get_bc ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
101 for (std::size_t j = 0; j < pbc.size (); ++j)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
102 pbc[j]->apply(A);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
103 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
104 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
105 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
106 octave_idx_type nr = A.size (0), nc = A.size (1);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
107 // nz shoud be estimated in a better way\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
108 double alpha = 0.005;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
109 octave_idx_type nz = ceil (alpha * nr * nc);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
110 SparseMatrix sm (nr, nc, nz);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
111 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
112 octave_idx_type ii = 0;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
113 sm.cidx (0) = 0;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
114 for (octave_idx_type j = 0; j < nc; ++j)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
115 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
116 for (octave_idx_type i = 0; i < nr; ++i)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
117 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
118 double tmp = A(i, j);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
119 if (tmp != 0.)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
120 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
121 if (ii == nz)\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
122 {\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
123 nz = ceil ((nc * nr * ii) / (j * nr + 1));\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
124 sm.change_capacity (nz);\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
125 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
126 sm.data(ii) = tmp;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
127 sm.ridx(ii) = i;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
128 ++ii;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
129 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
130 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
131 sm.cidx(j+1) = ii;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
132 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
133 sm.maybe_compress ();\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
134 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
135 retval = sm;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
136 \n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
137 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
138 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
139 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
140 }\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
141 return retval;\n\ |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
142 }"; |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
143 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
144 STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
145 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
146 fid = fopen (sprintf ("fem_rhs_%s.cc", ufl_name), 'w'); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
147 if (fid >= 0) |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
148 fputs (fid, STRING); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
149 output = fclose (fid); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
150 else |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
151 error ("cannot open file"); |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
152 output = 1; |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
153 endif |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
154 |
4ef8dbafcdfc
New octave script for creation of function on the fly
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
155 endfunction |