Hi Praveen, don't declare the integrate methods as "static" in the conservationlaw class. If you do that, there is no "this" pointer for those functions, and boost will complain. Remove that and it should work. if you do want the integrate methods to be static, just follow the calling convention in step-12 or step-39.
-- Mihai ________________________________ Von: Praveen C <[email protected]> An: deal.ii <[email protected]> Gesendet: Mittwoch, den 16. März 2011, 11:20:54 Uhr Betreff: [deal.II] Correct way to use boost::bind and MeshWorker Hello all, I am modifying step-33 to introduce MeshWorker. Since this needs other class variables, I am trying to use boost::bind to bind the class pointer. Here is the main stuff: class ConservationLaw { ... typedef dealii::MeshWorker::DoFInfo<dim> DoFInfo; typedef dealii::MeshWorker::IntegrationInfo<dim> CellInfo; static void integrate_cell_term (DoFInfo& dinfo, CellInfo& info); static void integrate_boundary_term (DoFInfo& dinfo, CellInfo& info); static void integrate_face_term (DoFInfo& dinfo1, DoFInfo& dinfo2, CellInfo& info1, CellInfo& info2); ... } The functions are implemented like this template <int dim> void ConservationLaw<dim>::integrate_cell_term (DoFInfo& dinfo, CellInfo& info) { ... } template <int dim> void ConservationLaw<dim>::integrate_boundary_term ( DoFInfo& dinfo, CellInfo& info) { ... } template <int dim> void ConservationLaw<dim>::integrate_face_term ( DoFInfo& dinfo1, DoFInfo& dinfo2, CellInfo& info1, CellInfo& info2) { ... } Finally, the assemble function is template <int dim> void ConservationLaw<dim>::assemble_system (Integrator<dim>& integrator) { std::cout << "start assemble\n"; MeshWorker::integration_loop<dim, dim> (dof_handler.begin_active(), dof_handler.end(), integrator.dof_info, integrator.info_box, boost::bind(&ConservationLaw<dim>::integrate_cell_term, this, _1, _2), boost::bind(&ConservationLaw<dim>::integrate_boundary_term, this, _1, _2), boost::bind(&ConservationLaw<dim>::integrate_face_term, this, _1, _2, _3, _4), integrator.assembler, true); system_matrix.compress (); } But compiling the code gives me lot of boost errors: $ make ============================ Remaking Makefile.dep ==============debug========= claw.cc -> claw.g.o /Users/praveen/Applications/deal.II/7.0.0/contrib/boost/include/boost/bind/bind.hpp: In instantiation of ‘boost::_bi::result_traits<boost::_bi::unspecified, void (*)(dealii::MeshWorker::DoFInfo<2, 2, double>&, dealii::MeshWorker::IntegrationInfo<2, 2>&)>’: /Users/praveen/Applications/deal.II/7.0.0/contrib/boost/include/boost/bind/bind_template.hpp:15: instantiated from ‘boost::_bi::bind_t<boost::_bi::unspecified, void (*)(dealii::MeshWorker::DoFInfo<2, 2, double>&, dealii::MeshWorker::IntegrationInfo<2, 2>&), boost::_bi::list3<boost::_bi::value<ConservationLaw<2>*>, boost::arg<1>, boost::arg<2> > >’ claw.cc:725: instantiated from ‘void ConservationLaw<dim>::assemble_system(Integrator<dim>&) [with int dim = 2]’ claw.cc:1180: instantiated from ‘void ConservationLaw<dim>::run() [with int dim = 2]’ claw.cc:1288: instantiated from here /Users/praveen/Applications/deal.II/7.0.0/contrib/boost/include/boost/bind/bind.hpp:69: error: ‘void (*)(dealii::MeshWorker::DoFInfo<2, 2, double>&, dealii::MeshWorker::IntegrationInfo<2, 2>&)’ is not a class, struct, or union type What am I doing wrong ? Thanks praveen
_______________________________________________ dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
