9.1
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-2025 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/fvm_nodal.h
"
39
#include "
fvm/fvm_writer.h
"
40
41
#include "
base/cs_base.h
"
42
#include "
lagr/cs_lagr_particle.h
"
43
#include "
base/cs_time_step.h
"
44
45
/*----------------------------------------------------------------------------*/
46
47
BEGIN_C_DECLS
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
72
cs_lnum_t
73
cs_lagr_get_n_particles
(
void
);
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
* density <-- if < 1, fraction of particles to select
86
* n_particles --> number of selected particles, or NULL
87
* particle_list --> particle_list (1 to n numbering), or NULL
88
*----------------------------------------------------------------------------*/
89
90
void
91
cs_lagr_get_particle_list
(
cs_lnum_t
n_cells,
92
const
cs_lnum_t
cell_list[],
93
double
density,
94
cs_lnum_t
*n_particles,
95
cs_lnum_t
*particle_list);
96
97
/*----------------------------------------------------------------------------
98
* Extract values for a set of particles.
99
*
100
* The output array must have been allocated by the caller and be of
101
* sufficient size.
102
*
103
* parameters:
104
* particle_set <-- associated particle set
105
* attr <-- attribute whose values are required
106
* datatype <-- associated value type
107
* stride <-- number of values per particle
108
* component_id <-- if -1 : extract the whole attribute
109
* if >0 : id of the component to extract
110
* n_particles <-- number of particles in filter
111
* particle_list <-- particle_list (0 to n-1 numbering), or NULL
112
* values --> particle values for given attribute
113
*
114
* returns:
115
* 0 in case of success, 1 if attribute is not present
116
*----------------------------------------------------------------------------*/
117
118
int
119
cs_lagr_get_particle_values
(
const
cs_lagr_particle_set_t
*particles,
120
cs_lagr_attribute_t
attr,
121
cs_datatype_t
datatype,
122
int
stride,
123
int
component_id,
124
cs_lnum_t
n_particles,
125
const
cs_lnum_t
particle_list[],
126
void
*values);
127
128
/*----------------------------------------------------------------------------
129
* Extract trajectory values for a set of particles.
130
*
131
* Trajectories are defined as a mesh of segments, whose start and end
132
* points are copied in an interleaved manner in the segment_values array
133
* (p1_old, p1_new, p2_old, p2_new, ... pn_old, pn_new).
134
*
135
* The output array must have been allocated by the caller and be of
136
* sufficient size.
137
*
138
* parameters:
139
* particles <-- associated particle set
140
* attr <-- attribute whose values are required
141
* datatype <-- associated value type
142
* stride <-- number of values per particle
143
* component_id <-- if -1 : extract the whole attribute
144
* if >0 : id of the component to extract
145
* n_particles <-- number of particles in filter
146
* particle_list <-- particle_list (0 to n-1 numbering), or NULL
147
* segment_values --> particle segment values
148
*
149
* returns:
150
* 0 in case of success, 1 if attribute is not present
151
*----------------------------------------------------------------------------*/
152
153
int
154
cs_lagr_get_trajectory_values
(
const
cs_lagr_particle_set_t
*particles,
155
cs_lagr_attribute_t
attr,
156
cs_datatype_t
datatype,
157
int
stride,
158
int
component_id,
159
cs_lnum_t
n_particles,
160
const
cs_lnum_t
particle_list[],
161
void
*segment_values);
162
163
/*----------------------------------------------------------------------------*/
164
165
END_C_DECLS
166
167
#endif
/* __CS_LAGR_EXTRACT_H__ */
cs_base.h
cs_datatype_t
cs_datatype_t
Definition:
cs_defs.h:315
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition:
cs_defs.h:554
END_C_DECLS
#define END_C_DECLS
Definition:
cs_defs.h:555
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition:
cs_defs.h:350
cs_lagr_get_particle_values
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:259
cs_lagr_get_trajectory_values
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:361
cs_lagr_get_particle_list
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:133
cs_lagr_get_n_particles
cs_lnum_t cs_lagr_get_n_particles(void)
Get the local number of particles.
Definition:
cs_lagr_extract.cpp:105
cs_lagr_particle.h
cs_lagr_attribute_t
cs_lagr_attribute_t
Definition:
cs_lagr_particle.h:80
cs_time_step.h
fvm_nodal.h
fvm_writer.h
cs_lagr_particle_set_t
Definition:
cs_lagr_particle.h:226
src
lagr
cs_lagr_extract.h
Generated on Tue Dec 30 2025 16:20:04 for code_saturne by
1.9.4