3. Data Functions - DataFun

The data function module, DataFun, maintains function pointers to data access functions which form a high level data access interface. Each of the associated library device modules such as ABALib, SDRCLib, etc., which are described in the following chapters, are designed to implement a specific variety of data functions and to load the corresponding function pointers into a DataFun object. Rather than accessing the functions of a particular library device object such as ABALib directly, the user accesses the functions through a DataFun object. In this way data access independence is achieved. The DataFun module contains the following functions.

The actual data access functions listed below are implemented as inline methods using C preprocessor macros. This has been done to reduce procedure call overhead and to allow the user to alter the naming conventions or argument lists by defining new C preprocessor macros. The macros which implement the following API appear in the file datafun.h .

3.1. Library Control

VdmTools provides a number of functions for setting library device attributes and opening and closing library devices. Before data access can occur from a library device, a library device object and associated data function object must be instanced, library device attributes set and a library device opened. The following illustrates instancing SDRCLib and DataFun objects and setting SDRC Universal File data functions. The library device filetype, filetype, is device dependent.

vdm_SDRCLib *sdrclib;
vdm_DataFun *df;
Vint filetype;
                /* create data function */
df = vdm_DataFunBegin();
filetype = VDM_SDRC_UNIVERSAL;
                /* create SDRC Universal File device object */
sdrclib = vdm_SDRCLibBegin();
                /* load data functions for SDRCLib device */
vdm_SDRCLibDataFun (sdrclib,df);

At this point opening, appending, closing and accessing data from a library device can be accomplished abstractly using a DataFun object generated in the manner above.

A modification of the above code fragment to allow for either SDRC Universal files or NASTRAN Output2 files may be easily constructed. In the code that follows simply changing the filetype to VDM_NASTRAN_OUTPUT2 would setup the DataFun object for accessing NASTRAN Output2 files.

vdm_NASLib  *naslib;
vdm_SDRCLib *sdrclib;
vdm_DataFun *df;
Vint filetype;
Vint filetypeappend;
Vint ierr;
                /* create data function */
df = vdm_DataFunBegin();
filetype = VDM_SDRC_UNIVERSAL;
                /* create device object */
                /* load data functions */
if(filetype == VDM_SDRC_UNIVERSAL) {
    sdrclib = vdm_SDRCLibBegin();
    vdm_SDRCLibDataFun (sdrclib,df);
} else if(filetype == VDM_NASTRAN_OUTPUT2) {
    naslib = vdm_NASLibBegin();
    vdm_NASLibDataFun (naslib,df);
}

To open a library device use vdm_DataFunOpen(). The library device is now ready for access.

                /* open library on file "example.unv" */
vdm_DataFunOpen (df,0,"example.unv",filetype);
                /* check error */
ierr = vdm_DataFunError(df);
if(ierr) {
}

To optionally append a library device use vdm_DataFunAppend(). Not all library devices support an appended file and only certain library devices may be appended. The return error code should be checked for this case.

                /* append library on file "append.op2" */
filetypeappend = VDM_NASTRAN_OUTPUT2;
vdm_DataFunAppend (df,"append.op2",filetypeappend);
                /* check error */
ierr = vdm_DataFunError(df);
if(ierr) {
}

Any library device which can be appended can also be opened directly if a Connect object containing proper model information is set using vdm_DataFunSetConnect() prior to opening the file.

                /* set :ref:`Connect <Connect>` object */
vdm_DataFunSetConnect (df,connect);
filetyperesults = VDM_NASTRAN_OUTPUT2;
vdm_DataFunOpen (df,0,"resultsonly.op2",filetyperesults);

To close a library device and terminate VdmTools, reverse the process described above. The following code fragment illustrates this process and could easily generalized as above to delete either a SDRC Universal file library object or a NASTRAN Output2 file object,

                /* close library device */
vdm_DataFunClose (df);
                /* delete objects */
vdm_SDRCLibEnd (sdrclib);
vdm_DataFunEnd (df);

3.2. Query

VdmTools allows the user to query for certain global library device parameters. The number of entities such as finite elements and nodes may be retrieved using vdm_DataFunGetNumEntities() Use vdm_DataFunGetLibrary() to get the Library object associated with the device object. Use methods associated with the Library, Dataset and Attribute objects to retrieve dataset parameters and attribute values. Note that, in general, the Library object returned may be a copy of the internal Library object maintained by the interface device. This will be the case if a DataIPC connection to the device interface is used. For example to determine the number of datasets on a library device use the following code fragment,

vdm_Library *library;
Vint numdatasets;

                /* get library object */
vdm_DataFunGetLibrary (df,&library);
                /* get number of datasets on library */
vdm_LibraryGetNumDatasets (library,&numdatasets);

Each dataset on a library is assigned a dataset index ranging from zero to the number of datasets on the library minus one. To query dataset parameters of the idst th dataset such as dataset name, length, number of rows, number of columns, data type and number of dataset attributes use the following,

