Truchas shared-material properties UI

Background

We are implementing a custom view for Truchas materials, and still have one main requirement to address. The Truchas material attribute needs to support properties that can specified in either of two ways (i) with separate items for each material phase, or (ii) as a single item that applies to all material phases. An abridged breakdown of the working material definition (which can be modified) is:

AttDef Type="material.real"

  Group Name="phases", Extensible=True
    Double Name="density"
    Double Name= "specific-heat"
    Double Name="conductivity"
    Group Name="Fluid", Optional=True
      Double Name="viscosity"
    Group Name="Electromagnetic"
     Double Name="electrical-conductivity"
     Double Name="electrical-susceptibility"

  Group Name="shared-properties"
    Double Name="density", Optional=True
    Double Name= "specific-heat", Optional=True
    Double Name="conductivity", Optional=True
    Double Name="viscosity", Optional=True
    Double Name="electrical-conductivity", Optional=True
    Double Name="electrical-susceptibility", Optional=True

When a "shared-properties" item is enabled, it conceptually replaces the corresponding item in the individual "phases".

Display options:

1. In the simplest case, an item in the "phases" groups could be hidden when its corresponding "shared-properties" item is enabled.

2. One alternative would be to hide the value part of the "phases" item and display a substitute label. For example, the “Density” label could be replaced with “Density (Shared)”.

Implementation Options:

The original plan of traversing the qtItem hierarchy and hiding widgets was too naive. Some concepts to consider:

1. Overload qtGroupItem::createWidget() to accept a set of items, or alternatively, item names, to hide. This would seem to be the most straightforward, but would only support hiding items (not changing their display).

2. As an alternative, can we use a custom ItemView for this? For example

  • In the .sbt file, we assign a (new/TBD) ItemView to each item in the “phases” group that could be overridden by a shared version of the same property.

  • At runtime, when the shared-properties selections change, the custom material view sets some UserData on the items that are being overidden, and then uses the now-public qtItem::updateItemData() to redraw.

  • The custom ItemView checks the UserData and, depending on its state, draws the default display (from qtInputsItem), or doesn’t draw anything, or draws whatever custom labeling we choose.

1 Like
Privacy Notice