![]() |
TemporaryNewDomain1 is a fix for a deficiency in NewDomain1, which synthesizes SliceType_t from a single parameter, which is incorrect.
NewDomainNBase: a base class for all NewDomainN classes for N >= 3.
The general version of NewDomain2.
A simple base class for all specialized NewDomain2 objects, defining the functions which all have in common.
.. NewDomain7 are simple helper structs which are used to combine Domain objects of different types together (when possible). They are basically traits classes used to tell what the type is when you combine several domains together, and what the combined object looks like.
If you have N Domain objects to combine (where N is from 1 to 7), the type of the Domain object which results when you combine the Domain objects together is (for, say, combining 4 Domains of types T1, T2, T3, and T4 together) NewDomain4<T1,T2,T3,T4>::Type_t
The new Domain will be one of the Domain types listed in the include and forward ref sections above. Generally, combining a more specific type of domain with a more general type of domain (say, a Loc with a Range) results in return domain type of the more general category. E.g., in the case of combining a Loc with Range, the result would be a Range.
The dimension of the new Domain will be the sum of the dimensions of the input objects. The dimensions will be filled in from left to right from the arguments, going from 1 ... Dim for the dimensions. For example, if you combine three domains, the first of Dim 2, the next of Dim 1, the third of Dim 2, the result will be of Dim=5, and will have Dim 1&2 taken from the first argument, Dim 3 from the second, and Dim 4&5 from the third.
To combine domains together, there are two possibilities:
Both of these methods will perform 1D assigments of pieces of the domains to the resulting domain object, using the setDomain method of a 1D domain object.
Determining the type of the combined domain is done pair-wise, starting with the first two types, then combining the result of that with the third type, etc. So, most of the work here is in NewDomain2, which must be specialized for the different possible pairwise combinations. The other NewDomainN's then use NewDomain2 and NewDomain(N-1)'s.
There is actually more than one way to combine Domain objects together. Each method has an associated set of typedef and combine/fill methods. The above discussion was just for one of these methods; the different combining methods are:
So, to use NewDomainN objects, first determine what kind of combining rules you need in your particular context, and then use the relevant set of typedef and combine/fill methods from the list above.
This is most easily done through a base class, since we need to define several different specializations of NewDomain2.
The allowed versions of NewDomain2 are given as partial specializations of this general case. The general case assumes T1 and T2 are single-valued domains for which DomainTraits exist, that combine together to form Interval's (or Loc's for slice combine rules).
This just simplifies the work of specifying all the typedefs for the combination results. The implementations of the combine and fill routines are left to the NewDomainN classes which are derived from NewDomainNBase. T = final type in list of types for NewDomainN. Each NewDomainN is templated on N types T1 ... TN. T should be the same as TN. ND = type of lower-dimensional NewDomainN class which the subclass will build on. For example, NewDomain4<T1,..T4> should be derived from NewDomainNBase<NewDomain3<T1,T2,T3>, T4>. Thus, in this case, we have ND ==> NewDomain3<T1,T2,T3>, and T ==> T4.
.. NewDomain7: these build on each other pairwise, eventually returning back to NewDomain2 for the final determination. NewDomain1 does no actual combining, just a conversion; and NewDomain2 is defined already above.
We need the array's domain type in order to get the right answer when the user specifies a single AllDomain<Dim>.