Data Loader Addons


Functions

Boolean_t TecUtilImportAddConverter (DataSetConverter_pf ConverterCallback, const char *ConverterName, const char *FNameExtension)
  Register a data set converter with Tecplot.
Boolean_t TecUtilImportAddLoader (DataSetLoader_pf LoaderCallback, const char *DataSetLoaderName, DynamicMenuCallback_pf LoaderSelectedCallback, DataSetLoaderInstructionOverride_pf InstructionOverrideCallback)
  Register a data set loader with Tecplot.
Boolean_t TecUtilImportAddLoaderX (ArgList_pa ArgList)
  Register a data set loader with Tecplot.
Boolean_t TecUtilImportSetLoaderInstr (const char *DataSetLoaderName, StringList_pa Instructions)
  Inform Tecplot about the instructions used to load the current data set.
void TecUtilImportWriteLoaderInstr (const char *DataSetLoaderName, StringList_pa Instructions)
  Writes a $!READDATASET macro command to the macro file if macro recording is on.
LgIndex_t TecUtilImportGetLoaderInstrCount (void)
  Gets the number of loader instruction lists available for retrieval by TecUtilImportGetLoaderInstrByNum.
void TecUtilImportGetLoaderInstrByNum (LgIndex_t Index, char **DataSetReaderName, StringList_pa *DataSetLoaderInstructions)
  Retrieves the instructions of the n'th data loader used to load the data into the data set attached to the current frame.
Boolean_t TecUtilImportGetLoaderInstr (char **DataSetLoaderName, StringList_pa *DataSetLoaderInstructions)
  Get the instructions of the last data loader used to load the data into the data set attached to the current frame.


Function Documentation

Boolean_t TecUtilImportAddConverter ( DataSetConverter_pf  ConverterCallback,
const char *  ConverterName,
const char *  FNameExtension 
)

Register a data set converter with Tecplot.

This will add an option to the list of data imports accessed via the File/Import menu option. See Section 9.2, "Data Set Loaders," in the ADK User's Manual for a discussion of data set loaders.

Parameters:
ConverterCallback Name of the function to call to convert data to the Tecplot binary format.
ConverterName Unique name given to the data set converter. This name is used in the list of importers in the dialog launched by choosing File/Import. If a layout file is created the $READDATASET macro command will also use this name to identify the converter to use.
FNameExtension This is the file name extension used by files converted with this data set converter
Returns:
Returns TRUE if the data set converter is added.
Precondition:
ConverterName String must have a valid address and non-zero length.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilImportAddConverter(
   &                   ConverterCallback,
   &                   ConverterName,
   &                   FNameExtension)
    POINTER         (ConverterCallbackPtr, ConverterCallback)
    CHARACTER*(*)   ConverterName
    CHARACTER*(*)   FNameExtension

Python Syntax:

    This function is not supported in Python.

An add-on is created that has the following data set converter function:

   Boolean_t ConvertBananaData(char  *DataFName,
                                       char  *TempBinFName,
                                       char **MessageString);
   {
      Boolean_t IsOk = TRUE;
      //
      // Code here to open DataFName,
      // read in the data and write out a binary
      // Tecplot datafile to TempBinFName using
      // calls to TecUtilTecXxx functions. If there is
      // a problem, call TecUtilStringAlloc() on
      // MessageString, supply a message describing the
      // issue, and set ISOk to FALSE.
      //
      return (IsOk);
   }
   The call to register the data set converter with Tecplot is then accomplished using the following:
   .
   .
       IsOk = TecUtilImportAddConverter(ConvertBananaData,
                                        "BANANA",
                                        "*.ban");

Boolean_t TecUtilImportAddLoader ( DataSetLoader_pf  LoaderCallback,
const char *  DataSetLoaderName,
DynamicMenuCallback_pf  LoaderSelectedCallback,
DataSetLoaderInstructionOverride_pf  InstructionOverrideCallback 
)

Register a data set loader with Tecplot.

This will add an option to the list of data imports accessed via the File/Import menu option. Data set loaders are more complex than data set converters, but provide you with greater flexibility in terms of the graphical user interface and how the data can be retrieved. See Section 9.2, "Data Set Loaders," in the ADK User's Manual for a discussion of data set loaders.

