cta_modbuild_b3b.h

Go to the documentation of this file.
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_modbuild_b3.h
00022 \brief Description of the COSTA blackbox component
00023 */
00024 
00025 #ifndef CTA_MODBUILD_B3B_H
00026 #define CTA_MODBUILD_B3B_H
00027 
00028 #include <string.h>
00029 #ifdef WIN32
00030 #include <direct.h>
00031 #endif
00032 #include "cta.h"
00033 #include "cta_system.h"
00034 #include "f_cta_utils.h"
00035 #include "cta_datatypes.h"
00036 #include "cta_model_utilities.h" 
00037 #include "cta_handles.h"
00038 #include "cta_datetime.h"
00039 
00040 #define STRING_MAX              1024                 /* maximum length of string */
00041 
00042 #define B3B_ENCODING  ("utf-8")              /* XML encodiing */
00043 
00044 
00045 typedef struct B3B_Variable B3B_Variable;
00046 typedef B3B_Variable * B3B_VariablePntr;
00047 
00048 struct B3B_Variable {
00049    char    *name;                            /* variable name */
00050    double   value;                           /* variable value */
00051 };
00052 
00053 typedef struct B3B_Station B3B_Station;
00054 typedef B3B_Station * B3B_StationPntr;
00055 
00056 struct B3B_Station {
00057    char             *name;                   /* station name */
00058    char             *location;               /* station location */
00059    char             *filename;               /* station filename */
00060    int               nvariables;             /* station number of variables */
00061    B3B_VariablePntr *variables;              /* station variables */
00062 };
00063 
00064 typedef struct B3B_Forcing B3B_Forcing;
00065 typedef B3B_Forcing * B3B_ForcingPntr;
00066 
00067 struct B3B_Forcing {
00068    char    *name;                            /* forcing name */
00069    char    *file;                            /* forcing file */
00070    char    *element;                         /* forcing element */
00071    char    *property;                        /* forcing property */
00072    char    *item;                            /* forcing item */
00073    double   value;                           /* forcing value */
00074 };
00075 
00076 typedef struct B3B_Parameter B3B_Parameter;
00077 typedef B3B_Parameter * B3B_ParameterPntr;
00078 
00079 struct B3B_Parameter {
00080    char    *name;                            /* parameter name */
00081    char    *file;                            /* parameter file */
00082    char    *element;                         /* parameter element */
00083    char    *property;                        /* parameter property */
00084    char    *item;                            /* parameter item */
00085    double   value;                           /* parameter value */
00086 };
00087 
00088 typedef struct B3B_StateExchange B3B_StateExchange;
00089 typedef B3B_StateExchange * B3B_StateExchangePntr;
00090 
00091 struct B3B_StateExchange {
00092    char    *executable;                      /* name of blackbox executable */
00093    char    *state2model;                     /* name of input file */
00094    char    *model2state;                     /* name of output file */
00095    char    *outputSteps;                     /* output steps 'last' or 'all' */
00096 };
00097 
00098 typedef struct B3B_Model B3B_Model;
00099 typedef B3B_Model * B3B_ModelPntr;
00100 
00101 struct B3B_Model{
00102    char                   *type;             /* model type */
00103    char                   *description;      /* model description */
00104    double                  timestep;         /* simulation timestep in seconds */
00105    int                     simulationNumber; /* simulation number */
00106    char                   *workingdir;       /* working map of simulation */
00107    char                   *templatedir;      /* map with simulation template */
00108    char                   *simulationMap;    /* map with simulation results */
00109    int                     stateLength;      /* length of the state vector */
00110    int                     nstations;        /* number of stations */
00111    B3B_StateExchangePntr   stateexchange;    /* pointer to the state exchange variables */
00112    B3B_StationPntr        *stations;         /* pointer to the list of stations */
00113    int                     nparameters;      /* number of parameters */
00114    B3B_ParameterPntr      *parameters;       /* pointer to the list of parameters */
00115    int                     nforcings;        /* number of forcings */
00116    B3B_ForcingPntr        *forcings;         /* pointer to the list of forcings */
00117 };
00118 
00119 static int B3B_simulationNumber=0;             // Number of the simulation         
00120 
00121 #define B3B_INDEX_THIS              ( 0) /* Handle of instance               */
00122 #define B3B_INDEX_TIME              ( 1) /* Time instance of model (state)   */
00123 #define B3B_INDEX_STATE             ( 2) /* State vector of model            */
00124 #define B3B_INDEX_FORCINGS          ( 3) /* Tree vector containing the forcings of the model */
00125 #define B3B_INDEX_PARAMETERS        ( 4) /* Tree vector of model parameters */
00126 #define B3B_INDEX_USERDATA          ( 5) /* Userdata */
00127 
00128 #define B3B_SIZE_DATABLK            ( 6)
00129 
00130 
00131 /** \brief Create the model class of the B3B Black-box builder
00132  *
00133  * \note This is not a user function. It is called at initialization of the
00134  *       COSTA environment.
00135  *
00136  *  \param modelcls  O  receives handle of the B3B-modelbuilder class
00137  */
00138 
00139 void CTA_Modbuild_b3b_CreateClass(CTA_ModelClass *modelcls);
00140 
00141 #endif
00142 

Generated on Mon Apr 6 14:05:58 2009 for COSTA by  doxygen 1.5.2