Download PDF file

Transcript
Loading the Data
TecUtilArgListDealloc(&ArgList);
9 - 7 Loading the Data
You must enable your add-on to load values for each variable in the zone. The best method for adding the variable values depends on your data and the requirements of your loader. Up to this point,
the same basic code would be used regardless of the loading method. The following code will show
how to use Auto Load on Demand, which is the preferred method for loading large binary files. A
later section called USING CUSTOM LOAD ON DEMAND will show how to revise LoaderCallback and add other code for Custom Load on Demand. The section USING IMMEDIATE
LOADING will show how to revise LoaderCallback to use Immediate Loading.
9- 7.1 Using Auto Load on Demand
If your add-on doesn’t need to control when variables are loaded and unloaded, and if your cellcentered variable values (if any) are listed in a form accepted by Tecplot, you should use Auto Load
on Demand. Some platforms have a different byte order, and you would need to check for this to
make your loader platform independent. However, for this exercise, we will assume that the byte
order is “Native”. You must specify the offset in the file for the first value of the current variable.
The parameter Stride is set to 1 for data in Block format, greater than one for data in Point format.
A stride greater than one is allowed only if all variables are nodal. For this exercise, assume the
Data Value Structure is ClassicPlus.
Add the code below after the command in LoaderCallback() to deallocate the argument list
ArgList.
int Stride;
Boolean_t IsNativeByteOrder = TRUE
for (VarIndex = 1; VarIndex <= NumVars; VarIndex++)
{
Stride = 1;
CurOffset = sizeof(double)*(VarIndex - 1)
* NumPoints + ZoneOffset + DataOffset;
IsOk = TecUtilDataValueAutoLOD (ZoneIndex,
VarIndex,
DataValueStructure_ClassicPlus,
FileName,
CurOffset,
Stride,
IsNativeByteOrder);
69