Parameters:
LoaderCallback Function to call to load non-Tecplot format data into Tecplot. The data set loader itself calls this function when a request is made to load non-Tecplot format data in via the user interface. Tecplot also calls this function when processing a $!READDATASET macro command that identifies this loader.
DataSetLoaderName Unique name given to the DataSet Loader. This name is used in the list of importers in the dialog launched by choosing File/Import. If a layout file is created, the $READDATASET macro command will also use this name to identify the loader to use.
LoaderSelectedCallback Function that is called when the user selects this data set loader from the list of importers in the File/Import dialog. This function typically will launch a custom dialog to prompt the user to identify the data to be loaded. If NULL Tecplot will not register a callback or put an entry in the File/Import dialog.
InstructionOverrideCallback Name of the function to call when the user chooses to override the data source for a given data set when a layout file is being read in. If set to NULL then Tecplot will issue an error message stating that this operation is not available. If provided, this function typically will launch a dialog that shows the user what the current settings are to load the data and provide a means by which the user can alter these instructions. The Instructions stringlist is updated according to changes made by the user and the new information is then used to load the data.
Returns:
Returns TRUE if the data set loader is added.
Precondition:
DataSetLoaderName String must have a valid address and non-zero length.
Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilImportAddLoader(
   &                   LoaderCallback,
   &                   DataSetLoaderName,
   &                   LoaderSelectedCallback,
   &                   InstructionOverrideCallback)
    POINTER         (LoaderCallbackPtr, LoaderCallback)
    CHARACTER*(*)   DataSetLoaderName
    POINTER         (LoaderSelectedCallbackPtr, LoaderSelectedCallback)
    POINTER         (InstructionOverrideCallbackPtr, InstructionOverrideCallback)

Python Syntax:

    This function is not supported in Python.

An add-on is created that has the following data set loader function:

   Boolean_t LoadBananaData(StringList_pa Instructions)
   {
     Boolean_t IsOk = TRUE;
     //
     // Add code to scan through instructions
     // and load the data.  When done, inform
     // Tecplot about the instructions used to
     // load the data.
     //
      if (IsOk)
        TecUtilImportSetLoaderInstr("BANANA", Instructions);
      return (IsOk);
   }

A function is also created to handle user requests to use the loader from the File/Import dialog:

   void BananaLoaderDialog(void)
     {
      //
      // Launch a custom dialog to prompt the
      // user to identify the data to be loaded.
      //
     }

A function is also created to handle user requests to modify the instructions. This function is optional.

   Boolean_t OverrideBananaInstructions(StringList_pa Instructions)
     {
        Boolean_t IsOk = TRUE;
        //
        // Code here to view the current instructions and present
        // an interface to the user to change them.
        //
         return (IsOk);
     }

The call to register the data set loader with Tecplot is then accomplished using the following:

      .
      .
      IsOk = TecUtilImportAddLoader(LoadBananaData,
                                    "BANANA",
                                    BananaLoaderDialog,
                                    OverrideBananaInstructions);

Boolean_t TecUtilImportAddLoaderX ( ArgList_pa  ArgList  ) 

Register a data set loader with Tecplot.

This will add an option to the list of data imports accessed via the File/Import menu option. Data set loaders are more complex than data set converters, but provide you with greater flexibility in terms of the graphical user interface and how the data can be retrieved. See Section 9.2, "Data Set Loaders," in the ADK User's Manual for a discussion of data set loaders.

Parameters:
ArgList Set of Arglist entries. This is built using calls to TecUtilArgListAppendXXXX functions.


Arglist Values

SV_FILENAMEEXTENSIONS
Type: char *
Arg Function: TecUtilArgListAppendString()
Default: "*"
Required: No
Notes: A spaced separated string of file extensions used by the loaders. For example "*.dat *.plt".

SV_ALLOWMULTIFILESELECTION
Type: Boolean_t
Arg Function: TecUtilArgListAppendInt()()
Default: FALSE
Required: No
Notes: Indicates if the loaders handles multiple files at once for its loader instructions.

