~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to libple/examples/my_ple_mesh.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __MY_PLE_MESH_H__
 
2
#define __MY_PLE_MESH_H__
 
3
 
 
4
/*============================================================================
 
5
 * Main structure for a nodal representation associated with a mesh
 
6
 *============================================================================*/
 
7
 
 
8
/*
 
9
 
 
10
  This file is part of the "Parallel Location and Exchange" library,
 
11
  intended to provide mesh or particle-based code coupling services.
 
12
 
 
13
  Copyright (C) 2005-2010  EDF
 
14
 
 
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.
 
19
 
 
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.
 
24
 
 
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
 
28
*/
 
29
 
 
30
/*----------------------------------------------------------------------------
 
31
 *  Local headers
 
32
 *----------------------------------------------------------------------------*/
 
33
 
 
34
#include "ple_defs.h"
 
35
 
 
36
/*----------------------------------------------------------------------------*/
 
37
 
 
38
#ifdef __cplusplus
 
39
extern "C" {
 
40
#if 0
 
41
} /* Fake brace to force back Emacs auto-indentation back to column 0 */
 
42
#endif
 
43
#endif /* __cplusplus */
 
44
 
 
45
/*=============================================================================
 
46
 * Macro definitions
 
47
 *============================================================================*/
 
48
 
 
49
/*============================================================================
 
50
 * Type definitions
 
51
 *============================================================================*/
 
52
 
 
53
/*----------------------------------------------------------------------------
 
54
 * Element types
 
55
 *----------------------------------------------------------------------------*/
 
56
 
 
57
typedef enum {
 
58
 
 
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 */
 
69
 
 
70
} my_ple_element_t;
 
71
 
 
72
/*----------------------------------------------------------------------------
 
73
 * Structure defining a mesh in nodal definition
 
74
 *----------------------------------------------------------------------------*/
 
75
 
 
76
typedef struct _my_ple_mesh_t my_ple_mesh_t;
 
77
 
 
78
/*=============================================================================
 
79
 * Static global variables
 
80
 *============================================================================*/
 
81
 
 
82
/* Names of (single) element types */
 
83
 
 
84
extern const char  *my_ple_element_type_name[];
 
85
 
 
86
/* Number of vertices associated with each "nodal" element type */
 
87
 
 
88
extern const int  my_ple_mesh_n_vertices_element[];
 
89
 
 
90
/*=============================================================================
 
91
 * Public function prototypes
 
92
 *============================================================================*/
 
93
 
 
94
/*----------------------------------------------------------------------------
 
95
 * Creation of a mesh representation structure.
 
96
 *
 
97
 * parameters:
 
98
 *   dim  <-- spatial dimension
 
99
 *
 
100
 * returns:
 
101
 *  pointer to created mesh representation structure
 
102
 *----------------------------------------------------------------------------*/
 
103
 
 
104
my_ple_mesh_t *
 
105
my_ple_mesh_create(int  dim);
 
106
 
 
107
/*----------------------------------------------------------------------------
 
108
 * Destruction of a mesh representation structure.
 
109
 *
 
110
 * parameters:
 
111
 *   mesh  <-> pointer to pointer to structure that should be destroyed
 
112
 *----------------------------------------------------------------------------*/
 
113
 
 
114
void
 
115
my_ple_mesh_destroy(my_ple_mesh_t  **mesh);
 
116
 
 
117
/*----------------------------------------------------------------------------
 
118
 * Assign shared vertex coordinates to an extracted mesh.
 
119
 *
 
120
 * parameters:
 
121
 *   mesh          <-> mesh structure
 
122
 *   vertex_coords <-- vertex coordinates (interlaced)
 
123
 *----------------------------------------------------------------------------*/
 
124
 
 
125
void
 
126
my_ple_mesh_set_shared_vertices(my_ple_mesh_t     *mesh,
 
127
                                 const ple_coord_t   vertex_coords[]);
 
128
 
 
129
/*----------------------------------------------------------------------------
 
130
 * Assign private vertex coordinates to a mesh.
 
131
 *
 
132
 * Ownership of the given coordinates array is transferred to
 
133
 * the mesh representation structure.
 
134
 *
 
135
 * parameters:
 
136
 *   mesh          <-> mesh structure
 
137
 *   vertex_coords <-- vertex coordinates (interlaced)
 
138
 *----------------------------------------------------------------------------*/
 
139
 
 
140
void
 
141
my_ple_mesh_transfer_vertices(my_ple_mesh_t  *mesh,
 
142
                               ple_coord_t      vertex_coords[]);
 
143
 
 
144
/*----------------------------------------------------------------------------
 
145
 * Append a new section to an existing my_ple_mesh mesh, and transfer
 
146
 * ownership of the given connectivity to that section.
 
147
 *
 
148
 * parameters:
 
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
 *----------------------------------------------------------------------------*/
 
163
 
 
164
void
 
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[]);
 
173
 
 
174
/*----------------------------------------------------------------------------
 
175
 * Append a new section to an existing my_ple_mesh mesh, sharing the given
 
176
 * given connectivity with the caller.
 
177
 *
 
178
 * The caller should not destroy or modify the arrays passed to this
 
179
 * function until the mesh is destroyed.
 
180
 *
 
181
 * parameters:
 
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
 *----------------------------------------------------------------------------*/
 
196
 
 
197
void
 
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[]);
 
206
 
 
207
/*----------------------------------------------------------------------------
 
208
 * Return maximum dimension of entities in a mesh.
 
209
 *
 
210
 * parameters:
 
211
 *   mesh <-- pointer to mesh structure
 
212
 *
 
213
 * returns:
 
214
 *  maximum dimension of entities in mesh (0 to 3)
 
215
 *----------------------------------------------------------------------------*/
 
216
 
 
217
int
 
218
my_ple_mesh_get_max_entity_dim(const my_ple_mesh_t  *mesh);
 
219
 
 
220
/*----------------------------------------------------------------------------
 
221
 * Dump printout of a nodal representation structure.
 
222
 *
 
223
 * parameters:
 
224
 *   mesh <-- pointer to structure that should be dumped
 
225
 *----------------------------------------------------------------------------*/
 
226
 
 
227
void
 
228
my_ple_mesh_dump(const my_ple_mesh_t  *mesh);
 
229
 
 
230
/*----------------------------------------------------------------------------*/
 
231
 
 
232
#ifdef __cplusplus
 
233
}
 
234
#endif /* __cplusplus */
 
235
 
 
236
#endif /* __MY_PLE_MESH_H__ */