My Project
programmer's documentation
Functions
cs_lagr_particle.c File Reference
#include "cs_defs.h"
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <float.h>
#include <assert.h>
#include "bft_printf.h"
#include "bft_error.h"
#include "bft_mem.h"
#include "fvm_periodicity.h"
#include "cs_base.h"
#include "cs_math.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_random.h"
#include "cs_timer_stats.h"
#include "cs_lagr.h"
#include "cs_lagr_post.h"
#include "cs_lagr_clogging.h"
#include "cs_lagr_roughness.h"
#include "cs_lagr_dlvo.h"
#include "cs_lagr_particle.h"
Include dependency graph for cs_lagr_particle.c:

Functions

void cs_lagr_particle_attr_initialize (void)
 Define particle map based on defined options. More...
 
const cs_lagr_attribute_map_tcs_lagr_particle_get_attr_map (void)
 Return const pointer to the main particle attribute map structure. More...
 
void cs_lagr_particle_set_create (void)
 
void cs_lagr_particle_finalize (void)
 Destroy main particle set and map if they exist. More...
 
void cs_lagr_part_copy (cs_lnum_t dest, cs_lnum_t src)
 Copy attributes from one particle to another. More...
 
void cs_lagr_get_attr_info (const cs_lagr_particle_set_t *particles, int time_id, cs_lagr_attribute_t attr, size_t *extents, size_t *size, ptrdiff_t *displ, cs_datatype_t *datatype, int *count)
 Get data extents for a given particle attribute. More...
 
int cs_lagr_check_attr_query (const cs_lagr_particle_set_t *particles, cs_lagr_attribute_t attr, cs_datatype_t datatype, int stride, int component_id)
 Check that query for a given particle attribute is valid. More...
 
void cs_lagr_particle_attr_in_range (int attr)
 Check if a particle attribute is in a valid range. More...
 
cs_lagr_particle_set_tcs_lagr_get_particle_set (void)
 Return pointer to the main cs_lagr_particle_set_t structure. More...
 
int cs_lagr_particle_set_resize (cs_lnum_t n_min_particles)
 Resize particle set buffers if needed. More...
 
void cs_lagr_set_reallocation_factor (double f)
 Set reallocation factor for particle sets. More...
 
unsigned long long cs_lagr_get_n_g_particles_max (void)
 Get global maximum number of particles. More...
 
void cs_lagr_set_n_g_particles_max (unsigned long long n_g_particles_max)
 Set global maximum number of particles. More...
 
void cs_lagr_particles_current_to_previous (cs_lagr_particle_set_t *particles, cs_lnum_t particle_id)
 Copy current attributes to previous attributes. More...
 
void cs_lagr_particle_set_dump (const cs_lagr_particle_set_t *particles)
 Dump a cs_lagr_particle_set_t structure. More...
 
void cs_lagr_set_n_user_variables (int n_user_variables)
 Set number of user particle variables. More...
 

Detailed Description

Particle structure.

Function Documentation

◆ cs_lagr_check_attr_query()

int cs_lagr_check_attr_query ( const cs_lagr_particle_set_t particles,
cs_lagr_attribute_t  attr,
cs_datatype_t  datatype,
int  stride,
int  component_id 
)

Check that query for a given particle attribute is valid.

Parameters
[in]particlesassociated particle set
[in]attrattribute whose values are required
[in]datatypeassociated value type
[in]stridenumber of values per particle
[in]component_idif -1 : extract the whole attribute if >0 : id of the component to extract
Returns
0 in case of success, 1 in case of error

◆ cs_lagr_get_attr_info()

void cs_lagr_get_attr_info ( const cs_lagr_particle_set_t particles,
int  time_id,
cs_lagr_attribute_t  attr,
size_t *  extents,
size_t *  size,
ptrdiff_t *  displ,
cs_datatype_t datatype,
int *  count 
)

Get data extents for a given particle attribute.

For attributes not currently present, the displacement and data size should be -1 and 0 respectively.