SV_LOADERSELECTEDCALLBACKVERSION
Type: LoaderSelectedCallbackVersion_e
Arg Function: TecUtilArgListAppendInt()
Default: LoaderSelectedCallbackVersion_V2
Required: No
Notes: Version of the loader selected callback. Valid values are LoaderSelectedCallbackVersion_V1 for compatibility with DynamicMenuCallback_pf callback and LoaderSelectedCallbackVersion_V2 for DataLoaderCallbackV2_pf.

SV_LOADERSELECTEDCALLBACK
Type: DataLoaderCallbackV2_pf
Arg Function: TecUtilArgListAppendFunction()
Required: Yes
Notes: Function that is called when the user selects this data set loader from the list of importers in the File/Import dialog. Functions of type DynamicMenuCallback_pf typically will launch a custom dialog to prompt the user to identify the data to be loaded. Functions of type DataLoaderCallbackV2_pf it will require a list of files to be opened and a flag to launch a custom dialog. If NULL Tecplot will not register a callback or put an entry in the File/Import dialog.

SV_LOADERNAME
Type: char*
Arg Function: TecUtilArgListAppendString()
Required: Yes
Notes: Unique name given to the DataSet Loader. If a layout file is created, the $READDATASET macro command will also use this name to identify the loader to use.

SV_LOADERCALLBACK
Type: DataSetLoader_pf
Arg Function: TecUtilArgListAppendFunction()
Required: Yes
Notes: Function to call to load non-Tecplot format data into Tecplot. Tecplot also calls this function when processing a $!READDATASET macro command that identifies this loader.

SV_LOADERINSTRUCTIONOVERRIDECALLBACK
Type: DataSetLoaderInstructionOverride_pf
Arg Function: TecUtilArgListAppendFunction()
Default: LoaderSelectedCallbackVersion_V2
Required: No
Notes: Name of the function to call when the user chooses to override the data source for a given data set when a layout file is being read in. If set to NULL then Tecplot will issue an error message stating that this operation is not available. If provided, this function typically will launch a dialog that shows the user what the current settings are to load the data and provide a means by which the user can alter these instructions. The Instructions stringlist is updated according to changes made by the user and the new information is then used to load the data.

SV_CLIENTDATA
Type: ArbParam_t
Arg Function: TecUtilArgListAppendArbParam()
Default: 0
Required: No
Notes: Client data sent to callback.


Returns:
Returns TRUE if the data set loader is added.
Precondition:
ArgList Argument list must be valid.
Python Syntax:
  Results = TecUtil.ImportAddLoaderX(ArgList)

  Input:
                  ArgList              dictionary
  Output:
    Results[0]    ReturnVal            boolean

Boolean_t TecUtilImportGetLoaderInstr ( char **  DataSetLoaderName,
StringList_pa DataSetLoaderInstructions 
)

Get the instructions of the last data loader used to load the data into the data set attached to the current frame.

If a foreign data set loader addon was used to load the data, then the instruction string passed to the loader is returned. If the data was loaded by Tecplot, then the DataSetReaderName returned is "TECPLOT" and each file name in the data set is returned in the DataSetLoaderInstructions stringlist parameter. The current frame must have an attached data set when this function is used.

Note:
This function now has less usefulness in Tecplot than it once did in previous versions. Tecplot now maintains a data journal which allows for more complex data load sequences. It is important to note that other data altering instructions may follow your data loader instructions. This function does not provide any such information to the add-on.
Parameters:
DataSetLoaderName Name of the data set loader. You must use TecUtilStringDealloc() to free this string when you are done with it.
DataSetLoaderInstructions The data set loader instructions. You must use TecUtilStringListDealloc() to free this string list when you are done with it.
Returns:
Returns TRUE if the data was loaded using a data set loader.
Precondition:
Must have one or more frames.

Current frame must have a data set.

IMPLICATION(DataSetReaderName != NULL,VALID_REF(DataSetReaderName)) Pointer must be a valid address or NULL.

DataSetLoaderInstructions Pointer must be a valid address or NULL.

Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilImportGetLoaderInstr(
   &                   DataSetLoaderName,
   &                   DataSetLoaderNameLength,
   &                   DataSetLoaderInstructionsPtr)
    CHARACTER*(*)   DataSetLoaderName
    INTEGER*4       DataSetLoaderNameLength
    POINTER         (DataSetLoaderInstructionsPtr, DataSetLoaderInstructions)

