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