8.3
general documentation
cs_lagr_extract.h
Go to the documentation of this file.
1#ifndef __CS_LAGR_EXTRACT_H__
2#define __CS_LAGR_EXTRACT_H__
3
4/*============================================================================
5 * Extract information from lagrangian particles.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Standard C library headers
32 *----------------------------------------------------------------------------*/
33
34/*----------------------------------------------------------------------------
35 * Local headers
36 *----------------------------------------------------------------------------*/
37
38#include "fvm_nodal.h"
39#include "fvm_writer.h"
40
41#include "cs_base.h"
42#include "cs_lagr_particle.h"
43#include "cs_time_step.h"
44
45/*----------------------------------------------------------------------------*/
46
48
49/*============================================================================
50 * Macro definitions
51 *============================================================================*/
52
53/*============================================================================
54 * Local type definitions
55 *============================================================================*/
56
57/*=============================================================================
58 * Global variables
59 *============================================================================*/
60
61/*============================================================================
62 * Public function prototypes
63 *============================================================================*/
64
65/*----------------------------------------------------------------------------
66 * Get the local number of particles.
67 *
68 * returns:
69 * current number of particles.
70 *----------------------------------------------------------------------------*/
71
74
75/*----------------------------------------------------------------------------
76 * Extract a list of particles using an optional cell filter and
77 * statistical density filter.
78 *
79 * The output array must have been allocated by the caller and be of
80 * sufficient size.
81 *
82 * parameters:
83 * n_cells <-- number of cells in filter
84 * cell_list <-- optional list of containing cells filter
85 * (1 to n numbering)
86 * density <-- if < 1, fraction of particles to select
87 * n_particles --> number of selected particles, or NULL
88 * particle_list --> particle_list (1 to n numbering), or NULL
89 *----------------------------------------------------------------------------*/
90
91void
93 const cs_lnum_t cell_list[],
94 double density,
95 cs_lnum_t *n_particles,
96 cs_lnum_t *particle_list);
97
98/*----------------------------------------------------------------------------
99 * Extract values for a set of particles.
100 *
101 * The output array must have been allocated by the caller and be of
102 * sufficient size.
103 *
104 * parameters:
105 * particle_set <-- associated particle set
106 * attr <-- attribute whose values are required
107 * datatype <-- associated value type
108 * stride <-- number of values per particle
109 * component_id <-- if -1 : extract the whole attribute
110 * if >0 : id of the component to extract
111 * n_particles <-- number of particles in filter
112 * particle_list <-- particle_list (1 to n numbering), or NULL
113 * values --> particle values for given attribute
114 *
115 * returns:
116 * 0 in case of success, 1 if attribute is not present
117 *----------------------------------------------------------------------------*/
118
119int
122 cs_datatype_t datatype,
123 int stride,
124 int component_id,
125 cs_lnum_t n_particles,
126 const cs_lnum_t particle_list[],
127 void *values);
128
129/*----------------------------------------------------------------------------
130 * Extract trajectory values for a set of particles.
131 *
132 * Trajectories are defined as a mesh of segments, whose start and end
133 * points are copied in an interleaved manner in the segment_values array
134 * (p1_old, p1_new, p2_old, p2_new, ... pn_old, pn_new).
135 *
136 * The output array must have been allocated by the caller and be of
137 * sufficient size.
138 *
139 * parameters:
140 * particles <-- associated particle set
141 * attr <-- attribute whose values are required
142 * datatype <-- associated value type
143 * stride <-- number of values per particle
144 * component_id <-- if -1 : extract the whole attribute
145 * if >0 : id of the component to extract
146 * n_particles <-- number of particles in filter
147 * particle_list <-- particle_list (1 to n numbering), or NULL
148 * segment_values --> particle segment values
149 *
150 * returns:
151 * 0 in case of success, 1 if attribute is not present
152 *----------------------------------------------------------------------------*/
153
154int
157 cs_datatype_t datatype,
158 int stride,
159 int component_id,
160 cs_lnum_t n_particles,
161 const cs_lnum_t particle_list[],
162 void *segment_values);
163
164/*----------------------------------------------------------------------------*/
165
167
168#endif /* __CS_LAGR_EXTRACT_H__ */
cs_datatype_t
Definition: cs_defs.h:300
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
int cs_lagr_get_particle_values(const cs_lagr_particle_set_t *particles, cs_lagr_attribute_t attr, cs_datatype_t datatype, int stride, int component_id, cs_lnum_t n_particles, const cs_lnum_t particle_list[], void *values)
Extract values for a set of particles.
Definition: cs_lagr_extract.cpp:260
int cs_lagr_get_trajectory_values(const cs_lagr_particle_set_t *particles, cs_lagr_attribute_t attr, cs_datatype_t datatype, int stride, int component_id, cs_lnum_t n_particles, const cs_lnum_t particle_list[], void *segment_values)
Extract trajectory values for a set of particles.
Definition: cs_lagr_extract.cpp:362
void cs_lagr_get_particle_list(cs_lnum_t n_cells, const cs_lnum_t cell_list[], double density, cs_lnum_t *n_particles, cs_lnum_t *particle_list)
Extract a list of particles using an optional cell filter and statistical density filter.
Definition: cs_lagr_extract.cpp:134
cs_lnum_t cs_lagr_get_n_particles(void)
Get the local number of particles.
Definition: cs_lagr_extract.cpp:105
cs_lagr_attribute_t
Definition: cs_lagr_particle.h:80
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:123
Definition: cs_lagr_particle.h:223