programmer's documentation
Macros | Enumerations | Functions | Variables
cs_property.c File Reference
#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_reco.h"
#include "cs_property.h"
Include dependency graph for cs_property.c:

Macros

#define CS_PROPERTY_DBG   1
 

Enumerations

enum  ptykey_t { PTYKEY_POST_FREQ, PTYKEY_ERROR }
 

Functions

static const char * _print_ptykey (ptykey_t key)
 Print the name of the corresponding property key. More...
 
static ptykey_t _get_ptykey (const char *keyname)
 Get the corresponding enum from the name of a property key. If not found, return a key error. More...
 
cs_property_t * cs_property_create (const char *name, const char *key_type, const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
 Create and initialize a new property structure. More...
 
cs_property_t * cs_property_free (cs_property_t *pty)
 Free a cs_property_t structure. More...
 
bool cs_property_check_name (const cs_property_t *pty, const char *ref_name)
 Check if the given property has the name ref_name. More...
 
bool cs_property_is_uniform (const cs_property_t *pty)
 returns true if the property is uniform, otherwise false More...
 
const char * cs_property_get_name (const cs_property_t *pty)
 Retrieve the name of a property. More...
 
void cs_property_summary (const cs_property_t *pty)
 Print a summary of a cs_property_t structure. More...
 
void cs_property_set_value (cs_property_t *pty, const double val[])
 Set the value of a property attached to a cs_property_t structure. More...
 
void cs_property_def_by_value (cs_property_t *pty, const char *val)
 Define the value of a cs_property_t structure. More...
 
void cs_property_def_by_analytic (cs_property_t *pty, cs_analytic_func_t *func)
 Define a cs_property_t structure thanks to an analytic function. More...
 
void cs_property_def_by_law (cs_property_t *pty, cs_onevar_law_func_t *func)
 Define a cs_property_t structure thanks to a law function. More...
 
void cs_property_set_array (cs_property_t *pty, cs_flag_t array_flag, const cs_real_t *array)
 Set "array" members of a cs_property_t structure. More...
 
void cs_property_set_struct (cs_property_t *pty, const void *structure)
 Set "array" members of a cs_property_t structure. More...
 
void cs_property_set_option (cs_property_t *pty, const char *keyname, const char *keyval)
 Set optional parameters related to a cs_property_t structure. More...
 
void cs_property_get_cell_tensor (cs_lnum_t c_id, const cs_property_t *pty, bool do_inversion, cs_real_3_t *tensor)
 Compute the value of the tensor attached a property at the cell center. More...
 
cs_real_t cs_property_get_cell_value (cs_lnum_t c_id, const cs_property_t *pty)
 Compute the value of a property at the cell center. More...
 

Variables

static const char _err_empty_pty []
 
static const cs_flag_t cs_var_support_pc
 
static const cs_flag_t cs_var_support_pv
 

Macro Definition Documentation

#define CS_PROPERTY_DBG   1

Enumeration Type Documentation

enum ptykey_t
Enumerator
PTYKEY_POST_FREQ 
PTYKEY_ERROR 

Function Documentation

static ptykey_t _get_ptykey ( const char *  keyname)
static

Get the corresponding enum from the name of a property key. If not found, return a key error.

Parameters
[in]keynamename of the key
Returns
a ptykey_t
static const char* _print_ptykey ( ptykey_t  key)
static

Print the name of the corresponding property key.

Parameters
[in]keyname of the key
Returns
a string
bool cs_property_check_name ( const cs_property_t *  pty,
const char *  ref_name 
)

Check if the given property has the name ref_name.

Parameters
[in]ptypointer to a cs_property_t structure to test
[in]ref_namename of the property to find
Returns
true if the name of the property is ref_name otherwise false
cs_property_t* cs_property_create ( const char *  name,
const char *  key_type,
const cs_cdo_quantities_t cdoq,
const cs_cdo_connect_t connect,
const cs_time_step_t time_step 
)

Create and initialize a new property structure.

Parameters
[in]namename of the property
[in]key_typekeyname of the type of property
[in]cdoqpointer to a cs_cdo_quantities_t struct.
[in]connectpointer to a cs_cdo_connect_t struct.
[in]time_steppointer to a cs_time_step_t struct.
Returns
a pointer to a new allocated cs_property_t structure
void cs_property_def_by_analytic ( cs_property_t *  pty,
cs_analytic_func_t func 
)

Define a cs_property_t structure thanks to an analytic function.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]funcpointer to a function
void cs_property_def_by_law ( cs_property_t *  pty,
cs_onevar_law_func_t func 
)

Define a cs_property_t structure thanks to a law function.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]funcpointer to a function
void cs_property_def_by_value ( cs_property_t *  pty,
const char *  val 
)

Define the value of a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]keyvalaccessor to the value to set
cs_property_t* cs_property_free ( cs_property_t *  pty)

Free a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure to free
Returns
a NULL pointer
void cs_property_get_cell_tensor ( cs_lnum_t  c_id,
const cs_property_t *  pty,
bool  do_inversion,
cs_real_3_t tensor 
)

Compute the value of the tensor attached a property at the cell center.

Parameters
[in]c_idid of the current cell
[in]ptypointer to a cs_property_t structure
[in]do_inversiontrue or false
[in,out]tensor3x3 matrix
cs_real_t cs_property_get_cell_value ( cs_lnum_t  c_id,
const cs_property_t *  pty 
)

Compute the value of a property at the cell center.

Parameters
[in]c_idid of the current cell
[in]ptypointer to a cs_property_t structure
Returns
the value of the property for the given cell
const char* cs_property_get_name ( const cs_property_t *  pty)

Retrieve the name of a property.

Parameters
[in]ptypointer to a property
Returns
the name of the related property
bool cs_property_is_uniform ( const cs_property_t *  pty)

returns true if the property is uniform, otherwise false

Parameters
[in]ptypointer to a property to test
Returns
true or false
void cs_property_set_array ( cs_property_t *  pty,
cs_flag_t  array_flag,
const cs_real_t array 
)

Set "array" members of a cs_property_t structure.

Set members of a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]array_flaginformation on the support of the array
[in]arraypointer to an array of values
void cs_property_set_option ( cs_property_t *  pty,
const char *  keyname,
const char *  keyval 
)

Set optional parameters related to a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]keynamename of key related to the member of pty to set
[in]keyvalaccessor to the value to set
void cs_property_set_struct ( cs_property_t *  pty,
const void *  structure 
)

Set "array" members of a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]structurestructure to associate to this property
void cs_property_set_value ( cs_property_t *  pty,
const double  val[] 
)

Set the value of a property attached to a cs_property_t structure.

Parameters
[in,out]ptypointer to a cs_property_t structure
[in]valpointer to an array of double
void cs_property_summary ( const cs_property_t *  pty)

Print a summary of a cs_property_t structure.

Parameters
[in]ptypointer to a cs_property_t structure to summarize

Variable Documentation

const char _err_empty_pty[]
static
Initial value:
=
" Stop setting an empty cs_property_t structure.\n"
" Please check your settings.\n"
const cs_flag_t cs_var_support_pc
static
Initial value:
=
#define CS_PARAM_FLAG_CELL
Definition: cs_param.h:53
#define CS_PARAM_FLAG_PRIMAL
Definition: cs_param.h:54
const cs_flag_t cs_var_support_pv
static
Initial value:
=
#define CS_PARAM_FLAG_VERTEX
Definition: cs_param.h:50
#define CS_PARAM_FLAG_PRIMAL
Definition: cs_param.h:54