On 06/06/2013 17:34, Roy Stogner wrote:
>> "what is the proper way to change the quadrature rule in a
>> FEMSystem?"
>
> Three steps:
>
> Delete the current element_qrule (and/or side_qrule)
>
> Set it (or them) to the address of new-allocated QBase(s) of your
> choice.
>
> Loop over element_fe (and/or side_fe) and attach_quadrature_rule() to
> each.
>
> I don't know if this has been tested, though.
> ---
> Roy
>

I got it to work. I was doing it almost right:

class HeatEqn : public FEMSystem{...}
void HeatEqn::init_context(DiffContext & context)
{
   FEMContext &c = libmesh_cast_ref<FEMContext&>(context);
   delete c.element_qrule;
   const unsigned int dim = c.dim;
   FEType fetype=c.element_fe_var[u_var]->get_fe_type();
   AutoPtr<QBase> qtrap(QBase::build(QTRAP,dim,FIRST));
   c.element_qrule = qtrap.get();
   c.element_fe_var[u_var]->attach_quadrature_rule(qtrap.get());
...etc...
}

but in this way the AutoPtr was releasing memory when going out of 
scope. Using instead

   c.element_fe_var[u_var]->attach_quadrature_rule(qtrap.release());

got me a running code (even in libmesh0.7.2).

Matteo

-- 
Matteo Semplice                 Dip. di Matematica
Phone: 011-6702831              Università degli Studi di Torino
Skype: matteosemplice           Via Carlo Alberto, 10 - Torino


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to