7.1
general documentation
cs_mesh_location.h File Reference
#include "cs_defs.h"
#include "cs_mesh.h"
+ Include dependency graph for cs_mesh_location.h:

Go to the source code of this file.

Typedefs

typedef struct _cs_mesh_location_t cs_mesh_location_t
 
typedef void() cs_mesh_location_select_t(void *input, const cs_mesh_t *m, int location_id, cs_lnum_t *n_elts, cs_lnum_t **elt_ids)
 

Enumerations

enum  cs_mesh_location_type_t {
  CS_MESH_LOCATION_NONE, CS_MESH_LOCATION_CELLS, CS_MESH_LOCATION_INTERIOR_FACES, CS_MESH_LOCATION_BOUNDARY_FACES,
  CS_MESH_LOCATION_VERTICES, CS_MESH_LOCATION_FACES, CS_MESH_LOCATION_EDGES, CS_MESH_LOCATION_PARTICLES,
  CS_MESH_LOCATION_OTHER
}
 
enum  cs_mesh_location_def_t { CS_MESH_LOCATION_DEF_NONE, CS_MESH_LOCATION_DEF_SELECTION_STR, CS_MESH_LOCATION_DEF_SELECTION_FUNC, CS_MESH_LOCATION_DEF_UNION }
 

Functions

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...
 
int cs_mesh_location_get_id_by_name (const char *ref_name)
 Find the related location id from the location name. 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...
 
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_tcs_mesh_location_get_n_elts (int id)
 Get a mesh location's number of elements. More...
 
const cs_lnum_tcs_mesh_location_get_elt_list (int id)
 Get a mesh location's elements list, if present. More...
 
const cs_lnum_tcs_mesh_location_get_elt_ids_try (int id)
 Get a mesh location's element ids, if present. More...
 
const cs_lnum_tcs_mesh_location_get_elt_ids (int id)
 Get a mesh location's element ids. More...
 
cs_mesh_location_def_t cs_mesh_location_get_definition_method (int id)
 Get a mesh location's definition method. More...
 
const char * cs_mesh_location_get_selection_string (int id)
 Get a mesh location's selection criteria string. More...
 
cs_mesh_location_select_tcs_mesh_location_get_selection_function (int id)
 Get a mesh location's selection function pointer. More...
 
int cs_mesh_location_get_n_sub_ids (int id)
 Get a mesh location's number of sub ids. More...
 
int * cs_mesh_location_get_sub_ids (int id)
 Get a mesh location's list of sub ids. More...
 
bool cs_mesh_location_is_complement (int id)
 Check if a mesh location is built as a complement of other mesh locations. 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. More...
 
void cs_mesh_location_set_explicit_ids (int id, bool explicit_elt_ids)
 Set behavior of cs_mesh_location_get_elt_ids for a given mesh location and locations based on it. More...
 

Variables

const char * cs_mesh_location_type_name []
 

Typedef Documentation

◆ cs_mesh_location_select_t

typedef void() cs_mesh_location_select_t(void *input, const cs_mesh_t *m, int location_id, cs_lnum_t *n_elts, cs_lnum_t **elt_ids)

◆ cs_mesh_location_t

typedef struct _cs_mesh_location_t cs_mesh_location_t

Enumeration Type Documentation

◆ cs_mesh_location_def_t

Enumerator
CS_MESH_LOCATION_DEF_NONE 
CS_MESH_LOCATION_DEF_SELECTION_STR 
CS_MESH_LOCATION_DEF_SELECTION_FUNC 
CS_MESH_LOCATION_DEF_UNION 

◆ cs_mesh_location_type_t

Enumerator
CS_MESH_LOCATION_NONE 
CS_MESH_LOCATION_CELLS 
CS_MESH_LOCATION_INTERIOR_FACES 
CS_MESH_LOCATION_BOUNDARY_FACES 
CS_MESH_LOCATION_VERTICES 
CS_MESH_LOCATION_FACES 
CS_MESH_LOCATION_EDGES 
CS_MESH_LOCATION_PARTICLES 
CS_MESH_LOCATION_OTHER 

Function Documentation

◆ cs_mesh_location_add()

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.

Parameters
[in]namename of location to define
[in]typetype of location to define
[in]criteriaselection criteria for associated elements, or NULL
Returns
id of newly defined created mesh location

◆ cs_mesh_location_add_by_func()

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.

Parameters
[in]namename of location to define
[in]typetype of location to define
[in]funcpointer to selection function for associated elements, or NULL
[in,out]inputpointer to optional (untyped) value or structure.
Returns
id of newly defined created mesh location

◆ cs_mesh_location_add_by_union()

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

