9.0
general documentation
Loading...
Searching...
No Matches
cs_mesh_adjacencies.cpp File Reference
#include "base/cs_defs.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include "bft/bft_error.h"
#include "bft/bft_printf.h"
#include "base/cs_array.h"
#include "base/cs_halo.h"
#include "base/cs_log.h"
#include "base/cs_mem.h"
#include "mesh/cs_mesh.h"
#include "base/cs_sort.h"
#include "mesh/cs_mesh_adjacencies.h"
Include dependency graph for cs_mesh_adjacencies.cpp:

Functions

cs_mesh_adjacencies_tcs_mesh_adjacencies_get_global (void)
 Get non-const pointer to cs_glob_mesh_adacencies.
void cs_mesh_adjacencies_initialize (void)
 Initialize mesh adjacencies helper API.
void cs_mesh_adjacencies_finalize (void)
 Finalize mesh adjacencies helper API.
void cs_mesh_adjacencies_update_mesh (void)
 Update mesh adjacencies helper API relative to mesh.
void cs_mesh_adjacencies_update_cell_cells_e (void)
 Update extended cell -> cell connectivites in mesh adjacencies helper API relative to mesh.
void cs_mesh_adjacencies_update_cell_i_faces (void)
 Ensure presence of cell -> interior face connectivites in mesh adjacencies helper API relative to mesh.
void cs_mesh_adjacencies_update_device (cs_alloc_mode_t alloc_mode)
 Map some global mesh adjacency arrays for use on device.
const cs_adjacency_tcs_mesh_adjacencies_cell_faces (void)
 Return cell -> face connectivites in mesh adjacencies helper API relative to mesh.
const cs_adjacency_tcs_mesh_adjacencies_cell_vertices (void)
 Return cell -> vertex connectivites in mesh adjacencies helper API relative to mesh.
cs_adjacency_tcs_adjacency_create (cs_flag_t flag, int stride, cs_lnum_t n_elts)
 Create a cs_adjacency_t structure of size n_elts.
cs_adjacency_tcs_adjacency_create_from_s_arrays (cs_lnum_t n_elts, int stride, cs_lnum_t *ids, short int *sgn)
 Create a cs_adjacency_t structure sharing arrays scanned with a stride.
cs_adjacency_tcs_adjacency_create_from_i_arrays (cs_lnum_t n_elts, cs_lnum_t *idx, cs_lnum_t *ids, short int *sgn)
 Create a cs_adjacency_t structure sharing arrays scanned with an index.
void cs_adjacency_destroy (cs_adjacency_t **p_adj)
 Destroy a cs_adjacency_t structure.
cs_adjacency_tcs_adjacency_compose (int n_c_elts, const cs_adjacency_t *a2b, const cs_adjacency_t *b2c)
 Create a new cs_adjacency_t structure from the composition of two cs_adjacency_t structures: (1) A -> B and (2) B -> C The resulting structure describes A -> C. It does not rely on a stride and has no sgn member.
cs_adjacency_tcs_adjacency_concatenate (const cs_adjacency_t *a2b_1, const cs_adjacency_t *a2b_2)
 Create a new cs_adjacency_t structure from the concatenation of two cs_adjacency_t structures: A -> B created by two different compositions: (1) A -> B = A -> C + C -> B (2) A -> B = A -> D + D -> B.
cs_adjacency_tcs_adjacency_difference (const cs_adjacency_t *a2b_1, const cs_adjacency_t *a2b_2)
 Create a new cs_adjacency_t structure from the difference of two cs_adjacency_t structures: A -> B created by two different compositions: (1) A -> B = A -> C + C -> B (2) A -> B = A -> D + D -> B.
cs_adjacency_tcs_adjacency_transpose (int n_b_elts, const cs_adjacency_t *a2b)
 Create a new cs_adjacency_t structure from a one corresponding to A -> B. The resulting structure deals with B -> A.
void cs_adjacency_sort (cs_adjacency_t *adj)
 Sort each sub-list related to an entry in a cs_adjacency_t structure.
void cs_adjacency_remove_self_entries (cs_adjacency_t *adj)
 In an indexed list, remove id(s) corresponding to the current index. Useful for instance in order to prepare a matrix structure in MSR storage.
void cs_adjacency_dump (const char *name, FILE *_f, cs_adjacency_t *adj)
 Dump a cs_adjacency_t structure to a file or into the standard output.
cs_adjacency_tcs_mesh_adjacency_c2f (const cs_mesh_t *m, int boundary_order)
 Build a cells to faces adjacency structure.
cs_adjacency_tcs_mesh_adjacency_c2f_lower (const cs_mesh_t *m, int boundary_order)
 Build a partial cells to faces adjacency structure.
cs_adjacency_tcs_mesh_adjacency_c2f_boundary (const cs_mesh_t *m)
 Build a cells to boundary faces adjacency structure.
