Feature Request: Category "exclude" logic
With the release of CMB/Truchas with support for coupled heat transfer and fluid flow (Oct 2020), there is a need to specify a Category::Set that includes "Heat Transfer" and explicitly doesn't include "Fluid Flow". (It is needed for the Diffusion Solver namelist, which has different properties depending on whether Fluid Flow is included or not.) In terms of the template syntax, the most obvious candidates are
Option 1: add an <ExcludeCategories>
element
<Categories>
<Cat>Heat Transfer</Cat>
</Categories>
<ExcludeCategories>
<Cat>Fluid Flow</Cat>
</ExcludeCategories>
Option 2: add an "Exclude" attribute to the <Cat>
element
<Categories>
<Cat>Heat Transfer</Cat>
<Cat Exclude="true">Fluid Flow</Cat>
</Categories>
Option 3: add a new element type <ExcludeCat>
**
<Categories>
<Cat>Heat Transfer</Cat>
<ExcludeCat>Fluid Flow</Cat>
</Categories>
Option 1 is the preferred choice but this is certainly open for more discussion.
The current use-case only requires one excluded category, but I am presuming we should support a set of excluded categories. In terms of the logic, I think Categories::Set::passes()
is only true when all excluded categories are not passed in (i.e., there is no any case for category exclusion).
In terms of implementation, one approach would add a std::set<std::string>
to store the excluded categories.