[dune-functions] interface check for GridViewFunction

Carsten Gräser graeser at mi.fu-berlin.de
Sun Sep 20 22:04:41 CEST 2015


Hi Christian,

Am 20.09.2015 um 21:51 schrieb Carsten Gräser:
> Hi Christian,
> 
> Am 20.09.2015 um 16:13 schrieb Christian Engwer:
>> Hi Carsten,
>>
>> thanks for putting this concept together. One downside of the current
>> concepts approach (in contrast to interface tests) is that I don't get
>> any information on what is missing/broken in the interface.
> what do you mean by 'interface test'? Deriving from an interface class?
> Of course you can still write tests against the interface.
> 
>> Is there an easy way to fix this? If not in general, then at least for
>> debugging?
> You can manually check the concept such that the substitution failure
> that is triggered if your type does not match will result in a compiler
> error. Then the error message indicates, which expression of the concept
> failed. I.e., to check if vector<double> is a function of signature
> double(int) you can do:
> 
> using F = std::vector<double>;
> using Concept = Dune::Functions::Concept::Function<double(int)>;
> using Check = decltype(Concept().require<F>(std::declval<F>()));
> 
> This will however not reveal if a base-concept is not satisfied.
> But maybe one can add a convenience method that also checks the
> parents in the concept hierarchy.

this would be easy to solve if we completely drop the refinement
mechanism for concepts. Instead one could simply add

 requireConcept<BaseConcept, T>()

to the list of valid expressions of the refining concept. I was
anyway thinking if we should change this, because it would lead
to less magic. However the 'Refines' mechanism is a little more
expressive.

Best,
Carsten

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-functions/attachments/20150920/7fd0bdb5/attachment.sig>


More information about the dune-functions mailing list