BigWhoop/include/interfaces/reader/eas3.h

170 lines
14 KiB
C
Raw Normal View History

2023-06-20 11:53:59 +00:00
/*================================================================================================*\
|| ||
|| /$$$$$$$ /$$ /$$ /$$ /$$ ||
|| | $$__ $$|__/ | $$ /$ | $$| $$ ||
|| | $$ \ $$ /$$ /$$$$$$ | $$ /$$$| $$| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ||
|| | $$$$$$$ | $$ /$$__ $$ | $$/$$ $$ $$| $$__ $$ /$$__ $$ /$$__ $$ /$$__ $$ ||
|| | $$__ $$| $$| $$ \ $$ | $$$$_ $$$$| $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$ ||
|| | $$ \ $$| $$| $$ | $$ | $$$/ \ $$$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ ||
|| | $$$$$$$/| $$| $$$$$$$ | $$/ \ $$| $$ | $$| $$$$$$/| $$$$$$/| $$$$$$$/ ||
|| |_______/ |__/ \____ $$ |__/ \__/|__/ |__/ \______/ \______/ | $$____/ ||
|| /$$ \ $$ | $$ ||
|| | $$$$$$/ | $$ ||
|| \______/ |__/ ||
|| ||
|| DESCRIPTION: ||
|| ------------ ||
|| ||
|| This file defines macros, structs and simple read and write functions used to ||
|| access conforming eas3 datasets. ||
|| ||
|| -------------------------------------------------------------------------------------------- ||
|| Copyright (c) 2023, High Performance Computing Center - University of Stuttgart ||
|| ||
|| Redistribution and use in source and binary forms, with or without modification, are ||
|| permitted provided that the following conditions are met: ||
|| ||
|| (1) Redistributions of source code must retain the above copyright notice, this list of ||
|| conditions and the following disclaimer. ||
|| ||
|| (2) Redistributions in binary form must reproduce the above copyright notice, this list ||
|| of conditions and the following disclaimer in the documentation and/or other ||
|| materials provided with the distribution. ||
|| ||
|| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS ||
|| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ||
|| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ||
|| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ||
|| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ||
|| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ||
|| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ||
|| TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ||
|| EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ||
|| ||
\*================================================================================================*/
2023-06-20 11:43:33 +00:00
#ifndef EAS3_H
#define EAS3_H
2023-06-20 11:53:59 +00:00
/************************************************************************************************\
|| _ _ _ ____ _ _ _ ___ ____ ||
|| | |\ | | | | | | \ |___ ||
|| | | \| |___ |___ |__| |__/ |___ ||
|| ||
\************************************************************************************************/
#include <stdio.h>
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#include "types.h"
/************************************************************************************************\
|| _ _ ____ ____ ____ ____ ____ ||
|| |\/| |__| | |__/ | | [__ ||
|| | | | | |___ | \ |__| ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These macros define EAS3 header markers. For more information see: !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/Main_Page/de !
! !
\*----------------------------------------------------------------------------------------------*/
#define EAS3_NO_ATTR 0x100000000000000 // No attributes present in the bitstream
#define EAS3_ALL_ATTR 0x200000000000000 // All attributes present in the bitstream
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#define EAS2_TYPE 0x100000000000000 // EAS2 Datatype
#define EAS3_TYPE 0x200000000000000 // EAS3 Datatype
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#define ATTRLEN 10 // Number of bytes defining an attribute
#define UDEFLEN 20 // Number of bytes defining data
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#define EAS3_NO_G 0x100000000000000 // No geometry data present in bitstream
#define EAS3_X0DX_G 0x200000000000000 // Start value & step size present
#define EAS3_UDEF_G 0x300000000000000 // Number of grid points present
#define EAS3_ALL_G 0x400000000000000 // Element for every appr. dim. present
#define EAS3_FULL_G 0x500000000000000 // Element for every dimension present
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#define EAS3_NO_UDEF 0x100000000000000 // No user defined data present in bitstr
#define EAS3_ALL_UDEF 0x200000000000000 // All user defined fields present
#define EAS3_INT_UDEF 0x300000000000000 // User defined integer field present
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
#define AUX_SIZE 0x8000 // Size of auxiliary information stream
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
/************************************************************************************************\
|| ___ _ _ ___ ____ ____ ||
|| | \_/ |__] |___ [__ ||
|| | | | |___ ___] ||
|| ||
\************************************************************************************************/
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to store the standard eas3 header parameters. For a more !
! thorough discussion of the eas3 datatype see: !
! !
! https://wiki.iag.uni-stuttgart.de/eas3wiki/index.php/EAS3_File_Format/de !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uint64 file_type; // Identifier for EAS Type (EAS2/3)
uint64 accuracy; // Accuracy of the eas3 file
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
uint64 nzs; // Temporal dimension size
uint64 npar; // No. parameters present in data-set
uint64 ndim1; // 1st spatial dimension size
uint64 ndim2; // 2nd spatial dimension size
uint64 ndim3; // 3rd spatial dimension size
uint64 attribute_mode; // Attribute of the eas3 file
uint64 gmode_time; // Geometry mode for the temp. dimension
uint64 gmode_param; // Geometry mode for the parameters
uint64 gmode_dim1; // 1st spatial dimension geometry mode
uint64 gmode_dim2; // 2nd spatial dimension geometry mode
uint64 gmode_dim3; // 3rd spatial dimension geometry mode
uint64 size_time; // Temporal dimension geometry array size
uint64 size_parameter; // Geometry array size of parameters
uint64 size_dim1; // 1st sptl. dimension geometry array size
uint64 size_dim2; // 2nd sptl. dimension geometry array size
uint64 size_dim3; // 3rd sptl. dimension geometry array size
2023-06-20 11:43:33 +00:00
2023-06-20 11:53:59 +00:00
uint64 udef_param; // Signals user def. parameters present
uint64 udef_char_size; // Size of user defined char. array
uint64 udef_int_size; // Size of user defined int. array
uint64 udef_real_size; // Size of user defined real array
} eas3_std_params;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! This structure is used to store all the necessary parameters required to access !
! parameters stored in an eas3 file. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef struct
{
uint64 *offset; // Offset of a parameter in a eas3 file
} eas3_file_util;
/************************************************************************************************\
|| ___ _ _ ___ _ _ ____ ____ _ _ _ _ ____ ___ _ ____ _ _ ____ ||
|| |__] | | |__] | | | |___ | | |\ | | | | | | |\ | [__ ||
|| | |__| |__] |___ | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************/
uchar open_eas3 (bwc_field *const field,
char const *const filename,
char const *mode);
//==========|==========================|======================|======|=======|====================
uchar load_eas3 (bwc_field *const field,
char const *const filename);
//==========|==========================|======================|======|=======|====================
uchar unload_eas3 (bwc_field *const field,
char const *const filename);
2023-06-20 11:43:33 +00:00
#endif