cta_resultwriter.h File Reference

#include "cta_system.h"
#include "cta_handles.h"
#include "cta_datatypes.h"

Go to the source code of this file.

Functions

CTAEXPORT int CTA_Resultwriter_putmessage (int iDWriter, char *config, char *workingDir, char *message)
 Handle a string message send to the resultwriter.
CTAEXPORT int CTA_Resultwriter_putvalue (int idwriter, char *config, char *workingdir, char *id, int handle, int outputlevel, char *context, int iteration)
 Handle a string message send to the resultwriter.
CTAEXPORT int CTA_Resultwriter_putiterationreport (int idwriter, char *config, char *workingDir, int iteration, double cost, int handle)
 Handle a string message send to the resultwriter.
CTAEXPORT int CTA_Resultwriter_free (int idwriter)
 Free a resultwriter (close output files etc).

Function Documentation

CTAEXPORT int CTA_Resultwriter_free ( int  idwriter  ) 

Free a resultwriter (close output files etc).

Parameters:
IDWriter I ID of this resultwriter (Counter of number of native result writers)
Returns:
error status: CTA_OK if successful
CTAEXPORT int CTA_Resultwriter_putiterationreport ( int  idwriter,
char *  config,
char *  workingDir,
int  iteration,
double  cost,
int  handle 
)

Handle a string message send to the resultwriter.

Parameters:
IDWriter I ID of this resultwriter (Counter of number of native result writers)
config I Name of XML configuration file containting the function pointers and additional information
workingDir I Full path to working directory
iteration I Iteration number from which the resultwriter was called
cost I Value of cost function
handle I Handle (Vector or TreeVector) of the current parameters
Returns:
error status: CTA_OK if successful
CTAEXPORT int CTA_Resultwriter_putmessage ( int  iDWriter,
char *  config,
char *  workingDir,
char *  message 
)

Handle a string message send to the resultwriter.

OpenDA support the concept of resultwriters. The Data assimilation algorithm will presents intermediate results and information on the computations to the result writer. Each implementation of a resultwriter can then handle this data in its own way.

To implement an native resultwriter the following methods need to be implemented. Note: for explanation on variables see resultwriter function methods. All strings have a len_... containing the result of strlen (used for using c-strings in Fortran)

C:

void putmessage(int iDWriter, CTA_Tree config, char* workingDir, char* message, int *retval, int len_workingDir, int len_message);

void putvalue(int iDWriter, CTA_Tree config, char* workingDir, int id, int handle, int outputlevel, char* context, int iteration, int &retval, len_workingDir, len_id, len_context);

void putiterationreport(int iDWriter, CTA_Tree config, char *workingDir, int iteration, double cost, CTA_Vector handle, int *retval, int len_workingDir);

void freewriter(int iDWriter);

Fortran 2003:

interface subroutine putmessage(iDWriter, config, workingDir, message, retval, & len_workingDir, len_message) & bind(C, NAME='putmessage') use iso_c_binding implicit none include 'cta_f90.inc'

integer(C_INT), VALUE iDWriter, config, len_workingDir, len_message integer(C_INT) retval character(kind=c_char) workingdir(*), message(*) end subroutine putmessage end interface

interface subroutine putvalue(iDWriter, config, workingDir, id, handle, & outputlevel, context, iteration, retval, & len_workingDir, len_id, len_context) & bind(C, NAME='putvalue') use iso_c_binding implicit none include 'cta_f90.inc' integer(C_INT), VALUE iDWriter, config, handle, outputlevel, iteration, & len_workingDir, len_id, len_context integer(C_INT) retval character(kind=c_char) workingdir(*), id(*), context(*)

end subroutine putvalue end interface

interface subroutine putiterationreport(iDWriter, config, workingDir, iteration, cost, & handle, retval, len_workingDir) & bind(C, NAME='putiterationreport') use iso_c_binding implicit none include 'cta_f90.inc' integer(C_INT), VALUE iDWriter, config, iteration, handle, len_workingDir real(C_DOUBLE), VALUE cost integer(C_INT) retval character(kind=c_char) workingdir(*) end subroutine putiterationreport end interface

interface subroutine freewriter(iDWriter) & bind(C, NAME='freewriter') use iso_c_binding implicit none include 'cta_f90.inc' integer(C_INT), VALUE iDWriter end subroutine freewriter end interface

The resultwriter must have an xml-configuration file containing at least the following (additional field may be used for private usage by the implementation) Note name of library and funtion name must correspond to the user implementation.

<?xml version="1.0" encoding="UTF-8"?> <openda_native xmlns:xi="http://www.w3.org/2001/XInclude"> <CTA_FUNCTION id="putvalue" name="putvalue" library="libresultwriter.so" function="putvalue"> <CTA_FUNCTION id="putmessage" name="putmessage" library="libresultwriter.so" function="putmessage"> <CTA_FUNCTION id="putiterationreport" name="putiterationreport" library="libresultwriter.so" function="putiterationreport"> <CTA_FUNCTION id="freewriter" name="freewriter" library="libresultwriter.so" function="freewriter"> </openda_native>

Author:
nils van velzen
Parameters:
IDWriter I ID of this resultwriter (Counter of number of native result writers)
config I Name of XML configuration file containting the function pointers and additional information
workingDir I Full path to working directory
message I Message send to resultwriter
Returns:
error status: CTA_OK if successful
CTAEXPORT int CTA_Resultwriter_putvalue ( int  idwriter,
char *  config,
char *  workingdir,
char *  id,
int  handle,
int  outputlevel,
char *  context,
int  iteration 
)

Handle a string message send to the resultwriter.

Parameters:
IDWriter I ID of this resultwriter (Counter of number of native result writers)
config I Name of XML configuration file containting the function pointers and additional information
workingDir I Full path to working directory
id I Name of the variable/array send to the resultwriter
handle I Handle (Vector or TreeVector) of variable
outputLevel I Selected output level (see opendabridge for possible values)
context I Location from which the resultwriter was called
iteration I Iteration number from which the resultwriter was called
Returns:
error status: CTA_OK if successful

Generated on 4 Mar 2014 for OpenDA by  doxygen 1.6.1