Python Syntax:

  Results = TecUtil.ImportGetLoaderInstr()

  Output:
    Results[0]    ReturnVal            boolean
    Results[1]    DataSetLoaderName    string
    Results[2]    DataSetLoaderInstructions sequence of strings

Get the data set loader and instructions used to load the current frame's data set:

   if (TecUtilDataSetIsAvailable())
     {
       char* LoaderName = NULL;
       StringList_pa LoaderInstructs = NULL;
       Boolean_t IsOk = TecUtilImportGetLoaderInstr(&LoaderName,
                                                    &LoaderInstructs);
       if (IsOk                    &&
           LoaderName != NULL      &&
           LoaderInstructs != NULL &&
           strcmp(LoaderName, "BANANA") == 0)
         {
           ...
         }

       if (LoaderName != NULL)
         TecUtilStringDealloc(&LoaderName);
       if (LoaderInstructs != NULL)
         TecUtilStringListDealloc(&LoaderInstructs);
     }

void TecUtilImportGetLoaderInstrByNum ( LgIndex_t  Index,
char **  DataSetReaderName,
StringList_pa DataSetLoaderInstructions 
)

Retrieves the instructions of the n'th data loader used to load the data into the data set attached to the current frame.

Use 1 for the first data loader, or call TecUtilImportGetLoaderInstrCount(), and use this value to get the most recent data loader. If a foreign data set loader addon was used to load the data, then the instruction string passed to the loader is returned. If the data was loaded by Tecplot, then the DataSetReaderName returned is "TECPLOT" and each file name in the data set is returned in the DataSetLoaderInstructions stringlist parameter. The current frame must have an attached data set when this function is used. You MUST call TecUtilImportGetLoaderInstrCount before calling this function in order to verify that at least 1 load command exists in the data journal. This function will assert if the Index parameter is invalid.

Parameters:
Index Index of the loader instruction list to retrieve
DataSetReaderName Receives the DataSet reader name of the selected instruction list This parameter must be released after use with TecUtilStringDealloc. This parameter may be NULL.
DataSetLoaderInstructions Receives the instruction string list selected This parameter must be released after use with TecUtilStringListDealloc. This parameter may be NULL.
Precondition:
Must have one or more frames.

Current frame must have a data set.

DataSetReaderName Pointer must be a valid address or NULL.

DataSetLoaderInstructions Pointer must be a valid address or NULL.

Fortran Syntax:
    SUBROUTINE TecUtilImportGetLoaderInstrByNum
   &           Index,
   &           DataSetReaderName
   &           DataSetReaderNameLength
   &           DataSetLoaderInstructions,
    INTEGER*4       Index
    CHARACTER*(*)   DataSetReaderName
    INTEGER*4       DataSetReaderNameLength
    POINTER         (DataSetLoaderInstructions, StringList)

Python Syntax:

  Results = TecUtil.ImportGetLoaderInstrByNum(Index)

  Input:
                  Index                int
  Output:
    Results[0]    DataSetReaderName    string
    Results[1]    DataSetLoaderInstructions sequence of strings

   if (TecUtilDataSetIsAvailable())
     {
       LgIndex_t MaxInstr = TecUtilImportGetLoaderInstrCount();
       if ( MaxInstr > 0 )
         {
           // only call TecUtilImportGetLoaderInstrByNum if
           // at least one dataset read instruction list exists

           StringList_pa Instr = NULL;
           char *LoaderName = NULL;
           // Get the last instruction list available
           TecUtilImportGetLoaderInstrByNum(MaxInstr, // 1-based
                                            &LoaderName,
                                            &Instr);

           // release when finished
           TecUtilStringDealloc(&LoaderName);
           TecUtilStringListDealloc(&Instr);
         }
     }

See also:
TecUtilImportGetLoaderInstr TecUtilImportGetLoaderInstrCount

LgIndex_t TecUtilImportGetLoaderInstrCount ( void   ) 

Gets the number of loader instruction lists available for retrieval by TecUtilImportGetLoaderInstrByNum.

You must call this function before calling TecUtilImportGetLoaderInstrByNum, to determine the maximum index of the dataset reader instruction index parameter. This function will return 0 if there are no dataset read commands in the journal. You must call this function before calling TecUtilImportGetLoaderInstrCount() in order to verify that at least one dataset read command has been executed.

