src/mesh/cs_mesh_location.h File Reference

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Enumerations | Functions
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 )(const cs_mesh_t *m, int location_id, cs_lnum_t *n_elts, cs_lnum_t **elt_list)
| Function pointer to mesh location elements selection definition. More...

## 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_PARTICLES, CS_MESH_LOCATION_OTHER }

## 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...
void | cs_mesh_location_build (cs_mesh_t *mesh, int id)
| Associate mesh locations with a mesh. More...
int | cs_mesh_location_define (const char *name, cs_mesh_location_type_t type, const char *criteria)
| Define a new mesh location. More...
int | cs_mesh_location_define_by_func (const char *name, cs_mesh_location_type_t type, cs_mesh_location_select_t *func)
| Define a new mesh location with a associated selection function. 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...

## Typedef Documentation

cs_mesh_location_select_t

Function pointer to mesh location elements selection definition.

If non-empty and not containing all elements, a list of elements of the parent mesh belonging to the location should be allocated (using BFT_MALLOC) and defined by this function when called. This list's lifecycle is then managed by the mesh location object.

Parameters

  [in] | m | pointer to associated mesh structure.
  [in] | location_id | id of associated location.
  [out] | n_elts | number of selected elements
  [out] | elt_list | list of selected elements.

typedef struct _cs_mesh_location_t cs_mesh_location_t

## Enumeration Type Documentation

enum 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_PARTICLES |
CS_MESH_LOCATION_OTHER |

## Function Documentation

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] | mesh | pointer to associated mesh structure
  [in] | id | id of mesh location

int cs_mesh_location_define | ( | 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] | name | name of location to define
  [in] | type | type of location to define
  [in] | criteria | selection criteria for associated elements, or NULL

Returns
  id of newly defined created mesh location

int cs_mesh_location_define_by_func | ( | const char * | name,
|  | cs_mesh_location_type_t | type,
|  | cs_mesh_location_select_t * | func
| ) |  |

Define a new mesh location with a 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] | name | name of location to define
  [in] | type | type of location to define
  [in] | func | pointer to selection function for associated elements, or NULL

Returns
  id of newly defined created mesh location

void cs_mesh_location_finalize | ( | void |  | ) |

Finalize mesh location API.

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.

Parameters

  [in] | id | id of mesh location

Returns
  pointer to elements list.

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] | id | id of mesh location

Returns
  array of numbers of elements.

const char* cs_mesh_location_get_name | ( | int | id | ) |

Get a mesh location's name.

Parameters

  [in] | id | id of mesh location

Returns
  pointer to mesh location name

cs_mesh_location_type_t cs_mesh_location_get_type | ( | int | id | ) |

Get a mesh location's type.

Parameters

  [in] | id | id of mesh location

Returns
  mesh location type

void cs_mesh_location_initialize | ( | void |  | ) |

Initialize mesh location API.

By default, 5 mesh locations are built, matching the 5 first values of the cs_mesh_location_type_t enum: CS_MESH_LOCATION_NONE for global values, CS_MESH_LOCCATION_CELLS for the cellsof 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.

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.

Returns
  number of mesh locations defined