7.2
general documentation
cs_xdef.h File Reference
#include <string.h>
#include "cs_base.h"
#include "cs_boundary_zone.h"
#include "cs_param_types.h"
#include "cs_quadrature.h"
#include "cs_volume_zone.h"
+ Include dependency graph for cs_xdef.h:

Go to the source code of this file.

Data Structures

struct  cs_xdef_t
 Structure storing medata for defining a quantity in a very flexible way. More...
 
struct  cs_xdef_array_context_t
 Context structure when an array is used for the definition. More...
 
struct  cs_xdef_analytic_context_t
 Context structure when a definition by analytic function is used. More...
 
struct  cs_xdef_dof_context_t
 Context structure when a definition by DoF function is used. More...
 
struct  cs_xdef_time_func_context_t
 Context structure when a time step function is used for the definition. More...
 

Typedefs

typedef void *() cs_xdef_free_input_t(void *input)
 Destroy an input data structure. Complex data structure can be used when a cs_xdef_t structure is defined by an analytic function, a DoF function or a time function. Please refer to cs_xdef_analytic_context_t, cs_xdef_time_func_context_t or cs_xdef_dof_context_t. More...
 

Enumerations

enum  cs_xdef_type_t {
  CS_XDEF_BY_ANALYTIC_FUNCTION, CS_XDEF_BY_ARRAY, CS_XDEF_BY_DOF_FUNCTION, CS_XDEF_BY_FIELD,
  CS_XDEF_BY_FUNCTION, CS_XDEF_BY_QOV, CS_XDEF_BY_SUB_DEFINITIONS, CS_XDEF_BY_TIME_FUNCTION,
  CS_XDEF_BY_VALUE, CS_N_XDEF_TYPES
}
 
enum  cs_xdef_support_t { CS_XDEF_SUPPORT_TIME, CS_XDEF_SUPPORT_BOUNDARY, CS_XDEF_SUPPORT_VOLUME, CS_N_XDEF_SUPPORTS }
 

Functions

static int cs_get_vol_zone_id (const char *z_name)
 Retrieve the volume zone if from the zone name (If name = NULL or has an empty length, all entities are selected) More...
 
static int cs_get_bdy_zone_id (const char *z_name)
 Retrieve the boundary zone if from the zone name (If name = NULL or has an empty length, all entities are selected) More...
 
static cs_real_t cs_xdef_get_scalar_value (cs_xdef_t *def)
 Retrieve the value associated to the given definition. This should be a definition by value and the dimension should be equal to one. More...
 
static cs_real_tcs_xdef_get_array (cs_xdef_t *def)
 Retrieve the values associated to the given definition. This should be a definition by array. More...
 
cs_xdef_tcs_xdef_volume_create (cs_xdef_type_t type, int dim, int z_id, cs_flag_t state, cs_flag_t meta, void *context)
 Allocate and initialize a new cs_xdef_t structure based on volumic elements. More...
 
cs_xdef_tcs_xdef_boundary_create (cs_xdef_type_t type, int dim, int z_id, cs_flag_t state, cs_flag_t meta, void *context)
 Allocate and initialize a new cs_xdef_t structure based on boundary elements. More...
 
cs_xdef_tcs_xdef_timestep_create (cs_xdef_type_t type, cs_flag_t state, cs_flag_t meta, void *context)
 Allocate and initialize a new cs_xdef_t structure for setting the time step. More...
 
cs_xdef_tcs_xdef_free (cs_xdef_t *d)
 Free a cs_xdef_t structure. More...
 
cs_xdef_tcs_xdef_copy (cs_xdef_t *src)
 copy a cs_xdef_t structure More...
 
void cs_xdef_set_input_context (cs_xdef_t *d, void *input)
 In the case of a definition by an analytic function, a time function or a function relying on degrees of freedom (DoFs), this function allows one to set a more or less complex input data structure. This call should be done before the first evaluation call of the associated cs_xdef_t structure. More...
 
void cs_xdef_set_free_input_function (cs_xdef_t *d, cs_xdef_free_input_t *free_input)
 In case of a definition by an analytic function, a time function or a function relying on degrees of freedom (DoFs). One can set a function to free a complex input data structure (please refer to cs_xdef_free_input_t) for more details. More...
 
void cs_xdef_set_array (cs_xdef_t *d, bool is_owner, cs_real_t *array)
 In case of definition by array, set the array after having added this definition. More...
 
void cs_xdef_set_array_zone_id (cs_xdef_t *d, int z_id)
 In case of definition by array, set the zone id related to the size of the array. By default, the zone id is the same as the zone id related to the definition so that there is no need to call this function. More...
 
void cs_xdef_set_array_pointers (cs_xdef_t *d, const cs_lnum_t *index, const cs_lnum_t *ids)
 In case of definition by array, set the optional index and ids arrays that may be useful when operating on definitions by array. More...
 
void cs_xdef_set_quadrature (cs_xdef_t *d, cs_quadrature_type_t qtype)
 Set the type of quadrature to use for evaluating the given description. More...
 
