My Project
programmer's documentation
Functions | Variables
fvm_nodal.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_mesh.h"
#include "fvm_defs.h"
#include "fvm_io_num.h"
#include "fvm_tesselation.h"
#include "cs_parall.h"
#include "fvm_nodal.h"
#include "fvm_nodal_priv.h"
Include dependency graph for fvm_nodal.c:

Functions

fvm_nodal_t * fvm_nodal_create (const char *name, int dim)
 
fvm_nodal_t * fvm_nodal_destroy (fvm_nodal_t *this_nodal)
 
fvm_nodal_t * fvm_nodal_copy (const fvm_nodal_t *this_nodal)
 
void fvm_nodal_reduce (fvm_nodal_t *this_nodal, int del_vertex_num)
 
void fvm_nodal_change_parent_num (fvm_nodal_t *this_nodal, const cs_lnum_t new_parent_num[], int entity_dim)
 
void fvm_nodal_remove_parent_num (fvm_nodal_t *this_nodal, int entity_dim)
 
void fvm_nodal_init_io_num (fvm_nodal_t *this_nodal, const cs_gnum_t parent_global_numbers[], int entity_dim)
 
void fvm_nodal_transfer_vertex_io_num (fvm_nodal_t *this_nodal, fvm_io_num_t **io_num)
 
void fvm_nodal_set_tag (fvm_nodal_t *this_nodal, const int tag[], int entity_dim)
 
void fvm_nodal_remove_tag (fvm_nodal_t *this_nodal, int entity_dim)
 
void fvm_nodal_define_vertex_list (fvm_nodal_t *this_nodal, cs_lnum_t n_vertices, cs_lnum_t parent_vertex_num[])
 
void fvm_nodal_set_shared_vertices (fvm_nodal_t *this_nodal, const cs_coord_t vertex_coords[])
 
cs_coord_tfvm_nodal_transfer_vertices (fvm_nodal_t *this_nodal, cs_coord_t vertex_coords[])
 
void fvm_nodal_make_vertices_private (fvm_nodal_t *this_nodal)
 
void fvm_nodal_set_group_class_set (fvm_nodal_t *this_nodal, const fvm_group_class_set_t *gc_set)
 
void fvm_nodal_transfer_global_vertex_labels (fvm_nodal_t *this_nodal, char *g_labels[])
 
const char * fvm_nodal_get_name (const fvm_nodal_t *this_nodal)
 
int fvm_nodal_get_dim (const fvm_nodal_t *this_nodal)
 
int fvm_nodal_get_max_entity_dim (const fvm_nodal_t *this_nodal)
 
cs_lnum_t fvm_nodal_get_n_entities (const fvm_nodal_t *this_nodal, int entity_dim)
 
cs_gnum_t fvm_nodal_get_n_g_vertices (const fvm_nodal_t *this_nodal)
 
cs_gnum_t fvm_nodal_get_n_g_elements (const fvm_nodal_t *this_nodal, fvm_element_t element_type)
 
cs_lnum_t fvm_nodal_get_n_elements (const fvm_nodal_t *this_nodal, fvm_element_t element_type)
 
void fvm_nodal_get_parent_num (const fvm_nodal_t *this_nodal, int entity_dim, cs_lnum_t parent_num[])
 
const char ** fvm_nodal_get_global_vertex_labels (const fvm_nodal_t *this_nodal)
 
const cs_mesh_tfvm_nodal_get_parent (const fvm_nodal_t *this_nodal)
 
void fvm_nodal_set_parent (fvm_nodal_t *this_nodal, const cs_mesh_t *parent)
 
void fvm_nodal_tesselate (fvm_nodal_t *this_nodal, fvm_element_t type, cs_lnum_t *error_count)
 
fvm_nodal_t * fvm_nodal_copy_edges (const char *name, const fvm_nodal_t *this_nodal)
 
