My Project
programmer's 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-2019 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 "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "fvm_defs.h"
41 #include "fvm_nodal.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 /*=============================================================================
56  * Static global variables
57  *============================================================================*/
58 
59 /*=============================================================================
60  * Public function prototypes
61  *============================================================================*/
62 
63 /*----------------------------------------------------------------------------
64  * Convert an array representation of one type to that of another type, with
65  * possible indirection, interlacing, de-interlacing, or change of data
66  * dimension (i.e. projection or filling extra dimension with zeroes).
67  *
68  * Floating point (real or double) source and destination arrays may be
69  * multidimensional (interlaced or not), but with and integer type
70  * for source or destination, only 1-D arrays are allowed (no use for
71  * integer "vector fields" being currently required or apparent).
72  *
73  * Integer type destination arrays may be converted to floating point
74  * (for output formats with no integer datatype, such as EnSight),
75  * but floating point values may not be converted to integer values
76  * (no use for this operation being currently apparent).
77  *
78  * parameters:
79  * src_dim <-- dimension of source data
80  * src_dim_shift <-- source data dimension shift (start index)
81  * dest_dim <-- destination data dimension (1 if non interlaced)
82  * src_idx_start <-- start index in source data
83  * src_idx_end <-- past-the-end index in source data
84  * src_interlace <-- indicates if source data is interlaced
85  * src_datatype <-- source data type (float, double, or int)
86  * dest_datatype <-- destination data type (float, double, or int)
87  * n_parent_lists <-- number of parent lists (if parent_num != NULL)
88  * parent_num_shift <-- parent number to value array index shifts;
89  * size: n_parent_lists
90  * parent_num <-- if n_parent_lists > 0, parent entity numbers
91  * src_data <-- array of source arrays (at least one, with one per
92  * source dimension if non interlaced, times one per
93  * parent list if multiple parent lists, with
94  * x_parent_1, y_parent_1, ..., x_parent_2, ...) order
95  * dest_data --> destination buffer
96  *----------------------------------------------------------------------------*/
97 
98 void
99 fvm_convert_array(const int src_dim,
100  const int src_dim_shift,
101  const int dest_dim,
102  const cs_lnum_t src_idx_start,
103  const cs_lnum_t src_idx_end,
104  const cs_interlace_t src_interlace,
105  const cs_datatype_t src_datatype,
106  const cs_datatype_t dest_datatype,
107  const int n_parent_lists,
108  const cs_lnum_t parent_num_shift[],
109  const cs_lnum_t parent_num[],
110  const void *const src_data[],
111  void *const dest_data);
112 
113 /*----------------------------------------------------------------------------*/
114 
116 
117 #endif /* __FVM_CONVERT_ARRAY_H__ */
cs_defs.h
fvm_convert_array
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_num_shift[], const cs_lnum_t parent_num[], const void *const src_data[], void *const dest_data)
Definition: fvm_convert_array.c:1995
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_datatype_t
cs_datatype_t
Definition: cs_defs.h:260
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_interlace_t
cs_interlace_t
Definition: cs_defs.h:439
fvm_nodal.h
fvm_defs.h