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 /*! CTA_Datatypes constant: COSTA-array */ 00104 #define CTA_ARRAY (-30) 00105 00106 00107 00108 // Codes to indicate CTA_Datatypes 00109 /*! COSTA CTA_Datatypes: arbitrary void */ 00110 #define CTA_VOID (-100) 00111 /*! CTA_Datatypes constant: integer (scalar) */ 00112 #define CTA_INTEGER (-101) 00113 /*! CTA_Datatypes constant: single precision real (scalar) */ 00114 #define CTA_REAL (-102) 00115 /*! CTA_Datatypes constant: double precision real (scalar) */ 00116 #define CTA_DOUBLE (-103) 00117 /*! CTA_Datatypes constant: FORTRAN-string */ 00118 #define CTA_FSTRING (-104) 00119 /*! CTA_Datatypes constant: C-string */ 00120 #define CTA_CSTRING (-105) 00121 00122 00123 /*! CTA_Datatypes constant: integer array */ 00124 #define CTA_1DINTEGER (-201) 00125 /*! CTA_Datatypes constant: single precision real array */ 00126 #define CTA_1DREAL (-202) 00127 /*! CTA_Datatypes constant: double precision real array */ 00128 #define CTA_1DDOUBLE (-203) 00129 /*! CTA_Datatypes constant: array of FORTRAN-strings */ 00130 #define CTA_1DFSTRING (-204) 00131 /*! CTA_Datatypes constant: array of C-strings */ 00132 #define CTA_1DCSTRING (-205) 00133 00134 // Common Constants 00135 00136 /*! COSTA flag/constant: Default */ 00137 #define CTA_DEFAULT (0) 00138 /*! COSTA flag/constant: NULL-Handle */ 00139 #define CTA_NULL (0) 00140 /*! COSTA flag/constant: FALSE */ 00141 #define CTA_FALSE (0) 00142 /*! COSTA flag/constant: TRUE */ 00143 #define CTA_TRUE (1) 00144 00145 #ifndef BOOL 00146 /*! Datatype for boolians */ 00147 #define BOOL int 00148 /*! Boolean value of TRUE */ 00149 #ifndef TRUE 00150 #define TRUE (1) 00151 #endif 00152 /*! Boolean value of FALSE */ 00153 #ifndef FALSE 00154 #define FALSE (0) 00155 #endif 00156 #endif 00157 #endif 00158 00159 #ifndef M_PI 00160 /*! constant pi */ 00161 #define M_PI (3.14159265358979) 00162 #endif 00163 00164 /*! The machine precision. More precisely, `eps' is the largest 00165 relative spacing between any two adjacent numbers in the machine's 00166 floating point system. This number is obviously system-dependent. 00167 On machines that support 64 bit IEEE floating point arithmetic, 00168 `eps' is approximately 2.2204e-16. 00169 This variable is not set automatically (yet) 00170 */ 00171 #ifndef M_EPS 00172 #define M_EPS (2.22044604925031e-16) 00173 00174 00175 #define CTA_STRLEN_TAG (80) 00176 #define CTA_STRLEN_NAME (80) 00177 00178 00179 //#define CTA_ASSIMOBS (1) 00180 //#define CTA_VALIDATEOBS (2) 00181 //#define CTA_ALLOBS (3) 00182 00183 /*! flush stdout and stderr in a number of the COSTA methods. useful for debugging */ 00184 #define CTA_FLUSH_ALWAYS ( 1) 00185 00186 /*! FORTRAN file unit for standard output */ 00187 #define CTA_F77_STDOUT ( 6) 00188 00189 #ifdef __cplusplus 00190 extern "C" { 00191 #endif 00192 00193 00194 /** \brief Get the result of the C-function sizeof for a COSTA datatype 00195 * 00196 * \param datatype I COSTA data type 00197 * \param size O receives result sizeof-function 00198 * \return CTA_OK if successful 00199 */ 00200 CTAEXPORT int CTA_SizeOf(CTA_Datatype datatype, int *size); 00201 00202 #ifdef __cplusplus 00203 } 00204 #endif 00205 00206 00207 #endif 00208