[Dune] problem with alberta, cannot find "ldunealbertagrid_0d"

Martin Nolte nolte at mathematik.uni-freiburg.de
Tue Feb 2 17:17:24 CET 2010


Hi Jö,

providing a default for ALBERTA_DIM is bad because it disables the magic of
gridtype.hh. If you write

make GRIDDIM=2 GRIDTYPE=ALBERTAGRID

you want your program to correctly compile and link with AlbertaGrid< 2 > and
ALBERTA_DIM=WORLDDIM=GRIDDIM=2. This is currently supported. Any default other
than ALBERTA_DIM=$(WORLDDIM) would break this. Now, we did not want to give a
default for GRIDDIM, so it defaults to the invalid value 0.

The discussed problem only occurs, if don't use this magic, or if WORLDDIM >
3. Then, the ALL_PKG_LIBS contain this troublesome -lalberta_$(ALBERTA_DIM)d,
which does not exist.

One real solution would be your suggestion (h). Another feasible suggestion
was made Andreas and Robert:

(i) add both, libalberta_0d and libalbertagrid_0d, to the dune-grid libraries.
This would only lack the WORLDDIM > 3 problem.

For me, solutions (h) and (a) are becoming the most promising. But as
Christian indicated that he might have antother solution, I would wait with
the decision.

Maybe I should also mention that ALBERTA can support WORLDDIM > 3, if the user
configures ALBERTA for it. This does not change the grid dimensions, however,
i.e., ALBERTA supports only 1d, 2d and 3d grids. The DUNE bindings should not
have any trouble with this, except for two things:
- the m4 file has to detect the available libraries (libalberta_nd)
- the according DUNE library libalbertagrid_nd has to be compiled
Just in case this is of interest...

Yours,

Martin





Jö Fahlke wrote:
> Am Tue,  2. Feb 2010, 10:13:42 +0100 schrieb Martin Nolte:
>> (a) don't include ALBERTA_CPPFLAGS in ALL_PKG_CPPFLAGS (solves the problem if 
>> you're never using ALBERTA.
>>
>> (b) provide a fix (like 2) default for ALBERTA_DIM (which is currently 
>> $(WORLDDIM)). This would disable the preprocessor magic for ALBERTA.
> 
> Can you elaborate on what exactly it would disable?  I don't see what the
> preprocessor has to do with it.
> 
> If we let configure substitute "ALBERTA_DIM = 2" into the Makfiles per
> default, this can still be overridden, both in the Makefile.am and on the Make
> command line.  I mean, this is essentially what is done currently, only
> instead of "ALBERTA_DIM = 2" we substitude "ALBERTA_DIM = $(WORLDDIM)".
> 
>> (c) provide a fix default for WORLDDIM (which is currently $(GRIDDIM)). Again, 
>> this influences the preprocessor magic
> 
> Same comment as for (b).
> 
>> (d) provide a nonzero default for GRIDDIM (currently 0). This would fix the 
>> problem, but the user gets no warning if he does not specify GRIDDIM.
> 
> What information would that warning convey to the user?  "Just set some value
> for GRIDDIM"?  If that is the case, why didn't we just pick a value?  In any
> case, even if we just pick a value, it can always be overriden in the
> Makefile.am and on the make command line.
> 
>> (e) add a libdunealbertagrid_0d and remove -lalberta_nd from the 
>> ALBERTA_CPPFLAGS. Then, -lalberta_nd should still be included through libtool, 
>> but I consider this a very dirty hack. I even doubt that it will be reliable.
> 
> I doubt that it will work correctly in the shared library case, since
> currently there appear to be direct calls from the program code into
> -lalberta_nd (see option (f)).
> 
>> (f) move all calls to -lalberta_nd into the libalbertagrid_nd (and add 
>> libalbertagrid_0d). This way, the libtool problem does not occur, but the code 
>> gets a lot slower (due to the added indirection in the ALBERTA calls).
> 
> Not to mention that it probably means a lot of work.  And not only right now,
> it has to maintained in the future as well.
> 
>> (g) leave it as it is and let the user provide a feasable default for 
>> ALBERTA_DIM (which is the variable you actually meant).
> 
> OK, why don't we just provide a default?  It can still be overriden in the
> Makefile.am and on the make command line.
> 
> (h) Make use of computed make variable names, like "ALBERTA_CPPFLAGS =
> $(ALBERTA$(ALBERTA_DIM)D_CPPFLAGS)".  This would result in empty
> $(ALBERTA_CPPFLAGS) in all cases where ALBERTA$(ALBERTA_DIM)D_CPPFLAGS is an
> undefined variable.  While this is non-POSIX, the automake manual says it is
> widely supported.
> 
> My favorite would be a --with-default-alberta-dim configure switch.  If that
> is not given a configure time, ALBERTA_DIM can default to '2' or '3' (I don't
> care which one exactly).  It can even default to '$(WOLDDIM)' for all I care,
> but only if that is fixed to have a sane default first.
> 
> Thanks,
> Jö.
> 

-- 
Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5642
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany





More information about the Dune mailing list