Re: Set subclasses

My answer missed part of your question.  I should also add that your
question and Glenn's are astute and have given me a chance to think
hard about Sets and MathTypes over the last day.
>    When I examine the subclasses of SimpleSet, it seems that GriddedSet and
> its subclasses define phi in the gridToValue() method.  DoubleSet, FloatSet,
> and List1DSet all seem to just be plain sets.
gridToValue and valueToGrid define the mapping between domain space and
grid space, which is a sort of parameterization of the manifold.
However, valueToGrid throws an Exception if ManifoldDimension !
DomainDimension, so in that case its not really a parameterization.
The original idea, which is fraying a bit, was that SimpleSets are Sets
with a single ManifoldDimension, while Sets may be Unions of SimpleSets
with different ManifoldDimensions (but note the current UnionSet is
always a SimpleSet and checks that its arguments all have the same
ManifoldDimension).  Of course, DoubleSets and FloatSets have a single
ManifoldDimension (that is currently always equal to the DomainDimension)
and they are not SimpleSets (because I never intended them to serve as
Field DomainSets - but only added the test for this ten minutes ago -
I must have missed it 18 months ago when I first wrote
Furthermore, the valueToInterp method is defined in SimpleSet (whereas
indexToValue and valueToIndex are defined in Set), so only SimpleSets
support interpolation algorithms.  However, currently any SimpleSet
with ManifoldDimension != DomainDimension just throws an Exception in
its valueToInterp method, and in its valueToIndex method.
The bottom line of all this is that applications will get an Exception
if they try to resample a Field with DomainSet with ManifoldDimension !
DomainDimension, but this makes some sense since the system currently
has no way of knowing if the new samples lie on the sub-manifold where
the Field is defined.  But the system does support other operations
with such Fields, including visualization.
Clearly this Set logic has evolved a bit as the system was written, but
I think it will hold for a while without major surgery.  Note that nearly
a third of the lines of code in the core package are in the Set classes -
they are major work horses.  One major area for future development is
the implementation of Sets that do explicitly document their manifolds
and use it to support resampling and interpolation when ManifoldDimension
!= DomainDimension.  But for now I think it is more important to build
extension packages that hide some of the complexity of the data model.
By the way, List1DSet extends SimpleSet.  It is intended for use as the
DomainSets of Fields that contain table data, where the domain values
are only table indices with no other signoificance.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738