APBS
1.4.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
vmgrid.c
Go to the documentation of this file.
1
49
#include "
vmgrid.h
"
50
51
VEMBED
(rcsid=
"$Id: vmgrid.c 1615 2010-10-20 19:16:35Z sobolevnrm $"
)
52
53
/* ///////////////////////////////////////////////////////////////////////////
54
// Routine: Vmgrid_ctor
55
// Author: Nathan Baker
57
VPUBLIC Vmgrid* Vmgrid_ctor() {
58
59
Vmgrid *thee = VNULL;
60
61
thee = Vmem_malloc(VNULL, 1, sizeof(Vmgrid));
62
VASSERT(thee != VNULL);
63
VASSERT(Vmgrid_ctor2(thee));
64
65
return thee;
66
}
67
68
/* ///////////////////////////////////////////////////////////////////////////
69
// Routine: Vmgrid_ctor2
70
// Author: Nathan Baker
72
VPUBLIC int Vmgrid_ctor2(Vmgrid *thee) {
73
74
int i;
75
76
if (thee == VNULL) return 0;
77
78
thee->ngrids = 0;
79
for (i=0; i<VMGRIDMAX; i++) thee->grids[i] = VNULL;
80
81
return 1;
82
}
83
84
/* ///////////////////////////////////////////////////////////////////////////
85
// Routine: Vmgrid_dtor
86
// Author: Nathan Baker
88
VPUBLIC void Vmgrid_dtor(Vmgrid **thee) {
89
90
if ((*thee) != VNULL) {
91
Vmgrid_dtor2(*thee);
92
Vmem_free(VNULL, 1, sizeof(Vmgrid), (void **)thee);
93
(*thee) = VNULL;
94
}
95
}
96
97
/* ///////////////////////////////////////////////////////////////////////////
98
// Routine: Vmgrid_dtor2
99
// Author: Nathan Baker
101
VPUBLIC void Vmgrid_dtor2(Vmgrid *thee) { ; }
102
103
/* ///////////////////////////////////////////////////////////////////////////
104
// Routine: Vmgrid_value
105
// Author: Nathan Baker
107
VPUBLIC int Vmgrid_value(Vmgrid *thee, double pt[3], double *value) {
108
109
int i, rc;
110
double tvalue;
111
112
VASSERT(thee != VNULL);
113
114
for (i=0; i<thee->ngrids; i++) {
115
rc = Vgrid_value(thee->grids[i], pt, &tvalue);
116
if (rc) {
117
*value = tvalue;
118
return 1;
119
}
120
}
121
122
Vnm_print(2, "Vmgrid_value: Point (%g, %g, %g) not found in \
123
hiearchy!\n", pt[0], pt[1], pt[2]);
124
125
return 0;
126
}
127
128
/* ///////////////////////////////////////////////////////////////////////////
129
// Routine: Vmgrid_curvature
130
//
131
// Notes: cflag=0 ==> Reduced Maximal Curvature
132
// cflag=1 ==> Mean Curvature (Laplace)
133
// cflag=2 ==> Gauss Curvature
134
// cflag=3 ==> True Maximal Curvature
135
//
136
// Authors: Nathan Baker
138
VPUBLIC int Vmgrid_curvature(Vmgrid *thee, double pt[3], int cflag,
139
double *value) {
140
141
int i, rc;
142
double tvalue;
143
144
VASSERT(thee != VNULL);
145
146
for (i=0; i<thee->ngrids; i++) {
147
rc = Vgrid_curvature(thee->grids[i], pt, cflag, &tvalue);
148
if (rc) {
149
*value = tvalue;
150
return 1;
151
}
152
}
153
154
Vnm_print(2, "Vmgrid_curvature: Point (%g, %g, %g) not found in \
155
hiearchy!\n", pt[0], pt[1], pt[2]);
156
157
return 0;
158
159
160
}
161
162
/* ///////////////////////////////////////////////////////////////////////////
163
// Routine: Vmgrid_gradient
164
//
165
// Authors: Nathan Baker
167
VPUBLIC int Vmgrid_gradient(Vmgrid *thee, double pt[3], double grad[3]) {
168
169
int i, j, rc;
170
double tgrad[3];
171
172
VASSERT(thee != VNULL);
173
174
for (i=0; i<thee->ngrids; i++) {
175
rc = Vgrid_gradient(thee->grids[i], pt, tgrad);
176
if (rc) {
177
for (j=0; j<3; j++) grad[j] = tgrad[j];
178
return 1;
179
}
180
}
181
182
Vnm_print(2, "Vmgrid_gradient: Point (%g, %g, %g) not found in \
183
hiearchy!\n", pt[0], pt[1], pt[2]);
184
185
return 0;
186
187
188
}
189
190
/* ///////////////////////////////////////////////////////////////////////////
191
// Routine: Vmgrid_addGrid
192
//
193
// Authors: Nathan Baker
195
VPUBLIC int Vmgrid_addGrid(Vmgrid *thee, Vgrid *grid) {
196
197
int i, j, rc;
198
double tgrad[3];
199
200
VASSERT(thee != VNULL);
201
202
if (grid == VNULL) {
203
Vnm_print(2, "Vmgrid_addGrid: Not adding VNULL grid!\n");
204
return 0;
205
}
206
207
if (thee->ngrids >= VMGRIDMAX) {
208
Vnm_print(2, "Vmgrid_addGrid: Too many grids in hierarchy (max = \
209
%d)!\n", VMGRIDMAX);
210
Vnm_print(2, "Vmgrid_addGrid: Not adding grid!\n");
211
return 0;
212
}
213
214
thee->grids[thee->ngrids] = grid;
215
(thee->ngrids)++;
216
217
return 1;
218
219
}
VEMBED
#define VEMBED(rctag)
Allows embedding of RCS ID tags in object files.
Definition:
vhal.h:563
vmgrid.h
Multiresolution oracle for Cartesian mesh data.
src
mg
vmgrid.c
Generated on Thu Oct 13 2016 11:56:33 for APBS by
1.8.5