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