Parameters
[in]namename of location to define
[in]typetype of location to define
[in]n_ml_idsnumber of mesh location ids
[in]ml_idslist of mesh location ids
[in]complementtake the complement of the selected entities if true
Returns
id of newly created mesh location

◆ cs_mesh_location_build()

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.

Parameters
[in]meshpointer to associated mesh structure
[in]idid of mesh location

◆ cs_mesh_location_finalize()

void cs_mesh_location_finalize ( void  )

Finalize mesh location API.

◆ cs_mesh_location_get_definition_method()

cs_mesh_location_def_t cs_mesh_location_get_definition_method ( int  id)

Get a mesh location's definition method.

Parameters
[in]idid of mesh location
Returns
enum value corresponding to the definition method

◆ cs_mesh_location_get_elt_ids()

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.

Parameters
[in]idid of mesh location
Returns
pointer to elements array (0 to n-1 numbering).

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.

Parameters
[in]idid of mesh location
Returns
pointer to elements array (0 to n-1 numbering).

◆ cs_mesh_location_get_elt_ids_try()

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}).

Parameters
[in]idid of mesh location
Returns
pointer to elements array (0 to n-1 numbering).

◆ cs_mesh_location_get_elt_list()

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.

Deprecated:
Use cs_mesh_location_get_elt_ids_try or cs_mesh_location_get_elt_ids instead.
Parameters
[in]idid of mesh location
Returns
pointer to elements array (0 to n-1 numbering).

◆ cs_mesh_location_get_explicit_ids()

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.

Parameters
[in]idid or type of mesh location
Returns
true if explicit element ids are required, false otherwise

Check if cs_mesh_location_get_elt_ids always returns explicit element ids for a given mesh location.

Parameters
[in]idid or type of location
Returns
true if explicit element ids are needed, false otherwise

◆ cs_mesh_location_get_id_by_name()

int cs_mesh_location_get_id_by_name ( const char *  ref_name)

Find the related location id from the location name.

Parameters
[in]ref_namename of the location to find
Returns
-1 if not found otherwise the associated id

◆ cs_mesh_location_get_n_elts()

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)

Parameters
[in]idid of mesh location
Returns
array of numbers of elements.

◆ cs_mesh_location_get_n_sub_ids()

int cs_mesh_location_get_n_sub_ids ( int  id)

Get a mesh location's number of sub ids.

Parameters
[in]idid of mesh location
Returns
integer value equal to the number of sub ids

◆ cs_mesh_location_get_name()

const char* cs_mesh_location_get_name ( int  id)

Get a mesh location's name.

Parameters
[in]idid of mesh location
Returns
pointer to mesh location name

◆ cs_mesh_location_get_selection_function()

cs_mesh_location_select_t* cs_mesh_location_get_selection_function ( int  id)

Get a mesh location's selection function pointer.

Parameters
[in]idid of mesh location
Returns
pointer to mesh location selection function pointer, or NULL

◆ cs_mesh_location_get_selection_string()

const char* cs_mesh_location_get_selection_string ( int  id)

Get a mesh location's selection criteria string.

Parameters
[in]idid of mesh location
Returns
pointer to mesh location selection criteria, or NULL

◆ cs_mesh_location_get_sub_ids()

int* cs_mesh_location_get_sub_ids ( int  id)

Get a mesh location's list of sub ids.

Parameters
[in]idid of mesh location
Returns
pointer to the list of sub ids.

◆ cs_mesh_location_get_type()

cs_mesh_location_type_t cs_mesh_location_get_type ( int  id)

Get a mesh location's type.

Parameters
[in]idid of mesh location
Returns
mesh location type

◆ cs_mesh_location_initialize()

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.

◆ cs_mesh_location_is_complement()

bool cs_mesh_location_is_complement ( int  id)

Check if a mesh location is built as a complement of other mesh locations.

Parameters
[in]idid of mesh location
Returns
true if build method is a complement, false otherwise.

◆ cs_mesh_location_n_locations()

int cs_mesh_location_n_locations ( void  )

Return number of mesh locations defined.

Returns
number of mesh locations defined

◆ cs_mesh_location_set_explicit_ids()

void cs_mesh_location_set_explicit_ids ( int  id,
bool  explicit_elt_ids 
)

Set behavior of cs_mesh_location_get_elt_ids for a given mesh location and locations based on it.

Parameters
[in]idid or type of mesh location
[in]explicit_elt_idsindicate if explicit element ids are required

Set behavior of cs_mesh_location_get_elt_ids for a given mesh location and locations based on it.

Parameters
[in]idid or type of location
[in]explicit_elt_idsindicate if explicit element ids are needed

Variable Documentation

◆ cs_mesh_location_type_name

const char* cs_mesh_location_type_name[]