I have just checked in some changes to the System class which allow objects, rather than function pointers, for assembly, initialization, and constraints. I tested it with a modified ex9 whose diff is shown below (not attached to avoid the mailing list filters).
I'm pretty happy with it, but am open to suggestions. I intend to do the same
thing with the QoI interface but need to know if the "qoi_indices" are
variables that need to be passed to the QoI computation functions?
-Ben
macbook(42)$ diff ex9.C ex9_object.C
66,82c66,102
< // Function prototype. This function will assemble the system
< // matrix and right-hand-side at each time step. Note that
< // since the system is linear we technically do not need to
< // assmeble the matrix at each time step, but we will anyway.
< // In subsequent examples we will employ adaptive mesh refinement,
< // and with a changing mesh it will be necessary to rebuild the
< // system matrix.
< void assemble_cd (EquationSystems& es,
< const std::string& system_name);
<
< // Function prototype. This function will initialize the system.
< // Initialization functions are optional for systems. They allow
< // you to specify the initial values of the solution. If an
< // initialization function is not provided then the default (0)
< // solution is provided.
< void init_cd (EquationSystems& es,
< const std::string& system_name);
---
>
>
>
> class Ex9 : public System::Initialization,
> public System::Assembly
> {
> public:
>
> Ex9 (EquationSystems& es_in,
> const std::string& system_name_in) :
> es(es_in),
> system_name(system_name_in) {}
>
>
> // Function prototype. This function will initialize the system.
> // Initialization functions are optional for systems. They allow
> // you to specify the initial values of the solution. If an
> // initialization function is not provided then the default (0)
> // solution is provided.
> virtual void initialize();
>
> // Function prototype. This function will assemble the system
> // matrix and right-hand-side at each time step. Note that
> // since the system is linear we technically do not need to
> // assmeble the matrix at each time step, but we will anyway.
> // In subsequent examples we will employ adaptive mesh refinement,
> // and with a changing mesh it will be necessary to rebuild the
> // system matrix.
> virtual void assemble();
>
> private:
>
> EquationSystems& es;
> const std::string system_name;
> };
>
>
147a168,169
> Ex9 ex9(equation_systems, "Convection-Diffusion");
>
154,155c176,177
< system.attach_assemble_function (assemble_cd);
< system.attach_init_function (init_cd);
---
> system.attach_assemble_object (ex9);
> system.attach_init_object (ex9);
249,250c271
< void init_cd (EquationSystems& es,
< const std::string& system_name)
---
> void Ex9::initialize ()
271,272c292
< void assemble_cd (EquationSystems& es,
< const std::string& system_name)
---
> void Ex9::assemble ()
ex9_object.C
Description: ex9_object.C
------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