cs_adjacency_tcs_mesh_adjacency_v2v (const cs_mesh_t *m)
 Allocate and define a cs_adjacency_t structure related to the connectivity vertex to vertices through edges.

Detailed Description

Additional mesh adjacencies.

Function Documentation

◆ cs_adjacency_compose()

cs_adjacency_t * cs_adjacency_compose ( int n_c_elts,
const cs_adjacency_t * a2b,
const cs_adjacency_t * b2c )

Create a new cs_adjacency_t structure from the composition of two cs_adjacency_t structures: (1) A -> B and (2) B -> C The resulting structure describes A -> C. It does not rely on a stride and has no sgn member.

Parameters
[in]n_c_eltsnumber of elements in C set
[in]a2badjacency A -> B
[in]b2cadjacency B -> C
Returns
a pointer to the cs_adjacency_t structure A -> C

◆ cs_adjacency_concatenate()

cs_adjacency_t * cs_adjacency_concatenate ( const cs_adjacency_t * a2b_1,
const cs_adjacency_t * a2b_2 )

Create a new cs_adjacency_t structure from the concatenation of two cs_adjacency_t structures: A -> B created by two different compositions: (1) A -> B = A -> C + C -> B (2) A -> B = A -> D + D -> B.

The resulting structure describes A -> B. It does not rely on a stride and has no sgn member and duplicated elements are removed

Parameters
[in]a2b_1adjacency A -> B (1)
[in]a2b_2adjacency A -> B (2)
Returns
a pointer to the cs_adjacency_t structure A -> B

◆ cs_adjacency_create()

cs_adjacency_t * cs_adjacency_create ( cs_flag_t flag,
int stride,
cs_lnum_t n_elts )

Create a cs_adjacency_t structure of size n_elts.

Parameters
[in]flagmetadata related to the new cs_adjacency to create
[in]stride> 0 if useful otherwise ignored
[in]n_eltsnumber of entries of the indexed list
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_adjacency_create_from_i_arrays()

cs_adjacency_t * cs_adjacency_create_from_i_arrays ( cs_lnum_t n_elts,
cs_lnum_t * idx,
cs_lnum_t * ids,
short int * sgn )

Create a cs_adjacency_t structure sharing arrays scanned with an index.

Parameters
[in]n_eltsnumber of elements
[in]idxarray of size n_elts + 1
[in]idsarray of element ids (size = idx[n_elts])
[in]sgnarray storing the orientation (may be nullptr)
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_adjacency_create_from_s_arrays()

cs_adjacency_t * cs_adjacency_create_from_s_arrays ( cs_lnum_t n_elts,
int stride,
cs_lnum_t * ids,
short int * sgn )

Create a cs_adjacency_t structure sharing arrays scanned with a stride.

Parameters
[in]n_eltsnumber of elements
[in]stridevalue of the stride
[in]idsarray of element ids (size = stride * n_elts)
[in]sgnarray storing the orientation (may be nullptr)
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_adjacency_destroy()

void cs_adjacency_destroy ( cs_adjacency_t ** p_adj)

Destroy a cs_adjacency_t structure.

Parameters
[in,out]p_adjpointer of pointer to a cs_adjacency_t structure

◆ cs_adjacency_difference()

cs_adjacency_t * cs_adjacency_difference ( const cs_adjacency_t * a2b_1,
const cs_adjacency_t * a2b_2 )

Create a new cs_adjacency_t structure from the difference of two cs_adjacency_t structures: A -> B created by two different compositions: (1) A -> B = A -> C + C -> B (2) A -> B = A -> D + D -> B.

The resulting structure describes (1)(2). It does not rely on a stride and has no sgn member and duplicated elements are removed

Parameters
[in]a2b_1adjacency A -> B (1)
[in]a2b_2adjacency A -> B (2)
Returns
a pointer to the cs_adjacency_t structure A -> B

◆ cs_adjacency_dump()

void cs_adjacency_dump ( const char * name,
FILE * _f,
cs_adjacency_t * adj )

Dump a cs_adjacency_t structure to a file or into the standard output.

Parameters
[in]namename of the dump file. Can be set to nullptr
[in]_fpointer to a FILE structure. Can be set to nullptr.
[in]adjpointer to a cs_adjacency_t structure

◆ cs_adjacency_remove_self_entries()

void cs_adjacency_remove_self_entries ( cs_adjacency_t * adj)

In an indexed list, remove id(s) corresponding to the current index. Useful for instance in order to prepare a matrix structure in MSR storage.

Parameters
[in,out]adjpointer to the cs_adjacency_t structure to update

◆ cs_adjacency_sort()

void cs_adjacency_sort ( cs_adjacency_t * adj)

Sort each sub-list related to an entry in a cs_adjacency_t structure.

Parameters
[in]adjpointer to a cs_adjacency_t structure

