tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mesh.h
Go to the documentation of this file.
1 /* =============================================================================
2  *
3  * mesh.h
4  *
5  * =============================================================================
6  *
7  * Copyright (C) Stanford University, 2006. All Rights Reserved.
8  * Author: Chi Cao Minh
9  *
10  * =============================================================================
11  *
12  * For the license of bayes/sort.h and bayes/sort.c, please see the header
13  * of the files.
14  *
15  * ------------------------------------------------------------------------
16  *
17  * For the license of kmeans, please see kmeans/LICENSE.kmeans
18  *
19  * ------------------------------------------------------------------------
20  *
21  * For the license of ssca2, please see ssca2/COPYRIGHT
22  *
23  * ------------------------------------------------------------------------
24  *
25  * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
26  * header of the files.
27  *
28  * ------------------------------------------------------------------------
29  *
30  * For the license of lib/rbtree.h and lib/rbtree.c, please see
31  * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
32  *
33  * ------------------------------------------------------------------------
34  *
35  * Unless otherwise noted, the following license applies to STAMP files:
36  *
37  * Copyright (c) 2007, Stanford University
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions are
42  * met:
43  *
44  * * Redistributions of source code must retain the above copyright
45  * notice, this list of conditions and the following disclaimer.
46  *
47  * * Redistributions in binary form must reproduce the above copyright
48  * notice, this list of conditions and the following disclaimer in
49  * the documentation and/or other materials provided with the
50  * distribution.
51  *
52  * * Neither the name of Stanford University nor the names of its
53  * contributors may be used to endorse or promote products derived
54  * from this software without specific prior written permission.
55  *
56  * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
57  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
60  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
61  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
62  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
64  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
66  * THE POSSIBILITY OF SUCH DAMAGE.
67  *
68  * =============================================================================
69  */
70 
71 
72 #ifndef MESH_H
73 #define MESH_H 1
74 
75 
76 #include "element.h"
77 #include "map.h"
78 #include "random.h"
79 #include "tm.h"
80 #include "vector.h"
81 
82 
83 typedef struct mesh mesh_t;
84 
85 
86 /* =============================================================================
87  * mesh_alloc
88  * =============================================================================
89  */
90 mesh_t*
91 mesh_alloc ();
92 
93 
94 /* =============================================================================
95  * mesh_free
96  * =============================================================================
97  */
98 void
99 mesh_free (mesh_t* meshPtr);
100 
101 
102 /* =============================================================================
103  * mesh_insert
104  * =============================================================================
105  */
106 void
107 mesh_insert (mesh_t* meshPtr, element_t* elementPtr, MAP_T* edgeMapPtr);
108 
109 
110 /* =============================================================================
111  * TMmesh_insert
112  * =============================================================================
113  */
114 void
116  mesh_t* meshPtr, element_t* elementPtr, MAP_T* edgeMapPtr);
117 
118 
119 /* =============================================================================
120  * TMmesh_remove
121  * =============================================================================
122  */
124 void
125 TMmesh_remove (TM_ARGDECL mesh_t* meshPtr, element_t* elementPtr);
126 
127 
128 /* =============================================================================
129  * TMmesh_insertBoundary
130  * =============================================================================
131  */
132 bool_t
133 TMmesh_insertBoundary (TM_ARGDECL mesh_t* meshPtr, edge_t* boundaryPtr);
134 
135 
136 /* =============================================================================
137  * TMmesh_removeBoundary
138  * =============================================================================
139  */
140 bool_t
141 TMmesh_removeBoundary (TM_ARGDECL mesh_t* meshPtr, edge_t* boundaryPtr);
142 
143 
144 /* =============================================================================
145  * mesh_read
146  *
147  * Returns number of elements read from file.
148  *
149  * Refer to http://www.cs.cmu.edu/~quake/triangle.html for file formats.
150  * =============================================================================
151  */
152 long
153 mesh_read (mesh_t* meshPtr, char* fileNamePrefix);
154 
155 
156 /* =============================================================================
157  * mesh_getBad
158  * -- Returns NULL if none
159  * =============================================================================
160  */
161 element_t*
162 mesh_getBad (mesh_t* meshPtr);
163 
164 
165 /* =============================================================================
166  * mesh_shuffleBad
167  * =============================================================================
168  */
169 void
170 mesh_shuffleBad (mesh_t* meshPtr, random_t* randomPtr);
171 
172 
173 /* =============================================================================
174  * mesh_check
175  * =============================================================================
176  */
177 bool_t
178 mesh_check (mesh_t* meshPtr, long expectedNumElement);
179 
180 
181 #define TMMESH_INSERT(m, e, em) TMmesh_insert(TM_ARG m, e, em)
182 #define TMMESH_REMOVE(m, e) TMmesh_remove(TM_ARG m, e)
183 #define TMMESH_INSERTBOUNDARY(m, b) TMmesh_insertBoundary(TM_ARG m, b)
184 #define TMMESH_REMOVEBOUNDARY(m, b) TMmesh_removeBoundary(TM_ARG m, b)
185 
186 
187 #endif /* MESH_H */
188 
189 
190 /* =============================================================================
191  *
192  * End of mesh.h
193  *
194  * =============================================================================
195  */
#define TM_CALLABLE
Definition: cxxtm.hpp:32
mesh_t * mesh_alloc()
Definition: mesh.c:102
long mesh_read(mesh_t *meshPtr, char *fileNamePrefix)
Definition: mesh.c:353
Definition: mesh.c:88
element_t * mesh_getBad(mesh_t *meshPtr)
Definition: mesh.c:480
int bool_t
Definition: portable_defns.h:32
#define TM_ARGDECL
Definition: tm.h:532
Definition: element.c:84
bool_t TMmesh_insertBoundary(TM_ARGDECL mesh_t *meshPtr, edge_t *boundaryPtr)
Definition: mesh.c:299
bool_t mesh_check(mesh_t *meshPtr, long expectedNumElement)
Definition: mesh.c:502
void mesh_shuffleBad(mesh_t *meshPtr, random_t *randomPtr)
Definition: mesh.c:491
Definition: random.h:86
TM_CALLABLE void TMmesh_remove(TM_ARGDECL mesh_t *meshPtr, element_t *elementPtr)
Definition: mesh.c:260
void mesh_free(mesh_t *meshPtr)
Definition: mesh.c:124
void mesh_insert(mesh_t *meshPtr, element_t *elementPtr, MAP_T *edgeMapPtr)
Definition: mesh.c:137
Definition: pair.h:82
void TMmesh_insert(TM_ARGDECL mesh_t *meshPtr, element_t *elementPtr, MAP_T *edgeMapPtr)
Definition: mesh.c:199
bool_t TMmesh_removeBoundary(TM_ARGDECL mesh_t *meshPtr, edge_t *boundaryPtr)
Definition: mesh.c:310