Let's continue our introduction to important DX "buzzwords."
Fields are the basic, most useful object in DX. Components by themselves are not particularly useful. It is only when Components are knitted together into a Field that they really begin to be useful. What happens, though, if you want to visualize two or three or several data objects at the same time? It is not possible, for example, to have more than one "positions" component within a single Field. Remember that DX considers "positions" a keyword, so operations that expect to manipulate the spatial coordinates will look for the "positions" array. If you wanted to display a 2D grid data set and a 3D volumetric data set at the same time in the same image (remember the sample that showed the water molecule Isosurface and the MapToPlane 2D surface at the same time?), you'd find it very clumsy to try to describe both 2D and 3D positions within one Component Array.
Instead, it makes more sense to treat different data sets as different objects; that is, we need to create one Field with 2D positions and another Field with 3D positions. Then it is convenient to have an object container that can group these Fields together. Remarkably, that container is called a Group in DX.
Groups come in a variety of similar species. The generic Group object can contain any mixture of Fields and Groups. For example, a Group may be made up of other Groups that are in turn made up only of Fields. Or a Group might contain a Group and a Field. The depth of the hierarchy is (theoretically) unlimited.
|
 |
Optional: View this Technical Aside if you want more detail on this subject; the information is not required to understand the upcoming material. |
The generic Group is very handy and used frequently. The Collect module takes in several inputs (Fields or Groups) and outputs a Group containing the input members. You can also construct Groups by defining them in data files to be imported, using the DX Native File Format, a topic for later discussion.
|
|
Do be aware that if you Collect the outputs of other Collects, you add a level to the hierarchy. You might now have a Group of Groups of Fields. That's OK, but can come as a surprise if you need to Select items and you aren't sure how deeply buried they are in a structure like this. |
Another commonly used Group type is the Series Group (or just "Series"). This Group has an added feature, a member index. This is a 0-based ordinal member number. Series groups also have a "series position" which is settable by the user to describe any arbitrary value that applies to that series member.
Let's say we record a Field of temperature data in a 3D volume. We conduct the same experiment at several different nitrogen concentrations. We could assemble the data as a Series in which each member was a Field of temperature data (and of course the 3D spatial positions and connections), and the "series position" is the nitrogen concentration value used for that measurement. Note that if we had 3 measurement sets (Fields), the first one in the series would have series member number 0, the second member number 1, the third member number 2. But the "series position" values might be "12.2", "24.9", 14.5", that is, they need not be in order or regularly spaced. Series groups are very often used to create logical time series since many researchers measure or model their phenomena over time. The series member numbers always start at 0 and increment by 1, but the actual time could be stored in the series position value slot for each series member allowing you to later select out a specific member by its real-time rather than its arbitrary index number.
|
|
We saw the Sequencer in action in some sample programs. The Sequencer emits a series of integers, so it is possible to have the Sequencer generate "series member numbers" automatically and these can be used to Select members from a Group, one after another, sending them to Image. Thus, an animation is born. |
There are a few other Group species, such as Multigrid, that we will not discuss in this class but which are fully documented in the OpenDX documentation (Users Guide, Chapter 3.2).
One more thing about Groups: you can assign names (strings) to members, but not with Collect. If you are constructing your own data files in the DX native file format, names can be assigned to Group members there. If you are building a Group within the DX programming interface, another module called CollectNamed does the same thing as Collect but let's you tack on a name for each member. Named Group members can be Selected by either their ordinal member number or by their given name.