Chemical Data Processing Library C++ API - Version 1.4.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  typedef T ValueType;
90  typedef GD GridDataType;
92  typedef typename CoordinatesTransformType::MatrixTemporaryType InvCoordinatesTransformType;
93  typedef typename std::conditional<std::is_const<GD>::value,
94  typename GD::ConstReference,
95  typename GD::Reference>::type Reference;
96  typedef typename GD::ConstReference ConstReference;
97  typedef typename GD::SizeType SizeType;
98  typedef std::ptrdiff_t SSizeType;
99  typedef typename GD::DifferenceType DifferenceType;
101  typedef const SelfType ConstClosureType;
102  typedef std::shared_ptr<SelfType> SharedPointer;
103 
105  xStep(xs), yStep(ys), zStep(zs)
106  {
107 
110  }
111 
113  data(data), xStep(xs), yStep(ys), zStep(zs)
114  {
115 
118  }
119 
121  xStep(s), yStep(s), zStep(s)
122  {
123 
126  }
127 
129  data(data), xStep(s), yStep(s), zStep(s)
130  {
131 
134  }
135 
137  data(usg.data), xStep(usg.xStep), yStep(usg.yStep), zStep(usg.zStep),
138  xform(usg.xform), invXform(usg.invXform) {}
139 
141  data(std::move(usg.data)), xStep(usg.xStep), yStep(usg.yStep), zStep(usg.zStep),
142  xform(usg.xform), invXform(usg.invXform) {}
143 
144  virtual ~RegularSpatialGrid() {}
145 
147  {
148  return data(i);
149  }
150 
152  {
153  return data(i);
154  }
155 
157  {
158  return data(i, j, k);
159  }
160 
162  {
163  return data(i, j, k);
164  }
165 
167  {
168  return data.getSize();
169  }
170 
172  {
173  return data.getSize1();
174  }
175 
177  {
178  return data.getSize2();
179  }
180 
182  {
183  return data.getSize3();
184  }
185 
187  {
188  return data.getMaxSize();
189  }
190 
192  {
193  return data.getMaxSize1();
194  }
195 
197  {
198  return data.getMaxSize2();
199  }
200 
202  {
203  return data.getMaxSize3();
204  }
205 
207  {
208  return xStep;
209  }
210 
212  {
213  return yStep;
214  }
215 
217  {
218  return zStep;
219  }
220 
222  {
223  xStep = xs;
224  }
225 
227  {
228  yStep = ys;
229  }
230 
232  {
233  zStep = zs;
234  }
235 
237  {
238  return ((data.getSize1() <= 1 ? SizeType(0) : (data.getSize1() - 1)) * xStep);
239  }
240 
242  {
243  return ((data.getSize2() <= 1 ? SizeType(0) : (data.getSize2() - 1)) * yStep);
244  }
245 
247  {
248  return ((data.getSize3() <= 1 ? SizeType(0) : (data.getSize3() - 1)) * zStep);
249  }
250 
251  template <typename V>
252  void getCoordinates(SizeType i, V& coords) const
253  {
254  SizeType z = i / (getSize1() * getSize2());
255  SizeType xy = i % (getSize1() * getSize2());
256  SizeType y = xy / getSize1();
257  SizeType x = xy % getSize1();
258 
259  getCoordinates(x, y, z, coords);
260  }
261 
262  template <typename V>
263  void getCoordinates(SSizeType i, SSizeType j, SSizeType k, V& coords) const
264  {
266 
267  getLocalCoordinates(i, j, k, local_coords);
268  local_coords(3) = CoordinatesValueType(1);
269 
272 
273  coords[0] = world_coords(0);
274  coords[1] = world_coords(1);
275  coords[2] = world_coords(2);
276  }
277 
278  template <typename V>
279  void getLocalCoordinates(SSizeType i, SSizeType j, SSizeType k, V& coords) const
280  {
281  coords[0] = i * xStep - getXExtent() * CoordinatesValueType(0.5);
282  coords[1] = j * yStep - getYExtent() * CoordinatesValueType(0.5);
283  coords[2] = k * zStep - getZExtent() * CoordinatesValueType(0.5);
284  }
285 
286  template <typename V1, typename V2>
287  void getLocalCoordinates(const V1& world_coords, V2& local_coords) const
288  {
289  CVector<CoordinatesValueType, 4> tmp_local_coords;
290 
291  transformToLocalCoordinates(world_coords, tmp_local_coords);
292 
293  local_coords[0] = tmp_local_coords[0];
294  local_coords[1] = tmp_local_coords[1];
295  local_coords[2] = tmp_local_coords[2];
296  }
297 
298  template <typename V>
299  bool containsPoint(const V& pos) const
300  {
302 
303  transformToLocalCoordinates(pos, local_coords);
304 
305  return containsLocalPoint(local_coords);
306  }
307 
308  template <typename V>
309  bool containsLocalPoint(const V& pos) const
310  {
311  if (CoordinatesValueType(pos[0]) >= (getXExtent() * CoordinatesValueType(0.5)))
312  return false;
313 
314  if (CoordinatesValueType(pos[1]) >= (getYExtent() * CoordinatesValueType(0.5)))
315  return false;
316 
317  if (CoordinatesValueType(pos[2]) >= (getZExtent() * CoordinatesValueType(0.5)))
318  return false;
319 
320  if (CoordinatesValueType(pos[0]) < (-getXExtent() * CoordinatesValueType(0.5)))
321  return false;
322 
323  if (CoordinatesValueType(pos[1]) < (-getYExtent() * CoordinatesValueType(0.5)))
324  return false;
325 
326  if (CoordinatesValueType(pos[2]) < (-getZExtent() * CoordinatesValueType(0.5)))
327  return false;
328 
329  return true;
330  }
331 
332  template <typename V1, typename V2>
333  void getContainingCell(const V1& pos, V2& indices) const
334  {
336 
337  transformToLocalCoordinates(pos, local_coords);
338 
339  getLocalContainingCell(local_coords, indices);
340  }
341 
342  template <typename V1, typename V2>
343  void getLocalContainingCell(const V1& pos, V2& indices) const
344  {
348 
349  indices[0] = SSizeType(std::floor(x / xStep));
350  indices[1] = SSizeType(std::floor(y / yStep));
351  indices[2] = SSizeType(std::floor(z / zStep));
352  }
353 
354  bool isEmpty() const
355  {
356  return data.isEmpty();
357  }
358 
359  const GridDataType& getData() const
360  {
361  return data;
362  }
363 
365  {
366  return data;
367  }
368 
370  {
371  return xform;
372  }
373 
374  template <typename T1>
375  void setCoordinatesTransform(const T1& xform)
376  {
377  this->xform = xform;
378 #ifdef CDPL_MATH_CHECKS_DISABLE
380 #else
382 #endif // CDPL_MATH_CHECKS_DISABLE
383  }
384 
386  {
387  data = usg.data;
388  xform = usg.xform;
389  invXform = usg.invXform;
390  xStep = usg.xStep;
391  yStep = usg.yStep;
392  zStep = usg.zStep;
393  return *this;
394  }
395 
397  {
398  data = std::move(usg.data);
399  xform = usg.xform;
400  invXform = usg.invXform;
401  xStep = usg.xStep;
402  yStep = usg.yStep;
403  zStep = usg.zStep;
404  return *this;
405  }
406 
407  template <typename E>
409  {
410  data.operator=(e);
411  return *this;
412  }
413 
414  template <typename E>
416  {
417  data.operator+=(e);
418  return *this;
419  }
420 
421  template <typename E>
423  {
424  data.operator-=(e);
425  return *this;
426  }
427 
428  template <typename T1>
429  typename std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& operator*=(const T1& t)
430  {
431  data.operator*=(t);
432  return *this;
433  }
434 
435  template <typename T1>
436  typename std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& operator/=(const T1& t)
437  {
438  data.operator/=(t);
439  return *this;
440  }
441 
442  template <typename E>
444  {
445  data.assign(e);
446  return *this;
447  }
448 
449  template <typename E>
451  {
452  data.plusAssign(e);
453  return *this;
454  }
455 
456  template <typename E>
458  {
459  data.minusAssign(e);
460  return *this;
461  }
462 
464  {
465  data.swap(usg.data);
466  xform.swap(usg.xform);
467  invXform.swap(usg.invXform);
468  std::swap(xStep, usg.xStep);
469  std::swap(yStep, usg.yStep);
470  std::swap(zStep, usg.zStep);
471  }
472 
473  friend void swap(RegularSpatialGrid& usg1, RegularSpatialGrid& usg2)
474  {
475  usg1.swap(usg2);
476  }
477 
478  void clear(const ValueType& v = ValueType())
479  {
480  data.clear(v);
481  }
482 
483  void resize(SizeType m, SizeType n, SizeType o, bool preserve = true, const ValueType& v = ValueType())
484  {
485  data.resize(m, n, o, preserve, v);
486  }
487 
488  private:
489  template <typename V1, typename V2>
490  void transformToLocalCoordinates(const V1& coords, V2& local_coords) const
491  {
493 
494  world_coords(0) = coords[0];
495  world_coords(1) = coords[1];
496  world_coords(2) = coords[2];
497  world_coords(3) = CoordinatesValueType(1);
498 
500  }
501 
502  GridDataType data;
503  CoordinatesValueType xStep;
504  CoordinatesValueType yStep;
505  CoordinatesValueType zStep;
508  };
509 
510  template <typename T, typename C, typename GD, typename XF, typename V>
511  T interpolateTrilinear(const RegularSpatialGrid<T, C, GD, XF>& grid, const V& pos, bool local_pos)
512  {
513  typedef RegularSpatialGrid<T, C, GD, XF> GridType;
514 
515  typedef typename GridType::CoordinatesValueType CoordinatesValueType;
516  typedef typename GridType::SSizeType SSizeType;
517  typedef typename GridType::ValueType ValueType;
518 
519  if (grid.isEmpty())
520  return CoordinatesValueType();
521 
522  CoordinatesValueType loc_pos[3];
523 
524  if (local_pos) {
525  loc_pos[0] = pos[0];
526  loc_pos[1] = pos[1];
527  loc_pos[2] = pos[2];
528 
529  } else
530  grid.getLocalCoordinates(pos, loc_pos);
531 
532  SSizeType inds[3];
533 
534  grid.getLocalContainingCell(loc_pos, inds);
535 
536  CoordinatesValueType xyz0[3];
537 
538  grid.getLocalCoordinates(inds[0], inds[1], inds[2], xyz0);
539 
540  SSizeType inds_p1[3];
541 
542  inds_p1[0] = inds[0] + 1;
543  inds_p1[1] = inds[1] + 1;
544  inds_p1[2] = inds[2] + 1;
545 
546  inds[0] = std::max(SSizeType(0), inds[0]);
547  inds[1] = std::max(SSizeType(0), inds[1]);
548  inds[2] = std::max(SSizeType(0), inds[2]);
549 
550  inds[0] = std::min(SSizeType(grid.getSize1() - 1), inds[0]);
551  inds[1] = std::min(SSizeType(grid.getSize2() - 1), inds[1]);
552  inds[2] = std::min(SSizeType(grid.getSize3() - 1), inds[2]);
553 
554  inds_p1[0] = std::max(SSizeType(0), inds_p1[0]);
555  inds_p1[1] = std::max(SSizeType(0), inds_p1[1]);
556  inds_p1[2] = std::max(SSizeType(0), inds_p1[2]);
557 
558  inds_p1[0] = std::min(SSizeType(grid.getSize1() - 1), inds_p1[0]);
559  inds_p1[1] = std::min(SSizeType(grid.getSize2() - 1), inds_p1[1]);
560  inds_p1[2] = std::min(SSizeType(grid.getSize3() - 1), inds_p1[2]);
561 
562  CoordinatesValueType xd = (loc_pos[0] - xyz0[0]) / grid.getXStepSize();
563  CoordinatesValueType yd = (loc_pos[1] - xyz0[1]) / grid.getYStepSize();
564  CoordinatesValueType zd = (loc_pos[2] - xyz0[2]) / grid.getZStepSize();
565 
566  ValueType c00 = grid(inds[0], inds[1], inds[2]) * (1 - xd) + grid(inds_p1[0], inds[1], inds[2]) * xd;
567  ValueType c01 = grid(inds[0], inds[1], inds_p1[2]) * (1 - xd) + grid(inds_p1[0], inds[1], inds_p1[2]) * xd;
568  ValueType c10 = grid(inds[0], inds_p1[1], inds[2]) * (1 - xd) + grid(inds_p1[0], inds_p1[1], inds[2]) * xd;
569  ValueType c11 = grid(inds[0], inds_p1[1], inds_p1[2]) * (1 - xd) + grid(inds_p1[0], inds_p1[1], inds_p1[2]) * xd;
570 
571  ValueType c0 = c00 * (1 - yd) + c10 * yd;
572  ValueType c1 = c01 * (1 - yd) + c11 * yd;
573 
574  ValueType c = c0 * (1 - zd) + c1 * zd;
575 
576  return c;
577  }
578 
583 
588  } // namespace Math
589 } // namespace CDPL
590 
591 #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:96
SizeType getMaxSize3() const
Definition: RegularSpatialGrid.hpp:201
bool containsPoint(const V &pos) const
Definition: RegularSpatialGrid.hpp:299
CoordinatesValueType getZStepSize() const
Definition: RegularSpatialGrid.hpp:216
XF CoordinatesTransformType
Definition: RegularSpatialGrid.hpp:91
RegularSpatialGrid & operator=(const RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:385
SizeType getMaxSize2() const
Definition: RegularSpatialGrid.hpp:196
void setCoordinatesTransform(const T1 &xform)
Definition: RegularSpatialGrid.hpp:375
void setYStepSize(const CoordinatesValueType &ys)
Definition: RegularSpatialGrid.hpp:226
bool isEmpty() const
Definition: RegularSpatialGrid.hpp:354
RegularSpatialGrid(const RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:136
void setZStepSize(const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:231
RegularSpatialGrid & operator=(RegularSpatialGrid &&usg)
Definition: RegularSpatialGrid.hpp:396
std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & operator*=(const T1 &t)
Definition: RegularSpatialGrid.hpp:429
RegularSpatialGrid(const GridDataType &data, const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:112
T ValueType
Definition: RegularSpatialGrid.hpp:88
std::conditional< std::is_const< GD >::value, typename GD::ConstReference, typename GD::Reference >::type Reference
Definition: RegularSpatialGrid.hpp:95
RegularSpatialGrid(const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Definition: RegularSpatialGrid.hpp:104
const SelfType ConstClosureType
Definition: RegularSpatialGrid.hpp:101
CoordinatesTransformType::MatrixTemporaryType InvCoordinatesTransformType
Definition: RegularSpatialGrid.hpp:92
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: RegularSpatialGrid.hpp:161
RegularSpatialGrid & minusAssign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:457
std::shared_ptr< SelfType > SharedPointer
Definition: RegularSpatialGrid.hpp:102
std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & operator/=(const T1 &t)
Definition: RegularSpatialGrid.hpp:436
CoordinatesValueType getYExtent() const
Definition: RegularSpatialGrid.hpp:241
GD::DifferenceType DifferenceType
Definition: RegularSpatialGrid.hpp:99
void clear(const ValueType &v=ValueType())
Definition: RegularSpatialGrid.hpp:478
SizeType getSize() const
Definition: RegularSpatialGrid.hpp:166
std::ptrdiff_t SSizeType
Definition: RegularSpatialGrid.hpp:98
SizeType getMaxSize1() const
Definition: RegularSpatialGrid.hpp:191
void setXStepSize(const CoordinatesValueType &xs)
Definition: RegularSpatialGrid.hpp:221
RegularSpatialGrid(const CoordinatesValueType &s)
Definition: RegularSpatialGrid.hpp:120
RegularSpatialGrid & operator+=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:415
friend void swap(RegularSpatialGrid &usg1, RegularSpatialGrid &usg2)
Definition: RegularSpatialGrid.hpp:473
GD::SizeType SizeType
Definition: RegularSpatialGrid.hpp:97
SizeType getSize3() const
Definition: RegularSpatialGrid.hpp:181
SizeType getSize1() const
Definition: RegularSpatialGrid.hpp:171
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: RegularSpatialGrid.hpp:156
CoordinatesValueType getXStepSize() const
Definition: RegularSpatialGrid.hpp:206
RegularSpatialGrid & operator-=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:422
RegularSpatialGrid(RegularSpatialGrid &&usg)
Definition: RegularSpatialGrid.hpp:140
const CoordinatesTransformType & getCoordinatesTransform() const
Definition: RegularSpatialGrid.hpp:369
SizeType getSize2() const
Definition: RegularSpatialGrid.hpp:176
CoordinatesValueType getYStepSize() const
Definition: RegularSpatialGrid.hpp:211
CoordinatesValueType getXExtent() const
Definition: RegularSpatialGrid.hpp:236
void getLocalCoordinates(SSizeType i, SSizeType j, SSizeType k, V &coords) const
Definition: RegularSpatialGrid.hpp:279
void getContainingCell(const V1 &pos, V2 &indices) const
Definition: RegularSpatialGrid.hpp:333
SelfType ClosureType
Definition: RegularSpatialGrid.hpp:100
RegularSpatialGrid & assign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:443
GD GridDataType
Definition: RegularSpatialGrid.hpp:90
ConstReference operator()(SizeType i) const
Definition: RegularSpatialGrid.hpp:151
RegularSpatialGrid & operator=(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:408
RegularSpatialGrid & plusAssign(const GridExpression< E > &e)
Definition: RegularSpatialGrid.hpp:450
const GridDataType & getData() const
Definition: RegularSpatialGrid.hpp:359
RegularSpatialGrid(const GridDataType &data, const CoordinatesValueType &s)
Definition: RegularSpatialGrid.hpp:128
void resize(SizeType m, SizeType n, SizeType o, bool preserve=true, const ValueType &v=ValueType())
Definition: RegularSpatialGrid.hpp:483
bool containsLocalPoint(const V &pos) const
Definition: RegularSpatialGrid.hpp:309
C CoordinatesValueType
Definition: RegularSpatialGrid.hpp:89
CoordinatesValueType getZExtent() const
Definition: RegularSpatialGrid.hpp:246
void getCoordinates(SizeType i, V &coords) const
Definition: RegularSpatialGrid.hpp:252
GridDataType & getData()
Definition: RegularSpatialGrid.hpp:364
void getLocalContainingCell(const V1 &pos, V2 &indices) const
Definition: RegularSpatialGrid.hpp:343
void getCoordinates(SSizeType i, SSizeType j, SSizeType k, V &coords) const
Definition: RegularSpatialGrid.hpp:263
Reference operator()(SizeType i)
Definition: RegularSpatialGrid.hpp:146
SizeType getMaxSize() const
Definition: RegularSpatialGrid.hpp:186
virtual ~RegularSpatialGrid()
Definition: RegularSpatialGrid.hpp:144
void getLocalCoordinates(const V1 &world_coords, V2 &local_coords) const
Definition: RegularSpatialGrid.hpp:287
void swap(RegularSpatialGrid &usg)
Definition: RegularSpatialGrid.hpp:463
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:587
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType prod(const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: MatrixExpression.hpp:831
RegularSpatialGrid< float > FRegularSpatialGrid
An unbounded dense regular grid in 3D space holding floating point values of type float.
Definition: RegularSpatialGrid.hpp:582
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:511
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