8.3
general documentation
cs_medcoupling_mesh.hxx
Go to the documentation of this file.
1#ifndef __CS_MEDCOUPLING_MESH_HXX__
2#define __CS_MEDCOUPLING_MESH_HXX__
3
4/*============================================================================
5 * Usage of MEDCoupling base components.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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#include "cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Standard C library headers
34 *----------------------------------------------------------------------------*/
35
36#include <stdarg.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string>
40
41#include "cs_mesh.h"
42
43/*----------------------------------------------------------------------------
44 * MEDCOUPLING library headers
45 *----------------------------------------------------------------------------*/
46
47#if defined(HAVE_MEDCOUPLING)
48
49#include "MEDCouplingUMesh.hxx"
50
51using namespace MEDCoupling;
52
53#endif
54
56
57/*----------------------------------------------------------------------------
58 * MEDCoupling mesh structure
59 *----------------------------------------------------------------------------*/
60
61typedef struct {
62
63 char *sel_criteria; /* Element selection criteria
64 (if provided) */
65
66 int elt_dim; /* Element dimension */
67
68 cs_lnum_t n_elts; /* Number of coupled elements */
69 cs_lnum_t *elt_list; /* List of associated elements
70 (0 to n-1) */
71
72 cs_lnum_t n_vtx; /* Number of vertices */
73 cs_lnum_t *vtx_list; /* List of associated vertices
74 (0 to n-1), or NULL */
75
76 cs_lnum_t *new_to_old; /* Connectivity used if only a section of
77 the mesh is read */
78
79 cs_real_t *bbox; /* Bounding box to optimize search */
80
81#if defined(HAVE_MEDCOUPLING)
82 MEDCouplingUMesh *med_mesh; /* MED mesh structure */
83#else
84 void *med_mesh;
85#endif
86
88
89/*=============================================================================
90 * Public functions
91 *============================================================================*/
92
93/*----------------------------------------------------------------------------*/
105/*----------------------------------------------------------------------------*/
106
109 const char *name,
110 const char *selection_criteria,
111 int elt_dim,
112 int use_bbox);
113
114/*----------------------------------------------------------------------------*/
127/*----------------------------------------------------------------------------*/
128
131 const char *name,
132 cs_lnum_t n_elts,
133 const cs_lnum_t elt_ids[],
134 int elt_dim,
135 int use_bbox);
136
137/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144
145void
147
148/*----------------------------------------------------------------------------*/
152/*----------------------------------------------------------------------------*/
153
154void
156
157/*----------------------------------------------------------------------------*/
165/*----------------------------------------------------------------------------*/
166
167int
169
170/*----------------------------------------------------------------------------*/
178/*----------------------------------------------------------------------------*/
179
182
183/*----------------------------------------------------------------------------*/
191/*----------------------------------------------------------------------------*/
192
193const cs_lnum_t *
195
196/*----------------------------------------------------------------------------*/
204/*----------------------------------------------------------------------------*/
205
208
209/*----------------------------------------------------------------------------*/
218/*----------------------------------------------------------------------------*/
219
220const cs_lnum_t *
222
223/*----------------------------------------------------------------------------*/
231/*----------------------------------------------------------------------------*/
232
233const cs_lnum_t *
235
236/*----------------------------------------------------------------------------*/
243/*----------------------------------------------------------------------------*/
244
245void
247 const std::string name);
248
249/*----------------------------------------------------------------------------*/
260/*----------------------------------------------------------------------------*/
261
262#if defined(HAVE_MEDCOUPLING)
263MEDCouplingUMesh *
264#else
265void *
266#endif
268 const cs_real_t normal[],
269 const cs_real_t length1,
270 const cs_real_t length2);
271
272/*----------------------------------------------------------------------------*/
284/*----------------------------------------------------------------------------*/
285
286#if defined(HAVE_MEDCOUPLING)
287MEDCouplingUMesh *
288#else
289void *
290#endif
292 const cs_real_t normal[],
293 const cs_real_t radius,
294 const int n_sectors);
295
296/*----------------------------------------------------------------------------*/
309/*----------------------------------------------------------------------------*/
310
311#if defined(HAVE_MEDCOUPLING)
312MEDCouplingUMesh *
313#else
314void *
315#endif
317 const cs_real_t normal[],
318 const cs_real_t radius1,
319 const cs_real_t radius2,
320 const int n_sectors);
321
322/*----------------------------------------------------------------------------*/
323
325
326#endif /* __CS_MEDCOUPLING_MESH_HXX__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
cs_lnum_t cs_medcoupling_mesh_get_n_elts(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's number of elements.
Definition: cs_medcoupling_mesh.cxx:1060
const cs_lnum_t * cs_medcoupling_mesh_get_elt_list(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's (parent) elements list.
Definition: cs_medcoupling_mesh.cxx:1080
cs_medcoupling_mesh_t * cs_medcoupling_mesh_from_base(cs_mesh_t *csmesh, const char *name, const char *selection_criteria, int elt_dim, int use_bbox)
create a new cs_medcoupling_mesh_t instance based on cs_mesh_t
Definition: cs_medcoupling_mesh.cxx:888
cs_lnum_t cs_medcoupling_mesh_get_n_vertices(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's number of vertices.
Definition: cs_medcoupling_mesh.cxx:1101
void cs_medcoupling_mesh_destroy(cs_medcoupling_mesh_t *mesh)
Destroy a cs_medcoupling_mesh_t.
Definition: cs_medcoupling_mesh.cxx:994
const cs_lnum_t * cs_medcoupling_mesh_get_vertex_list(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's (parent) vertices list.
Definition: cs_medcoupling_mesh.cxx:1122
void cs_medcoupling_mesh_destroy_all(void)
Destroy all cs_medcoupling_mesh_t instances.
Definition: cs_medcoupling_mesh.cxx:1016
MEDCouplingUMesh * cs_medcoupling_create_annulus_mesh(const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius1, const cs_real_t radius2, const int n_sectors)
Returns a pointer to a MEDCouplingUMesh of an annulus.
Definition: cs_medcoupling_mesh.cxx:1368
int cs_medcoupling_mesh_get_dim(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's spatial dimension.
Definition: cs_medcoupling_mesh.cxx:1040
cs_medcoupling_mesh_t * cs_medcoupling_mesh_from_ids(cs_mesh_t *csmesh, const char *name, cs_lnum_t n_elts, const cs_lnum_t elt_ids[], int elt_dim, int use_bbox)
create a new cs_medcoupling_mesh_t instance based on cs_mesh_t
Definition: cs_medcoupling_mesh.cxx:947
const cs_lnum_t * cs_medcoupling_mesh_get_connectivity(cs_medcoupling_mesh_t *m)
Return a cs_medcoupling_mesh_t structure's (parent) elements list.
Definition: cs_medcoupling_mesh.cxx:1143
MEDCouplingUMesh * cs_medcoupling_create_plane_mesh(const cs_real_t origin[], const cs_real_t normal[], const cs_real_t length1, const cs_real_t length2)
Returns a pointer to a MEDCouplingUMesh of a plane.
Definition: cs_medcoupling_mesh.cxx:1198
MEDCouplingUMesh * cs_medcoupling_create_disc_mesh(const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius, const int n_sectors)
Returns a pointer to a MEDCouplingUMesh of a disc.
Definition: cs_medcoupling_mesh.cxx:1271
void cs_medcoupling_mesh_export(cs_medcoupling_mesh_t *m, const std::string name)
Export a medcoupling_mesh.
Definition: cs_medcoupling_mesh.cxx:1163
Definition: mesh.f90:26
Definition: cs_medcoupling_mesh.hxx:61
char * sel_criteria
Definition: cs_medcoupling_mesh.hxx:63
cs_lnum_t n_vtx
Definition: cs_medcoupling_mesh.hxx:72
cs_lnum_t n_elts
Definition: cs_medcoupling_mesh.hxx:68
cs_lnum_t * vtx_list
Definition: cs_medcoupling_mesh.hxx:73
cs_lnum_t * new_to_old
Definition: cs_medcoupling_mesh.hxx:76
MEDCouplingUMesh * med_mesh
Definition: cs_medcoupling_mesh.hxx:82
int elt_dim
Definition: cs_medcoupling_mesh.hxx:66
cs_lnum_t * elt_list
Definition: cs_medcoupling_mesh.hxx:69
cs_real_t * bbox
Definition: cs_medcoupling_mesh.hxx:79
Definition: cs_mesh.h:85