9.0
general documentation
Loading...
Searching...
No Matches
cs_time_table.h File Reference
#include "base/cs_defs.h"
#include "base/cs_time_step.h"
Include dependency graph for cs_time_table.h:

Go to the source code of this file.

Functions

int cs_time_table_column_id_by_name (const cs_time_table_t *table, const char *name)
 Get column id corresponding to a given header/label.
cs_time_table_t * cs_time_table_by_name_try (const char *name)
 Try to get time table based on name.
cs_time_table_t * cs_time_table_by_name (const char *name)
 Get time table based on name.
void cs_time_table_set_offset (cs_time_table_t *table, cs_real_t time_offset)
 Set time offset value for a time table.
void cs_time_table_set_headers (cs_time_table_t *table, const int n_headers, const char **headers)
 Set headers labels for a time table. Number of headers needs to be equal to the number of columns, otherwise an error is raised.
cs_time_table_t * cs_time_table_from_csv_file (const char *name, const char *file_name, const char *separator, const int n_headers, const int n_columns, const int *col_idx, const bool ignore_missing_tokens)
 Define a time table from a CSV file.
cs_time_table_t * cs_time_table_from_csv_file_simple (const char *name, const char *file_name, const char *separator)
 Define a time table from a CSV file. We suppose that all columns are to be read, no headers line to skip and that missing tokens are to be ignored.
cs_time_table_t * cs_time_table_from_csv_file_simple_headers (const char *name, const char *file_name, const char *separator, const int n_headers)
 Define a time table from a CSV file. We suppose that all columns are to be read and that missing tokens are to be ignored.
void cs_time_table_set_time_col_id (cs_time_table_t *table, const int col_id)
 Define the column id for time based on an index.
void cs_time_table_set_time_from_label (cs_time_table_t *table, const char *time_label)
 Define the column id for time based on a label.
void cs_time_table_reset_position (cs_time_table_t *table)
 Reset time table time value (force search from beginning of table).
void cs_time_table_update_position (cs_time_table_t *table, cs_real_t time, bool reset_time_value)
 Update time coefficients used for data interpolation.
cs_real_t cs_time_table_compute_time_value (const char *name, cs_real_t t, const int col, bool overwrite_prev)
 Compute value using a given abscissa and a specific column.
cs_real_t cs_time_table_compute_time_value_by_label (const char *name, cs_real_t t, const char *label, bool overwrite_prev)
 Compute value using a given abscissa and a label.
void cs_time_table_compute_n_time_values (const char *name, cs_real_t t, const int n_cols, const int cols[], bool overwrite_prev, cs_real_t *retvals)
 Compute values for several columns of a time table for a given abscissa.
void cs_time_table_compute_n_time_values_by_label (const char *name, cs_real_t t, const int n_cols, const char *labels[], bool overwrite_prev, cs_real_t *retvals)
 Compute values for several columns of a time table for a given abscissa.
static cs_real_t CS_TIME_TABLE (const char *name, const char *label)
 Compute value from time table based on label and current time. Positions are not updated for the table.
int cs_time_table_get_n_rows (const char *name)
 Extract n_rows from cs_time_table_t structure.
int cs_time_table_get_n_cols (const char *name)
 Extract n_cols from cs_time_table_t structure.
const cs_real_t ** cs_time_table_get_data (const char *name)
 Return pointer to table data.
void cs_time_table_destroy_all (void)
 Free all data structures related to datasets.

Function Documentation

◆ CS_TIME_TABLE()

cs_real_t CS_TIME_TABLE ( const char * name,
const char * label )
inlinestatic

Compute value from time table based on label and current time. Positions are not updated for the table.

Parameters
[in]nameName of the used time table
[in]labelLabel of column used for computation
Returns
Interpolated value

◆ cs_time_table_by_name()

cs_time_table_t * cs_time_table_by_name ( const char * name)

Get time table based on name.

Parameters
[in]nameName of time table
Returns
pointer to time table, raises error if not found.

◆ cs_time_table_by_name_try()

cs_time_table_t * cs_time_table_by_name_try ( const char * name)

Try to get time table based on name.

Parameters
[in]nameName of time table
Returns
pointer to time table, NULL if not found.
Parameters
[in]nameName of time table
Returns
pointer to time table, null if not found.

◆ cs_time_table_column_id_by_name()

int cs_time_table_column_id_by_name ( const cs_time_table_t * table,
const char * name )

Get column id corresponding to a given header/label.

Parameters
[in]tablepointer to time table
[in]namename of the header/column
Returns
index of the corresponding column. -1 if not found.

◆ cs_time_table_compute_n_time_values()

void cs_time_table_compute_n_time_values ( const char * name,
cs_real_t t,
const int n_cols,
const int cols[],
bool overwrite_prev,
cs_real_t * retvals )

Compute values for several columns of a time table for a given abscissa.

Parameters
[in]nameName of the time table to use
[in]tTime for which we seek values
[in]n_colsNumber of values to compute
[in]colsArray with the indices of columns for computation
[in]overwrite_prevStart search of value using first value
[out]retvalsArray of output values

◆ cs_time_table_compute_n_time_values_by_label()

void cs_time_table_compute_n_time_values_by_label ( const char * name,
cs_real_t t,
const int n_cols,
const char * labels[],
bool overwrite_prev,
cs_real_t * retvals )

