File: cs_lagr_extract.h

package info (click to toggle)
code-saturne 4.3.3%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 77,992 kB
  • sloc: ansic: 281,257; f90: 122,305; python: 56,490; makefile: 3,915; xml: 3,285; cpp: 3,183; sh: 1,139; lex: 176; yacc: 101; sed: 16
file content (168 lines) | stat: -rw-r--r-- 7,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef __CS_LAGR_EXTRACT_H__
#define __CS_LAGR_EXTRACT_H__

/*============================================================================
 * Extract information from lagrangian particles.
 *============================================================================*/

/*
  This file is part of Code_Saturne, a general-purpose CFD tool.

  Copyright (C) 1998-2016 EDF S.A.

  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free Software
  Foundation; either version 2 of the License, or (at your option) any later
  version.

  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  details.

  You should have received a copy of the GNU General Public License along with
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
 * Standard C library headers
 *----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
 * Local headers
 *----------------------------------------------------------------------------*/

#include "fvm_nodal.h"
#include "fvm_writer.h"

#include "cs_base.h"
#include "cs_lagr_particle.h"
#include "cs_time_step.h"

/*----------------------------------------------------------------------------*/

BEGIN_C_DECLS

/*============================================================================
 * Macro definitions
 *============================================================================*/

/*============================================================================
 * Local type definitions
 *============================================================================*/

/*=============================================================================
 * Global variables
 *============================================================================*/

/*============================================================================
 * Public function prototypes
 *============================================================================*/

/*----------------------------------------------------------------------------
 * Get the local number of particles.
 *
 * returns:
 *   current number of particles.
 *----------------------------------------------------------------------------*/

cs_lnum_t
cs_lagr_get_n_particles(void);

/*----------------------------------------------------------------------------
 * Extract a list of particles using an optional cell filter and
 * statistical density filter.
 *
 * The output array must have been allocated by the caller and be of
 * sufficient size.
 *
 * parameters:
 *   n_cells         <-- number of cells in filter
 *   cell_list       <-- optional list of containing cells filter
 *                       (1 to n numbering)
 *   density         <-- if < 1, fraction of particles to select
 *   n_particles     --> number of selected particles, or NULL
 *   particle_list   --> particle_list (1 to n numbering), or NULL
 *----------------------------------------------------------------------------*/

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 values for a set of particles.
 *
 * The output array must have been allocated by the caller and be of
 * sufficient size.
 *
 * parameters:
 *   particle_set  <-- associated particle set
 *   attr          <-- attribute whose values are required
 *   datatype      <-- associated value type
 *   stride        <-- number of values per particle
 *   component_id  <-- if -1 : extract the whole attribute
 *                     if >0 : id of the component to extract
 *   n_particles   <-- number of particles in filter
 *   particle_list <-- particle_list (1 to n numbering), or NULL
 *   values        --> particle values for given attribute
 *
 * returns:
 *   0 in case of success, 1 if attribute is not present
 *----------------------------------------------------------------------------*/

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 trajectory values for a set of particles.
 *
 * Trajectories are defined as a mesh of segments, whose start and end
 * points are copied in an interleaved manner in the segment_values array
 * (p1_old, p1_new, p2_old, p2_new, ... pn_old, pn_new).
 *
 * The output array must have been allocated by the caller and be of
 * sufficient size.
 *
 * parameters:
 *   particles      <-- associated particle set
 *   attr           <-- attribute whose values are required
 *   datatype       <-- associated value type
 *   stride         <-- number of values per particle
 *   component_id   <-- if -1 : extract the whole attribute
 *                      if >0 : id of the component to extract
 *   n_particles    <-- number of particles in filter
 *   particle_list  <-- particle_list (1 to n numbering), or NULL
 *   segment_values --> particle segment values
 *
 * returns:
 *    0 in case of success, 1 if attribute is not present
 *----------------------------------------------------------------------------*/

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);

/*----------------------------------------------------------------------------*/

END_C_DECLS

#endif /* __CS_LAGR_EXTRACT_H__ */