8.1
general documentation
cs_medcoupling_postprocess.cxx File Reference
#include <string>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "cs_array.h"
#include "cs_defs.h"
#include "cs_halo.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_medcoupling_utils.h"
#include "cs_medcoupling_mesh.hxx"
#include <MEDCoupling_version.h>
#include <MEDCouplingUMesh.hxx>
#include <MEDCouplingNormalizedUnstructuredMesh.txx>
#include "Interpolation2D3D.hxx"
#include "cs_medcoupling_postprocess.h"
+ Include dependency graph for cs_medcoupling_postprocess.cxx:

Enumerations

enum  cs_medcoupling_int_weight_t {
  CS_MEDCPL_INT_WEIGHT_NONE , CS_MEDCPL_INT_WEIGHT_SCALAR , CS_MEDCPL_INT_WEIGHT_VECTOR , CS_MEDCPL_INT_WEIGHT_SCALAR_VECTOR ,
  CS_MEDCPL_INT_WEIGHT_N_TYPES
}
 

Functions

static cs_medcoupling_slice_t * _get_slice_try (const char *name)
 Get a slice by name. Returns NULL if not found. More...
 
static cs_medcoupling_slice_t * _allocate_new_slice ()
 Allocate a new pointer for a slice. More...
 
static cs_medcoupling_slice_t * _add_slice (const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[])
 Add a new slice. More...
 
static void _compute_slice (cs_medcoupling_slice_t *si, MEDCouplingUMesh *m)
 Compute intersected surface. More...
 
template<const cs_medcoupling_int_weight_t iw_type>
void _compute_scalar_integral_l (cs_medcoupling_slice_t *si, const cs_real_t *scalar, const cs_real_t *weight_s, const cs_real_3_t *weight_v, cs_real_t *int_l, cs_real_t *w_l)
 Compute the local integral contribution. Parallel sum needs to be done in another call. More...
 
cs_medcoupling_slice_t * cs_medcoupling_slice_by_id (int id)
 Get pointer to a slice based on id. More...
 
cs_medcoupling_slice_t * cs_medcoupling_slice_by_name (const char *name)
 Get pointer to slice based on name, raises an error if not found. More...
 
cs_medcoupling_slice_t * cs_medcoupling_slice_by_name_try (const char *name)
 Get pointer to slice based on name. Returns NULL if not found. More...
 
void cs_medcoupling_postprocess_add_plane_slice (const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t length1, const cs_real_t length2)
 Add a slice based on a plane. More...
 
void cs_medcoupling_postprocess_add_disc_slice (const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius, const int n_sectors)
 Add a slice based on a disc. More...
 
void cs_medcoupling_postprocess_add_annulus_slice (const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius1, const cs_real_t radius2, const int n_sectors)
 Add a slice based on an annulus. More...
 
cs_lnum_t cs_medcoupling_slice_get_n_elts (const char *name)
 Get number cells that may be intersected by the slice. More...
 
cs_lnum_tcs_medcoupling_slice_get_elt_ids (const char *name)
 Get list of ids of the elements which may be intersected. More...
 
cs_real_tcs_medcoupling_slice_get_surfaces (const char *name)
 Get list of intersection surfaces for each cell intersected. More...
 
cs_real_t cs_medcoupling_slice_get_total_surface (const char *name)
 Get total intersection surface between a slice and volume mesh. More...
 
cs_real_t cs_medcoupling_slice_scalar_integral (const char *name, const cs_real_t *scalar)
 Compute integral of a scalar over a slice. More...
 
cs_real_t cs_medcoupling_slice_scalar_mean (const char *name, const cs_real_t *scalar)
 Compute mean value of a scalar over a slice. More...
 
cs_real_t cs_medcoupling_slice_scalar_integral_weighted (const char *name, const cs_real_t *scalar, const cs_real_t *weight_s, const cs_real_3_t *weight_v)
 Compute integral of a scalar over a slice using a scalar and/or vectorial weights. If NULL is provided for both weights, the non-weighted function is called. More...
 
cs_real_t cs_medcoupling_slice_scalar_mean_weighted (const char *name, const cs_real_t *scalar, const cs_real_t *weight_s, const cs_real_3_t *weight_v)
 Compute mean of a scalar over a slice using a scalar and/or vectorial weights. If NULL is provided for both weights, the non-weighted function is called. More...
 
void cs_medcoupling_slice_destroy_all (void)
 Destroy all slices. More...
 

