32 int bytes =
sizeof(T);
35 char* dest = (
char*)&val;
84 unsigned long long int cells;
89 unsigned long long int fields;
94 unsigned long long int nodes0;
98 if (n_nodes0 > 1024 * 1024 * 1024)
103 for (
unsigned int i = 0; i < n_nodes0; i++)
105 unsigned long long int n_nodes1;
109 for (
int j = 0; j < nodes.
size(); j++)
111 double& node = nodes[j];
116 unsigned long long int n_cells0;
119 for (
int i = 0; i < n_cells0; i++)
121 unsigned long long int n_cells1;
125 for (
int j = 0; j < n_cells1; j++)
133 unsigned long long int n_cell_maps0;
134 ds.
read(n_cell_maps0);
137 for (
int i = 0; i < n_cell_maps0; i++)
139 unsigned long long int n_cell_maps1;
141 ds.
read(n_cell_maps1);
142 cell_maps.
resize(n_cell_maps1);
143 for (
int j = 0; j < n_cell_maps1; j++)
145 unsigned int& cell_map = cell_maps[j];
180 unsigned int k = l / n01;
181 unsigned int temp = l % n01;
248 btScalar fac = 1.0 / 64.0 * (9.0 * (x2 + y2 + z2) - 19.0);
249 res[0] = fac * _1mxt1my * _1mz;
250 res[1] = fac * _1pxt1my * _1mz;
251 res[2] = fac * _1mxt1py * _1mz;
252 res[3] = fac * _1pxt1py * _1mz;
253 res[4] = fac * _1mxt1my * _1pz;
254 res[5] = fac * _1pxt1my * _1pz;
255 res[6] = fac * _1mxt1py * _1pz;
256 res[7] = fac * _1pxt1py * _1pz;
260 fac = 9.0 / 64.0 * _1mx2;
263 res[8] = fact1m3x * _1myt1mz;
264 res[9] = fact1p3x * _1myt1mz;
265 res[10] = fact1m3x * _1myt1pz;
266 res[11] = fact1p3x * _1myt1pz;
267 res[12] = fact1m3x * _1pyt1mz;
268 res[13] = fact1p3x * _1pyt1mz;
269 res[14] = fact1m3x * _1pyt1pz;
270 res[15] = fact1p3x * _1pyt1pz;
272 fac = 9.0 / 64.0 * _1my2;
275 res[16] = fact1m3y * _1mxt1mz;
276 res[17] = fact1p3y * _1mxt1mz;
277 res[18] = fact1m3y * _1pxt1mz;
278 res[19] = fact1p3y * _1pxt1mz;
279 res[20] = fact1m3y * _1mxt1pz;
280 res[21] = fact1p3y * _1mxt1pz;
281 res[22] = fact1m3y * _1pxt1pz;
282 res[23] = fact1p3y * _1pxt1pz;
284 fac = 9.0 / 64.0 * _1mz2;
287 res[24] = fact1m3z * _1mxt1my;
288 res[25] = fact1p3z * _1mxt1my;
289 res[26] = fact1m3z * _1mxt1py;
290 res[27] = fact1p3z * _1mxt1py;
291 res[28] = fact1m3z * _1pxt1my;
292 res[29] = fact1p3z * _1pxt1my;
293 res[30] = fact1m3z * _1pxt1py;
294 res[31] = fact1p3z * _1pxt1py;
300 btScalar _9t3x2py2pz2m19 = 9.0 * (3.0 * x2 + y2 + z2) - 19.0;
301 btScalar _9tx2p3y2pz2m19 = 9.0 * (x2 + 3.0 * y2 + z2) - 19.0;
302 btScalar _9tx2py2p3z2m19 = 9.0 * (x2 + y2 + 3.0 * z2) - 19.0;
315 btScalar _18xm9t3x2py2pz2m19 = _18x - _9t3x2py2pz2m19;
316 btScalar _18xp9t3x2py2pz2m19 = _18x + _9t3x2py2pz2m19;
317 btScalar _18ym9tx2p3y2pz2m19 = _18y - _9tx2p3y2pz2m19;
318 btScalar _18yp9tx2p3y2pz2m19 = _18y + _9tx2p3y2pz2m19;
319 btScalar _18zm9tx2py2p3z2m19 = _18z - _9tx2py2p3z2m19;
320 btScalar _18zp9tx2py2p3z2m19 = _18z + _9tx2py2p3z2m19;
322 dN(0, 0) = _18xm9t3x2py2pz2m19 * _1myt1mz;
323 dN(0, 1) = _1mxt1mz * _18ym9tx2p3y2pz2m19;
324 dN(0, 2) = _1mxt1my * _18zm9tx2py2p3z2m19;
325 dN(1, 0) = _18xp9t3x2py2pz2m19 * _1myt1mz;
326 dN(1, 1) = _1pxt1mz * _18ym9tx2p3y2pz2m19;
327 dN(1, 2) = _1pxt1my * _18zm9tx2py2p3z2m19;
328 dN(2, 0) = _18xm9t3x2py2pz2m19 * _1pyt1mz;
329 dN(2, 1) = _1mxt1mz * _18yp9tx2p3y2pz2m19;
330 dN(2, 2) = _1mxt1py * _18zm9tx2py2p3z2m19;
331 dN(3, 0) = _18xp9t3x2py2pz2m19 * _1pyt1mz;
332 dN(3, 1) = _1pxt1mz * _18yp9tx2p3y2pz2m19;
333 dN(3, 2) = _1pxt1py * _18zm9tx2py2p3z2m19;
334 dN(4, 0) = _18xm9t3x2py2pz2m19 * _1myt1pz;
335 dN(4, 1) = _1mxt1pz * _18ym9tx2p3y2pz2m19;
336 dN(4, 2) = _1mxt1my * _18zp9tx2py2p3z2m19;
337 dN(5, 0) = _18xp9t3x2py2pz2m19 * _1myt1pz;
338 dN(5, 1) = _1pxt1pz * _18ym9tx2p3y2pz2m19;
339 dN(5, 2) = _1pxt1my * _18zp9tx2py2p3z2m19;
340 dN(6, 0) = _18xm9t3x2py2pz2m19 * _1pyt1pz;
341 dN(6, 1) = _1mxt1pz * _18yp9tx2p3y2pz2m19;
342 dN(6, 2) = _1mxt1py * _18zp9tx2py2p3z2m19;
343 dN(7, 0) = _18xp9t3x2py2pz2m19 * _1pyt1pz;
344 dN(7, 1) = _1pxt1pz * _18yp9tx2p3y2pz2m19;
345 dN(7, 2) = _1pxt1py * _18zp9tx2py2p3z2m19;
349 btScalar _m3m9x2m2x = -_3m9x2 - _2x;
351 btScalar _1mx2t1m3x = _1mx2 * _1m3x;
352 btScalar _1mx2t1p3x = _1mx2 * _1p3x;
353 dN(8, 0) = _m3m9x2m2x * _1myt1mz,
354 dN(8, 1) = -_1mx2t1m3x * _1mz,
355 dN(8, 2) = -_1mx2t1m3x * _1my;
356 dN(9, 0) = _p3m9x2m2x * _1myt1mz,
357 dN(9, 1) = -_1mx2t1p3x * _1mz,
358 dN(9, 2) = -_1mx2t1p3x * _1my;
359 dN(10, 0) = _m3m9x2m2x * _1myt1pz,
360 dN(10, 1) = -_1mx2t1m3x * _1pz,
361 dN(10, 2) = _1mx2t1m3x * _1my;
362 dN(11, 0) = _p3m9x2m2x * _1myt1pz,
363 dN(11, 1) = -_1mx2t1p3x * _1pz,
364 dN(11, 2) = _1mx2t1p3x * _1my;
365 dN(12, 0) = _m3m9x2m2x * _1pyt1mz,
366 dN(12, 1) = _1mx2t1m3x * _1mz,
367 dN(12, 2) = -_1mx2t1m3x * _1py;
368 dN(13, 0) = _p3m9x2m2x * _1pyt1mz,
369 dN(13, 1) = _1mx2t1p3x * _1mz,
370 dN(13, 2) = -_1mx2t1p3x * _1py;
371 dN(14, 0) = _m3m9x2m2x * _1pyt1pz,
372 dN(14, 1) = _1mx2t1m3x * _1pz,
373 dN(14, 2) = _1mx2t1m3x * _1py;
374 dN(15, 0) = _p3m9x2m2x * _1pyt1pz,
375 dN(15, 1) = _1mx2t1p3x * _1pz,
376 dN(15, 2) = _1mx2t1p3x * _1py;
378 btScalar _m3m9y2m2y = -_3m9y2 - _2y;
380 btScalar _1my2t1m3y = _1my2 * _1m3y;
381 btScalar _1my2t1p3y = _1my2 * _1p3y;
382 dN(16, 0) = -_1my2t1m3y * _1mz,
383 dN(16, 1) = _m3m9y2m2y * _1mxt1mz,
384 dN(16, 2) = -_1my2t1m3y * _1mx;
385 dN(17, 0) = -_1my2t1p3y * _1mz,
386 dN(17, 1) = _p3m9y2m2y * _1mxt1mz,
387 dN(17, 2) = -_1my2t1p3y * _1mx;
388 dN(18, 0) = _1my2t1m3y * _1mz,
389 dN(18, 1) = _m3m9y2m2y * _1pxt1mz,
390 dN(18, 2) = -_1my2t1m3y * _1px;
391 dN(19, 0) = _1my2t1p3y * _1mz,
392 dN(19, 1) = _p3m9y2m2y * _1pxt1mz,
393 dN(19, 2) = -_1my2t1p3y * _1px;
394 dN(20, 0) = -_1my2t1m3y * _1pz,
395 dN(20, 1) = _m3m9y2m2y * _1mxt1pz,
396 dN(20, 2) = _1my2t1m3y * _1mx;
397 dN(21, 0) = -_1my2t1p3y * _1pz,
398 dN(21, 1) = _p3m9y2m2y * _1mxt1pz,
399 dN(21, 2) = _1my2t1p3y * _1mx;
400 dN(22, 0) = _1my2t1m3y * _1pz,
401 dN(22, 1) = _m3m9y2m2y * _1pxt1pz,
402 dN(22, 2) = _1my2t1m3y * _1px;
403 dN(23, 0) = _1my2t1p3y * _1pz,
404 dN(23, 1) = _p3m9y2m2y * _1pxt1pz,
405 dN(23, 2) = _1my2t1p3y * _1px;
407 btScalar _m3m9z2m2z = -_3m9z2 - _2z;
409 btScalar _1mz2t1m3z = _1mz2 * _1m3z;
410 btScalar _1mz2t1p3z = _1mz2 * _1p3z;
411 dN(24, 0) = -_1mz2t1m3z * _1my,
412 dN(24, 1) = -_1mz2t1m3z * _1mx,
413 dN(24, 2) = _m3m9z2m2z * _1mxt1my;
414 dN(25, 0) = -_1mz2t1p3z * _1my,
415 dN(25, 1) = -_1mz2t1p3z * _1mx,
416 dN(25, 2) = _p3m9z2m2z * _1mxt1my;
417 dN(26, 0) = -_1mz2t1m3z * _1py,
418 dN(26, 1) = _1mz2t1m3z * _1mx,
419 dN(26, 2) = _m3m9z2m2z * _1mxt1py;
420 dN(27, 0) = -_1mz2t1p3z * _1py,
421 dN(27, 1) = _1mz2t1p3z * _1mx,
422 dN(27, 2) = _p3m9z2m2z * _1mxt1py;
423 dN(28, 0) = _1mz2t1m3z * _1my,
424 dN(28, 1) = -_1mz2t1m3z * _1px,
425 dN(28, 2) = _m3m9z2m2z * _1pxt1my;
426 dN(29, 0) = _1mz2t1p3z * _1my,
427 dN(29, 1) = -_1mz2t1p3z * _1px,
428 dN(29, 2) = _p3m9z2m2z * _1pxt1my;
429 dN(30, 0) = _1mz2t1m3z * _1py,
430 dN(30, 1) = _1mz2t1m3z * _1px,
431 dN(30, 2) = _m3m9z2m2z * _1pxt1py;
432 dN(31, 0) = _1mz2t1p3z * _1py,
433 dN(31, 1) = _1mz2t1p3z * _1px,
434 dN(31, 2) = _p3m9z2m2z * _1pxt1py;
453 unsigned int mi[3] = {(
unsigned int)tmpmi[0], (
unsigned int)tmpmi[1], (
unsigned int)tmpmi[2]};
484 for (
unsigned int j = 0u; j < 32u; ++j)
486 unsigned int v = cell.
m_cells[j];
487 double c =
m_nodes[field_id][v];
505 for (
unsigned int j = 0u; j < 32u; ++j)
507 unsigned int v = cell.
m_cells[j];
508 double c =
m_nodes[field_id][v];
515 (*gradient)[0] += c * dN(j, 0);
516 (*gradient)[1] += c * dN(j, 1);
517 (*gradient)[2] += c * dN(j, 2);
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
btVector3 can be used to represent 3D points and vectors.
const btVector3 & min() const
bool contains(const btVector3 &x) const
const btVector3 & max() const
btVector3 m_inv_cell_size
btShapeMatrix shape_function_(btVector3 const &xi, btShapeGradients *gradient=0) const
bool load(const char *data, int size)
unsigned int multiToSingleIndex(btMultiIndex const &ijk) const
bool interpolate(unsigned int field_id, double &dist, btVector3 const &x, btVector3 *gradient) const
btMultiIndex singleToMultiIndex(unsigned int l) const
btAlignedBox3d subdomain(btMultiIndex const &ijk) const
unsigned int m_resolution[3]
btAlignedObjectArray< btAlignedObjectArray< btCell32 > > m_cells
btAlignedObjectArray< btAlignedObjectArray< double > > m_nodes
btAlignedObjectArray< btAlignedObjectArray< unsigned int > > m_cell_map
btSdfDataStream(const char *data, int size)
void topRowsDivide(int row, double denom)
void bottomRowsMul(int row, double val)