void fvm_nodal_dump (const fvm_nodal_t *this_nodal)
 

Variables

const int fvm_nodal_n_vertices_element []
 
static int fvm_nodal_n_edges_element []
 

Detailed Description

Main structure for a nodal representation associated with a mesh.

The fvm_nodal_t structure is mostly used to handle post-processing output in external formats, usually running in parallel using MPI. This implies reconstructing a nodal connectivity (cells -> vertices) from the main faces -> cells connectivity (using an intermediate cells -> faces representation). It is also possible to directly pass a nodal connectivity to such a structure.

So as to limit memory usage and avoid unecessary copies, the fvm_nodal_t structure associated to a mesh defined by its nodal connectivity is construed as a "view" on a mesh, and owns as little data as possible. As such, most main structures associated with this representation are defined by 2 arrays, one private, and one shared. For example, an fvm_nodal_t structure has 2 coordinate arrays:

const *cs_coord_t vertex_coords;

*cs_coord_t _vertex_coords;

If coordinates are shared with the calling code (and owned by that code), we have _vertex_coords = NULL, and vertex_coords points to the array passed from the calling code. If the coordinates array belongs to FVM (either having been "given" by the calling code, or generated by an operation wich invalidates coorindates sharing with the parent mesh, such as mesh extrusion), we have vertex_coords = _vertex_coords, which points to the private array.

When an fvm_nodal_t object is destroyed, it destroys its private data and frees the corresponding memory, but obviously leaves its shared data untouched.

If a fvm_nodal_t structure B is built from a structure A with which it shares its data, and a second fvm_nodal_t mesh C is a view on B (for example a restriction to a part of the domain that we whish to post-process more frequently), C must be destroyed before B, which must be destroyed before A. FVM does not use reference counters or a similar mechanism, so good managment of object lifecycles is of the responsiblity of the calling code. In practice, this logic is simple enough that no issues have been encountered with this model so far in the intended uses of the code.

Another associated concept is that of "parent_number": if a mesh constitutes a "view" on another, sur un autre, a list of parent entity numbers allows accessing variables associated with the "parent" mesh, without needing to extract or duplicate values at the level of the calling code.

Note that an FVM structure is global from an MPI point of view, as it may participate in collective parallel operations. Thus, if an FVM mesh represents a subset of a global domain, it may very well be empty for some ranks, but it must still exist on all ranks of the main communicator associated with FVM.

For parallelism, another important concept is that of "global numbering", corresponding to entity numbers in a "serial" or "global" version of an object: two entities (vertices, elements, ...) on different processors having a same global number correspond to the same "absolute" object. Except when explicitely mentioned, all other data defining an object is based on local definitions and numberings. Parallelism is thus made quite "transparent" to the calling code.

Function Documentation

◆ fvm_nodal_change_parent_num()

void fvm_nodal_change_parent_num ( fvm_nodal_t *  this_nodal,
const cs_lnum_t  new_parent_num[],
int  entity_dim 
)

◆ fvm_nodal_copy()

fvm_nodal_t* fvm_nodal_copy ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_copy_edges()

fvm_nodal_t* fvm_nodal_copy_edges ( const char *  name,
const fvm_nodal_t *  this_nodal 
)

◆ fvm_nodal_create()

fvm_nodal_t* fvm_nodal_create ( const char *  name,
int  dim 
)

◆ fvm_nodal_define_vertex_list()

void fvm_nodal_define_vertex_list ( fvm_nodal_t *  this_nodal,
cs_lnum_t  n_vertices,
cs_lnum_t  parent_vertex_num[] 
)

◆ fvm_nodal_destroy()

fvm_nodal_t* fvm_nodal_destroy ( fvm_nodal_t *  this_nodal)

◆ fvm_nodal_dump()

void fvm_nodal_dump ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_dim()

int fvm_nodal_get_dim ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_global_vertex_labels()

const char** fvm_nodal_get_global_vertex_labels ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_max_entity_dim()

