9.2
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-2026 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 "base/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 "mesh/cs_mesh.h"
42
43/*----------------------------------------------------------------------------
44 * MEDCOUPLING library headers
45 *----------------------------------------------------------------------------*/
46
47#if defined(HAVE_MEDCOUPLING)
48
49// Disable warnings introduced by including this header file, which
50// result from usage of deprecated objects in MEDCouplingUMesh
52DISABLE_WARNING(-Wdeprecated-declarations)
53DISABLE_WARNING(-Wunused-parameter)
54// Disable this warning on LLVM based compilers
55DISABLE_WARNING_LLVM(-Winconsistent-missing-override)
56#include "MEDCouplingUMesh.hxx"
58
59using namespace MEDCoupling;
60
61#endif
62
63/*----------------------------------------------------------------------------
64 * MEDCoupling mesh structure
65 *----------------------------------------------------------------------------*/
66
67typedef struct {
68
69 char *sel_criteria; /* Element selection criteria
70 (if provided) */
71
72 int elt_dim; /* Element dimension */
73
74 cs_lnum_t n_elts; /* Number of coupled elements */
75 cs_lnum_t *elt_list; /* List of associated elements
76 (0 to n-1) */
77
78 cs_lnum_t n_vtx; /* Number of vertices */
79 cs_lnum_t *vtx_list; /* List of associated vertices
80 (0 to n-1), or NULL */
81
82 cs_lnum_t *new_to_old; /* Connectivity used if only a section of
83 the mesh is read */
84
85 cs_real_t *bbox; /* Bounding box to optimize search */
86
87#if defined(HAVE_MEDCOUPLING)
88 MEDCouplingUMesh *med_mesh; /* MED mesh structure */
89#else
90 void *med_mesh;
91#endif
92
94
95/*=============================================================================
96 * Public functions
97 *============================================================================*/
98
99/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112
115 const char *name,
116 const char *selection_criteria,
117 int elt_dim,
118 int use_bbox);
119
120/*----------------------------------------------------------------------------*/
133/*----------------------------------------------------------------------------*/
134
137 const char *name,
138 cs_lnum_t n_elts,
139 const cs_lnum_t elt_ids[],
140 int elt_dim,
141 int use_bbox);
142
143/*----------------------------------------------------------------------------*/
149/*----------------------------------------------------------------------------*/
150
151void
153
154/*----------------------------------------------------------------------------*/
158/*----------------------------------------------------------------------------*/
159
160void
162
163/*----------------------------------------------------------------------------*/
171/*----------------------------------------------------------------------------*/
172
173int
175
176/*----------------------------------------------------------------------------*/
184/*----------------------------------------------------------------------------*/
185
188
189/*----------------------------------------------------------------------------*/
197/*----------------------------------------------------------------------------*/
198
199const cs_lnum_t *
201
202/*----------------------------------------------------------------------------*/
210/*----------------------------------------------------------------------------*/
211
214
215/*----------------------------------------------------------------------------*/
224/*----------------------------------------------------------------------------*/
225
226const cs_lnum_t *
228
229/*----------------------------------------------------------------------------*/
237/*----------------------------------------------------------------------------*/
238
239const cs_lnum_t *
241
242/*----------------------------------------------------------------------------*/
249/*----------------------------------------------------------------------------*/
250
251void
253 const std::string name);
254
255/*----------------------------------------------------------------------------*/
266/*----------------------------------------------------------------------------*/
267
268#if defined(HAVE_MEDCOUPLING)
269MEDCouplingUMesh *
270#else
271void *
272#endif
274 const cs_real_t normal[],
275 const cs_real_t length1,
276 const cs_real_t length2);
277
278/*----------------------------------------------------------------------------*/
290/*----------------------------------------------------------------------------*/
291
292#if defined(HAVE_MEDCOUPLING)
293MEDCouplingUMesh *
294#else
295void *
296#endif
298 const cs_real_t normal[],
299 const cs_real_t radius,
300 const int n_sectors);
301
302/*----------------------------------------------------------------------------*/
315/*----------------------------------------------------------------------------*/
316
317#if defined(HAVE_MEDCOUPLING)
318MEDCouplingUMesh *
319#else
320void *
321#endif
323 const cs_real_t normal[],
324 const cs_real_t radius1,
325 const cs_real_t radius2,
326 const int n_sectors);
327
328/*----------------------------------------------------------------------------*/
329
330#endif /* CS_MEDCOUPLING_MESH_HXX */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
#define DISABLE_WARNING_PUSH
Definition: cs_defs.h:168
#define DISABLE_WARNING_LLVM(warningName)
Definition: cs_defs.h:171
#define DISABLE_WARNING_POP
Definition: cs_defs.h:170
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
#define DISABLE_WARNING(warningName)
Definition: cs_defs.h:169
void * 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:1196
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:1058
void * 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:1269
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:1078
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:886
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:1099
void cs_medcoupling_mesh_destroy(cs_medcoupling_mesh_t *mesh)
Destroy a cs_medcoupling_mesh_t.
Definition: cs_medcoupling_mesh.cxx:992
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:1120
void cs_medcoupling_mesh_destroy_all(void)
Destroy all cs_medcoupling_mesh_t instances.
Definition: cs_medcoupling_mesh.cxx:1014
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:1038
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:945
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:1141
void * 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:1366
void cs_medcoupling_mesh_export(cs_medcoupling_mesh_t *m, const std::string name)
Export a medcoupling_mesh.
Definition: cs_medcoupling_mesh.cxx:1161
Definition: mesh.f90:26
Definition: cs_medcoupling_mesh.hxx:67
void * med_mesh
Definition: cs_medcoupling_mesh.hxx:90
char * sel_criteria
Definition: cs_medcoupling_mesh.hxx:69
cs_lnum_t n_vtx
Definition: cs_medcoupling_mesh.hxx:78
cs_lnum_t n_elts
Definition: cs_medcoupling_mesh.hxx:74
cs_lnum_t * vtx_list
Definition: cs_medcoupling_mesh.hxx:79
cs_lnum_t * new_to_old
Definition: cs_medcoupling_mesh.hxx:82
int elt_dim
Definition: cs_medcoupling_mesh.hxx:72
cs_lnum_t * elt_list
Definition: cs_medcoupling_mesh.hxx:75
cs_real_t * bbox
Definition: cs_medcoupling_mesh.hxx:85
Definition: cs_mesh.h:85