#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <float.h>
#include <bft_mem.h>
#include "cs_array.h"
#include "cs_array_reduce.h"
#include "cs_halo.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_parall.h"
#include "cs_range_set.h"
#include "cs_volume_zone.h"
#include "cs_quadrature.h"
#include "cs_evaluate.h"
Functions | |
void | cs_evaluate_init_sharing (const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_mesh_t *mesh) |
Set shared pointers to main domain members. More... | |
void | cs_evaluate_array_reduction (int dim, cs_lnum_t n_x, const cs_real_t *array, const cs_real_t *w_x, cs_real_t *min, cs_real_t *max, cs_real_t *wsum, cs_real_t *asum, cs_real_t *ssum) |
Compute reduced quantities for an array of size equal to dim * n_x The computed quantities are synchronized in parallel. More... | |
void | cs_evaluate_scatter_array_reduction (int dim, cs_lnum_t n_x, const cs_real_t *array, const cs_adjacency_t *c2x, const cs_real_t *w_x, cs_real_t *min, cs_real_t *max, cs_real_t *wsum, cs_real_t *asum, cs_real_t *ssum) |
Compute reduced quantities for an array attached to either vertex, face or edge DoFs The weight to apply to each entity x is scanned using the adjacency structure. array size is equal to dim * n_x The computed quantities are synchronized in parallel. More... | |
void | cs_evaluate_density_by_value (cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate the quantity defined by a value in the case of a density field for all the degrees of freedom Accessor to the value is by unit of volume and the return values are integrated over a volume. More... | |
void | cs_evaluate_density_by_analytic (cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[]) |
Compute the value related to each DoF in the case of a density field The value defined by the analytic function is by unity of volume and the return values are integrated over a volume. More... | |
void | cs_evaluate_potential_at_vertices_by_value (const cs_xdef_t *def, const cs_lnum_t n_v_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate a potential field at vertices from a definition by a constant value. More... | |
void | cs_evaluate_potential_at_vertices_by_analytic (const cs_xdef_t *def, const cs_real_t time_eval, const cs_lnum_t n_v_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the quantity attached to a potential field at vertices when the definition relies on an analytic expression. More... | |
void | cs_evaluate_potential_at_vertices_by_dof_func (const cs_xdef_t *def, const cs_lnum_t n_v_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the quantity attached to a potential field at vertices when the definition relies on a DoF function (Degrees of freedom) More... | |
void | cs_evaluate_potential_at_faces_by_value (const cs_xdef_t *def, const cs_lnum_t n_f_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate a potential field at face centers from a definition by a constant value. More... | |
void | cs_evaluate_potential_at_faces_by_analytic (const cs_xdef_t *def, const cs_real_t time_eval, const cs_lnum_t n_f_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the quantity attached to a potential field at face centers when the definition relies on an analytic expression. More... | |
void | cs_evaluate_potential_at_cells_by_array (const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate a potential field at cell centers from a definition by array. More... | |
void | cs_evaluate_potential_at_cells_by_value (const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate a potential field at cell centers from a definition by value. More... | |
void | cs_evaluate_potential_at_cells_by_analytic (const cs_xdef_t *def, const cs_real_t time_eval, cs_real_t retval[]) |
Evaluate the quantity attached to a potential field at cell centers when the definition relies on an analytic expression. More... | |
void | cs_evaluate_potential_at_cells_by_dof_func (const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate the quantity attached to a potential field at cells when the definition relies on a DoF function (Degrees of freedom) More... | |
void | cs_evaluate_potential_by_qov (cs_flag_t dof_flag, const cs_xdef_t *def, cs_real_t vvals[], cs_real_t wvals[]) |
Define a value to each DoF in the case of a potential field in order to put a given quantity inside the volume associated to the zone related to the given definition wvals may be nullptr. More... | |
void | cs_evaluate_circulation_along_edges_by_value (const cs_xdef_t *def, const cs_lnum_t n_e_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined thanks to a constant vector field (by value) More... | |
void | cs_evaluate_circulation_along_edges_by_array (const cs_xdef_t *def, const cs_lnum_t n_e_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined thanks to an array. More... | |
void | cs_evaluate_circulation_along_edges_by_analytic (const cs_xdef_t *def, const cs_real_t time_eval, const cs_lnum_t n_e_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined by an analytical function. More... | |
void | cs_evaluate_average_on_faces_by_value (const cs_xdef_t *def, const cs_lnum_t n_f_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the average of a function on the faces. More... | |
void | cs_evaluate_average_on_faces_by_analytic (const cs_xdef_t *def, const cs_real_t time_eval, const cs_lnum_t n_f_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the average of a function on the faces. Warning: retval has to be initialize before calling this function. More... | |
void | cs_evaluate_average_on_faces (const cs_xdef_t *def, cs_real_t time_eval, const cs_lnum_t n_f_selected, const cs_lnum_t *selected_lst, cs_real_t retval[]) |
Evaluate the average value on faces following the given definition. More... | |
void | cs_evaluate_average_on_cells_by_value (const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate the average of a function on the cells. More... | |
void | cs_evaluate_average_on_cells_by_array (const cs_xdef_t *def, cs_real_t retval[]) |
Evaluate the average of a function on the cells. More... | |
void | cs_evaluate_average_on_cells_by_analytic (const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[]) |
Evaluate the average of a function on the cells. Warning: retval has to be initialize before calling this function. More... | |
void | cs_evaluate_average_on_cells (const cs_xdef_t *def, cs_real_t time_eval, cs_real_t retval[]) |
Evaluate the average value on cells following the given definition The cells associated to this definition (through the related zone) are all considered. More... | |
cs_real_t | cs_evaluate_scal_domain_integral_by_array (cs_flag_t array_loc, const cs_real_t *array_val) |
Evaluate the integral over the full computational domain of a quantity defined by an array. The parallel sum reduction is performed inside this function. More... | |
void cs_evaluate_array_reduction | ( | int | dim, |
cs_lnum_t | n_x, | ||
const cs_real_t * | array, | ||
const cs_real_t * | w_x, | ||
cs_real_t * | min, | ||
cs_real_t * | max, | ||
cs_real_t * | wsum, | ||
cs_real_t * | asum, | ||
cs_real_t * | ssum | ||
) |
Compute reduced quantities for an array of size equal to dim * n_x The computed quantities are synchronized in parallel.
[in] | dim | local array dimension (max: 3) |
[in] | n_x | number of elements |
[in] | array | array to analyze |
[in] | w_x | weight to apply (may be set to nullptr) |
[in,out] | min | resulting min array (size: dim, or 4 if dim = 3) |
[in,out] | max | resulting max array (size: dim, or 4 if dim = 3) |
[in,out] | wsum | (weighted) sum array (size: dim, or 4 if dim = 3) |
[in,out] | asum | (weighted) sum of absolute values (same size as wsum) |
[in,out] | ssum | (weighted) sum of squared values (same size as wsum) |
void cs_evaluate_average_on_cells | ( | const cs_xdef_t * | def, |
cs_real_t | time_eval, | ||
cs_real_t | retval[] | ||
) |
Evaluate the average value on cells following the given definition The cells associated to this definition (through the related zone) are all considered.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_average_on_cells_by_analytic | ( | const cs_xdef_t * | def, |
cs_real_t | time_eval, | ||
cs_real_t | retval[] | ||
) |
Evaluate the average of a function on the cells. Warning: retval has to be initialize before calling this function.
Evaluate the average of a function on the cells Warning: retval has to be initialize before calling this function.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in,out] | retval | pointer to the computed values |
Evaluate the average of a function on the cells.
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | retval | pointer to the computed values |
Evaluate the average of a function on the cells.
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_average_on_faces | ( | const cs_xdef_t * | def, |
cs_real_t | time_eval, | ||
const cs_lnum_t | n_f_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the average value on faces following the given definition.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in] | n_f_selected | number of selected faces |
[in] | selected_lst | list of selected faces |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_average_on_faces_by_analytic | ( | const cs_xdef_t * | def, |
const cs_real_t | time_eval, | ||
const cs_lnum_t | n_f_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the average of a function on the faces. Warning: retval has to be initialize before calling this function.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in] | n_f_selected | number of selected faces |
[in] | selected_lst | list of selected faces |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_average_on_faces_by_value | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_f_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the average of a function on the faces.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_f_selected | number of selected faces |
[in] | selected_lst | list of selected faces |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_circulation_along_edges_by_analytic | ( | const cs_xdef_t * | def, |
const cs_real_t | time_eval, | ||
const cs_lnum_t | n_e_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined by an analytical function.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in] | n_e_selected | number of selected edges |
[in] | selected_lst | list of selected edges |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_circulation_along_edges_by_array | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_e_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined thanks to an array.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_e_selected | number of selected edges |
[in] | selected_lst | list of selected edges |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_circulation_along_edges_by_value | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_e_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the circulation along a selection of (primal) edges. Circulation is defined thanks to a constant vector field (by value)
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_e_selected | number of selected edges |
[in] | selected_lst | list of selected edges |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_density_by_analytic | ( | cs_flag_t | dof_flag, |
const cs_xdef_t * | def, | ||
cs_real_t | time_eval, | ||
cs_real_t | retval[] | ||
) |
Compute the value related to each DoF in the case of a density field The value defined by the analytic function is by unity of volume and the return values are integrated over a volume.
[in] | dof_flag | indicate where the evaluation has to be done |
[in] | def | pointer to a cs_xdef_t structure |
[in] | time_eval | physical time at which one evaluates the term |
[in,out] | retval | pointer to the computed values |
Evaluate the quantity defined by a value in the case of a density field for all the degrees of freedom Accessor to the value is by unit of volume and the return values are integrated over a volume.
[in] | dof_flag | indicate where the evaluation has to be done |
[in] | def | pointer to a cs_xdef_t structure |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_init_sharing | ( | const cs_cdo_quantities_t * | quant, |
const cs_cdo_connect_t * | connect, | ||
const cs_mesh_t * | mesh | ||
) |
Set shared pointers to main domain members.
[in] | quant | pointer to additional mesh quantities for CDO schemes |
[in] | connect | pointer to additional mesh connectivities for CDO schemes |
[in] | mesh | pointer to the shared mesh structure |
void cs_evaluate_potential_at_cells_by_analytic | ( | const cs_xdef_t * | def, |
const cs_real_t | time_eval, | ||
cs_real_t | retval[] | ||
) |
Evaluate the quantity attached to a potential field at cell centers when the definition relies on an analytic expression.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in,out] | retval | pointer to the computed values |
Evaluate a potential field at cell centers from a definition by array.
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | retval | pointer to the computed values |
Evaluate the quantity attached to a potential field at cells when the definition relies on a DoF function (Degrees of freedom)
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | retval | pointer to the computed values |
Evaluate a potential field at cell centers from a definition by value.
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_at_faces_by_analytic | ( | const cs_xdef_t * | def, |
const cs_real_t | time_eval, | ||
const cs_lnum_t | n_f_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the quantity attached to a potential field at face centers when the definition relies on an analytic expression.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in] | n_f_selected | number of selected faces |
[in] | selected_lst | list of selected faces |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_at_faces_by_value | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_f_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate a potential field at face centers from a definition by a constant value.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_f_selected | number of selected faces |
[in] | selected_lst | list of selected faces |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_at_vertices_by_analytic | ( | const cs_xdef_t * | def, |
const cs_real_t | time_eval, | ||
const cs_lnum_t | n_v_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the quantity attached to a potential field at vertices when the definition relies on an analytic expression.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | time_eval | physical time at which one evaluates the term |
[in] | n_v_selected | number of selected vertices |
[in] | selected_lst | list of selected vertices |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_at_vertices_by_dof_func | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_v_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate the quantity attached to a potential field at vertices when the definition relies on a DoF function (Degrees of freedom)
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_v_selected | number of selected vertices |
[in] | selected_lst | list of selected vertices |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_at_vertices_by_value | ( | const cs_xdef_t * | def, |
const cs_lnum_t | n_v_selected, | ||
const cs_lnum_t * | selected_lst, | ||
cs_real_t | retval[] | ||
) |
Evaluate a potential field at vertices from a definition by a constant value.
[in] | def | pointer to a cs_xdef_t pointer |
[in] | n_v_selected | number of selected vertices |
[in] | selected_lst | list of selected vertices |
[in,out] | retval | pointer to the computed values |
void cs_evaluate_potential_by_qov | ( | cs_flag_t | dof_flag, |
const cs_xdef_t * | def, | ||
cs_real_t | vvals[], | ||
cs_real_t | wvals[] | ||
) |
Define a value to each DoF in the case of a potential field in order to put a given quantity inside the volume associated to the zone related to the given definition wvals may be nullptr.
Define a value to each DoF in the case of a potential field in order to put a given quantity inside the volume associated to the zone related to the given definition wvals may be null.
[in] | dof_flag | indicate where the evaluation has to be done |
[in] | def | pointer to a cs_xdef_t pointer |
[in,out] | vvals | pointer to the first array of computed values |
[in,out] | wvals | pointer to the second array of computed values |
cs_real_t cs_evaluate_scal_domain_integral_by_array | ( | cs_flag_t | array_loc, |
const cs_real_t * | array_val | ||
) |
Evaluate the integral over the full computational domain of a quantity defined by an array. The parallel sum reduction is performed inside this function.
[in] | array_loc | flag indicating where are located values |
[in] | array_val | array of values |
void cs_evaluate_scatter_array_reduction | ( | int | dim, |
cs_lnum_t | n_x, | ||
const cs_real_t * | array, | ||
const cs_adjacency_t * | c2x, | ||
const cs_real_t * | w_x, | ||
cs_real_t * | min, | ||
cs_real_t * | max, | ||
cs_real_t * | wsum, | ||
cs_real_t * | asum, | ||
cs_real_t * | ssum | ||
) |
Compute reduced quantities for an array attached to either vertex, face or edge DoFs The weight to apply to each entity x is scanned using the adjacency structure. array size is equal to dim * n_x The computed quantities are synchronized in parallel.
[in] | dim | local array dimension (max: 3) |
[in] | n_x | number of elements |
[in] | array | array to analyze |
[in] | c2x | pointer to the associated cs_adjacency_t structure |
[in] | w_x | weight to apply (may be set to nullptr) |
[in,out] | min | resulting min array (size: dim, or 4 if dim = 3) |
[in,out] | max | resulting max array (size: dim, or 4 if dim = 3) |
[in,out] | wsum | (weighted) sum array (size: dim, or 4 if dim = 3) |
[in,out] | asum | (weighted) sum of absolute values (same size as wsum) |
[in,out] | ssum | (weighted) sum of squared values (same size as wsum) |