4 Database
The file database.cc contains:
-
Arrays with actual data and information arrays.
- Acces routines.
The actual data and information about it is stored in a number of arrays:
-
dbl_data
This array contains pointers to the actual double data.
It has so for all possible data (MDAT), and for all possible
versions of the data (MVERSION).
(Some data, like element data and nodal data, can exist in more than one
version; that is, it can exist on more than one mesh).
- int_data
The same as dbl_data but now for integers however.
- max_index
The maximum index allocated for the data item.
- no_index
Set to 1 if the data item doesn't have an index,
like NUMBER_OF_PROCESSORS.
- type
INTEGER for integer data,
and DOUBLE for double data.
- name
The name, e.g. element for data item ELEMENT.
- external
Set to 1 if it is user data, set to 0 if it is internally for tn only.
- data_length
Set to the length of the data item (or the maximum length in
the data item doesn't have a fixed length).
- fixed_length
Set to 1 if the length of the data item is fixed,
set 0 0 if the length of the data item is not a priori fixed.
- data_class
The class a data item belongs to.
E.g. ELEMENT_GROUP belongs to the class ELEMENT.
This allows for operations on a class,
like deleting an element and all its properties.
- print_only
Set to 1 if the data item is meant for printing after the calculation only,
and thus is not allowed to be input in the data file.
- version_all
Set to 1 if all versions (meshes) of a data item can exist.
E.g. of ELEMENT all versions can exist,
but of NUMBER_OF_PROCESSORS only one version can exist.
There are a number of routines to acces the data.
The most important routines are listed below:
-
db(idat,index,*ival,*dval,&length,version,task)
This is the main routine to acces data on the database.
The data can either be read or written with this routine.
-
The data item accessed is idat,
e.g. idat is ELEMENT,
or idat is NODE, etc.
- The index, for the data item, accessed is index
- Integer data is accessed via the ival array.
- Double data is accessed via the dval array.
- The length of the data item is contained in length.
If the data is read, the length is returned.
If the data is written, the length should be set.
- The version of the data should be set in version.
This is either VERSION_NORMAL, or VERSION_NEW, etc.
See the discussion of versions in a seperate section below.
- The task to be performed is et in task.
If the data is written then set task to PUT.
If the data is read then set taks to GET.
Some other task options exist.
- …