#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "grasp_controller.h"
#include "grasp_mpi_engine.h"
#include "yamlsettings/yamlsettings.h"
#include "../input/grasp_input.h"
#include "../output/grasp_output.h"
#include "../settings/grasp_settings.h"
#include <grasp/utils.h>
#include "mo_grasp_controller.h"
#include "../input/grasp_input_load_functions.h"
#include "../output/grasp_output_load_function.h"
#include "../settings/grasp_settings_data_types.h"
#include "../output/grasp_output_stream.h"
#include "../global/grasp_compilation_information.h"
#include "../global/grasp_runtime_information.h"
#include "../global/grasp_error_codes.h"
#include "grasp_controller_iteration_callback.h"
Variables | |
grasp_output_stream | controller_stream |
grasp_output_stream | controller_trackmem_stream |
Function Documentation
◆ already_initialized()
bool already_initialized | ( | int | n, |
char | already_in_use[GRASP_MAX_OUTPUT_FUNC][_GBL_FILE_PATH_LEN], | ||
char * | current_function | ||
) |
◆ 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
-
settings Current input settings tile_description Current tile description results Output results obtained from all retrievals functions Extension 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_description current tile description iinversion number 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
-
settings current settings structure tile_description current tile description functions extension 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
-
settings Current settings structure filled tile_description Tile description which will be updated functions extension functions structure which will be initialize and updated results grasp 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
-
settings Current settings structure tile_description Current description of the tile results Result structure will be filled with results from retrievals functions extension functions will be called during the process
- Returns
- negative if error otherwise 0 or positive.
◆ 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
-
settings Current settings structure tile_description Current description of the tile results Result structure will be filled with results from retrievals functions extension functions will be called during the process segments It 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
-
settings Current input settings tile_description Current tile description results Result structure with all output from retrievals functions Output 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
-
settings Current input segment segment Segment which has been processed output Output obtained from the retrieval algorithm tile_description Current tile description results Result structure where output will be included functions Extension 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
-
settings Settings 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
-
settings Current input settings segment Current segment to be processed output Output obtained from retrieval tile_description Description of current tile ninversion Number 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
-
argc count of total input arguments argv value of input arguments from main call (command line) Settings structure 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
-
ninversion Number of current inversion settings Current settings tile_description Description of current tile
- Returns
- true if it is invertible
Variable Documentation
◆ controller_stream
grasp_output_stream controller_stream |
◆ controller_trackmem_stream
grasp_output_stream controller_trackmem_stream |