Mercurial > fem-fenics-eugenio
comparison inst/private/generate_fs.m @ 268:61830a4f9ab9
Improve formatting
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Thu, 14 Aug 2014 12:26:55 +0200 |
parents | 5e9b5bbdc56b |
children |
comparison
equal
deleted
inserted
replaced
267:53039ac90368 | 268:61830a4f9ab9 |
---|---|
15 | 15 |
16 | 16 |
17 ## -*- texinfo -*- | 17 ## -*- texinfo -*- |
18 ## function for internal usage only | 18 ## function for internal usage only |
19 ## @end deftypefn | 19 ## @end deftypefn |
20 | |
20 function output = generate_fs (ufl_name) | 21 function output = generate_fs (ufl_name) |
21 | 22 |
22 STRING ="\n\ | 23 STRING ="\n\ |
23 #include <fem-fenics/functionspace.h>\n\ | 24 #include <fem-fenics/functionspace.h>\n\ |
24 #include <fem-fenics/mesh.h>\n\ | 25 #include <fem-fenics/mesh.h>\n\ |
25 #include ""@@UFL_NAME@@.h""\n\ | 26 #include ""@@UFL_NAME@@.h""\n\ |
26 #include <fem-fenics/dolfin_compat.h>\n\ | 27 #include <fem-fenics/dolfin_compat.h>\n\ |
27 \n\ | 28 \n\ |
28 DEFUN_DLD (@@UFL_NAME@@_FunctionSpace, args, , ""initialize a fs from a mesh declared with fem_init_mesh"")\n\ | 29 DEFUN_DLD (@@UFL_NAME@@_FunctionSpace, args, ,\ |
30 ""initialize a fs from a mesh declared with fem_init_mesh"")\n\ | |
29 {\n\ | 31 {\n\ |
30 int nargin = args.length ();\n\ | 32 int nargin = args.length ();\n\ |
31 octave_value retval;\n\ | 33 octave_value retval;\n\ |
32 \n\ | 34 \n\ |
33 if (nargin < 1 || nargin > 1)\n\ | 35 if (nargin < 1 || nargin > 1)\n\ |
44 \n\ | 46 \n\ |
45 if (args(0).type_id () == mesh::static_type_id ())\n\ | 47 if (args(0).type_id () == mesh::static_type_id ())\n\ |
46 {\n\ | 48 {\n\ |
47 const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());\n\ | 49 const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());\n\ |
48 const dolfin::Mesh & mshd = msho.get_msh ();\n\ | 50 const dolfin::Mesh & mshd = msho.get_msh ();\n\ |
49 SHARED_PTR <const dolfin::FunctionSpace> g (new @@UFL_NAME@@::FunctionSpace (mshd));\n\ | 51 SHARED_PTR <const dolfin::FunctionSpace>\ |
52 g (new @@UFL_NAME@@::FunctionSpace (mshd));\n\ | |
50 \n\ | 53 \n\ |
51 if (! functionspace_type_loaded)\n\ | 54 if (! functionspace_type_loaded)\n\ |
52 {\n\ | 55 {\n\ |
53 functionspace::register_type ();\n\ | 56 functionspace::register_type ();\n\ |
54 functionspace_type_loaded = true;\n\ | 57 functionspace_type_loaded = true;\n\ |
59 }\n\ | 62 }\n\ |
60 }\n\ | 63 }\n\ |
61 return retval;\n\ | 64 return retval;\n\ |
62 }"; | 65 }"; |
63 | 66 |
64 STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name); | 67 STRING = strrep (STRING, "@@UFL_NAME@@", ufl_name); |
65 | 68 |
66 fid = fopen (sprintf ("%s_FunctionSpace.cc", ufl_name), 'w'); | 69 fid = fopen (sprintf ("%s_FunctionSpace.cc", ufl_name), "w"); |
67 if (fid >= 0) | 70 if (fid >= 0) |
68 fputs (fid, STRING); | 71 fputs (fid, STRING); |
69 output = fclose (fid); | 72 output = fclose (fid); |
70 else | 73 else |
71 error ("cannot open file"); | 74 error ("cannot open file"); |