Chemical Data Processing Library C++ API - Version 1.2.0
RegularSpatialGrid.hpp
Go to the documentation of this file.
1 /*
2  * RegularSpatialGrid.hpp
3  *
4  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef CDPL_MATH_REGULARSPATIALGRID_HPP
28 #define CDPL_MATH_REGULARSPATIALGRID_HPP
29 
30 #include <type_traits>
31 #include <utility>
32 #include <memory>
33 
35 #include "CDPL/Math/Grid.hpp"
36 #include "CDPL/Math/Matrix.hpp"
37 #include "CDPL/Math/Vector.hpp"
38 #include "CDPL/Math/TypeTraits.hpp"
39 #include "CDPL/Base/Exceptions.hpp"
40 
41 namespace CDPL
42 {
43 
44  namespace Math
45  {
46 
47  template <typename MatrixType>
49  {
50 
51  static void init(MatrixType& mtx)
52  {
54  }
55 
56  template <typename M>
57  static bool invert(const MatrixType& mtx, M& inv_mtx)
58  {
59  return Math::invert(mtx, inv_mtx);
60  }
61 
62  template <typename V, typename R>
63  static void transform(const MatrixType& mtx, const V& v, R& r)
64  {
65  prod(mtx, v, r);
66  }
67  };
68 
69  template <typename T>
71 
72  template <typename T>
74  {};
75 
76  template <typename T>
77  struct GridCoordinatesTransformTraits<BoundedMatrix<T, 4, 4> > : public GridCoordinatesMatrixTransformTraits<BoundedMatrix<T, 4, 4> >
78  {};
79 
80 
81  template <typename T, typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4> >
82  class RegularSpatialGrid : public GridExpression<RegularSpatialGrid<T, C, GD, XF> >
83  {
84 
86 
87  public:
88  enum DataMode
89  {
90 
92  POINT
93  };
94 
95  typedef T ValueType;
97  typedef GD GridDataType;
99  typedef typename CoordinatesTransformType::MatrixTemporaryType InvCoordinatesTransformType;
100  typedef typename std::conditional<std::is_const<GD>::value,
101  typename GD::ConstReference,
102  typename GD::Reference>::type Reference;
103  typedef typename GD::ConstReference ConstReference;
104  typedef typename GD::SizeType SizeType;
105  typedef std::ptrdiff_t SSizeType;
106  typedef typename GD::DifferenceType DifferenceType;
108  typedef const SelfType ConstClosureType;
109  typedef std::shared_ptr<SelfType> SharedPointer;
110 
112  dataMode(POINT), xStep(xs), yStep(ys), zStep(zs)
113  {
114 
117  }
118 
120  dataMode(POINT), data(data), xStep(xs), yStep(ys), zStep(zs)
121  {
122 
125  }
126 
128  dataMode(POINT), xStep(s), yStep(s), zStep(s)
129  {
130 
133  }
134 
136  dataMode(POINT), data(data), xStep(s), yStep(s), zStep(s)
137  {
138 
141  }
142 
144  dataMode(usg.dataMode), data(usg.data), xStep(usg.xStep), yStep(usg.yStep), zStep(usg.zStep),
145  xform(usg.xform), invXform(usg.invXform) {}
146 
148  dataMode(usg.dataMode), data(std::move(usg.data)), xStep(usg.xStep), yStep(usg.yStep), zStep(usg.zStep),
149  xform(usg.xform), invXform(usg.invXform) {}
150 
151  virtual ~RegularSpatialGrid() {}
152 
154  {
155  dataMode = mode;
156  }
157 
159  {
160  return dataMode;
161  }
162 
164  {
165  return data(i);
166  }
167 
169  {
170  return data(i);
171  }
172 
174  {
175  return data(i, j, k);
176  }
177 
179  {
180  return data(i, j, k);
181  }
182 
184  {
185  return data.getSize();
186  }
187 
189  {
190  return data.getSize1();
191  }
192 
194  {
195  return data.getSize2();
196  }
197 
199  {
200  return data.getSize3();
201  }
202 
204  {
205  return data.getMaxSize();
206  }
207 
209  {
210  return data.getMaxSize1();
211  }
212 
214  {
215  return data.getMaxSize2();
216  }
217 
219  {
220  return data.getMaxSize3();
221  }
222 
224  {
225  return xStep;
226  }
227 
229  {
230  return yStep;
231  }
232 
234  {
235  return zStep;
236  }
237 
239  {
240  xStep = xs;
241  }
242 
244  {
245  yStep = ys;
246  }
247 
249  {
250  zStep = zs;
251  }
252 
254  {
255  if (dataMode == POINT)
256  return (data.getSize1() * xStep);
257 
258  return ((data.getSize1() <= 1 ? SizeType(0) : (data.getSize1() - 1)) * xStep);
259  }
260 
262  {
263  if (dataMode == POINT)
264  return (data.getSize2() * yStep);
265 
266  return ((data.getSize2() <= 1 ? SizeType(0) : (data.getSize2() - 1)) * yStep);
267  }
268 
270  {
271  if (dataMode == POINT)
272  return (data.getSize3() * zStep);
273 
274  return ((data.getSize3() <= 1 ? SizeType(0) : (data.getSize3() - 1)) * zStep);
275  }
276 
277  template <typename V>
278  void getCoordinates(SizeType i, V& coords) const
279  {
280  SizeType z = i / (getSize1() * getSize2());
281  SizeType xy = i % (getSize1() * getSize2());
282  SizeType y = xy / getSize1();
283  SizeType x = xy % getSize1();
284 
285  getCoordinates(x, y, z, coords);
286  }
287 
288  template <typename V>
289  void getCoordinates(SSizeType i, SSizeType j, SSizeType k, V& coords) const
290  {
292 
293  getLocalCoordinates(i, j, k, local_coords);
294  local_coords(3) = CoordinatesValueType(1);
295 
298 
299  coords[0] = world_coords(0);
300  coords[1] = world_coords(1);
301  coords[2] = world_coords(2);
302  }
303 
304  template <typename V>
305  void getLocalCoordinates(SSizeType i, SSizeType j, SSizeType k, V& coords) const
306  {
307  if (dataMode == POINT) {
308  coords[0] = i * xStep + (xStep - getXExtent()) * CoordinatesValueType(0.5);
309  coords[1] = j * yStep + (yStep - getYExtent()) * CoordinatesValueType(0.5);
310  coords[2] = k * zStep + (zStep - getZExtent()) * CoordinatesValueType(0.5);
311  return;
312  }
313 
314  coords[0] = i * xStep - getXExtent() * CoordinatesValueType(0.5);
315  coords[1] = j * yStep - getYExtent() * CoordinatesValueType(0.5);
316  coords[2] = k * zStep - getZExtent() * CoordinatesValueType(0.5);
317  }
318 
319  template <typename V1, typename V2>
320  void getLocalCoordinates(const V1& world_coords, V2& local_coords) const
321  {
322  CVector<CoordinatesValueType, 4> tmp_local_coords;
323 
324  transformToLocalCoordinates(world_coords, tmp_local_coords);
325 
326  local_coords[0] = tmp_local_coords[0];
327  local_coords[1] = tmp_local_coords[1];
328  local_coords[2] = tmp_local_coords[2];
329  }
330 
331  template <typename V>
332  bool containsPoint(const V& pos) const
333  {
335 
336  transformToLocalCoordinates(pos, local_coords);
337 
338  return containsLocalPoint(local_coords);
339  }
340 
341  template <typename V>
342  bool containsLocalPoint(const V& pos) const
343  {
344  if (CoordinatesValueType(pos[0]) >= (getXExtent() * CoordinatesValueType(0.5)))
345  return false;
346 
347  if (CoordinatesValueType(pos[1]) >= (getYExtent() * CoordinatesValueType(0.5)))
348  return false;
349 
350  if (CoordinatesValueType(pos[2]) >= (getZExtent() * CoordinatesValueType(0.5)))
351  return false;
352 
353  if (CoordinatesValueType(pos[0]) < (-getXExtent() * CoordinatesValueType(0.5)))
354  return false;
355 
356  if (CoordinatesValueType(pos[1]) < (-getYExtent() * CoordinatesValueType(0.5)))
357  return false;
358 
359  if (CoordinatesValueType(pos[2]) < (-getZExtent() * CoordinatesValueType(0.5)))
360  return false;
361 
362  return true;
363  }
364 
365  template <typename V1, typename V2>
366  void getContainingCell(const V1& pos, V2& indices) const
367  {
369 
370  transformToLocalCoordinates(pos, local_coords);
371 
372  getLocalContainingCell(local_coords, indices);
373  }
374 
375  template <typename V1, typename V2>
376  void getLocalContainingCell(const V1& pos, V2& indices) const
377  {
381 
382  indices[0] = SSizeType(std::floor(x / xStep));
383  indices[1] = SSizeType(std::floor(y / yStep));
384  indices[2] = SSizeType(std::floor(z / zStep));
385  }
386 
387  bool isEmpty() const
388  {
389  return data.isEmpty();
390  }
391 
392  const GridDataType& getData() const
393  {
394  return data;
395  }
396 
398  {
399  return data;
400  }
401 
403  {
404  return xform;
405  }
406 
407  template <typename T1>
408  void setCoordinatesTransform(const T1& xform)
409  {
410  this->xform = xform;
411 #ifdef CDPL_MATH_CHECKS_DISABLE
413 #else
415 #endif // CDPL_MATH_CHECKS_DISABLE
416  }
417 
419  {
420  dataMode = usg.dataMode;
421  data = usg.data;
422  xform = usg.xform;
423  invXform = usg.invXform;
424  xStep = usg.xStep;
425  yStep = usg.yStep;
426  zStep = usg.zStep;
427  return *this;
428  }
429 
431  {
432  dataMode = usg.dataMode;
433  data = std::move(usg.data);
434  xform = usg.xform;
435  invXform = usg.invXform;
436  xStep = usg.xStep;
437  yStep = usg.yStep;
438  zStep = usg.zStep;
439  return *this;
440  }
441 
442  template <typename E>
444  {
445  data.operator=(e);
446  return *this;
447  }
448 
449  template <typename E>
451  {
452  data.operator+=(e);
453  return *this;
454  }
455 
456  template <typename E>
458  {
459  data.operator-=(e);
460  return *this;
461  }
462 
463  template <typename T1>
464  typename std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& operator*=(const T1& t)
465  {
466  data.operator*=(t);
467  return *this;
468  }
469 
470  template <typename T1>
471  typename std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& operator/=(const T1& t)
472  {
473  data.operator/=(t);
474  return *this;
475  }
476 
477  template <typename E>
479  {
480  data.assign(e);
481  return *this;
482  }
483 
484  template <typename E>
486  {
487  data.plusAssign(e);
488  return *this;
489  }
490 
491  template <typename E>
493  {
494  data.minusAssign(e);
495  return *this;
496  }
497 
499  {
500  data.swap(usg.data);
501  xform.swap(usg.xform);
502  invXform.swap(usg.invXform);
503  std::swap(xStep, usg.xStep);
504  std::swap(yStep, usg.yStep);
505  std::swap(zStep, usg.zStep);
506  std::swap(dataMode, dataMode);
507  }
508 
509  friend void swap(RegularSpatialGrid& usg1, RegularSpatialGrid& usg2)
510  {
511  usg1.swap(usg2);
512  }
513 
514  void clear(const ValueType& v = ValueType())
515  {
516  data.clear(v);
517  }
518 
519  void resize(SizeType m, SizeType n, SizeType o, bool preserve = true, const ValueType& v = ValueType())
520  {
521  data.resize(m, n, o, preserve, v);
522  }
523 
524  private:
525  template <typename V1, typename V2>
526  void transformToLocalCoordinates(const V1& coords, V2& local_coords) const
527  {
529 
530  world_coords(0) = coords[0];
531  world_coords(1) = coords[1];
532  world_coords(2) = coords[2];
533  world_coords(3) = CoordinatesValueType(1);
534 
536  }
537 
538  DataMode dataMode;
539  GridDataType data;
540  CoordinatesValueType xStep;
541  CoordinatesValueType yStep;
542  CoordinatesValueType zStep;
545  };
546 
547  template <typename T, typename C, typename GD, typename XF, typename V>
548  T interpolateTrilinear(const RegularSpatialGrid<T, C, GD, XF>& grid, const V& pos, bool local_pos)
549  {
550  typedef RegularSpatialGrid<T, C, GD, XF> GridType;
551 
552  typedef typename GridType::CoordinatesValueType CoordinatesValueType;
553  typedef typename GridType::SSizeType SSizeType;
554  typedef typename GridType::ValueType ValueType;
555 
556  if (grid.isEmpty())
557  return CoordinatesValueType();
558 
559  CoordinatesValueType loc_pos[3];
560 
561  if (local_pos) {
562  loc_pos[0] = pos[0];
563  loc_pos[1] = pos[1];
564  loc_pos[2] = pos[2];
565 
566  } else
567  grid.getLocalCoordinates(pos, loc_pos);
568 
569  SSizeType inds[3];
570 
571  grid.getLocalContainingCell(loc_pos, inds);
572 
573  CoordinatesValueType xyz0[3];
574 
575  grid.getLocalCoordinates(inds[0], inds[1], inds[2], xyz0);
576 
577  SSizeType inds_p1[3];
578 
579  if (grid.getDataMode() == GridType::POINT) {
580  bool recalc_xyz0 = false;
581 
582  if (loc_pos[0] < xyz0[0]) {
583  inds_p1[0] = inds[0];
584  inds[0] -= 1;
585  recalc_xyz0 = true;
586 
587  } else
588  inds_p1[0] = inds[0] + 1;
589 
590  if (loc_pos[1] < xyz0[1]) {
591  inds_p1[1] = inds[1];
592  inds[1] -= 1;
593  recalc_xyz0 = true;
594 
595  } else
596  inds_p1[1] = inds[1] + 1;
597 
598  if (loc_pos[2] < xyz0[2]) {
599  inds_p1[2] = inds[2];
600  inds[2] -= 1;
601  recalc_xyz0 = true;
602 
603  } else
604  inds_p1[2] = inds[2] + 1;
605 
606  if (recalc_xyz0)
607  grid.getLocalCoordinates(inds[0], inds[1], inds[2], xyz0);
608 
609  } else {
610  inds_p1[0] = inds[0] + 1;
611  inds_p1[1] = inds[1] + 1;
612  inds_p1[2] = inds[2] + 1;
613  }
614 
615  inds[0] = std::max(SSizeType(0), inds[0]);
616  inds[1] = std::max(SSizeType(0), inds[1]);
617  inds[2] = std::max(SSizeType(0), inds[2]);
618 
619  inds[0] = std::min(SSizeType(grid.getSize1() - 1), inds[0]);
620  inds[1] = std::min(SSizeType(grid.getSize2() - 1), inds[1]);
621  inds[2] = std::min(SSizeType(grid.getSize3() - 1), inds[2]);
622 
623  inds_p1[0] = std::max(SSizeType(0), inds_p1[0]);
624  inds_p1[1] = std::max(SSizeType(0), inds_p1[1]);
625  inds_p1[2] = std::max(SSizeType(0), inds_p1[2]);
626 
627  inds_p1[0] = std::min(SSizeType(grid.getSize1() - 1), inds_p1[0]);
628  inds_p1[1] = std::min(SSizeType(grid.getSize2() - 1), inds_p1[1]);
629  inds_p1[2] = std::min(SSizeType(grid.getSize3() - 1), inds_p1[2]);
630 
631  CoordinatesValueType xd = (loc_pos[0] - xyz0[0]) / grid.getXStepSize();
632  CoordinatesValueType yd = (loc_pos[1] - xyz0[1]) / grid.getYStepSize();
633  CoordinatesValueType zd = (loc_pos[2] - xyz0[2]) / grid.getZStepSize();
634 
635  ValueType c00 = grid(inds[0], inds[1], inds[2]) * (1 - xd) + grid(inds_p1[0], inds[1], inds[2]) * xd;
636  ValueType c01 = grid(inds[0], inds[1], inds_p1[2]) * (1 - xd) + grid(inds_p1[0], inds[1], inds_p1[2]) * xd;
637  ValueType c10 = grid(inds[0], inds_p1[1], inds[2]) * (1 - xd) + grid(inds_p1[0], inds_p1[1], inds[2]) * xd;
638  ValueType c11 = grid(inds[0], inds_p1[1], inds_p1[2]) * (1 - xd) + grid(inds_p1[0], inds_p1[1], inds_p1[2]) * xd;
639 
640  ValueType c0 = c00 * (1 - yd) + c10 * yd;
641  ValueType c1 = c01 * (1 - yd) + c11 * yd;
642 
643  ValueType c = c0 * (1 - zd) + c1 * zd;
644 
645  return c;
646  }
647 
652 
657  } // namespace Math
658 } // namespace CDPL
659 
660 #endif // CDPL_MATH_REGULARSPATIALGRID_HPP
Definition of exception classes.
#define CDPL_MATH_CHECK(expr, msg, e)
Definition: Check.hpp:36
Definition of various grid expression types and operations.
Definition of grid data types.
Definition of matrix data types.
Definition of type traits.
Definition of vector data types.
Thrown to indicate that some requested calculation has failed.
Definition: Base/Exceptions.hpp:230
Definition: Matrix.hpp:854
Definition: Matrix.hpp:1152
Definition: Vector.hpp:1053
Definition: Expression.hpp:120
Definition: Math/Grid.hpp:226
Definition: Matrix.hpp:1607
Definition: RegularSpatialGrid.hpp:83
GD::ConstReference ConstReference
Definition: RegularSpatialGrid.hpp:103
SizeType getMaxSize3() const
Definition: RegularSpatialGrid.hpp:218
bool containsPoint(const V &pos) const
Definition: RegularSpatialGrid.hpp:332
CoordinatesValueType getZStepSize() const
Definition: RegularSpatialGrid.hpp:233
XF CoordinatesTransformType
Definition: RegularSpatialGrid.hpp:98
RegularSpatialGrid & operator=(const RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:418
SizeType getMaxSize2() const
Definition: RegularSpatialGrid.hpp:213
DataMode
Definition: RegularSpatialGrid.hpp:89
@ POINT
Definition: RegularSpatialGrid.hpp:92
@ CELL
Definition: RegularSpatialGrid.hpp:91
void setCoordinatesTransform(const T1 &xform)
Definition: RegularSpatialGrid.hpp:408
void setYStepSize(const CoordinatesValueType &ys)
Definition: RegularSpatialGrid.hpp:243
bool isEmpty() const
Definition: RegularSpatialGrid.hpp:387
RegularSpatialGrid(const RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:143
DataMode getDataMode() const
Definition: RegularSpatialGrid.hpp:158
void setZStepSize(const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:248
RegularSpatialGrid & operator=(RegularSpatialGrid &&usg)
Definition: RegularSpatialGrid.hpp:430
std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & operator*=(const T1 &t)
Definition: RegularSpatialGrid.hpp:464
RegularSpatialGrid(const GridDataType &data, const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:119
T ValueType
Definition: RegularSpatialGrid.hpp:95
std::conditional< std::is_const< GD >::value, typename GD::ConstReference, typename GD::Reference >::type Reference
Definition: RegularSpatialGrid.hpp:102
RegularSpatialGrid(const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:111
const SelfType ConstClosureType
Definition: RegularSpatialGrid.hpp:108
CoordinatesTransformType::MatrixTemporaryType InvCoordinatesTransformType
Definition: RegularSpatialGrid.hpp:99
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: RegularSpatialGrid.hpp:178
RegularSpatialGrid & minusAssign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:492
std::shared_ptr< SelfType > SharedPointer
Definition: RegularSpatialGrid.hpp:109
std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & operator/=(const T1 &t)
Definition: RegularSpatialGrid.hpp:471
CoordinatesValueType getYExtent() const
Definition: RegularSpatialGrid.hpp:261
GD::DifferenceType DifferenceType
Definition: RegularSpatialGrid.hpp:106
void clear(const ValueType &v=ValueType())
Definition: RegularSpatialGrid.hpp:514
SizeType getSize() const
Definition: RegularSpatialGrid.hpp:183
std::ptrdiff_t SSizeType
Definition: RegularSpatialGrid.hpp:105
SizeType getMaxSize1() const
Definition: RegularSpatialGrid.hpp:208
void setXStepSize(const CoordinatesValueType &xs)
Definition: RegularSpatialGrid.hpp:238
RegularSpatialGrid(const CoordinatesValueType &s)
Definition: RegularSpatialGrid.hpp:127
RegularSpatialGrid & operator+=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:450
friend void swap(RegularSpatialGrid &usg1, RegularSpatialGrid &usg2)
Definition: RegularSpatialGrid.hpp:509
GD::SizeType SizeType
Definition: RegularSpatialGrid.hpp:104
SizeType getSize3() const
Definition: RegularSpatialGrid.hpp:198
SizeType getSize1() const
Definition: RegularSpatialGrid.hpp:188
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: RegularSpatialGrid.hpp:173
CoordinatesValueType getXStepSize() const
Definition: RegularSpatialGrid.hpp:223
RegularSpatialGrid & operator-=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:457
RegularSpatialGrid(RegularSpatialGrid &&usg)
Definition: RegularSpatialGrid.hpp:147
const CoordinatesTransformType & getCoordinatesTransform() const
Definition: RegularSpatialGrid.hpp:402
void setDataMode(DataMode mode)
Definition: RegularSpatialGrid.hpp:153
SizeType getSize2() const
Definition: RegularSpatialGrid.hpp:193
CoordinatesValueType getYStepSize() const
Definition: RegularSpatialGrid.hpp:228
CoordinatesValueType getXExtent() const
Definition: RegularSpatialGrid.hpp:253
void getLocalCoordinates(SSizeType i, SSizeType j, SSizeType k, V &coords) const
Definition: RegularSpatialGrid.hpp:305
void getContainingCell(const V1 &pos, V2 &indices) const
Definition: RegularSpatialGrid.hpp:366
SelfType ClosureType
Definition: RegularSpatialGrid.hpp:107
RegularSpatialGrid & assign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:478
GD GridDataType
Definition: RegularSpatialGrid.hpp:97
ConstReference operator()(SizeType i) const
Definition: RegularSpatialGrid.hpp:168
RegularSpatialGrid & operator=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:443
RegularSpatialGrid & plusAssign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:485
const GridDataType & getData() const
Definition: RegularSpatialGrid.hpp:392
RegularSpatialGrid(const GridDataType &data, const CoordinatesValueType &s)
Definition: RegularSpatialGrid.hpp:135
void resize(SizeType m, SizeType n, SizeType o, bool preserve=true, const ValueType &v=ValueType())
Definition: RegularSpatialGrid.hpp:519
bool containsLocalPoint(const V &pos) const
Definition: RegularSpatialGrid.hpp:342
C CoordinatesValueType
Definition: RegularSpatialGrid.hpp:96
CoordinatesValueType getZExtent() const
Definition: RegularSpatialGrid.hpp:269
void getCoordinates(SizeType i, V &coords) const
Definition: RegularSpatialGrid.hpp:278
GridDataType & getData()
Definition: RegularSpatialGrid.hpp:397
void getLocalContainingCell(const V1 &pos, V2 &indices) const
Definition: RegularSpatialGrid.hpp:376
void getCoordinates(SSizeType i, SSizeType j, SSizeType k, V &coords) const
Definition: RegularSpatialGrid.hpp:289
Reference operator()(SizeType i)
Definition: RegularSpatialGrid.hpp:163
SizeType getMaxSize() const
Definition: RegularSpatialGrid.hpp:203
virtual ~RegularSpatialGrid()
Definition: RegularSpatialGrid.hpp:151
void getLocalCoordinates(const V1 &world_coords, V2 &local_coords) const
Definition: RegularSpatialGrid.hpp:320
void swap(RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:498
constexpr unsigned int V2
Specifies the PDB format version V2.
Definition: PDBFormatVersion.hpp:54
constexpr unsigned int R
Specifies that the atom has R configuration.
Definition: AtomConfiguration.hpp:58
constexpr unsigned int M
A generic type that covers any element that is a metal.
Definition: AtomType.hpp:657
constexpr unsigned int V
Specifies Vanadium.
Definition: AtomType.hpp:177
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int C
Specifies Carbon.
Definition: AtomType.hpp:92
constexpr unsigned int r
Specifies that the stereocenter has r configuration.
Definition: CIPDescriptor.hpp:76
constexpr unsigned int s
Specifies that the stereocenter has s configuration.
Definition: CIPDescriptor.hpp:81
constexpr unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
RegularSpatialGrid< double > DRegularSpatialGrid
An unbounded dense regular grid in 3D space holding floating point values of type double.
Definition: RegularSpatialGrid.hpp:656
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType prod(const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: MatrixExpression.hpp:833
RegularSpatialGrid< float > FRegularSpatialGrid
An unbounded dense regular grid in 3D space holding floating point values of type float.
Definition: RegularSpatialGrid.hpp:651
bool invert(const MatrixExpression< E > &e, MatrixContainer< C > &c)
Definition: Matrix.hpp:1766
T interpolateTrilinear(const RegularSpatialGrid< T, C, GD, XF > &grid, const V &pos, bool local_pos)
Definition: RegularSpatialGrid.hpp:548
void transform(VectorArray< CVector< T, Dim > > &va, const CMatrix< T1, Dim, Dim > &xform)
Transforms each -dimensional vector in the array with the -dimensional square matrix xform.
Definition: VectorArrayFunctions.hpp:51
The namespace of the Chemical Data Processing Library.
Definition: RegularSpatialGrid.hpp:49
static bool invert(const MatrixType &mtx, M &inv_mtx)
Definition: RegularSpatialGrid.hpp:57
static void init(MatrixType &mtx)
Definition: RegularSpatialGrid.hpp:51
static void transform(const MatrixType &mtx, const V &v, R &r)
Definition: RegularSpatialGrid.hpp:63
Definition: RegularSpatialGrid.hpp:70