gmsh_mesh.h 1.31 KB
Newer Older
Michel Henry's avatar
Michel Henry committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef SLIM_GMSH_MESH_H
#define SLIM_GMSH_MESH_H
#include <stdlib.h>

typedef struct {
  int tag;
  int dim;
  int parent_tag;
  int parent_dim;
  size_t n_physicals;
  int *physicals;
  size_t n_partitions;
  int *partitions;
  size_t n_nodes;
  int element_type;
  double *x;
  size_t *nodes_tag;
  size_t n_elements;
  size_t *elements; // lines in 1d, triangles in 2d
  size_t *elements_tag;
  size_t n_nodes_by_element;
  size_t n_bounds;
  double bbmin[3],bbmax[3];
  int *bounds;
} Entity;

typedef struct {
  int n_affine;
  double *affine;
  int dim;
  int tag;
  int parent_tag;
  size_t n_nodes;
  size_t *nodes; // 2*n_nodes
}Periodic;

typedef struct {
  int n_partitions;
  size_t n_entities[4];
  Entity **entities[4];
  int n_physical_names;
  char **physical_names;
  int *physical_name_tag;
  int *physical_name_dim;
  int n_periodic;
  Periodic **periodic;
} GmshMesh;

GmshMesh *gmsh_mesh_new();
void gmsh_mesh_read(GmshMesh *mesh, const char *file_name);
void gmsh_mesh_write(const GmshMesh *mesh, const char *filename);
void gmsh_mesh_free(GmshMesh *mesh);
void gmsh_mesh_partition_2d(GmshMesh *mesh, int npart);
Entity *gmsh_mesh_new_entity(GmshMesh *mesh, int dim, int tag,int parent_dim,int parent_tag);
Entity *gmsh_mesh_get_entity(const GmshMesh *mesh, int dim, int tag);
void gmsh_periodic_free(Periodic *p);
#endif