Hi Guido,

Thank you very much for your reply.  I have tried, unsuccessfuly to impliment 
this, I'm afraid, because I'm not sure what form "advection_problem" should 
take!  What I have done is taken the step-12 tutorial, and remove the "static" 
from 

static void integrate_cell_term
static void integrate_boundary_term
static void integrate_face_term

in class AdvectionProblem, and replaced 


MeshWorker::integration_loop<dim, dim>
      (dof_handler.begin_active(), dof_handler.end(),
       dof_info, info_box,
       &AdvectionProblem<dim>::integrate_cell_term,
       &AdvectionProblem<dim>::integrate_boundary_term,
       &AdvectionProblem<dim>::integrate_face_term,
       assembler, true);

with

 MeshWorker::integration_loop<dim, dim>
       (dof_handler.begin_active(), dof_handler.end(),
        dof_info, info_box,
        std_cxx1x::bind(&AdvectionProblem<dim>::integrate_cell_term, 
&advection_problem, std_cxx1x::_1, std_cxx1x::_2),
        std_cxx1x::bind(&AdvectionProblem<dim>::integrate_boundary_term, 
&advection_problem, std_cxx1x::_1, std_cxx1x::_2),
        std_cxx1x::bind(&AdvectionProblem<dim>::integrate_face_term, 
&advection_problem, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4),
        assembler, true);

in assemble_system ()

I altered your bit of code slightly by changing cell_integrator -> 
integrate_cell_term, bdry_integrator->  integrate_boundary_term,  
face_integrator-> integrate_face_term, so as to be in line with step-12 names.  
I have tried compiling the code with "true" and without "true" in the final 
argument, but both produce the same errors.

Is there an example of this implemented? I have tried a few different things 
for "advection_problem", but I have now run out of ideas!  


I would be very grateful of any help!

Many thanks


Katie Leonard

DPhil student in Computational Biology,
The University of Oxford.
________________________________________
From: Guido Kanschat [[email protected]]
Sent: 03 January 2012 12:56
To: Katie Leonard
Subject: Re: [deal.II] Passing global parameters to Meshworker functions

Katie, yes, there is, even if it looks pretty ugly:

First, the error message you receive is due to the fact that your
function "integrate_cell_term" is static and thus is not associated
with an object of type AdvectionProblem. Thus, you have to remove the
qualifier "static" in the declaration.

Second, this will cause the call to the loop to crash. That call
should be changed now to something like:

  MeshWorker::integration_loop<dim, dim>(
    dof_handler.begin_active(), dof_handler.end(),
    dof_info, info_box,
    std_cxx1x::bind(&AdvectionProblem<dim>::cell_integrator, &advection_problem,
                    std_cxx1x::_1, std_cxx1x::_2),
    std_cxx1x::bind(&AdvectionProblem<dim>::bdry_integrator, &advection_problem,
                    std_cxx1x::_1, std_cxx1x::_2),
    std_cxx1x::bind(&AdvectionProblem<dim>::face_integrator, &advection_problem,
                    std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4),
    assembler);

The simple function pointers you could use in the basic version have
been replaced by bind, which allows to give additional arguments, in
this case the pointer to the advection_problem object you are running
this for.

Please have a look at
http://www.dealii.org/developer/doxygen/deal.II/classAlgorithms_1_1ThetaTimestepping.html

as well for a sample implementation of such a technique.

Best,
Guido

On Tue, Jan 3, 2012 at 6:24 AM, Katie Leonard
<[email protected]> wrote:
> Hello,
>
> Happy New Year!
>
> I am extending step-12 to include time dependency, and I would like to pass 
> global parameters, such as "time_step" - the size of the time step to the 
> integrate_cell_term, integrate_boundary_term and integrate_face_term.  
> However, I get the following error:
>
> In static member function ‘static void 
> Step12::AdvectionProblem<dim>::integrate_cell_term(Step12::AdvectionProblem<dim>::DoFInfo&,
>  Step12::AdvectionProblem<dim>::CellInfo&)’:
> step-12.cc:288:28: error: invalid use of member 
> ‘Step12::AdvectionProblem<dim>::time_step’ in static member function
>
> I was wondering whether there is a way to do this in the Meshworker framework?
>
> Many thanks,
>
>
> Katie Leonard
>
> DPhil student in Computational Biology,
> The University of Oxford.
> _______________________________________________
> dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii



--
Guido Kanschat, Department of Mathematics, Texas A&M University

In accordance with the Texas Public Information Act all email sent to
and from my Texas A&M email account can be obtained through a Public
Information Request. If you do not want your correspondence public,
please arrange a phone conversation with me.
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to