grasp_controller.h File Reference

Functions needed by the controller to organize the workflow. More...

#include "yamlsettings/yamlsettings.h"
#include "../input/grasp_input.h"
#include "../output/grasp_output.h"
#include "../output/grasp_output_stream.h"

Go to the source code of this file.

Functions

grasp_output_streamgrasp_controller_get_trackmem_stream ()
 
int grasp_controller_free_results_description (grasp_results_description *result)
 
grasp_output_streamgrasp_controller_get_stream ()
 
double grasp_controller_get_algorithm_ut ()
 
double grasp_controller_get_algorithm_ct ()
 
int grasp_controller_get_nerror_segment ()
 
int grasp_controller_get_nerror_pixel ()
 
int grasp_controller_read_settings (int argc, char **argv, grasp_settings **settings, yamlsettings_parser_settings_file_mode settings_file_mode)
 
int grasp_controller_initialize_functions (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_processing_functions_t *functions)
 
int grasp_controller_initialize_inversion (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_processing_functions_t *functions, grasp_results_t *results)
 
int grasp_controller_invert_tile (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions)
 
int grasp_controller_invert_tile_sequential (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions)
 
int grasp_controller_invert_tile_mpi (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions)
 
int grasp_controller_call_inversion (grasp_settings *settings, grasp_segment_t *segment, output_segment_general *output, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions, int iinversion, int id_inversion)
 
int grasp_controller_get_next_inversion (grasp_tile_dimensions_t *tile_description, int iinversion)
 
int grasp_controller_processor_unit (const grasp_settings *settings, const grasp_segment_t *segment, output_segment_general *output, const grasp_tile_dimensions_t *tile_description, int ninversion)
 
int grasp_controller_post_process_segment (grasp_settings *settings, grasp_segment_t *segment, output_segment_general *output, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions)
 
bool grasp_controller_segment_is_invertible (int ninversion, const grasp_settings *settings, const grasp_tile_dimensions_t *tile_description)
 
void grasp_controller_process_options (grasp_settings *settings)
 
int grasp_controller_manage_tile (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions)
 
int grasp_controller_clean_memory (grasp_settings *settings, grasp_tile_description_t *tile_description, grasp_results_t *results, grasp_processing_functions_t *functions, grasp_results_description *results_description)
 

Variables

grasp_output_stream controller_stream
 

Detailed Description

Functions needed by the controller to organize the workflow.

Author
David Fuertes
Date
14 Oct 2013

Function Documentation

◆ grasp_controller_call_inversion()

int grasp_controller_call_inversion ( grasp_settings settings,
grasp_segment_t segment,
output_segment_general output,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions,
int  iinversion,
int  id_inversion 
)

Call inversion with settings, tile and output, knowing the output function of the segment and the number of inversion and its position in the tile (icol, irow, itime)

Parameters
settings
segment
output
tile_description
results
functions
iinversion
id_inversion
Returns
negative value in case of error.

◆ grasp_controller_clean_memory()

int grasp_controller_clean_memory ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions,
grasp_results_description results_description 
)

Clean functions, results, tile description and settings. The application is ready to finish.

Parameters
settingsCurrent input settings
tile_descriptionCurrent tile description
resultsOutput results obtained from all retrievals
functionsExtension functions used during the process
Returns
0 if the process finished properly, otherwise negative value

◆ grasp_controller_free_results_description()

int grasp_controller_free_results_description ( grasp_results_description result)

Freeing grasp results descrpition

Parameters
result
Returns

◆ grasp_controller_get_algorithm_ct()

double grasp_controller_get_algorithm_ct ( )

Return user time in seconds used by retrieval algorithm (computed total time taken by all retrievals)

Returns
User time in seconds used by retrieval algorithm

◆ grasp_controller_get_algorithm_ut()

double grasp_controller_get_algorithm_ut ( )

Return real time in seconds used by retrieval algorithm (computed total time taken by all retrievals)

Returns
real time in seconds used by retrieval algorithm

◆ grasp_controller_get_nerror_pixel()

int grasp_controller_get_nerror_pixel ( )

Return the number of pixels that were not processed in the process because a retrieval error

Returns
number of pixels

◆ grasp_controller_get_nerror_segment()

int grasp_controller_get_nerror_segment ( )

Return the number of segmenter that had to be ignored in the process because a retrieval error

Returns
number of segments

◆ grasp_controller_get_next_inversion()

int grasp_controller_get_next_inversion ( grasp_tile_dimensions_t tile_description,
int  iinversion 
)

Given a inversion number it return the position of the tile icol, irow and itime. The function return -1 if the number of inversion is out of bounds, 0 otherwise.

Parameters
tile_descriptioncurrent tile description
iinversionnumber of the inversion. First, second...
Returns
0 if the function worked OK

◆ grasp_controller_get_stream()

