Dear Dumux users,

as you might have noticed, Timo Koch enchanted us with a macro-free 
implementation of the property system. By merging !1296,

https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/merge_requests/1296

no property macros are used anymore throughout the Dumux master, apart from the 
sequential stuff. The plan is that the macros will stay valid in 3.0, become 
deprecated in 3.1 and will be removed in 3.2.


Ideally, you should already start getting rid of the macro usages in your code. 
As an immediate bonus, you will get far better error messages if you screw 
things up with the properties. There is a script 
bin/util/replace_property_macros.sh that should do most of the job 
automatically. You can for example apply it on top of the folder where you want 
to replace things by

find . -type f -name '*.[ch][ch]' -exec bash 
path_to_dumux/bin/util/replace_property_macros.sh {} \;

Please find some detailed manual instructions below.


Kind regards

Bernd


GET_PROP_TYPE:

Replace

typename GET_PROP_TYPE(TypeTag, MyProperty)

by

GetPropType<TypeTag, Properties::MyProperty>

and

typename GET_PROP_TYPE(TypeTag, MyProperty)::OtherType

by

typename GetPropType<TypeTag, Properties::MyProperty>::OtherType

You should be inside the namespace Dumux or have a corresponding alias. 
Otherwise, you have to prepend with `Dumux::`.


NEW_TYPE_TAG:

Replace

NEW_TYPE_TAG(MyTypeTag, INHERITS_FROM(Father1, Father2))

by

namespace TTag {

struct MyTypeTag { using InheritsFrom = std::tuple<Father2, Father1>; };

}

Note the reversed order.


GET_PROP_VALUE:

Replace

GET_PROP_VALUE(TypeTag, MyProperty)

by

getPropValue<TypeTag, Properties::MyProperty>()


SET_BOOL_PROP and SET_INT_PROP:

Replace

SET_BOOL_PROP(MyTypeTag, MyProperty, VALUE)

by

template<class TypeTag>

struct MyProperty<TypeTag, TTag::MyTypeTag> { static constexpr bool value = 
VALUE; };


SET_TYPE_PROP:

Replace

SET_TYPE_PROP(MyTypeTag, MyProperty, TYPE)

by

template<class TypeTag>

struct MyProperty<TypeTag, TTag::MyTypeTag> { using type = TYPE; };

SET_PROP:

Replace

SET_PROP(MyTypeTag, MyProperty)

by

template<class TypeTag>

struct MyProperty<TypeTag, TTag::MyTypeTag>


TTAG:

Replace

TTAG(MyTypeTag)

by

Properties::TTag::MyTypeTag

_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to