vdm_Library *library;
vdm_Dataset *dataset;
Vchar name[33];
Vint idst;
Vlong lrec;
Vint nrow, ncol, ntyp, natt;

                /* get library object */
vdm_DataFunGetLibrary (df,&library);
                /* get first dataset */
idst = 0;
                /* get dataset object of idst dataset */
vdm_LibraryGetDataset (library,idst,&dataset);
                /* inquire dataset parameters */
vdm_DatasetInq (dataset,name,&lrec,&nrow,&ncol,&ntyp);
                /* inquire number of dataset attributes */
vdm_DatasetGetNumAttributes (dataset,&natt);

Each attribute associated with a dataset is assigned an index ranging from zero to the number of attributes minus one. To query attribute parameters and values of the iatt th attribute of the idst th dataset such as attribute name, length, data type and value use the following,

{
    vdm_Library *library;
    vdm_Dataset *dataset;
    vdm_Attribute *attribute;
    Vchar name[33];
    Vint lnga, itya;
    Vchar cvalue[33];
    Vfloat rvalue[8];
    Vint ivalue[8];
    Vint idst, iatt;

                    /* get library object */
    vdm_DataFunGetLibrary (df,&library);
                    /* get first attribute of second dataset */
    idst = 1;
    iatt = 0;
                    /* get dataset object of idst dataset */
    vdm_LibraryGetDataset (library,idst,&dataset);
                    /* get iatt attribute object of dataset */
    vdm_DatasetGetAttribute (dataset,iatt,&attribute);
                    /* inquire attribute parameters */
    vdm_AttributeInq (attribute,name,lnga,itya);
                    /* get attribute value */
    if(itya == SYS_INTEGER) {
        vdm_AttributeValueInteger (attribute,ivalue);
    } else if(itya == SYS_SINGLE) {
        vdm_AttributeValueFloat (attribute,rvalue);
    } else if(itya == SYS_HOLLERITH) {
        vdm_AttributeValueString (attribute,cvalue);
    }

3.3. Read Datasets

Read dataset contents from a library device using vdm_DataFunReadDataset(). External library devices generally only support read operations. The number of bytes transfered is calculated using the dataset length and datatype which is returned using vdm_DatasetInq(). Use the following to read the contents of the idst th dataset into vector buff.

vdm_DataFunReadDataset (df,idst,(void*)buff);

Read dataset contents can be read for a specified set of columns using vdm_DataFunReadDatasetCols(). Use the following to read the contents of a specified set of ncols columns of the idst th dataset into vector buff.

vdm_DataFunReadDatasetCols (df,idst,ncols,cols,(void*)buff,(Vlong*)lptr);

3.4. Function Descriptions

The currently available DataFun functions are described in detail in this section.

vdm_DataFun *vdm_DataFunBegin(void)

create an instance of a DataFun object

Create an instance of a DataFun object. Memory is allocated for the object private data and the pointer to the data is returned. By default all function pointers are NULL.

Destroy an instance of a DataFun object using

void vdm_DataFunEnd (vdm_DataFun *datafun)

Return the current value of a DataFun object error flag using

Vint vdm_DataFunError (vdm_DataFun *datafun)

Make a copy of a DataFun object. The private data from the fromdatafun object is copied to the datafun object. Any previous private data in datafun is lost.

void vdm_DataFunCopy (vdm_DataFun *datafun,
                      vdm_DataFun *fromdatafun)

Returns

The function returns a pointer to the newly created DataFun object. If the object creation fails, NULL is returned.

void vdm_DataFunEnd(vdm_DataFun *p)

destroy an instance of a DataFun object

See vdm_DataFunBegin()

Vint vdm_DataFunError(vdm_DataFun *p)

return the current value of a DataFun object error flag

See vdm_DataFunBegin()

void vdm_DataFunSet(vdm_DataFun *p, Vint type, Vfunc *function)

set pointer to data function

Set pointers to data functions. This function is generally only required if the user is writing a custom interface to a data file.

Get function as an output argument using

void vdm_DataFunGet (vdm_DataFun *datafun,
                     Vint type,
                     void (**function)())

Errors

SYS_ERROR_ENUM is generated if an improper type is input.

Parameters
  • p – Pointer to DataFun object.

  • type – Function type being set

    =DATAFUN_APPEND           Set Append function
    =DATAFUN_CLOSE            Set Close function
    =DATAFUN_LIBDATASET       Set LibDataset function
    =DATAFUN_OPEN             Set Open function
    =DATAFUN_NUMDOMAINS       Set NumDomains function
    =DATAFUN_SETCONNECT       Set SetConnect function
    =DATAFUN_SETCONVENTION    Set SetConvention function
    =DATAFUN_SETIDS           Set SetIds function
    =DATAFUN_SETMODE          Set SetMode function
    =DATAFUN_SETSTATUS        Set SetStatus function
    =DATAFUN_GETINTEGER       Set GetInteger function
    =DATAFUN_GETLIBRARY       Set GetLibrary function
    =DATAFUN_GETNUMENTITIES   Set GetNumEntities function
    =DATAFUN_GETSTRING        Set GetString function
    =DATAFUN_NUMATTRIBUTES    Set NumAttributes function
    =DATAFUN_NUMDATASETS      Set NumDatasets function
    =DATAFUN_INQATTRIBUTES    Set InqAttributes function
    =DATAFUN_INQDATASETS      Set InqDatasets function
    =DATAFUN_DEFATTRIBUTE     Set DefAttribute function
    =DATAFUN_DEFDATASET       Set DefDataset function
    =DATAFUN_READDATASET      Set ReadDataset function
    =DATAFUN_READDATASETCOLS  Set ReadDatasetCols function
    =DATAFUN_WRITEDATASET     Set WriteDataset function
    =DATAFUN_SETATTVAL        Set SetAttVal function
    =DATAFUN_GETATTVAL        Set GetAttVal function
    =DATAFUN_SETTHREADSCOUNT  Set SetThreadsCount function
    

  • function – Pointer to data function

void vdm_DataFunGet(vdm_DataFun *p, Vint type, Vfunc **function)

get pointer to data function

See vdm_DataFunSet()

void vdm_DataFunSetObj(vdm_DataFun *p, Vobject *obj)

set pointer to auxiliary object

Set pointer to data function auxiliary object. This function is generally only required if the user is writing a custom interface to a data file.

Get obj as an output argument using

void vdm_DataFunGetObj (vdm_DataFun *datafun,
                        Vobject **obj)

Parameters
  • p – Pointer to DataFun object.

  • obj – Pointer to auxiliary object

void vdm_DataFunGetObj(vdm_DataFun *p, Vobject **obj)

get pointer to auxiliary object

See vdm_DataFunSetObj()

void vdm_DataFunCopy(vdm_DataFun *p, vdm_DataFun *fromp)

make a copy of a DataFun object

See vdm_DataFunBegin()

void vdm_DataFunSetMode(vdm_DataFun *p, Vint mode, Vint param)

set mode for dataset reading

Set dataset reading mode.

If mode is set to VDM_INCLUDEERRORMODE, then the failure of opening “INCLUDE” files is enabled or disabled. By default VDM_INCLUDEERRORMODE mode is to SYS_ON.

If mode is set to VDM_ZLIBCOMPRESSMODE, then dataset data is written to native HDF5 format with zlib compression. By default VDM_ZLIBCOMPRESSMODE mode is to SYS_OFF.

Parameters
  • p – Pointer to DataFun object.

  • mode – Type of mode to set

    =VDM_INCLUDEERRORMODE     INCLUDE error mode
    =VDM_ZLIBCOMPRESSMODE     Write with zlib Compression
    

  • param – Mode parameter

    =SYS_ON                   Enable mode
    =SYS_OFF                  Disable mode
    

void vdm_DataFunSetConvention(vdm_DataFun *p, Vint convention)

set dataset and attribute convention

Set a convention to be used for assigning dataset and attribute parameters and values. The conventions are to be OR’ed.

Use VDM_CONVENTION_ALTPART to enable an interface dependent alternate part and partname assignment method.

Use VDM_CONVENTION_CONVERTPOLY to test for the conversion of polygon and polyhedron elements to primitive cell shapes.

Use VDM_CONVENTION_DOUBLE to generate double precision geometry datasets. This affects the node coordinate dataset, X.N and the coordinate system dataset, CSYS.T. By default geometry datasets are single precision.

Use VDM_CONVENTION_DOUBLERESULT to generate double precision result datasets.

Use VDM_CONVENTION_ELEMCENT to project integration point data to element centroid. This is currently supported only for Abaqus ODB files.

Use VDM_CONVENTION_FRAMEZERO to generate results datasets for initial conditions. By default results datasets are not generated for initial conditions.

The VDM_CONVENTION_INTERNALSETS convention is used only with ABAQUS input files. If VDM_CONVENTION_INTERNALSETS is enabled, node, element and element face and edges sets which are marked INTERNAL by ABAQUS will be generated. By default the internal sets are not generated.

Use VDM_CONVENTION_NOCOMMENT to avoid reading vendor specific comment card conventions from input files. For example, enabling this convention will avoid reading $HMNAME comments from Nastran bulk data files.

Use VDM_CONVENTION_NODEBC to generate face and edge based boundary conditions on attached nodes. By default face and edge based boundary conditions are not applied to the attached nodes.

Use VDM_CONVENTION_NOEQUIV to avoid equivalencing (merging nodes into one) coincident nodes. This is useful for maintaining the node patterns and ordering for block structured grids which have matching nodes at their interfaces.

Use VDM_CONVENTION_NOINTERLAMINAR to ignore interlaminar results.

The VDM_CONVENTION_NOINTPT convention is currently used only with ABAQUS .odb files. If VDM_CONVENTION_NOINTPT is enabled, solution results located at element integration points are ignored. By default, VDM_CONVENTION_NOINTPT is disabled.

The VDM_CONVENTION_NOSETS convention is currently used with ABAQUS .odb files and OpenFoam files. If VDM_CONVENTION_NOSETS is enabled, no node or element sets are queried or generated. By default, VDM_CONVENTION_NOSETS is disabled.

The VDM_CONVENTION_PSHELLTHICK convention is used only with NASTRAN Output2 and Bulk Data files. If VDM_CONVENTION_PSHELLTHICK is enabled, the THICKNESS.EL dataset will contain only the default thickness defined by the shell property card such as PSHELL.

Use VDM_CONVENTION_SPARSE to generate sparse format for results datasets. By default result datasets are not sparse.

Use VDM_CONVENTION_STARCD to enable the StarCD convention for Ensight results files.

Use VDM_CONVENTION_UNIRESULTTYPE to quickly replicate the results contents from the first time step/increment onto all subsequent time steps/increments. This will lead to improve CPU performance in Abaqus ODB file during calls to vdm_DataFunOpen().

If VDM_CONVENTION_WALLINTER is enabled, all exterior faces are converted to interface elements. This allows solution results defined on wall faces to be represented as element results on the corresponding interface elements. By default, VDM_CONVENTION_WALLINTER is disabled.

The VDM_CONVENTION_NOINTERNALSETS convention is used only with Abaqus result files. If enabled, entity sets internally generated will not be read and processed. Depending on the number of additional internal sets processed, the reading performance might be improved.

The VDM_CONVENTION_NOHISTORYOUTPUT convention is used only with Abaqus result files. If enabled, the history output data will not be read. If a large number of history output data is present, this will reduce the loading time and avoid memory overusage.

The ‘VDM_CONVENTION_CGNSALWAYSMIXED’ convention is used only with CGNS input files. If enabled, any section which does not contain polygons or polyhedra will be exported with MIXED type even if it contains only one type of elements.

The ‘VDM_CONVENTION_ONLYSCALARSHEARPANELSTRESS ‘ convention is used only for Nx Nastran op2 files. If enabled, the stresses of shear panel elements will be presented only as a scalar dataset.

Parameters
  • p – Pointer to DataFun object.

  • convention – Dataset and attribute convention

    =VDM_CONVENTION_ALTPART         Enable alternate part assign
    =VDM_CONVENTION_CONVERTPOLY     Convert polygon and polyhedron
    =VDM_CONVENTION_DOUBLE          Double precision geometry
    =VDM_CONVENTION_DOUBLERESULT    Double precision results
    =VDM_CONVENTION_ELEMCENT        Integration point data to centroid
    =VDM_CONVENTION_EIP             Element integration point data
    =VDM_CONVENTION_FRAMEZERO       Generate initial condition result
    =VDM_CONVENTION_INTERNALSETS    Generate internal sets
    =VDM_CONVENTION_NOCOMMENT       No comment card conventions
    =VDM_CONVENTION_NODEBC          Write node boundary conditions
    =VDM_CONVENTION_NOEQUIV         No equivalence coincident nodes
    =VDM_CONVENTION_NOINTERLAMINAR  Ignore interlaminar results
    =VDM_CONVENTION_NOINTPT         Ignore integration point results
    =VDM_CONVENTION_NOSETS          Do not generate node and element sets
    =VDM_CONVENTION_PSHELLTHICK     Use PSHELL thickness
    =VDM_CONVENTION_SPARSE          Sparse result
    =VDM_CONVENTION_STARCD          Assume StarCD results convention
    =VDM_CONVENTION_STRESSINVARIANT Generate invariant results
    =VDM_CONVENTION_UNIRESULTTYPE   Assume uniform results over a step
    =VDM_CONVENTION_WALLINTER       Generate wall interface elements
    =VDM_CONVENTION_CGNSALWAYSMIXED Force CGNS export mesh as MIXED element types 
    =VDM_CONVENTION_ONLYSCALARSHEARPANELSTRESS Shear panel stress not presented as tensor
    

void vdm_DataFunSetStatus(vdm_DataFun *p, Vint status)

set file status for opening library

Specify the file status upon opening the library with vdm_DataFunOpen(). By default the status is VDM_STATUS_OLD. Use VDM_STATUS_NEW to write to a new file. If the file exists, it will be overwritten. Use VDM_STATUS_ADD to read or write to an existing file. This option is currently only supported for VDM_NATIVE libraries.

Parameters
  • p – Pointer to DataFun object.

  • status – File status to be used when opening library device.

    =VDM_STATUS_NEW           New file is created for writing
    =VDM_STATUS_OLD           Old file must exist read only
    =VDM_STATUS_ADD           Old file must exist read/write
    

void vdm_DataFunOpen(vdm_DataFun *p, Vint mode, Vchar *path, Vint type)

open library device

Open a library device.

The character path name is assumed to be UTF-8 encoded. This is true for all interfaces on LINUX platforms. It is true on Windows for all interfaces which do not require an underlying toolkit. These interfaces are listed below and include all HDF5 based interfaces.

  • Windows UTF-8 encoding

    SYS_ABAQUS_ODB ABAQUS .odb output data base
    SYS_H3D        Altair H3D file
    

  • Windows Multi-Byte Character Set (MBCS) encoding

    SYS_AUTODYN_RES   AUTODYN results file
    SYS_CFX_RESULT    CFX results file
    SYS_CGNS          CGNS data base
    SYS_NASTRAN_H5    MSC/NASTRAN .h5 data file
    SYS_NATIVE_HDF5   VKI native HDF5 data base
    SYS_PAM_ERF       ESI/PAM-CRASH ERF file
    SYS_SAMCEF        Siemens SAMCEF des files
    SYS_STARCCM       STAR-CCM results file
    

Some file types support multiple domains, usually associated with a domain decomposition for a parallel solution.

If a non-zero number of domains is returned using

vdm_DataFunNumDomains() then vdm_DataFunOpen() may then be called with mode set to zero to open all domains or with mode > 0 indicating the specific domain number to open.

Use vdm_DataFunClose() to close a library device.

If a file is being opened in the case that a Connect object has been previously set using vdm_DataFunSetConnect(), then the only file types supported are those also supported by vdm_DataFunAppend().

Errors

  • SYS_ERROR_ENUM is generated if an improper type is input.

  • SYS_ERROR_FILE is generated if the file does not exist or may not be opened.

  • SYS_ERROR_FORMAT is generated if the file contains data in an unrecognized format.

  • SYS_ERROR_OPERATION is generated if the file contains data which is logically inconsistent or the library device is already open.

  • SYS_ERROR_OPERATION is generated if an improper domain number is specified.

Parameters
  • p – Pointer to DataFun object.

  • mode – Open mode

    =0                      Open, open all domains
    >0                      Open domain number mode
    

  • path – Pathname to host file associated with the library device

  • type – Type of library device file

    =SYS_ABAQUS_FIL         ABAQUS .fil data file
    =SYS_ABAQUS_INPUT       ABAQUS .inp input file
    =SYS_ABAQUS_ODB         ABAQUS .odb output data base
    =SYS_ADAMS              MSC/Adams
    =SYS_AFLR               AFLR grid file
    =SYS_ANSYS_INPUT        ANSYS input (CDWRITE) file
    =SYS_ANSYS_RESULT       ANSYS results file
    =SYS_AUTODYN_RES        AUTODYN results file
    =SYS_CFX_RESULT         CFX results file
    =SYS_COMSOL_SECTION     COMSOL Sectionwise file
    =SYS_COMSOL_MPH         COMSOL mph ASCII file
    =SYS_COMSOL_MPHBIN      COMSOL mph binary file
    =SYS_CGNS               CGNS data base
    =SYS_ENSIGHT            CEI/Ensight file format
    =SYS_FEMAP_NEUTRAL      FEMAP neutral file
    =SYS_FDI_NEUTRAL        FIDAP neutral file
    =SYS_FLUENT_MESH        FLUENT mesh and data file
    =SYS_GMV                GMV file
    =SYS_HYPERMESH_ASCII    Altair HyperMesh ASCII file
    =SYS_H3D                Altair H3D file
    =SYS_LSTC_INPUT         LSTC/DYNA3D input file
    =SYS_LSTC_HISTORY       LSTC/DYNA3D time history data base
    =SYS_LSTC_STATE         LSTC/DYNA3D state data base
    =SYS_LSTC_STATEFEMZIP   LSTC/DYNA3D FEMZIP state data base
    =SYS_MARC_POST          MSC/Marc post data file
    =SYS_MECHANICA_FNF      PTC/Mechanica FEM Neutral File
    =SYS_MECHANICA_STUDY    PTC/Mechanica design study
    =SYS_MEMORY             VKI memory object
    =SYS_NASTRAN_BULKDATA   MSC/NASTRAN bulk data file
    =SYS_NASTRAN_OUTPUT2    MSC/NASTRAN OUTPUT2 data file
    =SYS_NASTRAN_XDB        MSC/NASTRAN XDB data file
    =SYS_NASTRAN_H5         MSC/NASTRAN .h5 data file
    =SYS_NATIVE             VKI native data base
    =SYS_NATIVE_HDF5        VKI native HDF5 data base
    =SYS_PAM_DAISY          ESI/PAM-CRASH DAISY file
    =SYS_PAM_ERF            ESI/PAM-CRASH ERF file
    =SYS_PATRAN_NEUTRAL     MSC/Patran neutral file
    =SYS_PATRAN_RESULT      MSC/Patran result file
    =SYS_PERMAS_POST        INTES/PERMAS result file
    =SYS_PLOT3D_GRID        NASA/PLOT3D grid file
    =SYS_PLOT3D_SOLUTION    NASA/PLOT3D solution or function file
    =SYS_POLYFLOW           POLYFLOW mesh file
    =SYS_SAMCEF             Siemens SAMCEF des files
    =SYS_SDRC_UNIVERSAL     SDRC universal file
    =SYS_STARCCM            STAR-CCM results file
    =SYS_STL                STL ASCII text format
    =SYS_STLBIN             STL binary format
    =SYS_TECPLOT            Tecplot file format
    =SYS_VTK_LEGACY         Vtk legacy file format
    

void vdm_DataFunClose(vdm_DataFun *p)

close library device

Close a library device. The file associated with the library device is closed. Any appended files associated with the library device are also closed. Use vdm_DataFunOpen() to open a library device. Use vdm_DataFunAppend() to append a library device.

Errors

SYS_ERROR_OPERATION is generated if the file is not open.

Parameters

p – Pointer to DataFun object.

void vdm_DataFunGetNumEntities(vdm_DataFun *p, Vint entitytype, Vint *numentities)

get number of entities on library device

Get the number of entities of a particular type defined on the library device.

Parameters
  • p – Pointer to DataFun object.

  • entitytype – Type of entity

    =SYS_NODE               Nodes
    =SYS_ELEM               Elements
    

  • numentities[out] Number of entities

void vdm_DataFunGetLibrary(vdm_DataFun *p, vdm_Library **library)

get library object associated with library device

Get Library object associated with a library device. Use the Library object to retrieve generic information about the datasets and attributes on the library device. See the descriptions of the Library, Dataset and Attribute modules.

Parameters
  • p – Pointer to DataFun object.

  • library – Pointer to Library object.

void vdm_DataFunDefDataset(vdm_DataFun *p, const Vchar *name, Vlong lrec, Vint nrow, Vint ncol, Vint type, Vint *idst)

define dataset and parameters

Generate a dataset and define the dataset parameters. Currently, dataset names are limited to 64 characters including the terminating null character. The length of the dataset contents in bytes is given by the product of lrec and the sizeof the data type indicated by type.

Inquire of defined name, lrec, nrow, ncol and type as output arguments for a given dataset index using

void vdm_DataFunInqDataset (vdm_DataFun *datafun,
                            Vint idst,
                            Vchar *name,
                            Vlong *lrec,
                            Vint *nrow,
                            Vint *ncol,
                            Vint *type)

Errors

SYS_ERROR_OVERFLOW is generated if the maximum number of datasets is exceeded.

Parameters
  • p – Pointer to DataFun object.

  • name – Name given to dataset

  • lrec – Length of dataset contents in type units

  • nrow – Number of dataset rows

  • ncol – Number of dataset columns

  • type – Data type of dataset contents

    =SYS_INTEGER            Integer, type Vint
    =SYS_FLOAT              Single precision, type Vfloat
    =SYS_HOLLERITH          Hollerith, type Vuint
    =SYS_DOUBLE             Double precision, type Vdouble
    =SYS_COMPLEX            Complex, type Vfloat[2]
    =SYS_DOUBLECOMPLEX      Double Complex, type Vdouble[2]
    

  • idst – Index of generated dataset

void vdm_DataFunReadDataset(vdm_DataFun *p, Vint idst, void *buff)

read dataset contents

Read the contents of a dataset. The dataset index, idst, is an integer in the range from zero to the number of datasets on the library device minus one.

Errors

SYS_ERROR_VALUE is generated if an improper idst is input.

Parameters
  • p – Pointer to DataFun object.

  • idst – Index of dataset object to read

  • buff[out] Pointer to array to receive dataset contents

void vdm_DataFunWriteDataset(vdm_DataFun *p, Vint idst, void *buff)

write dataset contents

Write the contents of a dataset. The dataset index, idst, is an integer in the range from zero to the number of datasets on the library device minus one. This function may only be called on writeable library devices such as a native data base.

Errors

SYS_ERROR_VALUE is generated if an improper idst is input.

Parameters
  • p – Pointer to DataFun object.

  • idst – Index of dataset object to read

  • buff – Pointer to array to dataset contents

void vdm_DataFunAppend(vdm_DataFun *p, Vchar *path, Vint type)

append library device

Append a library device. The results datasets on the file associated with the library device are appended to the initially opened library device. The following initially opened file types support the appended files.

 SYS_ABAQUS_
 SYS_ABAQUS_IN
 SYS_ABAQUS_
 SYS_ANSYS_IN
 SYS_ANSYS_RES
 SYS_FLUENT_M
 SYS_LSTC_IN
 SYS_NASTRAN_BULKD
 SYS_NASTRAN_OUTP
 SYS_NAT
 SYS_PATRAN_NEUT
 SYS_PLOT3D_G
 SYS_SDRC_UNIVER
 SYS_TECPLOT
Use vdm_DataFunClose() to close a library device and all appended library devices.

Errors

  • SYS_ERROR_ENUM is generated if an improper type is input.

  • SYS_ERROR_FILE is generated if the file does not exist or may not be opened.

  • SYS_ERROR_FORMAT is generated if the file contains data in an unrecognized format.

  • SYS_ERROR_OPERATION is generated if the file contains data which is logically inconsistent or the initially opened file type does not support the append function or the library device has not been opened.

Parameters
  • p – Pointer to DataFun object.

  • path – Pathname to host file associated with the library device

  • type – Type of library device file

    =SYS_FLUENT_MESH        FLUENT mesh and data file
    =SYS_NASTRAN_OUTPUT2    MSC/NASTRAN OUTPUT2 data file
    =SYS_NATIVE             VKI native data base
    =SYS_PATRAN_RESULT      MSC/Patran result file
    =SYS_PLOT3D_SOLUTION    NASA/PLOT3D solution or function file
    =SYS_SDRC_UNIVERSAL     SDRC universal file
    =SYS_STARCCM            STAR-CCM results file
    =SYS_TECPLOT            Tecplot file format
    

void vdm_DataFunSetIds(vdm_DataFun *p, Vint idtype, Vint id1, Vint id2, Vint id3)

set numeric identifier algorithm

Specify the algorithm used to compute or modify dataset numeric identifiers. If idtype is set to VDM_IDS_OFFSET, then id1, id2 and id3 are added to the respective numeric identifiers.

If idtype is set to VDM_IDS_BASE, then the respective numeric identifiers are incremented by the negative of the first occurrence of the numeric identifier plus id1, id2 and id3.

If idtype is set to VDM_IDS_ABSOLUTE, then the respective numeric identifiers are set to id1, id2 and id3. By default idtype is set to VDM_IDS_OFFSET, and id1, id2, id3 are set to zero.

Parameters
  • p – Pointer to DataFun object.

  • idtype – Numeric identifier algorithm

    =VDM_IDS_OFFSET           Offset ids
    =VDM_IDS_BASE             Increment ids over base
    =VDM_IDS_ABSOLUTE         Set ids
    

  • id1 – Numeric identifier

  • id2 – Numeric identifier

  • id3 – Numeric identifier

void vdm_DataFunSetConnect(vdm_DataFun *p, vis_Connect *connect)

set Connect object

Set a Connect object prior to opening a file which may not contain any model information - only results.

Parameters
  • p – Pointer to DataFun object.

  • connect – Pointer to Connect object.

void vdm_DataFunLibDataset(vdm_DataFun *p, Vint iop, Vint idst)

change library dataset

Change to a library dataset. Only the operation, VDM_LIBDATASET_PUSH requires the argument idst. The dataset index, idst, is an integer in the range from zero to the number of datasets on the library device minus one and must represent a library dataset.

Errors

  • SYS_ERROR_VALUE is generated if an improper idst is input.

  • SYS_ERROR_OPERATION is generated if idst is not a library dataset.

Parameters
  • p – Pointer to DataFun object.

  • iop – Operation

    =VDM_LIBDATASET_PUSH   Change to child library dataset idst
    =VDM_LIBDATASET_POP    Change to parent library
    =VDM_LIBDATASET_TOP    Change to root library
    

  • idst – Index of dataset object representing library

void vdm_DataFunDefAttribute(vdm_DataFun *p, Vint idst, const Vchar *name, Vint length, Vint type, Vint *iatt)

define attribute and parameters

Generate an attribute of dataset idst and define the attribute parameters. Currently, attribute names are limited to 32 characters including the terminating null character. Attribute values are limited to an array of 64 characters, 16 integers, 16 floats, or 8 doubles. If the specified length is less than the maximum, then the length is truncated to the maximum length for the data type.

Inquire of defined name, length, and type as output arguments for a given dataset index and attribute index using,

void vdm_DataFunInqAttribute (vdm_Attribute *attribute,
                              Vint idst,
                              Vint iatt,
                              Vchar *name,
                              Vint *length,
                              Vint *type)

Errors

  • SYS_ERROR_VALUE is generated if an improper idst is specified.

  • SYS_ERROR_VALUE is generated if a negative or zero length is specified.

  • SYS_ERROR_ENUM is generated if an improper type is specified.

Parameters
  • p – Pointer to DataFun object.

  • idst – Dataset index

  • name – Name given to attribute

  • length – Length of attribute value in type units

  • type – Data type of attribute value

    =SYS_INTEGER  Integer, type Vint
    =SYS_FLOAT    Single precision, type Vfloat
    =SYS_CHAR     Character, type Vchar
    =SYS_DOUBLE   Double precision, type Vdouble
    

  • iatt[out] Index of generated attribute

void vdm_DataFunSetAttVal(vdm_DataFun *p, Vint idst, Vint iatt, void *value)

set attribute value

Set the value of an attribute. This function may only be called on writeable library devices such as a native data base.

Get value as an output argument using

void vdm_DataFunGetAttVal (vdm_DataFun *datafun,
                           Vint idst,
                           Vint iatt,
                           void *value)

Errors

SYS_ERROR_VALUE is generated if an improper idst or iatt is input.

Parameters
  • p – Pointer to DataFun object.

  • idst – Index of dataset

  • iatt – Index of attribute

  • value – Pointer to attribute value

void vdm_DataFunGetAttVal(vdm_DataFun *p, Vint idst, Vint iatt, void *value)

get attribute value

See vdm_DataFunSetAttVal()

void vdm_DataFunNumDatasets(vdm_DataFun *p, Vint *numdats)

return number of datasets

Get the number of datasets associated with current library.

Parameters
  • p – Pointer to DataFun object.

  • numdats[out] Number of datasets

void vdm_DataFunNumAttributes(vdm_DataFun *p, Vint idst, Vint *numatts)

return number of attributes

Get the number of attributes associated with a dataset.

Parameters
  • p – Pointer to DataFun object.

  • idst – Dataset index

  • numatts[out] Number of attributes

void vdm_DataFunInqDataset(vdm_DataFun *p, Vint idst, const Vchar *name, Vlong *lrec, Vint *nrow, Vint *ncol, Vint *type)

inquire of defined name, lrec, nrow, ncol and type as output arguments for a given dataset index

See vdm_DataFunDefDataset()

void vdm_DataFunInqAttribute(vdm_DataFun *p, Vint idst, Vint iatt, const Vchar *name, Vint *length, Vint *type)

inquire of defined name, length, and type as output arguments for a given dataset index and attribute index

See vdm_DataFunGetInteger()

void vdm_DataFunGetInteger(vdm_DataFun *p, Vint type, Vint *iparam)

return integer parameters

Query for integer information. The integer query VDM_PHASE returns a progress phase number. Possible values are VDM_PHASE_OPENMODEL, VDM_PHASE_OPENMODELCOMPLETE and VDM_PHASE_OPENRESULT. This function is most often called in a monitor function. Use vdm_DataFunGetString() to access a descriptive string containing information on the data currently being accessed during vdm_DataFunOpen().

Errors

SYS_ERROR_ENUM is generated if an improper type is specified.

Parameters
  • p – Pointer to DataFun object.

  • type – Type of integer information to query

    =VDM_PHASE            Progress phase
    

  • iparam – Returned integer information

void vdm_DataFunGetString(vdm_DataFun *p, Vint type, Vchar *cparam)

return string parameters

Query for string information. The string query VDM_SOURCE returns a descriptive string containing information on the data currently being accessed during vdm_DataFunOpen(). This function is most often called in a monitor function. Use vdm_DataFunGetInteger() to access the current progress phase.

Errors

SYS_ERROR_ENUM is generated if an improper type is specified.

Parameters
  • p – Pointer to DataFun object.

  • type – Type of integer information to query

    =VDM_SOURCE           Current data source
    

  • cparam[out] Returned string information

void vdm_DataFunNumDomains(vdm_DataFun *p, Vchar *path, Vint type, Vint *numdomains)

query number of domains

Determine the number of domains. This function may be called before vdm_DataFunOpen() to determine the number of independent domains which may be read from the library device. If numdomains is returned as zero, either the library device does not support multiple domains or the specific file does not contain multiple domains.

Parameters
  • p – Pointer to DataFun object.

  • path – Pathname to host file associated with the library device

  • type – Type of library device file, see vdm_DataFunOpen().

  • numdomains[out] Number of domains

void vdm_DataFunReadDatasetCols(vdm_DataFun *p, Vint idst, Vint ncols, Vint cols[], void *buff, Vlong *lptr)

read dataset contents at specified columns

Read the contents of a dataset at specified columns. The dataset index, idst, is an integer in the range from zero to the number of datasets on the library device minus one. The output buffer, buff, must be sized to the length of the dataset times the byte size of the datatype of the dataset. The output buffer, lptr, must be sized ncols+1. If this selective columns read is not supported by the underlying library device, then lptr[0]=-2, (VDM_DATASETCOLS_UNSUP), and the entire dataset is read into buff. The lptr array entries lptr[1] through lptr[ncols] are undefined and should be ignored. If the selective read is supported, only ncols columns are read into buff. The lptr array contains the starting location in buff for each column or -1, (VDM_DATASETCOLS_UNDEF), if data at the column does not exist. The entry lptr[ncols] contains the total length of data returned in buff. Starting locations and total length of data are in units of the dataset datatype. The starting locations may not be in ascending order.

Errors

SYS_ERROR_VALUE is generated if an improper idst is input.

Parameters
  • p – Pointer to DataFun object.

  • idst – Index of dataset object to read

  • ncols – Number of columns

  • cols – Vector of column numbers

  • buff[out] Pointer to array to receive dataset contents

  • lptr[out] Pointer to starting position of each column in buff.