grasp_output_stream* grasp_controller_get_stream ( )

Return controller stream to be use in other submodules. This stream is opened after reading the settings and it is close at the end of the workflow

Returns
memory direction of controller stream

◆ grasp_controller_get_trackmem_stream()

grasp_output_stream* grasp_controller_get_trackmem_stream ( )

◆ grasp_controller_initialize_functions()

int grasp_controller_initialize_functions ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_processing_functions_t functions 
)

Function for initializing framework extension functions. It call init method from extensions.

Parameters
settingscurrent settings structure
tile_descriptioncurrent tile description
functionsextension functions structure which will be initialize and updated
Returns
0 if the process finished OK

◆ grasp_controller_initialize_inversion()

int grasp_controller_initialize_inversion ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_processing_functions_t functions,
grasp_results_t results 
)

Initialize a tile from a settings. Return 0 is everything was ok

Parameters
settingsCurrent settings structure filled
tile_descriptionTile description which will be updated
functionsextension functions structure which will be initialize and updated
resultsgrasp result structure (output result tile) which will be initialized
Returns
0 if the process finished OK

◆ grasp_controller_invert_tile()

int grasp_controller_invert_tile ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions 
)

Iterate over segments in a tile to retrieve them

Parameters
settingsCurrent settings structure
tile_descriptionCurrent description of the tile
resultsResult structure will be filled with results from retrievals
functionsextension functions will be called during the process
Returns
negative if error otherwise 0 or positive.

◆ grasp_controller_invert_tile_mpi()

int grasp_controller_invert_tile_mpi ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions 
)

◆ grasp_controller_invert_tile_sequential()

int grasp_controller_invert_tile_sequential ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions 
)

Iterate over segments in a tile to retrieve them sequentially

Parameters
settingsCurrent settings structure
tile_descriptionCurrent description of the tile
resultsResult structure will be filled with results from retrievals
functionsextension functions will be called during the process
segmentsIt is an output argument, if it is different than null it will be used to save each input segment generated by the driver
Returns
negative if error otherwise 0 or positive.

◆ grasp_controller_manage_tile()

int grasp_controller_manage_tile ( grasp_settings settings,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions 
)

It function call output extension function with result structure. After inverting all segments this function will work with output result structure

Parameters
settingsCurrent input settings
tile_descriptionCurrent tile description
resultsResult structure with all output from retrievals
functionsOutput extension function to call after processing and generate output files
Returns
0 if the process finished properly, otherwise negative value

◆ grasp_controller_post_process_segment()

int grasp_controller_post_process_segment ( grasp_settings settings,
grasp_segment_t segment,
output_segment_general output,
grasp_tile_description_t tile_description,
grasp_results_t results,
grasp_processing_functions_t functions 
)

Called by grasp_controller_call_inversion after a segment has been processed. It will call output extension functions

Parameters
settingsCurrent input segment
segmentSegment which has been processed
outputOutput obtained from the retrieval algorithm
tile_descriptionCurrent tile description
resultsResult structure where output will be included
functionsExtension functions
Returns
0 if the process finished properly, otherwise negative value

◆ grasp_controller_process_options()

void grasp_controller_process_options ( grasp_settings settings)

Process controller options (call help, call debug, ...). It checks the input options and call controller functions to answer user demands

Parameters
settingsSettings from user yaml file

◆ grasp_controller_processor_unit()

int grasp_controller_processor_unit ( const grasp_settings settings,
const grasp_segment_t segment,
output_segment_general output,
const grasp_tile_dimensions_t tile_description,
int  ninversion 
)

Called by grasp_controller_call_inversion. It performs a processing of a segment

Parameters
settingsCurrent input settings
segmentCurrent segment to be processed
outputOutput obtained from retrieval
tile_descriptionDescription of current tile
ninversionNumber of current inversion used in print statements
Returns
error code. 0 if the process is ok.

◆ grasp_controller_read_settings()

int grasp_controller_read_settings ( int  argc,
char **  argv,
grasp_settings **  settings,
yamlsettings_parser_settings_file_mode  settings_file_mode 
)

Initilize, read and return settings from argc,argv parameters using settings module.

Parameters
argccount of total input arguments
argvvalue of input arguments from main call (command line)
Settingsstructure allocated and filled
Returns
0 if the process was successfull

◆ grasp_controller_segment_is_invertible()

bool grasp_controller_segment_is_invertible ( int  ninversion,
const grasp_settings settings,
const grasp_tile_dimensions_t tile_description 
)

This function check if a segment is an range of segments that will be retrieved and true will be returned if the segment have to be retrieved, otherwise it will return false

Parameters
ninversionNumber of current inversion
settingsCurrent settings
tile_descriptionDescription of current tile
Returns
true if it is invertible

Variable Documentation

◆ controller_stream

grasp_output_stream controller_stream