int fvm_nodal_get_max_entity_dim ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_n_elements()

cs_lnum_t fvm_nodal_get_n_elements ( const fvm_nodal_t *  this_nodal,
fvm_element_t  element_type 
)

◆ fvm_nodal_get_n_entities()

cs_lnum_t fvm_nodal_get_n_entities ( const fvm_nodal_t *  this_nodal,
int  entity_dim 
)

◆ fvm_nodal_get_n_g_elements()

cs_gnum_t fvm_nodal_get_n_g_elements ( const fvm_nodal_t *  this_nodal,
fvm_element_t  element_type 
)

◆ fvm_nodal_get_n_g_vertices()

cs_gnum_t fvm_nodal_get_n_g_vertices ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_name()

const char* fvm_nodal_get_name ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_parent()

const cs_mesh_t* fvm_nodal_get_parent ( const fvm_nodal_t *  this_nodal)

◆ fvm_nodal_get_parent_num()

void fvm_nodal_get_parent_num ( const fvm_nodal_t *  this_nodal,
int  entity_dim,
cs_lnum_t  parent_num[] 
)

◆ fvm_nodal_init_io_num()

void fvm_nodal_init_io_num ( fvm_nodal_t *  this_nodal,
const cs_gnum_t  parent_global_numbers[],
int  entity_dim 
)

◆ fvm_nodal_make_vertices_private()

void fvm_nodal_make_vertices_private ( fvm_nodal_t *  this_nodal)

◆ fvm_nodal_reduce()

void fvm_nodal_reduce ( fvm_nodal_t *  this_nodal,
int  del_vertex_num 
)

◆ fvm_nodal_remove_parent_num()

void fvm_nodal_remove_parent_num ( fvm_nodal_t *  this_nodal,
int  entity_dim 
)

◆ fvm_nodal_remove_tag()

void fvm_nodal_remove_tag ( fvm_nodal_t *  this_nodal,
int  entity_dim 
)

◆ fvm_nodal_set_group_class_set()

void fvm_nodal_set_group_class_set ( fvm_nodal_t *  this_nodal,
const fvm_group_class_set_t gc_set 
)

◆ fvm_nodal_set_parent()

void fvm_nodal_set_parent ( fvm_nodal_t *  this_nodal,
const cs_mesh_t parent 
)

◆ fvm_nodal_set_shared_vertices()

void fvm_nodal_set_shared_vertices ( fvm_nodal_t *  this_nodal,
const cs_coord_t  vertex_coords[] 
)

◆ fvm_nodal_set_tag()

void fvm_nodal_set_tag ( fvm_nodal_t *  this_nodal,
const int  tag[],
int  entity_dim 
)

◆ fvm_nodal_tesselate()

void fvm_nodal_tesselate ( fvm_nodal_t *  this_nodal,
fvm_element_t  type,
cs_lnum_t error_count 
)

◆ fvm_nodal_transfer_global_vertex_labels()

void fvm_nodal_transfer_global_vertex_labels ( fvm_nodal_t *  this_nodal,
char *  g_labels[] 
)

◆ fvm_nodal_transfer_vertex_io_num()

void fvm_nodal_transfer_vertex_io_num ( fvm_nodal_t *  this_nodal,
fvm_io_num_t **  io_num 
)

◆ fvm_nodal_transfer_vertices()

cs_coord_t* fvm_nodal_transfer_vertices ( fvm_nodal_t *  this_nodal,
cs_coord_t  vertex_coords[] 
)

Variable Documentation

◆ fvm_nodal_n_edges_element

int fvm_nodal_n_edges_element[]
static
Initial value:
= {1,
3,
4,
0,
6,
8,
9,
12,
0}

◆ fvm_nodal_n_vertices_element

const int fvm_nodal_n_vertices_element[]
Initial value:
= {2,
3,
4,
0,
4,
5,
6,
8,
0}