1
#ifndef __MY_PLE_MESH_H__
2
#define __MY_PLE_MESH_H__
4
/*============================================================================
5
* Main structure for a nodal representation associated with a mesh
6
*============================================================================*/
10
This file is part of the "Parallel Location and Exchange" library,
11
intended to provide mesh or particle-based code coupling services.
13
Copyright (C) 2005-2010 EDF
15
This library is free software; you can redistribute it and/or
16
modify it under the terms of the GNU Lesser General Public
17
License as published by the Free Software Foundation; either
18
version 2.1 of the License, or (at your option) any later version.
20
This library is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
Lesser General Public License for more details.
25
You should have received a copy of the GNU Lesser General Public
26
License along with this library; if not, write to the Free Software
27
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
/*----------------------------------------------------------------------------
32
*----------------------------------------------------------------------------*/
36
/*----------------------------------------------------------------------------*/
41
} /* Fake brace to force back Emacs auto-indentation back to column 0 */
43
#endif /* __cplusplus */
45
/*=============================================================================
47
*============================================================================*/
49
/*============================================================================
51
*============================================================================*/
53
/*----------------------------------------------------------------------------
55
*----------------------------------------------------------------------------*/
59
MY_PLE_EDGE, /* Edge */
60
MY_PLE_FACE_TRIA, /* Triangle */
61
MY_PLE_FACE_QUAD, /* Quadrangle */
62
MY_PLE_FACE_POLY, /* Simple Polygon */
63
MY_PLE_CELL_TETRA, /* Tetrahedron */
64
MY_PLE_CELL_PYRAM, /* Pyramid */
65
MY_PLE_CELL_PRISM, /* Prism (pentahedron) */
66
MY_PLE_CELL_HEXA, /* Hexahedron (brick) */
67
MY_PLE_CELL_POLY, /* Simple Polyhedron (convex or quasi-convex) */
68
MY_PLE_N_ELEMENT_TYPES /* Number of element types */
72
/*----------------------------------------------------------------------------
73
* Structure defining a mesh in nodal definition
74
*----------------------------------------------------------------------------*/
76
typedef struct _my_ple_mesh_t my_ple_mesh_t;
78
/*=============================================================================
79
* Static global variables
80
*============================================================================*/
82
/* Names of (single) element types */
84
extern const char *my_ple_element_type_name[];
86
/* Number of vertices associated with each "nodal" element type */
88
extern const int my_ple_mesh_n_vertices_element[];
90
/*=============================================================================
91
* Public function prototypes
92
*============================================================================*/
94
/*----------------------------------------------------------------------------
95
* Creation of a mesh representation structure.
98
* dim <-- spatial dimension
101
* pointer to created mesh representation structure
102
*----------------------------------------------------------------------------*/
105
my_ple_mesh_create(int dim);
107
/*----------------------------------------------------------------------------
108
* Destruction of a mesh representation structure.
111
* mesh <-> pointer to pointer to structure that should be destroyed
112
*----------------------------------------------------------------------------*/
115
my_ple_mesh_destroy(my_ple_mesh_t **mesh);
117
/*----------------------------------------------------------------------------
118
* Assign shared vertex coordinates to an extracted mesh.
121
* mesh <-> mesh structure
122
* vertex_coords <-- vertex coordinates (interlaced)
123
*----------------------------------------------------------------------------*/
126
my_ple_mesh_set_shared_vertices(my_ple_mesh_t *mesh,
127
const ple_coord_t vertex_coords[]);
129
/*----------------------------------------------------------------------------
130
* Assign private vertex coordinates to a mesh.
132
* Ownership of the given coordinates array is transferred to
133
* the mesh representation structure.
136
* mesh <-> mesh structure
137
* vertex_coords <-- vertex coordinates (interlaced)
138
*----------------------------------------------------------------------------*/
141
my_ple_mesh_transfer_vertices(my_ple_mesh_t *mesh,
142
ple_coord_t vertex_coords[]);
144
/*----------------------------------------------------------------------------
145
* Append a new section to an existing my_ple_mesh mesh, and transfer
146
* ownership of the given connectivity to that section.
149
* mesh <-> mesh structure
150
* n_elements <-- number of elements to add
151
* type <-- type of elements to add
152
* face_index <-- polyhedron -> faces index (O to n-1)
153
* size: n_elements + 1
154
* face_num <-- polyhedron -> face numbers (1 to n, signed,
155
* > 0 for outwards pointing face normal
156
* < 0 for inwards pointing face normal);
157
* size: face_index[n_elements]
158
* vertex_index <-- polygon face -> vertices index (O to n-1)
159
* size: face_index[n_elements]
160
* vertex_num <-- element -> vertex connectivity
161
* element_num <-- element numbers
162
*----------------------------------------------------------------------------*/
165
my_ple_mesh_append_by_transfer(my_ple_mesh_t *mesh,
166
ple_lnum_t n_elements,
167
my_ple_element_t type,
168
ple_lnum_t face_index[],
169
ple_lnum_t face_num[],
170
ple_lnum_t vertex_index[],
171
ple_lnum_t vertex_num[],
172
ple_lnum_t elt_num[]);
174
/*----------------------------------------------------------------------------
175
* Append a new section to an existing my_ple_mesh mesh, sharing the given
176
* given connectivity with the caller.
178
* The caller should not destroy or modify the arrays passed to this
179
* function until the mesh is destroyed.
182
* mesh <-> mesh structure
183
* n_elements <-- number of elements to add
184
* type <-- type of elements to add
185
* face_index <-- polyhedron -> faces index (O to n-1)
186
* size: n_elements + 1
187
* face_num <-- polyhedron -> face numbers (1 to n, signed,
188
* > 0 for outwards pointing face normal
189
* < 0 for inwards pointing face normal);
190
* size: face_index[n_elements]
191
* vertex_index <-- polygon face -> vertices index (O to n-1)
192
* size: face_index[n_elements]
193
* vertex_num <-- element -> vertex connectivity
194
* element_num <-- element numbers
195
*----------------------------------------------------------------------------*/
198
my_ple_mesh_append_shared(my_ple_mesh_t *mesh,
199
ple_lnum_t n_elements,
200
my_ple_element_t type,
201
ple_lnum_t face_index[],
202
ple_lnum_t face_num[],
203
ple_lnum_t vertex_index[],
204
ple_lnum_t vertex_num[],
205
ple_lnum_t element_num[]);
207
/*----------------------------------------------------------------------------
208
* Return maximum dimension of entities in a mesh.
211
* mesh <-- pointer to mesh structure
214
* maximum dimension of entities in mesh (0 to 3)
215
*----------------------------------------------------------------------------*/
218
my_ple_mesh_get_max_entity_dim(const my_ple_mesh_t *mesh);
220
/*----------------------------------------------------------------------------
221
* Dump printout of a nodal representation structure.
224
* mesh <-- pointer to structure that should be dumped
225
*----------------------------------------------------------------------------*/
228
my_ple_mesh_dump(const my_ple_mesh_t *mesh);
230
/*----------------------------------------------------------------------------*/
234
#endif /* __cplusplus */
236
#endif /* __MY_PLE_MESH_H__ */