00001 /* 00002 COSTA: Problem solving environment for data assimilation 00003 Copyright (C) 2005 Nils van Velzen 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 /** 00021 \file cta_datatypes.h 00022 \brief Definitions of constants and datatypes that are publically used in COSTA 00023 */ 00024 00025 00026 #ifndef CTA_DATA_TYPS_H 00027 #define CTA_DATA_TYPS_H 00028 #include <stdlib.h> 00029 #include <math.h> 00030 #include "cta_system.h" 00031 00032 /** The datatpe of a COSTA Datatype */ 00033 typedef int CTA_Datatype; 00034 00035 /** A COSTA-function CTA_Function *function 00036 is a void-pointer. If it points to an 00037 existing function, it may be used to call 00038 that function, simply by 00039 retval = function(arguments); 00040 */ 00041 typedef void CTA_Function(); 00042 00043 /*! handle to a COSTA object */ 00044 #define CTA_HANDLE (-1) 00045 /*! A handle of a COSTA interface object */ 00046 #define CTA_INTERFACE (-2) 00047 /*! A handle of a COSTA function object */ 00048 #define CTA_FUNCTION (-3) 00049 /*! A handle of a COSTA vector object */ 00050 #define CTA_VECTOR (-4) 00051 /*! A handle of a COSTA Vector class */ 00052 #define CTA_VECTORCLASS (-5) 00053 /*! A handle of a COSTA (sub) treevector */ 00054 #define CTA_TREEVECTOR (-6) 00055 /*! A handle of a COSTA Matrix class */ 00056 #define CTA_MATRIXCLASS (-7) 00057 /*! A handle of a COSTA Matrix */ 00058 #define CTA_MATRIX (-8) 00059 /*! A handle of a COSTA Covariance matrix class */ 00060 #define CTA_COVMATCLASS (-9) 00061 /*! A handle of a COSTA Covariance matrix */ 00062 #define CTA_COVMAT (-10) 00063 /*! A handle of a COSTA Interpolation matrix */ 00064 #define CTA_INTPOL (-11) 00065 /*! A handle of a COSTA observation component */ 00066 #define CTA_OBS (-12) 00067 /*! A handle of a COSTA Model class */ 00068 #define CTA_MODELCLASS (-13) 00069 /*! A handle of a COSTA Model */ 00070 #define CTA_MODEL (-14) 00071 /*! A handle of a COSTA Time */ 00072 #define CTA_TIME (-15) 00073 /*! A handle of a COSTA StochObserver object */ 00074 #define CTA_SOBS (-16) 00075 /*! A handle of a COSTA StochObserver class */ 00076 #define CTA_SOBSCLASS (-17) 00077 /*! A handle of a COSTA ObserverDescription object */ 00078 #define CTA_OBSDESCR (-18) 00079 /*! A handle of a COSTA ObserverDescription class */ 00080 #define CTA_OBSDESCRCLASS (CTA_SOBSCLASS) 00081 /*! A handle of a COSTA Method object */ 00082 #define CTA_METHODCLASS (-19) 00083 /*! A handle of a COSTA Method object */ 00084 #define CTA_METHOD (-20) 00085 /*! A handle of a COSTA tree object */ 00086 #define CTA_TREE (-21) 00087 /*! A handle of a COSTA Pack-object */ 00088 #define CTA_PACK (-22) 00089 /*! A handle to an unknown data object */ 00090 #define CTA_DATABLOCK (-23) 00091 /*! A handle of a COSTA meta information object */ 00092 #define CTA_METAINFO (-24) 00093 /*! A handle of a COSTA meta information object */ 00094 #define CTA_METAINFOCLASS (-25) 00095 /*! A handle of a COSTA relation table object */ 00096 #define CTA_RELTABLE (-26) 00097 /*! An explicit subtreevector (for XML-use) */ 00098 #define CTA_SUBTREEVECTOR (-27) 00099 /*! CTA_Datatypes constant: COSTA-string */ 00100 #define CTA_STRING (-28) 00101 /*! CTA_Datatypes constant: COSTA-file */ 00102 #define CTA_FILE (-29) 00103 00104 00105 00106 // Codes to indicate CTA_Datatypes 00107 /*! COSTA CTA_Datatypes: arbitrary void */ 00108 #define CTA_VOID (-100) 00109 /*! CTA_Datatypes constant: integer (scalar) */ 00110 #define CTA_INTEGER (-101) 00111 /*! CTA_Datatypes constant: single precision real (scalar) */ 00112 #define CTA_REAL (-102) 00113 /*! CTA_Datatypes constant: double precision real (scalar) */ 00114 #define CTA_DOUBLE (-103) 00115 /*! CTA_Datatypes constant: FORTRAN-string */ 00116 #define CTA_FSTRING (-104) 00117 /*! CTA_Datatypes constant: C-string */ 00118 #define CTA_CSTRING (-105) 00119 00120 00121 /*! CTA_Datatypes constant: integer array */ 00122 #define CTA_1DINTEGER (-201) 00123 /*! CTA_Datatypes constant: single precision real array */ 00124 #define CTA_1DREAL (-202) 00125 /*! CTA_Datatypes constant: double precision real array */ 00126 #define CTA_1DDOUBLE (-203) 00127 /*! CTA_Datatypes constant: array of FORTRAN-strings */ 00128 #define CTA_1DFSTRING (-204) 00129 /*! CTA_Datatypes constant: array of C-strings */ 00130 #define CTA_1DCSTRING (-205) 00131 00132 // Common Constants 00133 00134 /*! COSTA flag/constant: Default */ 00135 #define CTA_DEFAULT (0) 00136 /*! COSTA flag/constant: NULL-Handle */ 00137 #define CTA_NULL (0) 00138 /*! COSTA flag/constant: FALSE */ 00139 #define CTA_FALSE (0) 00140 /*! COSTA flag/constant: TRUE */ 00141 #define CTA_TRUE (1) 00142 00143 #ifndef BOOL 00144 /*! Datatype for boolians */ 00145 #define BOOL int 00146 /*! Boolean value of TRUE */ 00147 #ifndef TRUE 00148 #define TRUE (1) 00149 #endif 00150 /*! Boolean value of FALSE */ 00151 #ifndef FALSE 00152 #define FALSE (0) 00153 #endif 00154 #endif 00155 #endif 00156 00157 #ifndef M_PI 00158 /*! constant pi */ 00159 #define M_PI (3.14159265358979) 00160 #endif 00161 00162 /*! The machine precision. More precisely, `eps' is the largest 00163 relative spacing between any two adjacent numbers in the machine's 00164 floating point system. This number is obviously system-dependent. 00165 On machines that support 64 bit IEEE floating point arithmetic, 00166 `eps' is approximately 2.2204e-16. 00167 This variable is not set automatically (yet) 00168 */ 00169 #ifndef M_EPS 00170 #define M_EPS (2.22044604925031e-16) 00171 00172 00173 #define CTA_STRLEN_TAG (80) 00174 #define CTA_STRLEN_NAME (80) 00175 00176 00177 //#define CTA_ASSIMOBS (1) 00178 //#define CTA_VALIDATEOBS (2) 00179 //#define CTA_ALLOBS (3) 00180 00181 /*! flush stdout and stderr in a number of the COSTA methods. useful for debugging */ 00182 #define CTA_FLUSH_ALWAYS ( 1) 00183 00184 /*! FORTRAN file unit for standard output */ 00185 #define CTA_F77_STDOUT ( 6) 00186 00187 #ifdef __cplusplus 00188 extern "C" { 00189 #endif 00190 00191 00192 /** \brief Get the result of the C-function sizeof for a COSTA datatype 00193 * 00194 * \param datatype I COSTA data type 00195 * \param size O receives result sizeof-function 00196 * \return CTA_OK if successful 00197 */ 00198 CTAEXPORT int CTA_SizeOf(CTA_Datatype datatype, int *size); 00199 00200 #ifdef __cplusplus 00201 } 00202 #endif 00203 00204 00205 #endif 00206