As with all file formats, the CCM specification has undergone some changes in its history. Where possible, backwards compatibility has been included within the library itself. However, there have been a few hierarchical changes which the library cannot hide from the client. If backwards compatibility with these files is desired, the client will need to handle the case appropriately. These cases have been recorded below, along with sample code to handle it. The readexample.cpp read example included contains appropriate handling for all cases.
Addition of Phase Node (2.2.0)
In version 2.2.0 it became necessary to support different material phases, each with their own sets of (possibly different) fields. The Phase entity was inserted between the FieldSet and the Field, so clients must be aware that there may be no Phase entity under FieldSet in older files.
Code:
...
bool oldFile = (CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase) != kCCMIONoErr);
i = 0;
while (oldFile ||
CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase)== kCCMIONoErr)
{
if (oldFile)
phase = solution; ... read data ... oldFile = false;
}
...
Multidimensional data stored as scalar components (2.4.0)
Some clients noted that often multidimensional data (i.e. vector data) was needed one component at a time. Since this can reduce the memory needed to compute secondary quantities, an important consideration for large data, the file format was changed to store multidimensional data as components. Previously all field data was read using CCMIOReadFieldData*(). With this change only scalar data can be read with CCMIOReadFieldData*() and all multidimensional data must be read with CCMIOReadMultiDimensionalFieldData*(). (The extra function was added to be consistent with prefering extra functions to extra parameters) However, CCMIOReadFieldData*() is still required to read older data.
Code:
...
CCMIOReadField(&err, field, name, shortName, &dims, &datatype);
CCMIOEntitySize(&err, fieldData, &n, &max);
CCMIOReadMultiDimensionalFieldData(&err, field, kCCMIOVectorX, scalarID);
if (err == kCCMIOVersionErr)
data.size(n * dims);
else
data.size(n);
...
while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &j, &fieldData) == kCCMIONoErr)
...
CCMIOReadFieldDataf(...);
...
Generated on Mon Jun 5 17:16:02 2006 for libccmio by
1.2.18