SCOREC core
Parallel unstructured mesh tools
agm.h
1 /******************************************************************************
2 
3  Copyright 2014 Scientific Computation Research Center,
4  Rensselaer Polytechnic Institute. All rights reserved.
5 
6  This work is open source software, licensed under the terms of the
7  BSD license as described in the LICENSE file in the top-level directory.
8 
9 *******************************************************************************/
10 
11 #ifndef AGM_H
12 #define AGM_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct agm;
19 
20 enum agm_obj_type {
21  AGM_ENTITY,
22  AGM_USE,
23  AGM_BOUNDARY,
24  AGM_OBJ_TYPES
25 };
26 
27 enum agm_ent_type {
28  AGM_VERTEX,
29  AGM_EDGE,
30  AGM_FACE,
31  AGM_REGION,
32  AGM_ENT_TYPES
33 };
34 
35 enum agm_use_type {
36  AGM_VERTEX_USE,
37  AGM_EDGE_USE,
38  AGM_FACE_USE,
39  AGM_USE_TYPES
40 };
41 
42 enum agm_bdry_type {
43  AGM_ENDPOINTS,
44  AGM_LOOP,
45  AGM_SHELL,
46  AGM_BDRY_TYPES
47 };
48 
49 struct agm_ent {
50  enum agm_ent_type type;
51  int id;
52 };
53 
54 struct agm_use {
55  enum agm_use_type type;
56  int id;
57 };
58 
59 struct agm_bdry {
60  enum agm_bdry_type type;
61  int id;
62 };
63 
64 struct agm* agm_new(void);
65 void agm_free(struct agm* m);
66 // seol
67 void agm_free_tags(struct agm* m);
68 
69 struct agm_ent agm_add_ent(struct agm* m, enum agm_ent_type t);
70 struct agm_bdry agm_add_bdry(struct agm* m, struct agm_ent e);
71 struct agm_use agm_add_use(struct agm* m, struct agm_bdry b, struct agm_ent of);
72 
73 void agm_reserve(struct agm* m, enum agm_ent_type t, int n);
74 
75 int agm_ent_count(struct agm* m, enum agm_ent_type t);
76 int agm_use_count(struct agm* m, enum agm_use_type t);
77 int agm_bdry_count(struct agm* m, enum agm_bdry_type t);
78 
79 struct agm_ent agm_first_ent(struct agm* m, enum agm_ent_type t);
80 struct agm_ent agm_next_ent(struct agm* m, struct agm_ent e);
81 
82 int agm_ent_null(struct agm_ent e);
83 int agm_ent_eq(struct agm_ent a, struct agm_ent b);
84 int agm_use_null(struct agm_use u);
85 int agm_use_eq(struct agm_use a, struct agm_use b);
86 int agm_bdry_null(struct agm_bdry b);
87 int agm_bdry_eq(struct agm_bdry a, struct agm_bdry b);
88 
89 struct agm_use agm_first_use_of(struct agm* m, struct agm_ent e);
90 struct agm_use agm_next_use_of(struct agm* m, struct agm_use u);
91 struct agm_use agm_first_use_by(struct agm* m, struct agm_bdry b);
92 struct agm_use agm_next_use_by(struct agm* m, struct agm_use u);
93 struct agm_ent agm_used(struct agm* m, struct agm_use u);
94 struct agm_bdry agm_user(struct agm* m, struct agm_use u);
95 struct agm_ent agm_bounds(struct agm* m, struct agm_bdry b);
96 struct agm_bdry agm_first_bdry_of(struct agm* m, struct agm_ent e);
97 struct agm_bdry agm_next_bdry_of(struct agm* m, struct agm_bdry b);
98 
99 int agm_use_count_of(struct agm* m, struct agm_ent e);
100 int agm_use_count_by(struct agm* m, struct agm_bdry b);
101 int agm_bdry_count_of(struct agm* m, struct agm_ent e);
102 int agm_down_count(struct agm* m, struct agm_ent e);
103 
104 struct agm_tag;
105 
106 struct agm_tag* agm_new_tag(struct agm* m, int bytes);
107 void* agm_tag_at(struct agm_tag* t, enum agm_obj_type o,
108  int subtype, int index);
109 
110 enum agm_ent_type agm_type_from_dim(int dim);
111 int agm_dim_from_type(enum agm_ent_type t);
112 
113 struct agm_use agm_find_use_by_bdry(struct agm* m, struct agm_ent of,
114  struct agm_bdry by);
115 struct agm_use agm_find_use_by_ent(struct agm* m, struct agm_ent of,
116  struct agm_ent by);
117 int agm_find_path(struct agm* m, struct agm_ent from, struct agm_ent to,
118  struct agm_use path[4]);
119 
120 #ifdef __cplusplus
121 } /* extern "C" */
122 #endif
123 
124 #endif