Compute values for several columns of a time table for a given abscissa.

Parameters
[in]nameName of the time table to use
[in]tTime for which we seek values
[in]n_colsNumber of values to compute
[in]labelsArray with the labels of columns for computation
[in]overwrite_prevStart search of value using first value
[out]retvalsArray of output values

◆ cs_time_table_compute_time_value()

cs_real_t cs_time_table_compute_time_value ( const char * name,
cs_real_t t,
const int col,
bool overwrite_prev )

Compute value using a given abscissa and a specific column.

Parameters
[in]nameName of the used time table
[in]tTime for which we seek values
[in]colIndex of column used for computation
[in]overwrite_prevStart search of value using first value
Returns
Interpolated value

◆ cs_time_table_compute_time_value_by_label()

cs_real_t cs_time_table_compute_time_value_by_label ( const char * name,
cs_real_t t,
const char * label,
bool overwrite_prev )

Compute value using a given abscissa and a label.

Parameters
[in]nameName of the used time table
[in]tTime for which we seek values
[in]labelLabel of column used for computation
[in]overwrite_prevStart search of value using first value
Returns
Interpolated value

◆ cs_time_table_destroy_all()

void cs_time_table_destroy_all ( void )

Free all data structures related to datasets.

◆ cs_time_table_from_csv_file()

cs_time_table_t * cs_time_table_from_csv_file ( const char * name,
const char * file_name,
const char * separator,
const int n_headers,
const int n_columns,
const int * col_idx,
const bool ignore_missing_tokens )

Define a time table from a CSV file.

Parameters
[in]nameName of the table to be created
[in]file_namePath to CSV file
[in]separatorSeparator used in the CSV file
[in]n_headersNumber of header lines to be ignored during parsing
[in]n_columnsNumber of columns to read. -1 for all
[in]col_idxArray containing indexes of columns to read if n_columns != -1
[in]ignore_missing_tokensShould we ignore missing tokens
Returns
pointer to newly created time table

◆ cs_time_table_from_csv_file_simple()

cs_time_table_t * cs_time_table_from_csv_file_simple ( const char * name,
const char * file_name,
const char * separator )

Define a time table from a CSV file. We suppose that all columns are to be read, no headers line to skip and that missing tokens are to be ignored.

Parameters
[in]nameName of the table to be created
[in]file_namePath to CSV file
[in]separatorSeparator used in the CSV file
Returns
pointer to newly created time table

◆ cs_time_table_from_csv_file_simple_headers()

cs_time_table_t * cs_time_table_from_csv_file_simple_headers ( const char * name,
const char * file_name,
const char * separator,
const int n_headers )

Define a time table from a CSV file. We suppose that all columns are to be read and that missing tokens are to be ignored.

Parameters
[in]nameName of the table to be created
[in]file_namePath to CSV file
[in]separatorSeparator used in the CSV file
[in]n_headersNumber of header lines to be ignored during parsing
Returns
pointer to newly created time table

◆ cs_time_table_get_data()

const cs_real_t ** cs_time_table_get_data ( const char * name)

Return pointer to table data.

Parameters
[in]nameName of the time table to use
[out]retvalsArray of output values

◆ cs_time_table_get_n_cols()

int cs_time_table_get_n_cols ( const char * name)

Extract n_cols from cs_time_table_t structure.

Parameters
[in]nameName of the time table to use

◆ cs_time_table_get_n_rows()

int cs_time_table_get_n_rows ( const char * name)

Extract n_rows from cs_time_table_t structure.

Parameters
[in]nameName of the time table to use

◆ cs_time_table_reset_position()

void cs_time_table_reset_position ( cs_time_table_t * table)

Reset time table time value (force search from beginning of table).

Parameters
[in]tablePointer to time table structure

◆ cs_time_table_set_headers()

void cs_time_table_set_headers ( cs_time_table_t * table,
const int n_headers,
const char ** headers )

Set headers labels for a time table. Number of headers needs to be equal to the number of columns, otherwise an error is raised.

Parameters
[in]tablePointer to time table structure
[in]n_headersNumber of headers to define
[in]headersArray of headers strings

◆ cs_time_table_set_offset()

void cs_time_table_set_offset ( cs_time_table_t * table,
cs_real_t time_offset )

Set time offset value for a time table.

Parameters
[in]tablePointer to time table structure
[in]time_offsetValue of time offset for the table.

◆ cs_time_table_set_time_col_id()

void cs_time_table_set_time_col_id ( cs_time_table_t * table,
const int col_id )

Define the column id for time based on an index.

Parameters
[in]tablePointer to time table structure
[in]col_idIndex of column which is to be used as time

◆ cs_time_table_set_time_from_label()

void cs_time_table_set_time_from_label ( cs_time_table_t * table,
const char * time_label )

Define the column id for time based on a label.

Parameters
[in]tablePointer to time table structure
[in]time_labelLabel to identify index of column which is to be used as time
[in]tablePointer to time table structure
[in]time_labelLabel to identify index of column used as time

◆ cs_time_table_update_position()

void cs_time_table_update_position ( cs_time_table_t * table,
cs_real_t time,
bool reset_time_value )

Update time coefficients used for data interpolation.

Parameters
[in]tablePointer to time table structure
[in]timeTime value
[in]reset_time_valueReset current time value (bool)