HyperMath

Writing Data to Altair Binary Format (ABF)

Writing Data to Altair Binary Format (ABF)

Previous topic Next topic Expand/collapse all hidden text  

Writing Data to Altair Binary Format (ABF)

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

ABF allows data to be stored in Type, request, and component categories such that it can be read in other Altair products such as HyperGraph.  Data can optionally be grouped as Subcases.  The general sequence of writing the data is as follows:

Create the ABF file.
Create Subcase (optional).
Add data to Subcase.
Repeat previous two steps as many times as needed.
Close the file.

When the file is opened, an ABF object is returned.  All other operations are done via this object’s interface.  The various built-in functions for exporting to ABF format are discussed below.

hmtoggle_plus1AbfObject = CreateAbfFile(filename)

Creates the ABF file and returns an ABF object.  Existing files are overwritten.

Option

Description

filename

A string containing the filename with the full path.  Use forward slash, (/)  or double backslashes, (\\), for folder separators.

AbfObject

An ABF object.  The rest of the operations are done via its interface.

hmtoggle_plus1R = AbfObject::CreateSubcase(subcase)

Creates a Subcase. This is optional.

Option

Description

subcase

A string for the Subcase name.

R

A Boolean indicating the status of the operation. True is returned on success.

hmtoggle_plus1R = AbfObject::AddData(type, request, component, vector)

Add data to be written. The data is grouped as part of last created Subcase, if any.

Option

Description

type

A string containing the name of the data Type.

request

A string containing the name of the data Request.

component

A string containing the name of the data Component.

vector

A string containing the name of the vector containing the data.

R

A Boolean indicating the status of the operation.  True is returned on success.

hmtoggle_plus1AbfObject::Close()

Writes the added data to the ABF file and closes it. Returns True on success. The ABF object must be reinitialized after this for further use.  Using the previous information, the general sequence is as follows:

AbfObject = CreateAbfFile(filename)

AbfObject::CreateSubcase(subcase_1)

AbfObject::AddData(type, request, component, vector_1)

AbfObject::AddData(type, request, component, vector_n)

AbfObject::CreateSubcase(subcase_M)

AbfObject::AddData(type, request, component, vector_1)

AbfObject::AddData(type, request, component, vector_n)

AbfObject::Close()

Any data added prior to creating the first Subcase is grouped as part of the first Subcase.

hmtoggle_plus1Example

This example shows how to create an ABF file with two Subcases, each containing a pair of vectors.

Xvec1 = [1:10]; Yvec1 = Xvec1 // 1st pair

Xvec2 = [1:10]; Yvec2 = -Xvec2 // 2nd pair

Abf = CreateAbfFile("C:/test.abf")

Abf::CreateSubcase("Subcase 1")

Abf::AddData("type", "req", "compX", "Xvec1")

Abf::AddData("type", "req", "compY", "Yvec1")

Abf::CreateSubcase("Subcase 2")

Abf::AddData("type", "req", "compX", "Xvec2")

Abf::AddData("type", "req", "compY", "Yvec2")

Abf::Close()

Abf = nil