programmer's documentation
cs_medcoupling_remapper.hxx
Go to the documentation of this file.
1 #ifndef __CS_MEDCOUPLING_REMAPPER_HXX__
2 #define __CS_MEDCOUPLING_REMAPPER_HXX__
3 
4 /*============================================================================
5  * Interpolation using MEDCoupling Remapper.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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  * MED library headers
36  *----------------------------------------------------------------------------*/
37 
39 
40 #if defined(HAVE_MEDCOUPLING_LOADER)
41 
42 /*----------------------------------------------------------------------------
43  * Local headers
44  *----------------------------------------------------------------------------*/
45 
46 #include "cs_base.h"
47 
48 /*----------------------------------------------------------------------------*/
49 
50 /*============================================================================
51  * Structure definitions
52  *============================================================================*/
53 
54 typedef struct _cs_medcoupling_remapper_t cs_medcoupling_remapper_t;
55 
56 /*============================================================================
57  * Public C++ function prototypes
58  *============================================================================*/
59 
60 /*----------------------------------------------------------------------------
61  * Return remapper associated with a given id
62  *
63  * parameters:
64  * id <-- remapper id
65  *
66  * return:
67  * pointer to remapper
68  *----------------------------------------------------------------------------*/
69 
70 cs_medcoupling_remapper_t *
71 cs_medcoupling_remapper_by_id(int r_id);
72 
73 /*----------------------------------------------------------------------------
74  * Return remapper associated with a given name
75  *
76  * parameters:
77  * name <-- remapper name
78  *
79  * return:
80  * pointer to remapper, or NULL
81  *----------------------------------------------------------------------------*/
82 
83 cs_medcoupling_remapper_t *
84 cs_medcoupling_remapper_by_name_try(const char *name);
85 
86 #if defined(HAVE_MEDCOUPLING_LOADER)
87 
88 /*----------------------------------------------------------------------------
89  * Create or update update the list of remappers in the case where
90  * several remappers may be needed.
91  *
92  * parameters:
93  * name <-- new remapper name
94  * elt_dim <-- element dimension
95  * select_criteria <-- selection criteria
96  * medfile_path <-- path of associated MED file
97  * n_fields <-- number of fields
98  * field_names <-- associated field names
99  * iteration <-- associated iteration
100  * iteration_order <-- associated iteration order
101  *
102  * return:
103  * id of the newly added remapper within the list
104  *----------------------------------------------------------------------------*/
105 
106 int
107 cs_medcoupling_remapper_initialize(const char *name,
108  int elt_dim,
109  const char *select_criteria,
110  const char *medfile_path,
111  int n_fields,
112  const char **field_names,
113  int iteration,
114  int iteration_order);
115 
116 #endif /* HAVE_MEDCOUPLING_LOADER */
117 
118 /*----------------------------------------------------------------------------
119  * Update field values (if several time steps are available in the MED file).
120  *
121  * parameters:
122  * r <-- remapper object
123  * iteration <-- associated iteration
124  * iteration_order <-- associated iteration order
125  *----------------------------------------------------------------------------*/
126 
127 void
128 cs_medcoupling_remapper_set_iteration(cs_medcoupling_remapper_t *r,
129  int iteration,
130  int iteration_order);
131 
132 /*----------------------------------------------------------------------------
133  * Create the interpolation matrix.
134  *
135  * This step is separated from the interpolation step since it only needs
136  * to be done once per mesh, while interpolation can be done for several
137  * fields.
138  *
139  * parameters:
140  * r <-- remapper object
141  * iteration <-- associated iteration
142  * iteration_order <-- associated iteration order
143  *----------------------------------------------------------------------------*/
144 
145 void
146 cs_medcoupling_remapper_setup(cs_medcoupling_remapper_t *r);
147 
148 /*----------------------------------------------------------------------------
149  * Copy interpolated values to a new array.
150  *
151  * The caller is responsible for freeing the returned array.
152  *
153  * parameters:
154  * field_id <-- id of given field
155  * r <-- pointer to remapper object
156  * default_val <-- default value
157  *
158  * return:
159  * pointer to allocated values array
160  *----------------------------------------------------------------------------*/
161 
162 cs_real_t *
163 cs_medcoupling_remapper_copy_values(cs_medcoupling_remapper_t *r,
164  int field_id,
165  double default_val);
166 
167 /*----------------------------------------------------------------------------
168  * Translate the mapped source mesh.
169  *
170  * Caution: cs_medcoupling_remapper_prepare() must to be called after this
171  * function in order to update the interpolation matrix.
172  *
173  * parameters:
174  * r <-- pointer to remapper object
175  * translation <-- translation vector
176  *----------------------------------------------------------------------------*/
177 
178 void
179 cs_medcoupling_remapper_translate(cs_medcoupling_remapper_t *r,
180  cs_real_t translation[3]);
181 
182 /*----------------------------------------------------------------------------
183  * Rotate the mapped source mesh.
184  *
185  * Caution: cs_medcoupling_remapper_prepare() must to be called after this
186  * function in order to update the interpolation matrix.
187  *
188  * parameters:
189  * r <-- pointer to remapper object
190  * invariant <-- coordinates of invariant point
191  * axis <-- rotation axis vector
192  * angle <-- rotation angle
193  *----------------------------------------------------------------------------*/
194 
195 void
196 cs_medcoupling_remapper_rotate(cs_medcoupling_remapper_t *r,
197  cs_real_t invariant[3],
198  cs_real_t axis[3],
199  cs_real_t angle);
200 
201 /*----------------------------------------------------------------------------*/
202 
204 
205 #endif /* MEDCOUPLING_LOADER */
206 
207 #endif /* __CS_MEDCOUPLING_REMAPPER_HXX__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
#define END_C_DECLS
Definition: cs_defs.h:463