◆ cs_adjacency_transpose()

cs_adjacency_t * cs_adjacency_transpose ( int n_b_elts,
const cs_adjacency_t * a2b )

Create a new cs_adjacency_t structure from a one corresponding to A -> B. The resulting structure deals with B -> A.

Parameters
[in]n_b_eltssize of the set of B elements
[in]a2bpointer to the A -> B cs_adjacency_t structure
Returns
a new pointer to the cs_adjacency_t structure B -> A

◆ cs_mesh_adjacencies_cell_faces()

const cs_adjacency_t * cs_mesh_adjacencies_cell_faces ( void )

Return cell -> face connectivites in mesh adjacencies helper API relative to mesh.

Boundary faces appear first, interior faces second.

This connectivity is built only when first requested, then updated later if needed.

◆ cs_mesh_adjacencies_cell_vertices()

const cs_adjacency_t * cs_mesh_adjacencies_cell_vertices ( void )

Return cell -> vertex connectivites in mesh adjacencies helper API relative to mesh.

This connectivity is built only when first requested, then updated later if needed.

◆ cs_mesh_adjacencies_finalize()

void cs_mesh_adjacencies_finalize ( void )

Finalize mesh adjacencies helper API.

◆ cs_mesh_adjacencies_get_global()

cs_mesh_adjacencies_t * cs_mesh_adjacencies_get_global ( void )

Get non-const pointer to cs_glob_mesh_adacencies.

◆ cs_mesh_adjacencies_initialize()

void cs_mesh_adjacencies_initialize ( void )

Initialize mesh adjacencies helper API.

◆ cs_mesh_adjacencies_update_cell_cells_e()

void cs_mesh_adjacencies_update_cell_cells_e ( void )

Update extended cell -> cell connectivites in mesh adjacencies helper API relative to mesh.

◆ cs_mesh_adjacencies_update_cell_i_faces()

void cs_mesh_adjacencies_update_cell_i_faces ( void )

Ensure presence of cell -> interior face connectivites in mesh adjacencies helper API relative to mesh.

◆ cs_mesh_adjacencies_update_device()

void cs_mesh_adjacencies_update_device ( cs_alloc_mode_t alloc_mode)

Map some global mesh adjacency arrays for use on device.

More elements may be mapped dependin on which arrays are used in accelerated algorithms.

Parameters
[in]alloc_modechosen allocation mode

◆ cs_mesh_adjacencies_update_mesh()

void cs_mesh_adjacencies_update_mesh ( void )

Update mesh adjacencies helper API relative to mesh.

◆ cs_mesh_adjacency_c2f()

cs_adjacency_t * cs_mesh_adjacency_c2f ( const cs_mesh_t * m,
int boundary_order )

Build a cells to faces adjacency structure.

With the boundary_order option set to 0, boundary faces come first, so interior face ids are shifted by the number of boundary faces. With boundary_order set to 1, boundary faces come last, so face ids are shifted by the number of interior faces.

Parameters
[in]mpointer to a cs_mesh_t structure
[in]boundary_orderboundaries first (0) or last (1)
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_mesh_adjacency_c2f_boundary()

cs_adjacency_t * cs_mesh_adjacency_c2f_boundary ( const cs_mesh_t * m)

Build a cells to boundary faces adjacency structure.

By construction, face ids adjacent to each cell are ordered.

Parameters
[in]mpointer to a cs_mesh_t structure
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_mesh_adjacency_c2f_lower()

cs_adjacency_t * cs_mesh_adjacency_c2f_lower ( const cs_mesh_t * m,
int boundary_order )

Build a partial cells to faces adjacency structure.

With the boundary_order option set to 0, boundary faces come first, so interior face ids are shifted by the number of boundary faces. With boundary_order set to 1, boundary faces come last, so face ids are shifted by the number of interior faces. With boundary order set to -1, boundary faces are ignored.

Only internal faces as seen from the cell with lowest cell id (out of 2 cells adjacent to that face) are added to the structure, so each face appears only once, not twice. In other words, only the lower part of the corresponding cell-cells adjacency matrix is built.

By construction, face ids adjacent to each cell are ordered.

Parameters
[in]mpointer to a cs_mesh_t structure
[in]boundary_orderboundaries first (0), last (1), or ignored (-1)
Returns
a pointer to a new allocated cs_adjacency_t structure

◆ cs_mesh_adjacency_v2v()

cs_adjacency_t * cs_mesh_adjacency_v2v ( const cs_mesh_t * m)

Allocate and define a cs_adjacency_t structure related to the connectivity vertex to vertices through edges.

Adjacent vertices are accessed based on the vertex with lowest id. Another v2v connectivity through cells is possible. Please read the cs_cdo_connect.cpp source code if interested

Parameters
[in]mpointer to a cs_mesh_t structure
Returns
a pointer to a new allocated cs_adjacency_t structure