Returns:
The number of instruction lists (read commands) available for retrieval by TecUtilImportGetLoaderInstrByNum. Returns 0 if there have been no dataset read commands.
Precondition:
Must have one or more frames.

Current frame must have a data set.

Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilImportGetLoaderInstrCount()

Python Syntax:

  Results = TecUtil.ImportGetLoaderInstrCount()

  Output:
    Results[0]    ReturnVal            int

   if (TecUtilDataSetIsAvailable())
     {
       LgIndex_t MaxInstr = TecUtilImportGetLoaderInstrCount();
       if ( MaxInstr > 0 )
         {
           // only call TecUtilImportGetLoaderInstrByNum if
           // at least one dataset read instruction list exists

           StringList_pa *Instr = NULL;
           char *LoaderName = NULL;
           // Get the last instruction list available
           TecUtilImportGetLoaderInstrByNum(MaxInstr, // 1-based
                                            &LoaderName,
                                            &Instr);

           // release when finished
           TecUtilStringDealloc(&LoaderName);
           TecUtilStringListDealloc(&Instr);
         }
     }

See also:
TecUtilImportGetLoaderInstr TecUtilImportGetLoaderInstrByNum

Boolean_t TecUtilImportSetLoaderInstr ( const char *  DataSetLoaderName,
StringList_pa  Instructions 
)

Inform Tecplot about the instructions used to load the current data set.

It is assumed that the current data set was loaded via a data set loader. The current frame must have an attached data set when this function is used.

Parameters:
DataSetLoaderName Unique loader name. This same name must be used in TecUtilImportAddLoader().
Instructions Instructions used to load the current data set
Returns:
Returns TRUE if the instructions were successfully loaded.
Precondition:
DataSetLoaderName String must have a valid address and non-zero length.

Must have one or more frames.

Current frame must have a data set.

Fortran Syntax:
    INTEGER*4 FUNCTION TecUtilImportSetLoaderInstr(
   &                   DataSetLoaderName,
   &                   InstructionsPtr)
    CHARACTER*(*)   DataSetLoaderName
    POINTER         (InstructionsPtr, Instructions)

Python Syntax:

  Results = TecUtil.ImportSetLoaderInstr(DataSetLoaderName, Instructions)

  Input:
                  DataSetLoaderName    string
                  Instructions         sequence of strings
  Output:
    Results[0]    ReturnVal            boolean

void TecUtilImportWriteLoaderInstr ( const char *  DataSetLoaderName,
StringList_pa  Instructions 
)

Writes a $!READDATASET macro command to the macro file if macro recording is on.

Note:
Since TecUtilImportSetLoaderInstr() will automatically call this function, you normally do not need to call this function. If you are writing a loader that does not use an instruction string, that is it does not call TecUtilImportSetLoaderInstr(), then you should call this function before displaying your data.
Parameters:
DataSetLoaderName Unique loader name. This same name must be used when calling TecUtilImportAddLoader().
Instructions Instructions used to load the current data set. If you are not calling TecUtilImportSetLoaderInstr(), then typically this would be the filename which was used to load your data.
Precondition:
VALID_REF(DataSetReader) Pointer must be a valid address and non-NULL.
Fortran Syntax:
    SUBROUTINE TecUtilImportWriteLoaderInstr(
   &           DataSetLoaderName,
   &           InstructionsPtr)
    CHARACTER*(*)   DataSetLoaderName
    POINTER         (InstructionsPtr, Instructions)

Python Syntax:

  Results = TecUtil.ImportWriteLoaderInstr(DataSetLoaderName, Instructions)

  Input:
                  DataSetLoaderName    string
                  Instructions         sequence of strings
  Output:
    Results[0]    ReturnVal            NONE

Set up an instruction containing a filename and write a $!READDATASET macro command to the current macro file:

   StringList_pa Instructs = TecUtilStringListAlloc();
   TecUtilStringListAppendString(Instructs, "myfile.dat");
   TecUtilImportWriteLoaderInstr("BANANA", Instructs);
   TecUtilStringListDealloc(&Instructs);


Generated on Tue Mar 12 02:24:40 2013 for Tecplot by  doxygen 1.5.5