My Project
programmer's documentation
|
#include "cs_defs.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "fvm_selector.h"
#include "cs_halo.h"
#include "cs_parall.h"
#include "cs_mesh.h"
#include "cs_sort.h"
#include "cs_mesh_location.h"
Functions | |
static cs_mesh_location_t * | _mesh_location_by_id (int id) |
static const cs_mesh_location_t * | _const_mesh_location_by_id (int id) |
static int | _find_id_by_name (const char *ref_name) |
Find the related location id from the location name. More... | |
static int | _mesh_location_define (const char *name, cs_mesh_location_type_t type) |
static void | _build_by_ml_ids (cs_mesh_location_t *ml) |
int | cs_mesh_location_n_locations (void) |
Return number of mesh locations defined. More... | |
void | cs_mesh_location_initialize (void) |
Initialize mesh location API. More... | |
void | cs_mesh_location_finalize (void) |
Finalize mesh location API. More... | |
void | cs_mesh_location_build (cs_mesh_t *mesh, int id) |
Associate mesh locations with a mesh. More... | |
int | cs_mesh_location_add (const char *name, cs_mesh_location_type_t type, const char *criteria) |
Define a new mesh location. More... | |
int | cs_mesh_location_add_by_func (const char *name, cs_mesh_location_type_t type, cs_mesh_location_select_t *func, void *input) |
Define a new mesh location with an associated selection function. More... | |
int | cs_mesh_location_add_by_union (const char *name, cs_mesh_location_type_t type, int n_ml_ids, const int *ml_ids, bool complement) |
Define a new mesh location. More... | |
int | cs_mesh_location_get_id_by_name (const char *ref_name) |
Find the related location id from the location name. More... | |
const char * | cs_mesh_location_get_name (int id) |
Get a mesh location's name. More... | |
cs_mesh_location_type_t | cs_mesh_location_get_type (int id) |
Get a mesh location's type. More... | |
const cs_lnum_t * | cs_mesh_location_get_n_elts (int id) |
Get a mesh location's number of elements. More... | |
const cs_lnum_t * | cs_mesh_location_get_elt_list (int id) |
Get a mesh location's elements list, if present. More... | |
const cs_lnum_t * | cs_mesh_location_get_elt_ids_try (int id) |
Get a mesh location's element ids, if present. More... | |
const cs_lnum_t * | cs_mesh_location_get_elt_ids (int id) |
Get a mesh location's element ids. More... | |
const char * | cs_mesh_location_get_selection_string (int id) |
Get a mesh location's selection criteria string. More... | |
cs_mesh_location_select_t * | cs_mesh_location_get_selection_function (int id) |
Get a mesh location's selection function pointer. More... | |
bool | cs_mesh_location_get_explicit_ids (int id) |
Check if cs_mesh_location_get_elt_ids always returns explicit element ids for a given mesh location type. More... | |
void | cs_mesh_location_set_explicit_ids (int id, bool explicit_elt_ids) |
Set behavior of cs_mesh_location_get_elt_ids for mesh mesh location type. More... | |
|
static |
|
static |
|
static |
Find the related location id from the location name.
[in] | ref_name | name of the location to find |
|
static |
|
static |
int cs_mesh_location_add | ( | const char * | name, |
cs_mesh_location_type_t | type, | ||
const char * | criteria | ||
) |
Define a new mesh location.
So as to define a subset of mesh entities of a given type, an optional selection criteria may be given.
[in] | name | name of location to define |
[in] | type | type of location to define |
[in] | criteria | selection criteria for associated elements, or NULL |
int cs_mesh_location_add_by_func | ( | const char * | name, |
cs_mesh_location_type_t | type, | ||
cs_mesh_location_select_t * | func, | ||
void * | input | ||
) |
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] | type | type of location to define |
[in] | func | pointer to selection function for associated elements, or NULL |
[in,out] | input | pointer to optional (untyped) value or structure. |
int cs_mesh_location_add_by_union | ( | const char * | name, |
cs_mesh_location_type_t | type, | ||
int | n_ml_ids, | ||
const int * | ml_ids, | ||
bool | complement | ||
) |
Define a new mesh location.
So as to define a subset of mesh entities of a given type, a list of ids related to existing mesh locations may be given
[in] | name | name of location to define |
[in] | type | type of location to define |
[in] | n_ml_ids | number of mesh location ids |
[in] | ml_ids | list of mesh location ids |
[in] | complement | take the complement of the selected entities if true |
void cs_mesh_location_build | ( | cs_mesh_t * | mesh, |
int | id | ||
) |
Associate mesh locations with a mesh.
If mesh_id is negative, all defined mesh locations are associated (which is useful for the common case where only one mesh is present). If mesh_id is non-negative, only the location with the matching id is associated (which may be useful when multiple meshes are defined).
The number of elements are computed based on the underlying mesh, and element lists are built for mesh subset locations.
[in] | mesh | pointer to associated mesh structure |
[in] | id | id of mesh location |
void cs_mesh_location_finalize | ( | void | ) |
Finalize mesh location API.
const cs_lnum_t* cs_mesh_location_get_elt_ids | ( | int | id | ) |
Get a mesh location's element ids.
This function may only be used with a given location if cs_mesh_location_set_explicit_ids has been used to indicate explicit ids are needed for this location type.
[in] | id | id of mesh location |
const cs_lnum_t* cs_mesh_location_get_elt_ids_try | ( | int | id | ) |
Get a mesh location's element ids, if present.
An array of element ids is returned if the location is a subset of a main main location type, and NULL is returned when the id array would map to the identity function (i.e. {0, 1, 2, ..., n_elts-1}).
[in] | id | id of mesh location |
const cs_lnum_t* cs_mesh_location_get_elt_list | ( | int | id | ) |
Get a mesh location's elements list, if present.
A list of elements is defined if the location is a subset of a main location type.
[in] | id | id of mesh location |
bool cs_mesh_location_get_explicit_ids | ( | int | id | ) |
Check if cs_mesh_location_get_elt_ids always returns explicit element ids for a given mesh location type.
Check if cs_mesh_location_get_elt_ids always returns explicit element ids for a given mesh location.
[in] | id | id or type of location |
int cs_mesh_location_get_id_by_name | ( | const char * | ref_name | ) |
Find the related location id from the location name.
[in] | ref_name | name of the location to find |
const cs_lnum_t* cs_mesh_location_get_n_elts | ( | int | id | ) |
Get a mesh location's number of elements.
A pointer to a array of 3 values is returned: 0: local number of elements 1: with standard ghost elements (if applicable) 2: with extended ghost elements (if applicable)
[in] | id | id of mesh location |
const char* cs_mesh_location_get_name | ( | int | id | ) |
Get a mesh location's name.
[in] | id | id of mesh location |
cs_mesh_location_select_t* cs_mesh_location_get_selection_function | ( | int | id | ) |
Get a mesh location's selection function pointer.
[in] | id | id of mesh location |
const char* cs_mesh_location_get_selection_string | ( | int | id | ) |
Get a mesh location's selection criteria string.
[in] | id | id of mesh location |
cs_mesh_location_type_t cs_mesh_location_get_type | ( | int | id | ) |
Get a mesh location's type.
[in] | id | id of mesh location |
void cs_mesh_location_initialize | ( | void | ) |
Initialize mesh location API.
By default, 7 mesh locations are built, matching the 7 first values of the cs_mesh_location_type_t enum: CS_MESH_LOCATION_NONE for global values, CS_MESH_LOCATION_CELLS for the cells of the (default) global mesh, CS_MESH_LOCATION_INTERIOR_FACES and CS_MESH_LOCATION_BOUNDARY_FACES for its faces, and CS_MESH_LOCATION_VERTICES for its vertices. CS_MESH_LOCATION_FACES and a placeholder for CS_MESH_LOCATION_EDGES are also added for CDO discretizations.
Locations should then be built once the global mesh is complete, and its halo structures completed.
int cs_mesh_location_n_locations | ( | void | ) |
Return number of mesh locations defined.
void cs_mesh_location_set_explicit_ids | ( | int | id, |
bool | explicit_elt_ids | ||
) |
Set behavior of cs_mesh_location_get_elt_ids for mesh mesh location type.
Set behavior of cs_mesh_location_get_elt_ids for a given mesh location and locations based on it.
[in] | id | id or type of location |
[in] | explicit_elt_ids | indicate if explicit element ids are needed |