cta_bb_modbuild_utils.h

Go to the documentation of this file.
00001 /*
00002 COSTA: Problem solving environment for data assimilation
00003 Copyright (C) 2006  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_b3b_utils_h.h
00022 \brief Description of the COSTA blackbox component utilisties
00023 */
00024 
00025 #ifndef CTA_MODBUILD_BB_UTILS_H
00026 #define CTA_MODBUILD_BB_UTILS_H
00027 
00028 #include <libxml/encoding.h>
00029 #include <libxml/parser.h>
00030 #include <libxml/tree.h>
00031 #include <libxml/xinclude.h>
00032 #include <libxml/xmlwriter.h>
00033 
00034 #include "cta.h"
00035 #include "cta_xml.h"
00036 #include "cta_bb_modbuild.h"
00037 
00038 /** \brief Copy a string
00039  *
00040  * \param name     I  string to be copied
00041  *
00042  * \return copy of the string
00043  */
00044 char *        BB_CopyText(const char *in);
00045 
00046 /** \brief Reallocates a block of memory
00047  *
00048  * \param memblock  I  Pointer to previously allocated memory block
00049  * \param size      I  New size in bytes.
00050  *
00051  * \return pointer to the allocated space
00052  */
00053 void *        BB_Realloc(void *memblock, size_t size);
00054 
00055 /** \brief Allocates a block of memory
00056  *
00057  * \param nelem     I  Number of elements
00058  * \param elsize    I  Element size
00059  *
00060  * \return pointer to the allocated space
00061  */
00062 void *        BB_Malloc(size_t nelem, size_t elsize);
00063    
00064 /** \brief Frees a block of memory that is currently allocated
00065  *
00066  * \param pntr     I  starting address of the memory block to be freed
00067  *
00068  * \return no return value
00069  */
00070 void          BB_Free(void *pntr);
00071 
00072 /** \brief Frees a model that is currently allocated
00073  *
00074  * \param pntr     I  starting address of the model to be freed
00075  *
00076  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00077  */
00078 int           BB_Free_Model(BB_ModelPntr model);
00079 
00080 /** \brief Frees a stateexchange that is currently allocated
00081  *
00082  * \param pntr     I  starting address of the stateexchange to be freed
00083  *
00084  * \return no return value
00085  */
00086 void          BB_Free_StateExchange(BB_StateExchangePntr stateexchange);
00087 
00088 /** \brief Frees a parameter that is currently allocated
00089  *
00090  * \param pntr     I  starting address of the parameter to be freed
00091  * \return no return value
00092  */
00093 void          BB_Free_Parameter(BB_ParameterPntr parameter);
00094 
00095 /** \brief Frees a forcing that is currently allocated
00096  *
00097  * \param pntr     I  starting address of the forcing to be freed
00098  * \return no return value
00099  */
00100 void          BB_Free_Forcing(BB_ForcingPntr forcings);
00101 
00102 /** \brief Frees a station that is currently allocated
00103  *
00104  * \param pntr     I  starting address of the station to be freed
00105  * \return no return value
00106  */
00107 void          BB_Free_Station(BB_StationPntr stations);
00108 
00109 /** \brief Convert COSTA state vector to BB model
00110  *
00111  * \param model    I  Pointer naar de model data
00112  * \param start    I  Simulatie starttijd in modified julian day
00113  * \param stop     I  Simulatie stoptijd in modified julian day
00114  * \param sstate   I  Model state to be written
00115  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00116  */
00117 int BB_State2Model(BB_ModelPntr model, double start, double stop, CTA_TreeVector sstate);
00118 
00119 /** \brief Convert BB model to COSTA state vector
00120  *
00121  * \param model    I  Pointer naar de model data
00122  * \param start    I  Simulatie starttijd in modified julian day
00123  * \param stop     I  Simulatie stoptijd in modified julian day
00124  * \param sstate   O  Pointer naar state vector
00125  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00126  */
00127 int  BB_Model2State(BB_ModelPntr model, double start, double stop, CTA_TreeVector *sstate);
00128 
00129 /** \brief Open model2state file 
00130  *
00131  * \param model     I  Pointer naar de model data
00132  * \param htree     O  Pointer naar costa tree
00133  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00134  */
00135 int           BB_OpenModel2State(BB_ModelPntr model, CTA_Tree *htree);
00136 
00137 /** \brief Get value of BB model 
00138  *
00139  * \param model     I  Pointer naar de model data
00140  * \param htree     I  Pointer naar costa tree
00141  * \param station   I  Name of the station
00142  * \param variable  I  Name of the variabele
00143  * \param time      I  tijdstip in MJD
00144  * \param value     O  waarde van de variabele op tijdstip van station
00145  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00146  */
00147 int           BB_Model2StateByStationVariableTime(BB_ModelPntr model, CTA_Tree htree, char *station, char *variable, double time, double *value);
00148 
00149 /** \brief 
00150  *
00151  * \param model    I  Pointer naar de model data
00152  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00153  */
00154 int           BB_Run_Model(BB_ModelPntr model);
00155 
00156 /** \brief 
00157  *
00158  * \param 
00159  * \return 
00160  */
00161 BB_ModelPntr BB_Read_Model(int simulationNumber, CTA_Tree hmodelinput, CTA_Handle *sstate, CTA_Handle *sparam, CTA_Handle *sforc);
00162 
00163 /** \brief Check for a COSTA error
00164  *
00165  * \param ierr     I  COSTA error code
00166  * \param msg      I  Error message
00167  * \return no return value
00168  */
00169 void          BB_CheckError(int ierr, const char *msg);
00170 
00171 #endif

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