cta_modbuild_b3b_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_B3B_UTILS_H
00026 #define CTA_MODBUILD_B3B_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_modbuild_b3b.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 *        B3B_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 *        B3B_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 *        B3B_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          B3B_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           B3B_Free_Model(B3B_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          B3B_Free_StateExchange(B3B_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          B3B_Free_Parameter(B3B_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          B3B_Free_Forcing(B3B_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          B3B_Free_Station(B3B_StationPntr stations);
00108 
00109 /** \brief Convert COSTA state vector to B3B 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  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00115  */
00116 int           B3B_State2Model(B3B_ModelPntr model, double start, double stop);
00117 
00118 /** \brief Convert B3B model to COSTA state vector
00119  *
00120  * \param model    I  Pointer naar de model data
00121  * \param start    I  Simulatie starttijd in modified julian day
00122  * \param stop     I  Simulatie stoptijd in modified julian day
00123  * \param sstate   O  Pointer naar state vector
00124  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00125  */
00126 int           B3B_Model2State(B3B_ModelPntr model, double start, double stop, CTA_TreeVector *sstate);
00127 
00128 /** \brief Open model2state file 
00129  *
00130  * \param model     I  Pointer naar de model data
00131  * \param htree     O  Pointer naar costa tree
00132  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00133  */
00134 int           B3B_OpenModel2State(B3B_ModelPntr model, CTA_Tree *htree);
00135 
00136 /** \brief Get value of B3B model 
00137  *
00138  * \param model     I  Pointer naar de model data
00139  * \param htree     I  Pointer naar costa tree
00140  * \param station   I  Name of the station
00141  * \param variable  I  Name of the variabele
00142  * \param time      I  tijdstip in MJD
00143  * \param value     O  waarde van de variabele op tijdstip van station
00144  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00145  */
00146 int           B3B_Model2StateByStationVariableTime(B3B_ModelPntr model, CTA_Tree htree, char *station, char *variable, double time, double *value);
00147 
00148 /** \brief 
00149  *
00150  * \param model    I  Pointer naar de model data
00151  * \return error status: CTA_OK, CTA_ILLEGAL_HANDLE
00152  */
00153 int           B3B_Run_Model(B3B_ModelPntr model);
00154 
00155 /** \brief 
00156  *
00157  * \param 
00158  * \return 
00159  */
00160 B3B_ModelPntr B3B_Read_Model(int simulationNumber, CTA_Tree hmodelinput, CTA_Handle *sstate, CTA_Handle *sparam, CTA_Handle *sforc);
00161 
00162 /** \brief Check for a COSTA error
00163  *
00164  * \param ierr     I  COSTA error code
00165  * \param msg      I  Error message
00166  * \return no return value
00167  */
00168 void          B3B_CheckError(int ierr, const char *msg);
00169 
00170 #endif

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