#include "cs_defs.h"
#include <assert.h>
#include <float.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "cs_base.h"
#include "cs_flag_check.h"
#include "cs_log.h"
#include "cs_map.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_parall.h"
#include "cs_volume_zone.h"
Functions | |
void | cs_volume_zone_initialize (void) |
Initialize volume zone structures. More... | |
void | cs_volume_zone_finalize (void) |
Free all volume zone structures. More... | |
int | cs_volume_zone_n_zones (void) |
Return number of volume zones defined. More... | |
int | cs_volume_zone_n_zones_time_varying (void) |
Return number of volume zones which may vary in time. More... | |
void | cs_volume_zone_build_all (bool mesh_modified) |
Update association of volume zones with a mesh. More... | |
int | cs_volume_zone_define (const char *name, const char *criteria, int type_flag) |
Define a new volume zone using a selection criteria string. More... | |
int | cs_volume_zone_define_by_func (const char *name, cs_mesh_location_select_t *func, void *input, int type_flag) |
Define a new mesh location with an associated selection function. More... | |
const cs_zone_t * | cs_volume_zone_by_id (int id) |
Return a pointer to a volume zone based on its id. More... | |
const cs_zone_t * | cs_volume_zone_by_name (const char *name) |
Return a pointer to a volume zone based on its name if present. More... | |
const cs_zone_t * | cs_volume_zone_by_name_try (const char *name) |
Return a pointer to a volume zone based on its name if present. More... | |
int | cs_volume_zone_id_by_name (const char *z_name) |
Retrieve the volume zone id from its zone name. If the zone name is equal to nullptr or has an empty length, then the default zone id (=0) corresponding to all entities is returned. More... | |
void | cs_volume_zone_set_type (int id, int type_flag) |
Set type flag for a given volume zone. More... | |
void | cs_volume_zone_set_time_varying (int id, bool time_varying) |
Set time varying behavior for a given volume zone. More... | |
void | cs_volume_zone_set_overlay (int id, bool allow_overlay) |
Set overlay behavior for a given volume zone. More... | |
const int * | cs_volume_zone_cell_zone_id (void) |
Return pointer to zone id associated with each cell. More... | |
void | cs_volume_zone_log_info (const cs_zone_t *z) |
Print info relative to a given volume zone to log file. More... | |
void | cs_volume_zone_log_setup (void) |
Log setup information relative to defined volume zones. More... | |
int | cs_volume_zone_n_type_zones (int type_flag) |
Return number of volume zones associated with a given zone flag. More... | |
cs_lnum_t | cs_volume_zone_n_type_cells (int type_flag) |
Return number of volume zone cells associated with a given zone flag. More... | |
void | cs_volume_zone_select_type_cells (int type_flag, cs_lnum_t cell_ids[]) |
Select cells associated with volume zones of a given type. More... | |
void | cs_volume_zone_tag_cell_type (int zone_type_flag, int tag_value, int tag[]) |
Tag cells of a given zone type. More... | |
void | cs_volume_zone_print_info (void) |
Print volume zones information to listing file. More... | |
Volume zone handling.
void cs_volume_zone_build_all | ( | bool | mesh_modified | ) |
Update association of volume zones with a mesh.
For time-varying zones, the associated mesh location is updated.
[in] | mesh_modified | indicate if mesh has been modified |
const cs_zone_t * cs_volume_zone_by_id | ( | int | id | ) |
Return a pointer to a volume zone based on its id.
This function requires that a volume zone of the given id is defined.
[in] | id | zone id |
const cs_zone_t * cs_volume_zone_by_name | ( | const char * | name | ) |
Return a pointer to a volume zone based on its name if present.
This function requires that a volume zone of the given name is defined.
[in] | name | volume zone name |
const cs_zone_t * cs_volume_zone_by_name_try | ( | const char * | name | ) |
Return a pointer to a volume zone based on its name if present.
If no volume zone of the given name is defined, nullptr is returned.
[in] | name | volume zone name |
const int * cs_volume_zone_cell_zone_id | ( | void | ) |
Return pointer to zone id associated with each cell.
In case of overlayed zones, the highest zone id associated with a given cell is given.
int cs_volume_zone_define | ( | const char * | name, |
const char * | criteria, | ||
int | type_flag | ||
) |
Define a new volume zone using a selection criteria string.
[in] | name | name of location to define |
[in] | criteria | selection criteria for associated elements |
[in] | type_flag | mask of zone category values |
int cs_volume_zone_define_by_func | ( | const char * | name, |
cs_mesh_location_select_t * | func, | ||
void * | input, | ||
int | type_flag | ||
) |
Define a new mesh location with an associated selection function.
So as to define a subset of mesh entities of a given type, a pointer to a selection function may be given.
This requires more programming but allows finer control than selection criteria, as the function has access to the complete mesh structure.
[in] | name | name of location to define |
[in] | func | pointer to selection function for associated elements |
[in,out] | input | pointer to optional (untyped) value or structure. |
[in] | type_flag | mask of zone category values |
void cs_volume_zone_finalize | ( | void | ) |
Free all volume zone structures.
int cs_volume_zone_id_by_name | ( | const char * | z_name | ) |
Retrieve the volume zone id from its zone name. If the zone name is equal to nullptr or has an empty length, then the default zone id (=0) corresponding to all entities is returned.
Retrieve the volume zone id from its zone name. If the zone name is equal to NULL or has an empty length, then the default zone id (=0) corresponding to all entities is returned.
[in] | z_name | name of the zone or nullptr or "" |
void cs_volume_zone_initialize | ( | void | ) |
Initialize volume zone structures.
This defines a default volume zone. This is the first function of the volume zone handling functions which should be called, and it should only be called after cs_mesh_location_initialize.
void cs_volume_zone_log_info | ( | const cs_zone_t * | z | ) |
Print info relative to a given volume zone to log file.
[in] | z | pointer to volume zone structure |
void cs_volume_zone_log_setup | ( | void | ) |
Log setup information relative to defined volume zones.
cs_lnum_t cs_volume_zone_n_type_cells | ( | int | type_flag | ) |
Return number of volume zone cells associated with a given zone flag.
Note that in the case of overlapping zones, a cell may be accounted for multiple times.
[in] | type_flag | flag to compare to zone type |
int cs_volume_zone_n_type_zones | ( | int | type_flag | ) |
Return number of volume zones associated with a given zone flag.
[in] | type_flag | flag to compare to zone type |
int cs_volume_zone_n_zones | ( | void | ) |
Return number of volume zones defined.
int cs_volume_zone_n_zones_time_varying | ( | void | ) |
Return number of volume zones which may vary in time.
void cs_volume_zone_print_info | ( | void | ) |
Print volume zones information to listing file.
void cs_volume_zone_select_type_cells | ( | int | type_flag, |
cs_lnum_t | cell_ids[] | ||
) |
Select cells associated with volume zones of a given type.
Note that in the case of overlapping zones, a cell may be accounted for multiple times.
[in] | type_flag | flag to compare to zone type |
[out] | cell_ids | ids of selected cells (size: given by cs_volume_zone_n_type_cells) |
void cs_volume_zone_set_overlay | ( | int | id, |
bool | allow_overlay | ||
) |
Set overlay behavior for a given volume zone.
[in] | id | volume zone id |
[in] | allow_overlay | true if the zone may be overlayed by another |
void cs_volume_zone_set_time_varying | ( | int | id, |
bool | time_varying | ||
) |
Set time varying behavior for a given volume zone.
[in] | id | volume zone id |
[in] | time_varying | true if the zone's definition varies in time |
void cs_volume_zone_set_type | ( | int | id, |
int | type_flag | ||
) |
Set type flag for a given volume zone.
[in] | id | volume zone id |
[in] | type_flag | volume zone type flag |
void cs_volume_zone_tag_cell_type | ( | int | zone_type_flag, |
int | tag_value, | ||
int | tag[] | ||
) |
Tag cells of a given zone type.
The tag array should be initialized. The given tag_value is associted to cells of the given zone type using a logical "or", so multiple flag bits can be handled using the same array if necessary.
[in] | zone_type_flag | zone types to tag |
[in] | tag_value | tag value to add to cells of matching zones |
[in,out] | tag | tag value for each cell |