Go to the source code of this file.
Defines | |
#define | EXTERN extern |
#define | ADF_DATA_TYPE_LENGTH 32 |
#define | ADF_DATE_LENGTH 32 |
#define | ADF_FILENAME_LENGTH 1024 |
#define | ADF_FORMAT_LENGTH 20 |
#define | ADF_LABEL_LENGTH 32 |
#define | ADF_MAXIMUM_LINK_DEPTH 100 |
#define | ADF_MAX_DIMENSIONS 12 |
#define | ADF_MAX_ERROR_STR_LENGTH 80 |
#define | ADF_MAX_LINK_DATA_SIZE 4096 |
#define | ADF_NAME_LENGTH 32 |
#define | ADF_STATUS_LENGTH 32 |
#define | ADF_VERSION_LENGTH 32 |
#define | NO_ERROR -1 |
#define | NUMBER_LESS_THAN_MINIMUM 1 |
#define | NUMBER_GREATER_THAN_MAXIMUM 2 |
#define | STRING_LENGTH_ZERO 3 |
#define | STRING_LENGTH_TOO_BIG 4 |
#define | STRING_NOT_A_HEX_STRING 5 |
#define | TOO_MANY_ADF_FILES_OPENED 6 |
#define | ADF_FILE_STATUS_NOT_RECOGNIZED 7 |
#define | FILE_OPEN_ERROR 8 |
#define | ADF_FILE_NOT_OPENED 9 |
#define | FILE_INDEX_OUT_OF_RANGE 10 |
#define | BLOCK_OFFSET_OUT_OF_RANGE 11 |
#define | NULL_STRING_POINTER 12 |
#define | FSEEK_ERROR 13 |
#define | FWRITE_ERROR 14 |
#define | FREAD_ERROR 15 |
#define | ADF_MEMORY_TAG_ERROR 16 |
#define | ADF_DISK_TAG_ERROR 17 |
#define | REQUESTED_NEW_FILE_EXISTS 18 |
#define | ADF_FILE_FORMAT_NOT_RECOGNIZED 19 |
#define | FREE_OF_ROOT_NODE 20 |
#define | FREE_OF_FREE_CHUNK_TABLE 21 |
#define | REQUESTED_OLD_FILE_NOT_FOUND 22 |
#define | UNIMPLEMENTED_CODE 23 |
#define | SUB_NODE_TABLE_ENTRIES_BAD 24 |
#define | MEMORY_ALLOCATION_FAILED 25 |
#define | DUPLICATE_CHILD_NAME 26 |
#define | ZERO_DIMENSIONS 27 |
#define | BAD_NUMBER_OF_DIMENSIONS 28 |
#define | CHILD_NOT_OF_GIVEN_PARENT 29 |
#define | DATA_TYPE_TOO_LONG 30 |
#define | INVALID_DATA_TYPE 31 |
#define | NULL_POINTER 32 |
#define | NO_DATA 33 |
#define | ERROR_ZEROING_OUT_MEMORY 34 |
#define | REQUESTED_DATA_TOO_LONG 35 |
#define | END_OUT_OF_DEFINED_RANGE 36 |
#define | BAD_STRIDE_VALUE 37 |
#define | MINIMUM_GT_MAXIMUM 38 |
#define | MACHINE_FORMAT_NOT_RECOGNIZED 39 |
#define | CANNOT_CONVERT_NATIVE_FORMAT 40 |
#define | CONVERSION_FORMATS_EQUAL 41 |
#define | DATA_TYPE_NOT_SUPPORTED 42 |
#define | FILE_CLOSE_ERROR 43 |
#define | NUMERIC_OVERFLOW 44 |
#define | START_OUT_OF_DEFINED_RANGE 45 |
#define | ZERO_LENGTH_VALUE 46 |
#define | BAD_DIMENSION_VALUE 47 |
#define | BAD_ERROR_STATE 48 |
#define | UNEQUAL_MEMORY_AND_DISK_DIMS 49 |
#define | LINKS_TOO_DEEP 50 |
#define | NODE_IS_NOT_A_LINK 51 |
#define | LINK_TARGET_NOT_THERE 52 |
#define | LINKED_TO_FILE_NOT_THERE 53 |
#define | NODE_ID_ZERO 54 |
#define | INCOMPLETE_DATA 55 |
#define | INVALID_NODE_NAME 56 |
#define | INVALID_VERSION 57 |
#define | NODES_NOT_IN_SAME_FILE 58 |
#define | PRISTK_NOT_FOUND 59 |
#define | MACHINE_FILE_INCOMPATABLE 60 |
#define | FFLUSH_ERROR 61 |
#define | NULL_NODEID_POINTER 62 |
#define | MAX_FILE_SIZE_EXCEEDED 63 |
Functions | |
EXTERN void | ADF_Children_Names (const double PID, const int istart, const int ilen, const int name_length, int *ilen_ret, char *names, int *error_return) |
EXTERN void | ADF_Children_IDs (const double PID, const int istart, const int ilen, int *ilen_ret, double *IDs, int *error_return) |
EXTERN void | ADF_Create (const double PID, const char *name, double *ID, int *error_return) |
EXTERN void | ADF_Database_Close (const double ID, int *error_return) |
EXTERN void | ADF_Database_Delete (const char *filename, int *error_return) |
EXTERN void | ADF_Database_Garbage_Collection (const double ID, int *error_return) |
EXTERN void | ADF_Database_Get_Format (const double Root_ID, char *format, int *error_return) |
EXTERN void | ADF_Database_Open (const char *filename, const char *status, const char *format, double *root_ID, int *error_return) |
EXTERN void | ADF_Database_Valid (const char *filename, int *error_return) |
EXTERN void | ADF_Database_Set_Format (const double Root_ID, const char *format, int *error_return) |
EXTERN void | ADF_Database_Version (const double Root_ID, char *version, char *creation_date, char *modification_date, int *error_return) |
EXTERN void | ADF_Delete (const double PID, const double ID, int *error_return) |
EXTERN void | ADF_Error_Message (const int error_return_input, char *error_string) |
EXTERN void | ADF_Flush_to_Disk (const double ID, int *error_return) |
EXTERN void | ADF_Get_Data_Type (const double ID, char *data_type, int *error_return) |
EXTERN void | ADF_Get_Dimension_Values (const double ID, int dim_vals[], int *error_return) |
EXTERN void | ADF_Get_Error_State (int *error_state, int *error_return) |
EXTERN void | ADF_Get_Label (const double ID, char *label, int *error_return) |
EXTERN void | ADF_Get_Link_Path (const double ID, char *filename, char *link_path, int *error_return) |
EXTERN void | ADF_Get_Name (const double ID, char *name, int *error_return) |
EXTERN void | ADF_Get_Node_ID (const double PID, const char *name, double *ID, int *error_return) |
EXTERN void | ADF_Get_Number_of_Dimensions (const double ID, int *num_dims, int *error_return) |
EXTERN void | ADF_Get_Root_ID (const double ID, double *Root_ID, int *error_return) |
EXTERN void | ADF_Is_Link (const double ID, int *link_path_length, int *error_return) |
EXTERN void | ADF_Library_Version (char *version, int *error_return) |
EXTERN void | ADF_Link (const double PID, const char *name, const char *file, const char *name_in_file, double *ID, int *error_return) |
EXTERN void | ADF_Link_Size (const double ID, int *len_file, int *len_name, int *error_return) |
EXTERN void | ADF_Move_Child (const double PID, const double ID, const double NPID, int *error_return) |
EXTERN void | ADF_Number_of_Children (const double ID, int *num_children, int *error_return) |
EXTERN void | ADF_Put_Dimension_Information (const double ID, const char *data_type, const int dims, const int dim_vals[], int *error_return) |
EXTERN void | ADF_Put_Name (const double PID, const double ID, const char *name, int *error_return) |
EXTERN void | ADF_Read_All_Data (const double ID, char *data, int *error_return) |
EXTERN void | ADF_Read_Block_Data (const double ID, const long b_start, const long b_end, char *data, int *error_return) |
EXTERN void | ADF_Read_Data (const double ID, const int s_start[], const int s_end[], const int s_stride[], const int m_num_dims, const int m_dims[], const int m_start[], const int m_end[], const int m_stride[], char *data, int *error_return) |
EXTERN void | ADF_Set_Error_State (const int error_state, int *error_return) |
EXTERN void | ADF_Set_Label (const double ID, const char *label, int *error_return) |
EXTERN void | ADF_Write_All_Data (const double ID, const char *data, int *error_return) |
EXTERN void | ADF_Write_Block_Data (const double ID, const long b_start, const long b_end, char *data, int *error_return) |
EXTERN void | ADF_Write_Data (const double ID, const int s_start[], const int s_end[], const int s_stride[], const int m_num_dims, const int m_dims[], const int m_start[], const int m_end[], const int m_stride[], const char *data, int *error_return) |
#define EXTERN extern |
File: ADF.h ---------------------------------------------------------------------- BOEING ---------------------------------------------------------------------- Project: CGNS Author: Tom Dickens 865-6122 tpd6908@yak.ca.boeing.com Date: 3/2/1995 Purpose: Provide prototype declarations for the ADF-Core routines. ---------------------------------------------------------------------- ----------------------------------------------------------------------
#define NO_ERROR -1 |
EXTERN void ADF_Children_IDs | ( | const double | PID, | |
const int | istart, | |||
const int | ilen, | |||
int * | ilen_ret, | |||
double * | IDs, | |||
int * | error_return | |||
) |
Check for zero children, return if 0
point to the first child wanted
Return the data for the requested children
Read the sub-node entry table
Get the ID from the sub-node table
Increment the disk-pointer and the number of IDs returned
Definition at line 370 of file ADF_interface.c.
EXTERN void ADF_Children_Names | ( | const double | PID, | |
const int | istart, | |||
const int | ilen, | |||
const int | name_length, | |||
int * | ilen_ret, | |||
char * | names, | |||
int * | error_return | |||
) |
Check for zero children, return if 0
point to the first child wanted
Return the data for the requested children
Read the sun-node entry table
Convert the child's name from blank-filled into a C string
Increment the disk-pointer and the number of names returned
Definition at line 278 of file ADF_interface.c.
EXTERN void ADF_Create | ( | const double | PID, | |
const char * | name, | |||
double * | ID, | |||
int * | error_return | |||
) |
Initialize node header
Skip any leading blanks in the name
Check for uniqueness and legality of the name
Assign the name to the new node
Allocate disk space for the new node
Write out the new node header
OK, new node is on disk. Now, update the list of children for the parent...
Return the ID of the new child
Finally, update modification date
Definition at line 464 of file ADF_interface.c.
EXTERN void ADF_Database_Close | ( | const double | ID, | |
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Close the ADF file (which may close other sub-files)
Definition at line 570 of file ADF_interface.c.
EXTERN void ADF_Database_Delete | ( | const char * | filename, | |
int * | error_return | |||
) |
Definition at line 600 of file ADF_interface.c.
EXTERN void ADF_Database_Garbage_Collection | ( | const double | ID, | |
int * | error_return | |||
) |
Definition at line 624 of file ADF_interface.c.
EXTERN void ADF_Database_Get_Format | ( | const double | Root_ID, | |
char * | format, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Definition at line 647 of file ADF_interface.c.
EXTERN void ADF_Database_Open | ( | const char * | filename, | |
const char * | status, | |||
const char * | format, | |||
double * | root_ID, | |||
int * | error_return | |||
) |
DO NOT Check filename for NULL here, it may NOT be used...
Get this machine's numeric format
Determine the requested STATUS
Determine the assessability of the filename
Determine the assessability of the filename
open the file
Determine the assessability of the filename
Compose the file header
Open the new file
write out the file header
Compose Initial root-node header
Write out the root-node header
Compose Initial Free-Chunk Table
Write out Free-Chunk Table
Read the header of the ADF file
Check Database version numbers for compatibility
If a new feature is added which requires that the file version be changed then it is done here. Care must be take not to break forward compatibility by changing the file version. Thus new features may not be available for older file versions. For instance version A1 files cannot be upgraded to version A2 and above since a change was made to how links were store and the file version is used to decide how to treat links.
The link separator was changed from " " to ">" in order to support blanks in filenames under Windows. This change is for version A02 and higher
get the root ID for the user
Remember the file's data format
check machine modes, if machine is native the file must be !!
Close the ADF file and free its index
Definition at line 751 of file ADF_interface.c.
EXTERN void ADF_Database_Set_Format | ( | const double | Root_ID, | |
const char * | format, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Get modification date to be updated with the header
Now write the disk header out...
Definition at line 1029 of file ADF_interface.c.
EXTERN void ADF_Database_Valid | ( | const char * | filename, | |
int * | error_return | |||
) |
Definition at line 984 of file ADF_interface.c.
EXTERN void ADF_Database_Version | ( | const double | Root_ID, | |
char * | version, | |||
char * | creation_date, | |||
char * | modification_date, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Convert the "what" string into a C string
Convert the creation date string into a C string
Convert the modification date string into a C string
Definition at line 1092 of file ADF_interface.c.
EXTERN void ADF_Delete | ( | const double | PID, | |
const double | ID, | |||
int * | error_return | |||
) |
Don't use ADFI_chase_link() - delete link nodes but NOT the nodes they are linked too
Delete node data
this node IS a link
Delete the link path data for this node
this node is NOT a link
Recursively delete all sub-nodes (children) of this node
Delete all data for this node
Disassociate node from parent
Delete this node's sub node table
Delete node header from disk
Finally, update modification date
Definition at line 1153 of file ADF_interface.c.
EXTERN void ADF_Error_Message | ( | const int | error_return_input, | |
char * | error_string | |||
) |
If return pointer is NULL, print message to stdout
NO_ERROR is NOT zero for pointer-assignment checking
Check range of error code
Error-code good, copy it for the user
Definition at line 1247 of file ADF_interface.c.
EXTERN void ADF_Flush_to_Disk | ( | const double | ID, | |
int * | error_return | |||
) |
Definition at line 1304 of file ADF_interface.c.
EXTERN void ADF_Get_Data_Type | ( | const double | ID, | |
char * | data_type, | |||
int * | error_return | |||
) |
EXTERN void ADF_Get_Dimension_Values | ( | const double | ID, | |
int | dim_vals[], | |||
int * | error_return | |||
) |
Check for zero dimensions
Check for too-large-of dimensions
Copy the dimension information
Definition at line 1375 of file ADF_interface.c.
EXTERN void ADF_Get_Error_State | ( | int * | error_state, | |
int * | error_return | |||
) |
Definition at line 1425 of file ADF_interface.c.
EXTERN void ADF_Get_Label | ( | const double | ID, | |
char * | label, | |||
int * | error_return | |||
) |
EXTERN void ADF_Get_Link_Path | ( | const double | ID, | |
char * | filename, | |||
char * | link_path, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Get tokenized datatype
look for file/link delimiter
no filename
no link ?
Definition at line 1495 of file ADF_interface.c.
EXTERN void ADF_Get_Name | ( | const double | ID, | |
char * | name, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Copy the blank-filled name into a C string
Definition at line 1679 of file ADF_interface.c.
EXTERN void ADF_Get_Node_ID | ( | const double | PID, | |
const char * | name, | |||
double * | ID, | |||
int * | error_return | |||
) |
initialize the ID variable to use in intermediate steps
start at the root node
according to user documentation, PID can be any valid node in the database, but we need to use it to get the root ID in order to start at the top
This is the root-node, return the Root-ID
NOT an error, just done and need to get out
start search for tokens (names separated by '/')
this should never happen but check anyway
Get file-index, etc. to start. Note: Parent ID may be a link
Track through the possible compound name string
Find this child under the current parent
Child NOT found
create the child ID
Get the next node-name token (NULL if no more). This is needed for the while-loop check and normally would be done at the end of the loop, but it is useful in the next step to see if there are any more branches in the path.
If this node is the last in the path it may be a link, but there needs to be a mechanism by which a link's ID can be determined and so we cannot follow the link at this time.
This child now becomes the parent. Do it again...
Definition at line 1747 of file ADF_interface.c.
EXTERN void ADF_Get_Number_of_Dimensions | ( | const double | ID, | |
int * | num_dims, | |||
int * | error_return | |||
) |
EXTERN void ADF_Get_Root_ID | ( | const double | ID, | |
double * | Root_ID, | |||
int * | error_return | |||
) |
Get the file ID
Use the file header to find the root ID
Format the root ID
Definition at line 1913 of file ADF_interface.c.
EXTERN void ADF_Is_Link | ( | const double | ID, | |
int * | link_path_length, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Definition at line 1959 of file ADF_interface.c.
EXTERN void ADF_Library_Version | ( | char * | version, | |
int * | error_return | |||
) |
Copy the proper portion of the "what" string
remove trailing "what" delimiter ('>')
Definition at line 2002 of file ADF_interface.c.
EXTERN void ADF_Link | ( | const double | PID, | |
const char * | name, | |||
const char * | file, | |||
const char * | name_in_file, | |||
double * | ID, | |||
int * | error_return | |||
) |
Don't check file since it can be a NULL pointer
Create the node in the normal way
Get the file, block, and offset numbers from the ID
Add the file and linked-to name as data in the child
We must use a datatype of "C1" to put the data into this node. With a datatype of "Lk" (a link), the written data will go into the linked-to node (that's the whole point). To set this up we must be careful...
Change the datatype to be LK, without deleting the data. We can't use ADF_Put_Dimension_Information since the change of datatype will delete the data. We must do this manually.
Finally, update modification date
Definition at line 2044 of file ADF_interface.c.
EXTERN void ADF_Link_Size | ( | const double | ID, | |
int * | len_file, | |||
int * | len_name, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the ID
Get node_header for the node
Get tokenized datatype
look for file/link delimiter
no filename
Definition at line 1590 of file ADF_interface.c.
EXTERN void ADF_Move_Child | ( | const double | PID, | |
const double | ID, | |||
const double | NPID, | |||
int * | error_return | |||
) |
check that child is really a child of parent
add child to its new parent's sub node table
remove child from its old parent's sub node table
Definition at line 2162 of file ADF_interface.c.
EXTERN void ADF_Number_of_Children | ( | const double | ID, | |
int * | num_children, | |||
int * | error_return | |||
) |
EXTERN void ADF_Put_Dimension_Information | ( | const double | ID, | |
const char * | data_type, | |||
const int | dims, | |||
const int | dim_vals[], | |||
int * | error_return | |||
) |
Check new datatype
Look at old datatype
Calculate new data-size
If the number of dimensions is zero, set data-bytes to zero
Calculate the total number of bytes in the data
Calculate old data-size
If the data-types are the same...
If a different datatype, throw-away the data, record new datatype
Copy the datatype
Blank fill the remaining space
Record the number of dimensions and the dimension values
Zero out remaining dimension values
Free the old data
Write modified node_header for the node
Finally, update modification date
Definition at line 2305 of file ADF_interface.c.
EXTERN void ADF_Put_Name | ( | const double | PID, | |
const double | ID, | |||
const char * | name, | |||
int * | error_return | |||
) |
Get the file, block, and offset numbers from the PID
Get the file, block, and offset numbers from the ID
Get node_header for the node (parent)
Get node_header for the node (child)
Skip any leading blanks in the name
Need to check for uniqueness and legality of the name
Confirm that child is from the parent
Copy the name
Blank fill the remaining space
Write modified node_header
replace the child's name in the parent's sub-node_table
Finally, update modification date
Definition at line 2438 of file ADF_interface.c.
EXTERN void ADF_Read_All_Data | ( | const double | ID, | |
char * | data, | |||
int * | error_return | |||
) |
Get datatype size
Calculate total number of bytes in the data
If there is NO DATA, fill data space with zeros, return error
NO_DATA is really a warning, so don't check & abort...
Read the data from disk
Allocate memory for the required table space in memory
Read in the table
Read data from each entry in the table
Check to be sure we aren't reading too much data (shrinking a data block can cause this)
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
Definition at line 2567 of file ADF_interface.c.
EXTERN void ADF_Read_Block_Data | ( | const double | ID, | |
const long | b_start, | |||
const long | b_end, | |||
char * | data, | |||
int * | error_return | |||
) |
Get datatype size
Calculate total number of bytes in the data
Calculate the starting and ending range in the file
If there is NO DATA, fill data space with zeros, return error
NO_DATA is really a warning, so don't check & abort...
Read the data from disk
Allocate memory for the required table space in memory
Read in the table
Read data from each entry in the table
Check to be sure we don't think the chunk is bigger than it is (shrinking a data block can cause this)
If start of block not in this chunk then continue
Set offset into the current chunk
The start of the block is inside the current chunk so adjust the offset to the beginning of the block
Calculate the number of bytes needed in this chunk
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
Definition at line 2691 of file ADF_interface.c.
EXTERN void ADF_Read_Data | ( | const double | ID, | |
const int | s_start[], | |||
const int | s_end[], | |||
const int | s_stride[], | |||
const int | m_num_dims, | |||
const int | m_dims[], | |||
const int | m_start[], | |||
const int | m_end[], | |||
const int | m_stride[], | |||
char * | data, | |||
int * | error_return | |||
) |
Get datatype length
Check to see if there is actual data to use
Check for multiple data-chunks
A single data chunk
Point to the start of the data
Multiple data chunks
Allocate memory for the required table space in memory
Read in the table
Setup initial indexing
Adjust data pointer
If there is no data on disk, return zeros
A single data chunk
Get the data off of disk
Read the data off of disk directly
Read and translate data
Increment disk pointers, for the special case of one dimensional data we will a simple increment to maximize the throught. Thus for block reads you can temporarily change to 1D for the read to improve efficiency. Note total size shouldn't change!!
Multiple data chunks
Get the data off of disk
Read the data off of disk directly
Read and translate data
Increment disk pointers
Increment memory pointers
Adjust data pointer
Multiple data chunks
Definition at line 2872 of file ADF_interface.c.
EXTERN void ADF_Set_Error_State | ( | const int | error_state, | |
int * | error_return | |||
) |
Definition at line 3143 of file ADF_interface.c.
EXTERN void ADF_Set_Label | ( | const double | ID, | |
const char * | label, | |||
int * | error_return | |||
) |
Don't check for NULL or BLANK label, these are OK
Copy the label
Blank fill the remaining space
Write modified node_header
Finally, update modification date
Definition at line 3170 of file ADF_interface.c.
EXTERN void ADF_Write_All_Data | ( | const double | ID, | |
const char * | data, | |||
int * | error_return | |||
) |
Get the datatype length
Calculate the total number of data bytes
If there currently is NO data, allocate disk space for it
Write the new data
Record the modified the node-header
Get the data length
Check start-of-chunk tag
Point to the start of the data
See if the new data exceedes the existing data space
If Data grew: Write old size, then allocate more data-space and write the rest
Write the part of the new data to existing data-chunk
Allocate a second data chunk
Write the rest of the data
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
Allocate a data-chunk-table for two entries
Write data-chunk-table to disk
get the size of the data_chunk for the table end pointer
get the size of the data_chunk for the table end pointer
Update node header with number of data-chunks = 2 and the pointer to the data-chunk-table
Write the new data to existing data-chunk
Multiple data chunks
Allocate memory for the data-chunk-table, with an additional entry in case we need to grow it
Read in the table
looping on the data-chunks, write the size of the current chunk
Limit the number of bytes written by whats left to write.
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
If we are out of data-chunks and have data left, allocate a new data-chunk in the file.
Write data-chunk-table to disk
allocate data space in the file
allocate space for the new data-chunk-entry-table
Free the old data-chunk-table
Update node header with number of data-chunks++ and the pointer to the data-chunk-table
Finally, update modification date
Definition at line 3225 of file ADF_interface.c.
EXTERN void ADF_Write_Block_Data | ( | const double | ID, | |
const long | b_start, | |||
const long | b_end, | |||
char * | data, | |||
int * | error_return | |||
) |
Get the datatype length
Calculate the total number of data bytes
Calculate the starting and ending range in the file
If there currently is NO data, allocate disk space for it
Write the new data
Record the modified the node-header
Get the data length
Check start-of-chunk tag
Point to the start of the data
See if the new data exceedes the existing data space
If Data grew: Write old size, then allocate more data-space and write the rest
Write the part of the new data to existing data-chunk
Allocate a second data chunk
Write the rest of the data
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
Allocate a data-chunk-table for two entries
Write data-chunk-table to disk
get the size of the data_chunk for the table end pointer
get the size of the data_chunk for the table end pointer
Update node header with number of data-chunks = 2 and the pointer to the data-chunk-table
Write the new data to existing data-chunk
Multiple data chunks
Allocate memory for the data-chunk-table, with an additional entry in case we need to grow it
Read in the table
looping on the data-chunks, write the size of the current chunk
If start of block not in this chunk then continue
Set offset into the current chunk
The start of the block is inside the current chunk so adjust the offset to the beginning of the block
Check to be sure we aren't writing too much data
Write the chunk
note: memory_bytes and file_bytes might be different (e.g., if machine is "IEEE_BIG" and file is "CRAY") in which case data pointer advances at a different rate from file pointer.
If we are out of data-chunks and have data left, allocate a new data-chunk in the file.
Write data-chunk-table to disk
allocate data space in the file
allocate space for the new data-chunk-entry-table
Free the old data-chunk-table
Update node header with number of data-chunks++ and the pointer to the data-chunk-table
Finally, update modification date
Definition at line 3502 of file ADF_interface.c.
EXTERN void ADF_Write_Data | ( | const double | ID, | |
const int | s_start[], | |||
const int | s_end[], | |||
const int | s_stride[], | |||
const int | m_num_dims, | |||
const int | m_dims[], | |||
const int | m_start[], | |||
const int | m_end[], | |||
const int | m_stride[], | |||
const char * | data, | |||
int * | error_return | |||
) |
Get datatype length
Calculate the total number of data bytes
check for need of data translation
If there currently is NO data, allocate disk space for it
initialize the new disk_space with zero's, then we'll write the partial data
Record the modified the node-header
If one data chunk, check to see if we need to add a second
Get the data length
Check start-of-chunk tag
Point to the start of the data
See if the new data exceedes the existing data space
If Data grew: Allocate more data-space and initialize to zero
Allocate memory for the data-chunk-table, with an additional entry in case we need to grow it
Allocate a second data chunk
Initialize the new data with zeros
Allocate a data-chunk-table for two entries
Write data-chunk-table to disk
get the size of the data_chunk for the table end pointer
get the size of the data_chunk for the table end pointer
Update node header with number of data-chunks = 2 and the pointer to the data-chunk-table
Multiple data chunks, check to see if we need to add one mode
Allocate memory for the data-chunk-table, with an additional entry in case we need to grow it
Read in the table
looping on the data-chunks, look at the size of the chunks
If we are out of data-chunks and have data left, allocate a new data-chunk in the file.
Write data-chunk-table to disk
allocate data space in the file
allocate space for the new data-chunk-entry-table
Initialize the new data chunk to zeros
Free the old data-chunk-table
Update node header with number of data-chunks++ and the pointer to the data-chunk-table
Do single data-chunks here...
Point to the start of the data
Setup initial indexing
Adjust data pointer
Put the data to disk
Here is where we need to check for spanning multiple data-chunks
Put the data out to disk
Increment disk/memory pointers, for the special case of one dimensional data we will a simple increment to maximize the throught. Thus for block writes you can temporarily change to 1D for the read to improve efficiency. Note total size shouldn't change!!
Adjust data pointer
Point to the start of the data
Setup initial indexing
Adjust data pointer
Put the data to disk
Put the data out to disk
Increment disk and memory pointers
Adjust data pointer
Finally, update modification date
Definition at line 3849 of file ADF_interface.c.