|
Especially for the linear algebra members there are some builtin mechanisms, to avoid meaningless operations. A list of such invalid operations is given below
Errors like these are relatively common. Therefore, the checks are really usefull. My point of view is
that it is better to get some anoying error messages than to compute meaningless results ...
In the following we successively debug a very small program which only intents to add the
multiscale coefficients of the function to the multiscale coefficients of .
The source code of our initial program is
Examples/Wrong.cc.
Make and start this code. You will get the error message:
AdaptiveData<2>::SetFunction: coordinate directions with periodic boundary conditions must be set, see AdaptiveGrid::SetPeriodicConditions
The reason for this error is we have forgotten to set the periodic coordinate directions of the adaptive grid.
This is a feature of AdaptiveGrid<D>. For e.g. the refinement
of such grids or the computation of multiscale coefficients of a function the periodic coordinate direction must be known.
To fix this problem we have to add a call of AdaptiveGrid<D>::SetPeriodicConditions.
The modified code is
Examples/Wrong1.cc.
Start this code. You will get the error message:
WC=bfff2b00 dimext=0
i: lift ismult | BC[0] BC[1] | XA XE
0: 0 1 | 0 0 | 0.000000e+00 1.000000e+00
1: 0 1 | 0 0 | 0.000000e+00 1.000000e+00
WC=bfff2b00 dimext=0
i: lift ismult | BC[0] BC[1] | XA XE
0: 0 1 | -1 -1 | 0.000000e+00 1.000000e+00
1: 0 1 | -1 -1 | 0.000000e+00 1.000000e+00
Wrong1.exe: /mount/plutonium/koster/AWFD/Sources/MultiVariat/AdaptiveData.hpp:557: void AdaptiveData<DIM>::Compatible(AdaptiveData<DIM>*) [with int DIM = 2]: Assertion `Ext.IsSame(&X->Ext)' failed.
Aborted
The output is the dump of the Extensions<D> of A and B. These are not compatible. The difference lies in the boundary conditions. Nevertheless, it makes sense to add the two functions. So how, can this be accomplished? Of course it is not possible to represent the result in terms of the wavelets with homogeneous Dirichlet BC. But, the wavelets with no BC suffice. Therefore, we have to find a representation of B in terms of the more general basis with no BC. This is achieved by a PROJECTION of B to the more general basis, see the corrected code Examples/Good.cc