Well - one thing that makes this worse is that System::add_variables()
(Note the "s") returns the variable ID of the last variable added when
you're adding a whole group (which is crazy not useful).

I know that we delay group creation a bit so that groups can automatically
be created so we may not know the group number at this point (I can't quite
tell)... but what if that function is changed to return the VariableGroup
object itself? Hold it as a reference we should be able to get the ID out
of it later...

Derek
On Sat, Aug 6, 2016 at 3:33 PM Roy Stogner <royst...@ices.utexas.edu> wrote:

>
> On Sat, 6 Aug 2016, Derek Gaston wrote:
>
> > Does anyone see a way to get the VariableGroup for a particular
> > Variable.  For instance, if I know the variable's number... how
> > would I get what group it's in?
>
> Right now IIRC the only way is to loop over all variable groups,
> accumulate the number of variables per group for each, and stop when
> the result exceeds the variable number you're interested in.
>
> That's a horrible way to do it, though, excusable only because
> nobody's actually *wanted* to do it.  If you need to do this anywhere
> in an inner loop then you ought to create a cached inverse lookup
> table in the DofMap.
> ---
> Roy
------------------------------------------------------------------------------
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to