Variables

static int _n_slices = 0
 
static cs_medcoupling_slice_t ** _slices = NULL
 

Enumeration Type Documentation

◆ cs_medcoupling_int_weight_t

Enumerator
CS_MEDCPL_INT_WEIGHT_NONE 
CS_MEDCPL_INT_WEIGHT_SCALAR 
CS_MEDCPL_INT_WEIGHT_VECTOR 
CS_MEDCPL_INT_WEIGHT_SCALAR_VECTOR 
CS_MEDCPL_INT_WEIGHT_N_TYPES 

Function Documentation

◆ _add_slice()

static cs_medcoupling_slice_t* _add_slice ( const char *  name,
const char *  selection_criteria,
const cs_real_t  origin[],
const cs_real_t  normal[] 
)
inlinestatic

Add a new slice.

Parameters
[in]nameName of the new intersection
[in]selection_criteriaSelection criteria for cells to intersect
[in]originOrigin point of the surface
[in]normalNormal vector of the surface
Returns
pointer to newly created slice

◆ _allocate_new_slice()

static cs_medcoupling_slice_t* _allocate_new_slice ( )
inlinestatic

Allocate a new pointer for a slice.

Returns
A newly allocated and initialised pointer.

◆ _compute_scalar_integral_l()

void _compute_scalar_integral_l ( cs_medcoupling_slice_t *  si,
const cs_real_t scalar,
const cs_real_t weight_s,
const cs_real_3_t weight_v,
cs_real_t int_l,
cs_real_t w_l 
)

Compute the local integral contribution. Parallel sum needs to be done in another call.

Parameters
[in]siSlice pointer
[in]scalarScalar array (size on n_cells)
[in]weight_sScalar weight array (size n_cells)
[in]weight_vVector weight array (size n_cells) in cs_real_3_t *
[out]int_lLocal integral value
[out]w_lLocal integrated weight value (if normalization is used)

◆ _compute_slice()

static void _compute_slice ( cs_medcoupling_slice_t *  si,
MEDCouplingUMesh *  m 
)
inlinestatic

Compute intersected surface.

Parameters
[in]siSlice
[in]mPointer to MEDCouplingUMesh representing the slice

◆ _get_slice_try()

static cs_medcoupling_slice_t* _get_slice_try ( const char *  name)
inlinestatic

Get a slice by name. Returns NULL if not found.

Parameters
[in]namename of the searched intersection
Returns
pointer to slice structure. NULL if not found.

◆ cs_medcoupling_postprocess_add_annulus_slice()

void cs_medcoupling_postprocess_add_annulus_slice ( const char *  name,
const char *  selection_criteria,
const cs_real_t  origin[],
const cs_real_t  normal[],
const cs_real_t  radius1,
const cs_real_t  radius2,
const int  n_sectors 
)

Add a slice based on an annulus.

Parameters
[in]nameName of the slice
[in]selection_criteriaSelection criteria for cells to intersect
[in]originCoordinates of origin point of slice
[in]normalNormal vector of the slice
[in]radius1Inner radius of the annulus (hole)
[in]radius2Outer radius of the annulus
[in]n_sectorsNumber of sectors for discretization. If negative, default value (36) is used.

◆ cs_medcoupling_postprocess_add_disc_slice()

void cs_medcoupling_postprocess_add_disc_slice ( const char *  name,
const char *  selection_criteria,
const cs_real_t  origin[],
const cs_real_t  normal[],
const cs_real_t  radius,
const int  n_sectors 
)

Add a slice based on a disc.

Parameters
[in]nameName of the slice
[in]selection_criteriaSelection criteria for cells to intersect
[in]originCoordinates of origin point of slice
[in]normalNormal vector of the slice
[in]radiusRadius of the disc
[in]n_sectorsNumber of sectors for discretization. If negative default value (36) is used.

◆ cs_medcoupling_postprocess_add_plane_slice()

void cs_medcoupling_postprocess_add_plane_slice ( const char *  name,
const char *  selection_criteria,
const cs_real_t  origin[],
const cs_real_t  normal[],
const cs_real_t  length1,
const cs_real_t  length2 
)

Add a slice based on a plane.

Parameters
[in]nameName of the slice
[in]selection_criteriaSelection criteria for cells to intersect
[in]originCoordinates of origin point of slice
[in]normalNormal vector of the slice
[in]length1Length along the first axis of the plane
[in]length2Length along the second axis of the plane

