My Project
programmer's documentation
Typedefs | Enumerations | Functions | Variables
cs_time_moment.h File Reference
#include "cs_base.h"
#include "cs_field.h"
#include "cs_restart.h"
Include dependency graph for cs_time_moment.h:

Go to the source code of this file.

Typedefs

typedef void() cs_time_moment_data_t(const void *input, cs_real_t *vals)
 

Enumerations

enum  cs_time_moment_type_t { CS_TIME_MOMENT_MEAN, CS_TIME_MOMENT_VARIANCE }
 Moment type. More...
 
enum  cs_time_moment_restart_t { CS_TIME_MOMENT_RESTART_RESET, CS_TIME_MOMENT_RESTART_AUTO, CS_TIME_MOMENT_RESTART_EXACT }
 Moment restart behavior. More...
 

Functions

void cs_time_moment_destroy_all (void)
 Destroy all moments management metadata. More...
 
void cs_time_moment_map_cell_dt (const cs_real_t *dt)
 Map time step values array for temporal moments. More...
 
void cs_time_moment_update_all (void)
 Update all moment accumulators. More...
 
int cs_time_moment_is_active (int moment_id)
 Return 1 if moment is active, 0 if it is not active yet. More...
 
int cs_time_moment_define_by_field_ids (const char *name, int n_fields, const int field_id[], const int component_id[], cs_time_moment_type_t type, int nt_start, double t_start, cs_time_moment_restart_t restart_mode, const char *restart_name)
 Define a moment of a product of existing field components. More...
 
int cs_time_moment_define_by_func (const char *name, int location_id, int dim, cs_time_moment_data_t *data_func, const void *data_input, cs_time_moment_data_t *w_data_func, void *w_data_input, cs_time_moment_type_t type, int nt_start, double t_start, cs_time_moment_restart_t restart_mode, const char *restart_name)
 Define a moment whose data values will be computed using a specified function. More...
 
int cs_time_moment_n_moments (void)
 Return the number of defined time moments. More...
 
int cs_time_moment_n_moments_restart (void)
 Return the number of time moments in the restart file, if any. More...
 
void cs_time_moment_restart_options_by_id (int restart_id, cs_time_moment_restart_t *restart_mode, const char **restart_name)
 Define a moment restart mode and name by an id. More...
 
const char * cs_time_moment_restart_name (int restart_id)
 Return name of a given time moments in the restart file, if any (check also cs_time_moment_n_moments_restart). More...
 
cs_field_tcs_time_moment_get_field (int moment_id)
 Return pointer to field associated with a given moment. More...
 
void cs_time_moment_reset (int moment_id)
 Reset a time moment. More...
 
void cs_time_moment_log_setup (void)
 Log moment definition setup information. More...
 
void cs_time_moment_log_iteration (void)
 Log moment definition information for a given iteration. More...
 
void cs_time_moment_restart_use_main (int use_main)
 Indicate if restart API should use "main" instead of "auxiliary" file. More...
 
void cs_time_moment_restart_read (cs_restart_t *restart)
 Read restart moment data. More...
 
void cs_time_moment_restart_write (cs_restart_t *restart)
 Checkpoint moment data. More...
 

Variables

const char * cs_time_moment_type_name []
 

Typedef Documentation

◆ cs_time_moment_data_t

typedef void() cs_time_moment_data_t(const void *input, cs_real_t *vals)

Enumeration Type Documentation

◆ cs_time_moment_restart_t

Moment restart behavior.

Enumerator
CS_TIME_MOMENT_RESTART_RESET 

Moment is reset in case of a restart file: starting time step will be no older than the restart time step.

CS_TIME_MOMENT_RESTART_AUTO 

Moment uses restart information if available: if the requested time step is older than the restart time step, restart information will be used, though the starting time step is not guaranteed.

CS_TIME_MOMENT_RESTART_EXACT 

If the requested time step is older than the restart time step, restart information will be used, and if the start time step or time does not match the one available, an error is thrown.

◆ cs_time_moment_type_t

Moment type.

Enumerator
CS_TIME_MOMENT_MEAN 

Moment is a mean

CS_TIME_MOMENT_VARIANCE 

Moment is a variance

Function Documentation

◆ cs_time_moment_define_by_field_ids()

int cs_time_moment_define_by_field_ids ( const char *  name,
int  n_fields,
const int  field_id[],
const int  component_id[],
cs_time_moment_type_t  type,
int  nt_start,
double  t_start,
cs_time_moment_restart_t  restart_mode,
const char *  restart_name 
)

Define a moment of a product of existing field components.

Moments will involve the tensor products of their component fields, and only scalar, vector, or rank-2 tensors are handled (for post-processing output reasons), so a moment may not involve more than 2 vectors or 1 tensor, unless single components are specified.

If of dimension > 1, the moment array is always interleaved.

parameters: name <– name of associated moment n_fields <– number of associated fields field_id <– ids of associated fields component_id <– ids of matching field components (-1 for all) type <– moment type nt_start <– starting time step (or -1 to use t_start) t_start <– starting time restart_mode <– behavior in case of restart (reset, auto, or strict) restart_name <– if not NULL, previous name in case of restart

returns:

id of new moment in case of success, -1 in case of error.

Define a moment of a product of existing field components.

Moments will involve the tensor products of their component fields, and only scalar, vector, or rank-2 tensors are handled (for post-processing output reasons), so a moment may not involve more than 2 vectors or 1 tensor, unless single components are specified.

Parameters
[in]namename of associated moment
[in]n_fieldsnumber of associated fields
[in]field_idids of associated fields
[in]component_idids of matching field components (-1 for all)
[in]typemoment type
[in]nt_startstarting time step (or -1 to use t_start)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
[in]restart_nameif not NULL, previous name in case of restart
Returns
id of new moment in case of success, -1 in case of error.

◆ cs_time_moment_define_by_func()

int cs_time_moment_define_by_func ( const char *  name,
int  location_id,
int  dim,
cs_time_moment_data_t data_func,
const void *  data_input,
cs_time_moment_data_t w_data_func,
void *  w_data_input,
cs_time_moment_type_t  type,
int  nt_start,
double  t_start,
cs_time_moment_restart_t  restart_mode,
const char *  restart_name 
)

Define a moment whose data values will be computed using a specified function.

Parameters
[in]namename of associated moment
[in]location_idid of associated mesh location
[in]dimdimension associated with element data
[in]data_funcfunction used to define data values
[in]data_inputpointer to optional (untyped) value or structure to be used by data_func
[in]w_data_funcfunction used to define weight values
[in]w_data_inputpointer to optional (untyped) value or structure to be used by w_data_func
[in]typemoment type
[in]nt_startstarting time step (or -1 to use t_start)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
[in]restart_nameif not NULL, previous name in case of restart
Returns
id of new moment in case of success, -1 in case of error.

◆ cs_time_moment_destroy_all()

void cs_time_moment_destroy_all ( void  )

Destroy all moments management metadata.

◆ cs_time_moment_get_field()

cs_field_t* cs_time_moment_get_field ( int  moment_id)

Return pointer to field associated with a given moment.

For moments defined automatically to assist computation of higher order moments, which do not have an associated field, NULL is returned.

Parameters
[in]moment_idid of associated moment
Returns
pointer to field associated with given moment, or NULL

◆ cs_time_moment_is_active()

int cs_time_moment_is_active ( int  moment_id)

Return 1 if moment is active, 0 if it is not active yet.

Parameters
[in]moment_idid of associated moment
Returns
1 if moment is active, 0 if it is not active yet

◆ cs_time_moment_log_iteration()

void cs_time_moment_log_iteration ( void  )

Log moment definition information for a given iteration.

◆ cs_time_moment_log_setup()

void cs_time_moment_log_setup ( void  )

Log moment definition setup information.

◆ cs_time_moment_map_cell_dt()

void cs_time_moment_map_cell_dt ( const cs_real_t dt)

Map time step values array for temporal moments.

If this function is not called, the field referenced by field pointer CS_F_(dt) will be used instead.

Parameters
[in]dtpointer to time step values array

◆ cs_time_moment_n_moments()

int cs_time_moment_n_moments ( void  )

Return the number of defined time moments.

Returns
number of defined time moments

◆ cs_time_moment_n_moments_restart()

int cs_time_moment_n_moments_restart ( void  )

Return the number of time moments in the restart file, if any.

Returns
number of defined moments in restart file, or 0

◆ cs_time_moment_reset()

void cs_time_moment_reset ( int  moment_id)

Reset a time moment.

Parameters
[in]moment_idid of associated moment

◆ cs_time_moment_restart_name()

const char* cs_time_moment_restart_name ( int  restart_id)

Return name of a given time moments in the restart file, if any (check also cs_time_moment_n_moments_restart).

Parameters
[in]restart_idid of time moment in restart data
Returns
name of defined moment in restart file, or NULL

◆ cs_time_moment_restart_options_by_id()

void cs_time_moment_restart_options_by_id ( int  restart_id,
cs_time_moment_restart_t restart_mode,
const char **  restart_name 
)

Define a moment restart mode and name by an id.

This is a utility function, to allow simplification of automatic setups. It must be called just before defining a moment to work properly if restart_id < -1 (automatic mode).

Parameters
[in]restart_id-2: automatic, -1: reset, >= 0: id of matching moment in restart data
[out]restart_modematching restart mode
[out]restart_namematching restart name

◆ cs_time_moment_restart_read()

void cs_time_moment_restart_read ( cs_restart_t restart)

Read restart moment data.

Parameters
[in]restartassociated restart file pointer

◆ cs_time_moment_restart_use_main()

void cs_time_moment_restart_use_main ( int  use_main)

Indicate if restart API should use "main" instead of "auxiliary" file.

Parameters
[in]use_mainuse "main" restart if nonzero, "auxiliary" otherwise

◆ cs_time_moment_restart_write()

void cs_time_moment_restart_write ( cs_restart_t restart)

Checkpoint moment data.

Parameters
[in]restartassociated restart file pointer

◆ cs_time_moment_update_all()

void cs_time_moment_update_all ( void  )

Update all moment accumulators.

Variable Documentation

◆ cs_time_moment_type_name

const char* cs_time_moment_type_name[]