Parameters
[in]particlesassociated particle set
[in]time_idassociated time id (0: current, 1: previous)
[in]attrparticle attribute
[out]extentssize (in bytes) of particle structure, or NULL
[out]sizesize (in bytes) of attribute in particle structure, or NULL
[out]displdisplacement (in bytes) in particle structure, or NULL
[out]datatypedatatype of associated attribute, or NULL
[out]countnumber of type values associated with attribute, or NULL

◆ cs_lagr_get_n_g_particles_max()

unsigned long long cs_lagr_get_n_g_particles_max ( void  )

Get global maximum number of particles.

By default, the number is limited only by local cs_lnum_t and global cs_gnum_t data representation limits.

Returns
global maximum number of particles

◆ cs_lagr_get_particle_set()

cs_lagr_particle_set_t* cs_lagr_get_particle_set ( void  )

Return pointer to the main cs_lagr_particle_set_t structure.

Returns
pointer to current particle set, or NULL

◆ cs_lagr_part_copy()

void cs_lagr_part_copy ( cs_lnum_t  dest,
cs_lnum_t  src 
)

Copy attributes from one particle to another.

The random value associated with the particle is modified.

Parameters
destid (0-based) of destination particle
srcid (0-based) of source particle

◆ cs_lagr_particle_attr_in_range()

void cs_lagr_particle_attr_in_range ( int  attr)

Check if a particle attribute is in a valid range.

If this is not the case, a fatal error is provoked.

Parameters
[in]attrparticle attribute

◆ cs_lagr_particle_attr_initialize()

void cs_lagr_particle_attr_initialize ( void  )

Define particle map based on defined options.

◆ cs_lagr_particle_finalize()

void cs_lagr_particle_finalize ( void  )

Destroy main particle set and map if they exist.

◆ cs_lagr_particle_get_attr_map()

const cs_lagr_attribute_map_t* cs_lagr_particle_get_attr_map ( void  )

Return const pointer to the main particle attribute map structure.

Returns
pointer to current particle attrbute map, or NULL

◆ cs_lagr_particle_set_create()

void cs_lagr_particle_set_create ( void  )

Allocate main cs_lagr_particle_set_t structure.

◆ cs_lagr_particle_set_dump()

void cs_lagr_particle_set_dump ( const cs_lagr_particle_set_t particles)

Dump a cs_lagr_particle_set_t structure.

Parameters
[in]particlescs_lagr_particle_t structure to dump

◆ cs_lagr_particle_set_resize()

int cs_lagr_particle_set_resize ( cs_lnum_t  n_min_particles)

Resize particle set buffers if needed.

By default, the total number of particles is not limited. A global limit may be set using cs_lagr_set_n_g_particles_max.

Parameters
[in]n_min_particlesminimum number of particles required
Returns
1 if resizing was required, -1 if the global minimum number of particles would exceed the global limit, 0 otherwise.

◆ cs_lagr_particles_current_to_previous()

void cs_lagr_particles_current_to_previous ( cs_lagr_particle_set_t particles,
cs_lnum_t  particle_id 
)

Copy current attributes to previous attributes.

Parameters
[in,out]particlesassociated particle set
[in]particle_idid of particle

◆ cs_lagr_set_n_g_particles_max()

void cs_lagr_set_n_g_particles_max ( unsigned long long  n_g_particles_max)

Set global maximum number of particles.

By default, the number is limited only by local cs_lnum_t and global cs_gnum_t data representation limits.

Parameters
[in]n_g_particles_maxglobal maximum number of particles

◆ cs_lagr_set_n_user_variables()

void cs_lagr_set_n_user_variables ( int  n_user_variables)

Set number of user particle variables.

Parameters
[in]n_user_variablesnumber of user variables

◆ cs_lagr_set_reallocation_factor()

void cs_lagr_set_reallocation_factor ( double  f)

Set reallocation factor for particle sets.

This factor determines the multiplier used for reallocations when the particle set's buffers are too small to handle the new number of particles.

Parameters
[in]freallocation size multiplier