/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/sedflux/run_new_process.c

Go to the documentation of this file.
00001 //---
00002 //
00003 // This file is part of sedflux.
00004 //
00005 // sedflux is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // sedflux 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
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with sedflux; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //
00019 //---
00020 
00021 /* Define the name of the process */
00022 #define SED_NEW_PROCESS_PROC_NAME "new process"
00023 
00024 /* Set the log domain for this file. */
00025 #define EH_LOG_DOMAIN SED_NEW_PROCESS_PROC_NAME
00026 
00027 #include <stdio.h>
00028 #include <limits.h>
00029 #include <string.h>
00030 #include <sed/sed_sedflux.h>
00031 #include <utils/utils.h>
00032 #include "my_processes.h"
00033 
00034 Sed_process_info
00035 run_new_process( Sed_process proc , Sed_cube prof )
00036 {
00037    New_process_t*   data = sed_process_user_data(proc);
00038    Sed_process_info info = SED_EMPTY_INFO;
00039 
00040    /* Do something to the Sed_cube */
00041    {
00042       double cur_val = sed_cube_sea_level( prof );
00043       sed_cube_set_sea_level( prof , cur_val - data->param );
00044    }
00045 
00046    /* Set and return mass balance information */
00047    info.mass_added = 0.;
00048    info.mass_lost  = 0.;
00049 
00050    return info;
00051 }
00052 
00053 #define S_KEY_PARAM_NAME_1 "parameter"
00054 #define S_KEY_PARAM_NAME_2 "another parameter"
00055 
00056 gboolean
00057 init_new_process( Sed_process p , Eh_symbol_table tab , GError** error )
00058 {
00059    New_process_t* data    = sed_process_new_user_data( p , New_process_t );
00060    GError*        tmp_err = NULL;
00061    gboolean       is_ok   = TRUE;
00062 
00063    eh_return_val_if_fail( error==NULL || *error==NULL , FALSE );
00064 
00065    if ( data )
00066    {
00067       /* Get the parameter values from the Eh_symbol_table */
00068 
00069       /* If there is an error, report it */
00070       if ( tmp_err )
00071       {
00072          g_propagate_error( error , tmp_err );
00073          is_ok = FALSE;
00074       }
00075    }
00076 
00077    return is_ok;
00078 }
00079 
00080 gboolean
00081 destroy_new_process( Sed_process p )
00082 {
00083    if ( p )
00084    {
00085       New_process_t* data = sed_process_user_data( p );
00086 
00087       if ( data )
00088       {
00089          /* Free resources used by data ... */
00090 
00091          /* ... and the data itself */
00092          eh_free( data );
00093       }
00094    }
00095 
00096    return TRUE;
00097 }

Generated on Fri Jan 4 18:04:16 2008 for sedflux by  doxygen 1.5.2