◆ cs_medcoupling_slice_by_id()

cs_medcoupling_slice_t* cs_medcoupling_slice_by_id ( int  id)

Get pointer to a slice based on id.

Parameters
[in]idindex of slice
Returns
pointer to slice. Raises an error if index is out of bounds.

◆ cs_medcoupling_slice_by_name()

cs_medcoupling_slice_t* cs_medcoupling_slice_by_name ( const char *  name)

Get pointer to slice based on name, raises an error if not found.

Parameters
[in]nameName of the slice structure
Returns
pointer to slice, raises error if not found.

◆ cs_medcoupling_slice_by_name_try()

cs_medcoupling_slice_t* cs_medcoupling_slice_by_name_try ( const char *  name)

Get pointer to slice based on name. Returns NULL if not found.

Parameters
[in]nameName of the slice structure
Returns
pointer to slice, NULL if not found.

◆ cs_medcoupling_slice_destroy_all()

void cs_medcoupling_slice_destroy_all ( void  )

Destroy all slices.

◆ cs_medcoupling_slice_get_elt_ids()

cs_lnum_t* cs_medcoupling_slice_get_elt_ids ( const char *  name)

Get list of ids of the elements which may be intersected.

Parameters
[in]nameName of the slice
Returns
Pointer to list of ids (cs_lnum_t *). Do not deallocate!

◆ cs_medcoupling_slice_get_n_elts()

cs_lnum_t cs_medcoupling_slice_get_n_elts ( const char *  name)

Get number cells that may be intersected by the slice.

Parameters
[in]nameName of the slice
Returns
Number of elements

◆ cs_medcoupling_slice_get_surfaces()

cs_real_t* cs_medcoupling_slice_get_surfaces ( const char *  name)

Get list of intersection surfaces for each cell intersected.

Parameters
[in]nameName of the slice
Returns
Pointer to list of intersection surfaces (cs_real_t *)

◆ cs_medcoupling_slice_get_total_surface()

cs_real_t cs_medcoupling_slice_get_total_surface ( const char *  name)

Get total intersection surface between a slice and volume mesh.

Parameters
[in]nameName of the slice
Returns
Value of total intersection surface

◆ cs_medcoupling_slice_scalar_integral()

cs_real_t cs_medcoupling_slice_scalar_integral ( const char *  name,
const cs_real_t scalar 
)

Compute integral of a scalar over a slice.

Parameters
[in]nameName of the slice
[in]scalarArray of scalar values (size n_cells)
Returns
Global integrated value. A cs_parall_sum is used.

◆ cs_medcoupling_slice_scalar_integral_weighted()

cs_real_t cs_medcoupling_slice_scalar_integral_weighted ( const char *  name,
const cs_real_t scalar,
const cs_real_t weight_s,
const cs_real_3_t weight_v 
)

Compute integral of a scalar over a slice using a scalar and/or vectorial weights. If NULL is provided for both weights, the non-weighted function is called.

Parameters
[in]nameName of the slice
[in]scalarArray of scalar values (size n_cells)
[in]weight_sScalar weight array (size n_cells)
[in]weight_vVectorial weight array (size n_cells)
Returns
Computed integral value over entire slice (parallel)

◆ cs_medcoupling_slice_scalar_mean()

cs_real_t cs_medcoupling_slice_scalar_mean ( const char *  name,
const cs_real_t scalar 
)

Compute mean value of a scalar over a slice.

Parameters
[in]nameName of the slice
[in]scalarArray of scalar values (size n_cells)
Returns
Global integrated value. A cs_parall_sum is used.

◆ cs_medcoupling_slice_scalar_mean_weighted()

cs_real_t cs_medcoupling_slice_scalar_mean_weighted ( const char *  name,
const cs_real_t scalar,
const cs_real_t weight_s,
const cs_real_3_t weight_v 
)

Compute mean of a scalar over a slice using a scalar and/or vectorial weights. If NULL is provided for both weights, the non-weighted function is called.

Parameters
[in]nameName of the slice
[in]scalarArray of scalar values (size n_cells)
[in]weight_sScalar weight array (size n_cells)
[in]weight_vVectorial weight array (size n_cells), cs_real_3_t pointer
Returns
Computed mean value over entire slice (parallel)

Variable Documentation

◆ _n_slices

int _n_slices = 0
static

◆ _slices

cs_medcoupling_slice_t** _slices = NULL
static