cs_quadrature_type_t cs_xdef_get_quadrature (cs_xdef_t *d)
 Get the type of quadrature to use for evaluating the given description. More...
 
cs_xdef_type_t cs_xdef_get_type (const cs_xdef_t *d)
 Retrieve the flag dedicated to the state. More...
 
cs_flag_t cs_xdef_get_state_flag (const cs_xdef_t *d)
 Retrieve the flag dedicated to the state. More...
 
void cs_xdef_log_setup (const char *prefix, const cs_xdef_t *d)
 Output the settings related to a cs_xdef_t structure in the setup logging file. More...
 
void cs_xdef_log (cs_log_t log_type, const char *prefix, const cs_xdef_t *d)
 Output the settings related to a cs_xdef_t structure. More...
 
const char * cs_xdef_type_get_name (cs_xdef_type_t xdef_type)
 Retrieve a pointer to the cs_xdef_type's name string. More...
 

Typedef Documentation

◆ cs_xdef_free_input_t

typedef void*() cs_xdef_free_input_t(void *input)

Destroy an input data structure. Complex data structure can be used when a cs_xdef_t structure is defined by an analytic function, a DoF function or a time function. Please refer to cs_xdef_analytic_context_t, cs_xdef_time_func_context_t or cs_xdef_dof_context_t.

Parameters
[in,out]inputpointer to an input structure associated to a context structure
Returns
a NULL pointer

Enumeration Type Documentation

◆ cs_xdef_support_t

Enumerator
CS_XDEF_SUPPORT_TIME 

Definition for the time step. No zone is attached.

CS_XDEF_SUPPORT_BOUNDARY 

Definition for a boundary zone. Zones are attached to a list of boundary faces.

CS_XDEF_SUPPORT_VOLUME 

Definition for a volumic zone. Zones are attached to a list of cells.

CS_N_XDEF_SUPPORTS 

◆ cs_xdef_type_t

Enumerator
CS_XDEF_BY_ANALYTIC_FUNCTION 

Definition relying on a cs_analytic_func_t function pointer

CS_XDEF_BY_ARRAY 

Definition based on an array

CS_XDEF_BY_DOF_FUNCTION 

Definition relying on a cs_dof_func_t function pointer

CS_XDEF_BY_FIELD 

Definition based on a field (see cs_field_t)

CS_XDEF_BY_FUNCTION 

Definition relying on a generic user-defined function. TODO

CS_XDEF_BY_QOV 

QOV = Quantity Over a Volume Definition which enables to spread a given quantity inside a volume. Useful to initialized a tracer in a subdomain for instance.

CS_XDEF_BY_SUB_DEFINITIONS 

Definition relying on a combination of other CS_XDEF_*** This kind of definition is useful for the definition of a property as the product of two existing ones.

CS_XDEF_BY_TIME_FUNCTION 

Definition relying on a function for setting the time step (see cs_time_func_t)

CS_XDEF_BY_VALUE 

Simple definition by a constant value

CS_N_XDEF_TYPES 

Function Documentation

◆ cs_get_bdy_zone_id()

static int cs_get_bdy_zone_id ( const char *  z_name)
inlinestatic

Retrieve the boundary zone if from the zone name (If name = NULL or has an empty length, all entities are selected)

Parameters
[in]z_namename of the zone
Returns
the id of the related zone

◆ cs_get_vol_zone_id()

static int cs_get_vol_zone_id ( const char *  z_name)
inlinestatic

Retrieve the volume zone if from the zone name (If name = NULL or has an empty length, all entities are selected)

Parameters
[in]z_namename of the zone
Returns
the id of the related zone

◆ cs_xdef_boundary_create()

cs_xdef_t* cs_xdef_boundary_create ( cs_xdef_type_t  type,
int  dim,
int  z_id,
cs_flag_t  state,
cs_flag_t  meta,
void *  context 
)

Allocate and initialize a new cs_xdef_t structure based on boundary elements.

Parameters
[in]typetype of definition
[in]dimdimension of the values to define
[in]z_idvolume zone id
[in]stateflag to know if this uniform, cellwise, steady...
[in]metametadata associated to this description
[in]contextpointer to a structure
Returns
a pointer to the new cs_xdef_t structure

◆ cs_xdef_copy()

cs_xdef_t* cs_xdef_copy ( cs_xdef_t src)

copy a cs_xdef_t structure

Parameters
[in]srcpointer to a cs_xdef_t structure to copy
Returns
a pointer to a new allocated cs_xdef_t structure

◆ cs_xdef_free()

cs_xdef_t* cs_xdef_free ( cs_xdef_t d)

Free a cs_xdef_t structure.

Parameters
[in,out]dpointer to a cs_xdef_t structure
Returns
NULL

◆ cs_xdef_get_array()

static cs_real_t* cs_xdef_get_array ( cs_xdef_t def)
inlinestatic

Retrieve the values associated to the given definition. This should be a definition by array.

Parameters
[in]defpointer to a cs_xdef_t structure
Returns
the pointer to the array of values

◆ cs_xdef_get_quadrature()

cs_quadrature_type_t cs_xdef_get_quadrature ( cs_xdef_t d)

