8.0
general documentation
cs_function.h File Reference
#include "cs_defs.h"
#include "cs_mesh_location.h"
#include "cs_param_types.h"
#include "cs_restart_default.h"
+ Include dependency graph for cs_function.h:

Go to the source code of this file.

Data Structures

struct  cs_function_t
 

Macros

#define CS_FUNCTION_INTENSIVE   (1 << 0)
 
#define CS_FUNCTION_EXTENSIVE   (1 << 1)
 
#define CS_FUNCTION_TIME_INDEPENDENT   (1 << 2)
 
#define CS_FUNCTION_USER   (1 << 3)
 

Typedefs

typedef void() cs_eval_at_location_t(int location_id, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, void *input, void *vals)
 Function pointer for evaluation of local function values. More...
 

Functions

cs_function_tcs_function_define_by_func (const char *name, int location_id, int dim, bool is_intensive, cs_datatype_t datatype, cs_eval_at_location_t *data_func, void *data_input)
 Define a function whose data values will be computed using the provided evaluation function. More...
 
cs_function_tcs_function_define_by_analytic_func (const char *name, int location_id, int dim, bool is_intensive, cs_analytic_func_t *data_func, void *data_input)
 Define a function whose data values will be computed using the provided "degree of freedom" type evaluation function. More...
 
cs_function_tcs_function_define_by_dof_func (const char *name, int location_id, int dim, bool is_intensive, cs_dof_func_t *data_func, void *data_input)
 Define a function whose data values will be computed using the provided "degree of freedom" type evaluation function. More...
 
void cs_function_destroy_all (void)
 Destroy all functions management metadata. More...
 
int cs_function_n_functions (void)
 Return the number of defined functions. More...
 
cs_function_tcs_function_by_id (int id)
 Return a pointer to a function object based on its id. More...
 
cs_function_tcs_function_by_name (const char *name)
 Return a pointer to a function object based on its name. More...
 
cs_function_tcs_function_by_name_try (const char *name)
 Return a pointer to a function object based on its name if present. More...
 
void cs_function_set_label (cs_function_t *f, const char *label)
 Assig a label to a function object. More...
 
void cs_function_log_defs (void)
 Log function definition setup information. More...
 
void cs_function_log_all_settings (void)
 Print info relative to all given function object settings to log file. More...
 
void cs_function_evaluate (const cs_function_t *f, const cs_time_step_t *ts, int location_id, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, void *vals)
 Evaluate function values. More...
 

Typedef Documentation

◆ cs_eval_at_location_t

typedef void() cs_eval_at_location_t(int location_id, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, void *input, void *vals)

Function pointer for evaluation of local function values.

If the matching values are multidimensional, they must be interleaved. The output values are assumed to use a dense storage (i.e. of size n_elts *

for the associated data type, in the same order as elt_ids if present.)

Note: if the input pointer is non-NULL, it must point to valid data when the selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • when a single integer identifier is needed, the input pointer can be set to that value instead of an actual address;
Parameters
[in]location_idbase associated mesh location id
[in]n_eltsnumber of associated elements
[in]elt_idsids of associated elements, or NULL if no filtering is required
[in,out]inputpointer to optional (untyped) value or structure.
[in,out]valspointer to output values (size: n_elts*dimension)

Function Documentation

◆ cs_function_by_id()

cs_function_t* cs_function_by_id ( int  id)

Return a pointer to a function object based on its id.

This function requires that a function of the given id is defined.

Parameters
[in]idfunction id
Returns
pointer to the function structure

◆ cs_function_by_name()

cs_function_t* cs_function_by_name ( const char *  name)

Return a pointer to a function object based on its name.

This function requires that a function of the given name is defined.

Parameters
[in]namefunction name
Returns
pointer to the function structure

◆ cs_function_by_name_try()

cs_function_t* cs_function_by_name_try ( const char *  name)

Return a pointer to a function object based on its name if present.

If no function of the given name is defined, NULL is returned.

Parameters
[in]namefunction name
Returns
pointer to the function structure, or NULL

◆ cs_function_define_by_analytic_func()

cs_function_t* cs_function_define_by_analytic_func ( const char *  name,
int  location_id,
int  dim,
bool  is_intensive,
cs_analytic_func_t data_func,
void *  data_input 
)

Define a function whose data values will be computed using the provided "degree of freedom" type evaluation function.

The provided function and optional associated input is of the same form as and may be shared with some boundary condition or property definitions.

Parameters
[in]namename of associated function
[in]location_idid of associated mesh location
[in]dimdimension associated with element data
[in]is_intensiveis the function intensive?
[in]data_funcfunction used to define data values
[in]data_inputpointer to optional (untyped) value or structure to be used by data_func
Returns
pointer to the associated function object in case of success, or NULL in case of error

◆ cs_function_define_by_dof_func()

cs_function_t* cs_function_define_by_dof_func ( const char *  name,
int  location_id,
int  dim,
bool  is_intensive,
cs_dof_func_t data_func,
void *  data_input 
)

Define a function whose data values will be computed using the provided "degree of freedom" type evaluation function.

The provided function and optional associated input is of the same form as and may be shared with some boundary condition or property definitions.

Parameters
[in]namename of associated function
[in]location_idid of associated mesh location
[in]dimdimension associated with element data
[in]is_intensiveis the function intensive?
[in]data_funcfunction used to define data values
[in]data_inputpointer to optional (untyped) value or structure to be used by data_func
Returns
pointer to the associated function object in case of success, or NULL in case of error

◆ cs_function_define_by_func()

cs_function_t* cs_function_define_by_func ( const char *  name,
int  location_id,
int  dim,
bool  is_intensive,
cs_datatype_t  datatype,
cs_eval_at_location_t data_func,
void *  data_input 
)

Define a function whose data values will be computed using the provided evaluation function.

If of dimension > 1, the evaluated values are always interleaved.

Parameters
[in]namename of associated function
[in]location_idid of associated mesh location
[in]dimdimension associated with element data
[in]is_intensiveis the function intensive?
[in]datatypeassociated data values type
[in]data_funcfunction used to define data values
[in]data_inputpointer to optional (untyped) value or structure to be used by data_func
Returns
pointer to the associated function object in case of success, or NULL in case of error

◆ cs_function_destroy_all()

void cs_function_destroy_all ( void  )

Destroy all functions management metadata.

◆ cs_function_evaluate()

void cs_function_evaluate ( const cs_function_t f,
const cs_time_step_t ts,
int  location_id,
cs_lnum_t  n_elts,
const cs_lnum_t elt_ids,
void *  vals 
)

Evaluate function values.

If the matching values are multidimensional, they must be interleaved. The output values are assumed to use a dense storage (i.e. of size n_elts *

for the associated data type, in the same order as elt_ids if present.)

Parameters
[in]fpointer to associated function handle
[in]location_idbase associated mesh location id
[in]n_eltsnumber of associated elements
[in]elt_idsids of associated elements, or NULL if no filtering is required
[in,out]valspointer to output values (size: n_elts*dimension)

◆ cs_function_log_all_settings()

void cs_function_log_all_settings ( void  )

Print info relative to all given function object settings to log file.

◆ cs_function_log_defs()

void cs_function_log_defs ( void  )

Log function definition setup information.

◆ cs_function_n_functions()

int cs_function_n_functions ( void  )

Return the number of defined functions.

Returns
number of defined functions

◆ cs_function_set_label()

void cs_function_set_label ( cs_function_t f,
const char *  label 
)

Assig a label to a function object.

Parameters
[in,out]fpointer to associated function handle
[in]labelassociated label