9.2
general documentation
fvm_convert_array.h
Go to the documentation of this file.
1#ifndef FVM_CONVERT_ARRAY_H
2#define FVM_CONVERT_ARRAY_H
3
4/*============================================================================
5 * Functions related to the transformation of data arrays for import
6 * or export of meshes and fields.
7 *
8 * All "reasonable" combinations of datatypes are handled here.
9 * (templates would be useful here).
10 *============================================================================*/
11
12/*
13 This file is part of code_saturne, a general-purpose CFD tool.
14
15 Copyright (C) 1998-2026 EDF S.A.
16
17 This program is free software; you can redistribute it and/or modify it under
18 the terms of the GNU General Public License as published by the Free Software
19 Foundation; either version 2 of the License, or (at your option) any later
20 version.
21
22 This program is distributed in the hope that it will be useful, but WITHOUT
23 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
24 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
25 details.
26
27 You should have received a copy of the GNU General Public License along with
28 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
29 Street, Fifth Floor, Boston, MA 02110-1301, USA.
30*/
31
32/*----------------------------------------------------------------------------*/
33
34#include "base/cs_defs.h"
35
36/*----------------------------------------------------------------------------
37 * Local headers
38 *----------------------------------------------------------------------------*/
39
40#include "fvm/fvm_defs.h"
41#include "fvm/fvm_nodal.h"
42
43/*=============================================================================
44 * Macro definitions
45 *============================================================================*/
46
47/*============================================================================
48 * Type definitions
49 *============================================================================*/
50
51/*=============================================================================
52 * Static global variables
53 *============================================================================*/
54
55/*=============================================================================
56 * Public function prototypes
57 *============================================================================*/
58
59/*----------------------------------------------------------------------------
60 * Convert an array representation of one type to that of another type, with
61 * possible indirection, interlacing, de-interlacing, or change of data
62 * dimension (i.e. projection or filling extra dimension with zeroes).
63 *
64 * Floating point (real or double) source and destination arrays may be
65 * multidimensional (interlaced or not), but with and integer type
66 * for source or destination, only 1-D arrays are allowed (no use for
67 * integer "vector fields" being currently required or apparent).
68 *
69 * Integer type destination arrays may be converted to floating point
70 * (for output formats with no integer datatype, such as EnSight),
71 * but floating point values may not be converted to integer values
72 * (no use for this operation being currently apparent).
73 *
74 * parameters:
75 * src_dim <-- dimension of source data
76 * src_dim_shift <-- source data dimension shift (start index)
77 * dest_dim <-- destination data dimension (1 if non interlaced)
78 * src_idx_start <-- start index in source data
79 * src_idx_end <-- past-the-end index in source data
80 * src_interlace <-- indicates if source data is interlaced
81 * src_datatype <-- source data type (float, double, or int)
82 * dest_datatype <-- destination data type (float, double, or int)
83 * n_parent_lists <-- number of parent lists (if parent_id != NULL)
84 * parent_id_shift <-- parent id to value array index shifts;
85 * size: n_parent_lists
86 * parent_id <-- if n_parent_lists > 0, parent entity ids
87 * src_data <-- array of source arrays (at least one, with one per
88 * source dimension if non interlaced, times one per
89 * parent list if multiple parent lists, with
90 * x_parent_1, y_parent_1, ..., x_parent_2, ...) order
91 * dest_data --> destination buffer
92 *----------------------------------------------------------------------------*/
93
94void
95fvm_convert_array(const int src_dim,
96 const int src_dim_shift,
97 const int dest_dim,
98 const cs_lnum_t src_idx_start,
99 const cs_lnum_t src_idx_end,
100 const cs_interlace_t src_interlace,
101 const cs_datatype_t src_datatype,
102 const cs_datatype_t dest_datatype,
103 const int n_parent_lists,
104 const cs_lnum_t parent_id_shift[],
105 const cs_lnum_t parent_id[],
106 const void *const src_data[],
107 void *const dest_data);
108
109/*----------------------------------------------------------------------------*/
110
111#endif /* FVM_CONVERT_ARRAY_H */
cs_datatype_t
Definition: cs_defs.h:290
cs_interlace_t
Definition: cs_defs.h:504
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
void fvm_convert_array(const int src_dim, const int src_dim_shift, const int dest_dim, const cs_lnum_t src_idx_start, const cs_lnum_t src_idx_end, const cs_interlace_t src_interlace, const cs_datatype_t src_datatype, const cs_datatype_t dest_datatype, const int n_parent_lists, const cs_lnum_t parent_id_shift[], const cs_lnum_t parent_id[], const void *const src_data[], void *const dest_data)
Definition: fvm_convert_array.cpp:1993