Mercurial > fem-fenics-eugenio
comparison src/assemble.cc @ 253:5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
* src/dolfin_compat.h: use a macro to set the correct shared_ptr (std or boost)
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Tue, 29 Jul 2014 18:05:56 +0200 |
parents | 8ca45824938e |
children | 61830a4f9ab9 |
comparison
equal
deleted
inserted
replaced
252:7f33554e439a | 253:5e9b5bbdc56b |
---|---|
16 */ | 16 */ |
17 | 17 |
18 #include "form.h" | 18 #include "form.h" |
19 #include "boundarycondition.h" | 19 #include "boundarycondition.h" |
20 #include "femfenics_factory.h" | 20 #include "femfenics_factory.h" |
21 #include "dolfin_compat.h" | |
21 | 22 |
22 DEFUN_DLD (assemble, args, nargout, | 23 DEFUN_DLD (assemble, args, nargout, |
23 "-*- texinfo -*-\n\ | 24 "-*- texinfo -*-\n\ |
24 @deftypefn {Function File} {[@var{A}], [@var{x}(Optional)]} = \ | 25 @deftypefn {Function File} {[@var{A}], [@var{x}(Optional)]} = \ |
25 assemble (@var{form_a}, @var{DirichletBC}) \n\ | 26 assemble (@var{form_a}, @var{DirichletBC}) \n\ |
93 const boundarycondition & bc | 94 const boundarycondition & bc |
94 = static_cast<const boundarycondition&> | 95 = static_cast<const boundarycondition&> |
95 (args(i).get_rep ()); | 96 (args(i).get_rep ()); |
96 | 97 |
97 const | 98 const |
98 std::vector<boost::shared_ptr | 99 std::vector<SHARED_PTR |
99 <const dolfin::DirichletBC> > | 100 <const dolfin::DirichletBC> > |
100 & pbc = bc.get_bc (); | 101 & pbc = bc.get_bc (); |
101 | 102 |
102 for (std::size_t j = 0; j < pbc.size (); ++j) | 103 for (std::size_t j = 0; j < pbc.size (); ++j) |
103 pbc[j]->apply(A); | 104 pbc[j]->apply(A); |
123 { | 124 { |
124 const boundarycondition & bc | 125 const boundarycondition & bc |
125 = static_cast<const boundarycondition&> | 126 = static_cast<const boundarycondition&> |
126 (args(i).get_rep ()); | 127 (args(i).get_rep ()); |
127 | 128 |
128 const std::vector<boost::shared_ptr | 129 const std::vector<SHARED_PTR |
129 <const dolfin::DirichletBC> > | 130 <const dolfin::DirichletBC> > |
130 & pbc = bc.get_bc (); | 131 & pbc = bc.get_bc (); |
131 | 132 |
132 for (std::size_t j = 0; j < pbc.size (); ++j) | 133 for (std::size_t j = 0; j < pbc.size (); ++j) |
133 pbc[j]->apply(A); | 134 pbc[j]->apply(A); |
173 femfenics_factory factory; | 174 femfenics_factory factory; |
174 | 175 |
175 dolfin::Vector A; | 176 dolfin::Vector A; |
176 dolfin::assemble (A, a); | 177 dolfin::assemble (A, a); |
177 | 178 |
179 #ifdef LATEST_DOLFIN | |
180 dolfin::Vector x (MPI_COMM_WORLD, myx.length ()); | |
181 #else | |
178 dolfin::Vector x (myx.length ()); | 182 dolfin::Vector x (myx.length ()); |
183 #endif | |
179 for (std::size_t i = 0; i < myx.length (); ++i) | 184 for (std::size_t i = 0; i < myx.length (); ++i) |
180 x.setitem (i, myx.xelem (i)); | 185 x.setitem (i, myx.xelem (i)); |
181 | 186 |
182 for (std::size_t i = 2; i < nargin; ++i) | 187 for (std::size_t i = 2; i < nargin; ++i) |
183 { | 188 { |
186 { | 191 { |
187 const boundarycondition & bc | 192 const boundarycondition & bc |
188 = static_cast<const boundarycondition&> | 193 = static_cast<const boundarycondition&> |
189 (args(i).get_rep ()); | 194 (args(i).get_rep ()); |
190 | 195 |
191 const std::vector<boost::shared_ptr | 196 const std::vector<SHARED_PTR |
192 <const dolfin::DirichletBC> > | 197 <const dolfin::DirichletBC> > |
193 & pbc = bc.get_bc (); | 198 & pbc = bc.get_bc (); |
194 | 199 |
195 for (std::size_t j = 0; | 200 for (std::size_t j = 0; |
196 j < pbc.size (); ++j) | 201 j < pbc.size (); ++j) |