Mercurial > fem-fenics-eugenio
comparison src/DirichletBC.cc @ 268:61830a4f9ab9
Improve formatting
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Thu, 14 Aug 2014 12:26:55 +0200 |
parents | ab35a8b0deef |
children |
comparison
equal
deleted
inserted
replaced
267:53039ac90368 | 268:61830a4f9ab9 |
---|---|
46 { | 46 { |
47 int nargin = args.length (); | 47 int nargin = args.length (); |
48 octave_value retval; | 48 octave_value retval; |
49 | 49 |
50 if (nargin < 3 || nargin > 4) | 50 if (nargin < 3 || nargin > 4) |
51 print_usage (); | 51 { print_usage (); } |
52 else | 52 else |
53 { | 53 { |
54 | 54 |
55 if (! functionspace_type_loaded) | 55 if (! functionspace_type_loaded) |
56 { | 56 { |
73 mlock (); | 73 mlock (); |
74 } | 74 } |
75 | 75 |
76 if (args(0).type_id () == functionspace::static_type_id ()) | 76 if (args(0).type_id () == functionspace::static_type_id ()) |
77 { | 77 { |
78 const functionspace & fspo = | 78 const functionspace & fspo = |
79 static_cast<const functionspace&> (args(0).get_rep ()); | 79 static_cast<const functionspace &> (args(0).get_rep ()); |
80 octave_fcn_handle * fh = args(1).fcn_handle_value (); | 80 octave_fcn_handle * fh = args(1).fcn_handle_value (); |
81 | 81 |
82 if (nargin == 3) | 82 if (nargin == 3) |
83 { | 83 { |
84 Array<octave_idx_type> side = args(2).array_value (); | 84 Array<octave_idx_type> side = args(2).array_value (); |
93 Array<double> res = tmp(0).array_value (); | 93 Array<double> res = tmp(0).array_value (); |
94 std::size_t l = res.length (); | 94 std::size_t l = res.length (); |
95 | 95 |
96 expression * pf; | 96 expression * pf; |
97 if (l > 1) | 97 if (l > 1) |
98 pf = new expression (*fh, l); | 98 { pf = new expression (*fh, l); } |
99 else | 99 else |
100 pf = new expression (*fh); | 100 { pf = new expression (*fh); } |
101 | 101 |
102 SHARED_PTR <const expression> f (pf); | 102 SHARED_PTR <const expression> f (pf); |
103 boundarycondition * pbc = new boundarycondition (); | 103 boundarycondition * pbc = new boundarycondition (); |
104 | 104 |
105 for (octave_idx_type i = 0; | 105 for (octave_idx_type i = 0; |
106 i < side.length (); ++i) | 106 i < side.length (); ++i) |
107 pbc->add_bc (V, f, side(i)); | 107 { pbc->add_bc (V, f, side(i)); } |
108 retval = octave_value (pbc); | 108 retval = octave_value (pbc); |
109 } | 109 } |
110 } | 110 } |
111 else | 111 else |
112 { | 112 { |
124 Array<double> res = tmp(0).array_value (); | 124 Array<double> res = tmp(0).array_value (); |
125 std::size_t l = res.length (); | 125 std::size_t l = res.length (); |
126 | 126 |
127 expression * pf; | 127 expression * pf; |
128 if (l > 1) | 128 if (l > 1) |
129 pf = new expression (*fh, l); | 129 { pf = new expression (*fh, l); } |
130 else | 130 else |
131 pf = new expression (*fh); | 131 { pf = new expression (*fh); } |
132 | 132 |
133 SHARED_PTR <const expression> f (pf); | 133 SHARED_PTR <const expression> f (pf); |
134 boundarycondition * pbc = new boundarycondition (); | 134 boundarycondition * pbc = new boundarycondition (); |
135 | 135 |
136 SHARED_PTR <dolfin::MeshFunction <std::size_t> const> const & | 136 SHARED_PTR <dolfin::MeshFunction <std::size_t> const> const & |
137 subdomains = mf.get_pmf (); | 137 subdomains = mf.get_pmf (); |
138 | 138 |
139 for (octave_idx_type i = 0; | 139 for (octave_idx_type i = 0; |
140 i < side.length (); ++i) | 140 i < side.length (); ++i) |
141 pbc->add_bc (V, f, subdomains, side(i)); | 141 { pbc->add_bc (V, f, subdomains, side (i)); } |
142 retval = octave_value (pbc); | 142 retval = octave_value (pbc); |
143 } | 143 } |
144 } | 144 } |
145 } | 145 } |
146 } | 146 } |