Get the type of quadrature to use for evaluating the given description.

Parameters
[in]dpointer to a cs_xdef_t structure
Returns
the type of quadrature

◆ cs_xdef_get_scalar_value()

static cs_real_t cs_xdef_get_scalar_value ( cs_xdef_t def)
inlinestatic

Retrieve the value associated to the given definition. This should be a definition by value and the dimension should be equal to one.

Parameters
[in]defpointer to a cs_xdef_t structure
Returns
the value of the definition

◆ cs_xdef_get_state_flag()

cs_flag_t cs_xdef_get_state_flag ( const cs_xdef_t d)

Retrieve the flag dedicated to the state.

Parameters
[in]dpointer to a cs_xdef_t structure
Returns
the value of the flag

◆ cs_xdef_get_type()

cs_xdef_type_t cs_xdef_get_type ( const cs_xdef_t d)

Retrieve the flag dedicated to the state.

Parameters
[in]dpointer to a cs_xdef_t structure
Returns
the value of the flag

◆ cs_xdef_log()

void cs_xdef_log ( cs_log_t  log_type,
const char *  prefix,
const cs_xdef_t d 
)

Output the settings related to a cs_xdef_t structure.

Parameters
[in]log_typerelated log file to consider
[in]prefixoptional string
[in]dpointer to a cs_xdef_t structure

◆ cs_xdef_log_setup()

void cs_xdef_log_setup ( const char *  prefix,
const cs_xdef_t d 
)

Output the settings related to a cs_xdef_t structure in the setup logging file.

Parameters
[in]prefixoptional string
[in]dpointer to a cs_xdef_t structure

◆ cs_xdef_set_array()

void cs_xdef_set_array ( cs_xdef_t d,
bool  is_owner,
cs_real_t array 
)

In case of definition by array, set the array after having added this definition.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]is_ownermanage or not the lifecycle of the array values
[in]arrayvalues

◆ cs_xdef_set_array_pointers()

void cs_xdef_set_array_pointers ( cs_xdef_t d,
const cs_lnum_t index,
const cs_lnum_t ids 
)

In case of definition by array, set the optional index and ids arrays that may be useful when operating on definitions by array.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]indexoptional pointer to an array of index values
[in]idsoptional pointer to a list of entity ids

◆ cs_xdef_set_array_zone_id()

void cs_xdef_set_array_zone_id ( cs_xdef_t d,
int  z_id 
)

In case of definition by array, set the zone id related to the size of the array. By default, the zone id is the same as the zone id related to the definition so that there is no need to call this function.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]z_idzone id associated to the array size

◆ cs_xdef_set_free_input_function()

void cs_xdef_set_free_input_function ( cs_xdef_t d,
cs_xdef_free_input_t free_input 
)

In case of a definition by an analytic function, a time function or a function relying on degrees of freedom (DoFs). One can set a function to free a complex input data structure (please refer to cs_xdef_free_input_t) for more details.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]free_inputpointer to a function which free the input structure

◆ cs_xdef_set_input_context()

void cs_xdef_set_input_context ( cs_xdef_t d,
void *  input 
)

In the case of a definition by an analytic function, a time function or a function relying on degrees of freedom (DoFs), this function allows one to set a more or less complex input data structure. This call should be done before the first evaluation call of the associated cs_xdef_t structure.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]inputpointer to an input structure

◆ cs_xdef_set_quadrature()

void cs_xdef_set_quadrature ( cs_xdef_t d,
cs_quadrature_type_t  qtype 
)

Set the type of quadrature to use for evaluating the given description.

Parameters
[in,out]dpointer to a cs_xdef_t structure
[in]qtypetype of quadrature

◆ cs_xdef_timestep_create()

cs_xdef_t* cs_xdef_timestep_create ( cs_xdef_type_t  type,
cs_flag_t  state,
cs_flag_t  meta,
void *  context 
)

Allocate and initialize a new cs_xdef_t structure for setting the time step.

Parameters
[in]typetype of definition
[in]stateflag to know if this uniform, cellwise, steady...
[in]metametadata associated to this description
[in]contextpointer to a structure storing the parameters (cast on-the-fly according to the type of definition)
Returns
a pointer to the new cs_xdef_t structure

◆ cs_xdef_type_get_name()

const char* cs_xdef_type_get_name ( cs_xdef_type_t  xdef_type)

Retrieve a pointer to the cs_xdef_type's name string.

Parameters
[in]xdef_typetype to query
Returns
a pointer to mathing name string

◆ cs_xdef_volume_create()

cs_xdef_t* cs_xdef_volume_create ( cs_xdef_type_t  type,
int  dim,
int  z_id,
cs_flag_t  state,
cs_flag_t  meta,
void *  context 
)

Allocate and initialize a new cs_xdef_t structure based on volumic elements.

Parameters
[in]typetype of definition
[in]dimdimension of the values to define
[in]z_idvolume zone id
[in]stateflag to know if this uniform, cellwise, steady...
[in]metametadata associated to this description
[in]contextpointer to a structure
Returns
a pointer to the new cs_xdef_t structure