Chemical Data Processing Library C++ API - Version 1.1.1
Math/Grid.hpp
Go to the documentation of this file.
1 /*
2  * Grid.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_GRID_HPP
28 #define CDPL_MATH_GRID_HPP
29 
30 #include <cstddef>
31 #include <algorithm>
32 #include <vector>
33 #include <limits>
34 #include <type_traits>
35 #include <utility>
36 #include <memory>
37 
38 #include "CDPL/Math/Check.hpp"
41 #include "CDPL/Math/Functional.hpp"
42 #include "CDPL/Math/TypeTraits.hpp"
43 #include "CDPL/Base/Exceptions.hpp"
44 
45 
46 namespace CDPL
47 {
48 
49  namespace Math
50  {
51 
52  template <typename G>
53  class GridReference : public GridExpression<GridReference<G> >
54  {
55 
56  typedef GridReference<G> SelfType;
57 
58  public:
59  typedef G GridType;
60  typedef typename G::ValueType ValueType;
61  typedef typename std::conditional<std::is_const<G>::value,
62  typename G::ConstReference,
63  typename G::Reference>::type Reference;
64  typedef typename G::ConstReference ConstReference;
65  typedef typename G::SizeType SizeType;
66  typedef typename G::DifferenceType DifferenceType;
68  typedef const SelfType ConstClosureType;
69 
70  explicit GridReference(GridType& g):
71  data(g) {}
72 
74  {
75  return data(i);
76  }
77 
79  {
80  return data(i);
81  }
82 
84  {
85  return data(i, j, k);
86  }
87 
89  {
90  return data(i, j, k);
91  }
92 
93  SizeType getSize() const
94  {
95  return data.getSize();
96  }
97 
99  {
100  return data.getSize1();
101  }
102 
104  {
105  return data.getSize2();
106  }
107 
109  {
110  return data.getSize3();
111  }
112 
114  {
115  return data.getMaxSize();
116  }
117 
119  {
120  return data.getMaxSize1();
121  }
122 
124  {
125  return data.getMaxSize2();
126  }
127 
129  {
130  return data.getMaxSize3();
131  }
132 
133  bool isEmpty() const
134  {
135  return data.isEmpty();
136  }
137 
138  const GridType& getData() const
139  {
140  return data;
141  }
142 
144  {
145  return data;
146  }
147 
149  {
150  data.operator=(r.data);
151  return *this;
152  }
153 
154  template <typename E>
156  {
157  data.operator=(e);
158  return *this;
159  }
160 
161  template <typename E>
163  {
164  data.operator+=(e);
165  return *this;
166  }
167 
168  template <typename E>
170  {
171  data.operator-=(e);
172  return *this;
173  }
174 
175  template <typename T>
176  typename std::enable_if<IsScalar<T>::value, GridReference>::type& operator*=(const T& t)
177  {
178  data.operator*=(t);
179  return *this;
180  }
181 
182  template <typename T>
183  typename std::enable_if<IsScalar<T>::value, GridReference>::type& operator/=(const T& t)
184  {
185  data.operator/=(t);
186  return *this;
187  }
188 
189  template <typename E>
191  {
192  data.assign(e);
193  return *this;
194  }
195 
196  template <typename E>
198  {
199  data.plusAssign(e);
200  return *this;
201  }
202 
203  template <typename E>
205  {
206  data.minusAssign(e);
207  return *this;
208  }
209 
211  {
212  data.swap(r.data);
213  }
214 
215  friend void swap(GridReference& r1, GridReference& r2)
216  {
217  r1.swap(r2);
218  }
219 
220  private:
221  GridType& data;
222  };
223 
224  template <typename T, typename A = std::vector<T> >
225  class Grid : public GridContainer<Grid<T, A> >
226  {
227 
228  typedef Grid<T, A> SelfType;
229 
230  public:
231  typedef T ValueType;
232  typedef T& Reference;
233  typedef const T& ConstReference;
234  typedef typename A::size_type SizeType;
235  typedef typename A::difference_type DifferenceType;
236  typedef A ArrayType;
237  typedef T* Pointer;
238  typedef const T* ConstPointer;
242  typedef std::shared_ptr<SelfType> SharedPointer;
243 
244  Grid():
245  data(), size1(0), size2(0), size3(0) {}
246 
248  data(storageSize(m, n, o)), size1(m), size2(n), size3(o) {}
249 
251  data(storageSize(m, n, o), v), size1(m), size2(n), size3(o) {}
252 
253  Grid(const Grid& g):
254  data(g.data), size1(g.size1), size2(g.size2), size3(g.size3) {}
255 
256  Grid(Grid&& g):
257  data(), size1(0), size2(0), size3(0)
258  {
259  swap(g);
260  }
261 
262  template <typename E>
264  data(storageSize(e().getSize1(), e().getSize2(), e().getSize3())), size1(e().getSize1()), size2(e().getSize2()), size3(e().getSize3())
265  {
266  gridAssignGrid<ScalarAssignment>(*this, e);
267  }
268 
270  {
271  CDPL_MATH_CHECK(i < (getSize1() * getSize2() * getSize3()), "Index out of range", Base::IndexError);
272  return data[i];
273  }
274 
276  {
277  CDPL_MATH_CHECK(i < (getSize1() * getSize2() * getSize3()), "Index out of range", Base::IndexError);
278  return data[i];
279  }
280 
282  {
283  CDPL_MATH_CHECK(i < getSize1() && j < getSize2() && k < getSize3(), "Index out of range", Base::IndexError);
284  return data[(k * getSize2() + j) * getSize1() + i];
285  }
286 
288  {
289  CDPL_MATH_CHECK(i < getSize1() && j < getSize2() && k < getSize3(), "Index out of range", Base::IndexError);
290  return data[(k * getSize2() + j) * getSize1() + i];
291  }
292 
293  bool isEmpty() const
294  {
295  return data.empty();
296  }
297 
299  {
300  return (size1 * size2 * size3);
301  }
302 
304  {
305  return size1;
306  }
307 
309  {
310  return size2;
311  }
312 
314  {
315  return size3;
316  }
317 
319  {
320  return data.max_size();
321  }
322 
324  {
325  return data;
326  }
327 
328  const ArrayType& getData() const
329  {
330  return data;
331  }
332 
333  Grid& operator=(const Grid& g)
334  {
335  data = g.data;
336  size1 = g.size1;
337  size2 = g.size2;
338  size3 = g.size3;
339  return *this;
340  }
341 
343  {
344  swap(g);
345  return *this;
346  }
347 
348  template <typename C>
350  {
351  return assign(c);
352  }
353 
354  template <typename E>
356  {
357  Grid tmp(e);
358  swap(tmp);
359  return *this;
360  }
361 
362  template <typename C>
364  {
365  return plusAssign(c);
366  }
367 
368  template <typename E>
370  {
371  Grid tmp(*this + e);
372  swap(tmp);
373  return *this;
374  }
375 
376  template <typename C>
378  {
379  return minusAssign(c);
380  }
381 
382  template <typename E>
384  {
385  Grid tmp(*this - e);
386  swap(tmp);
387  return *this;
388  }
389 
390  template <typename T1>
391  typename std::enable_if<IsScalar<T1>::value, Grid>::type& operator*=(const T1& t)
392  {
393  gridAssignScalar<ScalarMultiplicationAssignment>(*this, t);
394  return *this;
395  }
396 
397  template <typename T1>
398  typename std::enable_if<IsScalar<T1>::value, Grid>::type& operator/=(const T1& t)
399  {
400  gridAssignScalar<ScalarDivisionAssignment>(*this, t);
401  return *this;
402  }
403 
404  template <typename E>
406  {
407  resize(e().getSize1(), e().getSize2(), false);
408  gridAssignGrid<ScalarAssignment>(*this, e);
409  return *this;
410  }
411 
412  template <typename E>
414  {
415  gridAssignGrid<ScalarAdditionAssignment>(*this, e);
416  return *this;
417  }
418 
419  template <typename E>
421  {
422  gridAssignGrid<ScalarSubtractionAssignment>(*this, e);
423  return *this;
424  }
425 
426  void swap(Grid& g)
427  {
428  if (this != &g) {
429  std::swap(data, g.data);
430  std::swap(size1, g.size1);
431  std::swap(size2, g.size2);
432  std::swap(size3, g.size3);
433  }
434  }
435 
436  friend void swap(Grid& g1, Grid& g2)
437  {
438  g1.swap(g2);
439  }
440 
441  void clear(const ValueType& v = ValueType())
442  {
443  std::fill(data.begin(), data.end(), v);
444  }
445 
446  void resize(SizeType m, SizeType n, SizeType o, bool preserve = true, const ValueType& v = ValueType())
447  {
448  if (size1 == m && size2 == n && size3 == o)
449  return;
450 
451  if (preserve) {
452  Grid tmp(m, n, o, v);
453 
454  for (SizeType i = 0, min_size1 = std::min(size1, m); i < min_size1; i++)
455  for (SizeType j = 0, min_size2 = std::min(size2, n); j < min_size2; j++)
456  for (SizeType k = 0, min_size3 = std::min(size3, o); k < min_size3; k++)
457  tmp(i, j, k) = (*this)(i, j, k);
458 
459  swap(tmp);
460 
461  } else {
462  data.resize(storageSize(m, n, o), v);
463  size1 = m;
464  size2 = n;
465  size3 = o;
466  }
467  }
468 
469  private:
470  static SizeType storageSize(SizeType m, SizeType n, SizeType o)
471  {
472  CDPL_MATH_CHECK(n == 0 || o == 0 ||
473  (n <= (std::numeric_limits<SizeType>::max() / o) && m <= (std::numeric_limits<SizeType>::max() / (n * o))),
474  "Maximum size exceeded", Base::SizeError);
475  return (m * n * o);
476  }
477 
478  ArrayType data;
479  SizeType size1;
480  SizeType size2;
481  SizeType size3;
482  };
483 
484  template <typename T>
485  class ZeroGrid : public GridContainer<ZeroGrid<T> >
486  {
487 
488  typedef ZeroGrid<T> SelfType;
489 
490  public:
491  typedef T ValueType;
492  typedef const T& Reference;
493  typedef const T& ConstReference;
494  typedef std::size_t SizeType;
495  typedef std::ptrdiff_t DifferenceType;
499 
501  size1(0), size2(0), size3(0) {}
502 
504  size1(m), size2(n), size3(o) {}
505 
506  ZeroGrid(const ZeroGrid& m):
507  size1(m.size1), size2(m.size2), size3(m.size3) {}
508 
510  {
511  CDPL_MATH_CHECK(i < (getSize1() * getSize2() * getSize3()), "Index out of range", Base::IndexError);
512  return zero;
513  }
514 
516  {
517  CDPL_MATH_CHECK(i < getSize1() && j < getSize2() && k < getSize3(), "Index out of range", Base::IndexError);
518  return zero;
519  }
520 
521  bool isEmpty() const
522  {
523  return (size1 == 0 || size2 == 0 || size3 == 0);
524  }
525 
527  {
528  return (size1 * size2 * size3);
529  }
530 
532  {
533  return size1;
534  }
535 
537  {
538  return size2;
539  }
540 
542  {
543  return size3;
544  }
545 
547  {
548  return std::numeric_limits<SizeType>::max();
549  }
550 
552  {
553  return std::numeric_limits<SizeType>::max();
554  }
555 
557  {
558  return std::numeric_limits<SizeType>::max();
559  }
560 
562  {
563  if (this != &g) {
564  size1 = g.size1;
565  size2 = g.size2;
566  size3 = g.size3;
567  }
568 
569  return *this;
570  }
571 
572  void swap(ZeroGrid& g)
573  {
574  if (this != &g) {
575  std::swap(size1, g.size1);
576  std::swap(size2, g.size2);
577  std::swap(size3, g.size3);
578  }
579  }
580 
581  friend void swap(ZeroGrid& g1, ZeroGrid& g2)
582  {
583  g1.swap(g2);
584  }
585 
587  {
588  size1 = m;
589  size2 = n;
590  size3 = o;
591  }
592 
593  private:
594  SizeType size1;
595  SizeType size2;
596  SizeType size3;
597  static const ValueType zero;
598  };
599 
600  template <typename T>
601  const typename ZeroGrid<T>::ValueType ZeroGrid<T>::zero = ZeroGrid<T>::ValueType();
602 
603  template <typename T>
604  class ScalarGrid : public GridContainer<ScalarGrid<T> >
605  {
606 
607  typedef ScalarGrid<T> SelfType;
608 
609  public:
610  typedef T ValueType;
611  typedef const T& Reference;
612  typedef const T& ConstReference;
613  typedef std::size_t SizeType;
614  typedef std::ptrdiff_t DifferenceType;
618 
620  size1(0), size2(0), size3(0), value() {}
621 
623  size1(m), size2(n), size3(o), value(v) {}
624 
626  size1(m.size1), size2(m.size2), size3(m.size3), value(m.value) {}
627 
629  {
630  CDPL_MATH_CHECK(i < (getSize1() * getSize2() * getSize3()), "Index out of range", Base::IndexError);
631  return value;
632  }
633 
635  {
636  CDPL_MATH_CHECK(i < getSize1() && j < getSize2() && k < getSize3(), "Index out of range", Base::IndexError);
637  return value;
638  }
639 
640  bool isEmpty() const
641  {
642  return (size1 == 0 || size2 == 0 || size3 == 0);
643  }
644 
646  {
647  return (size1 * size2 * size3);
648  }
649 
651  {
652  return size1;
653  }
654 
656  {
657  return size2;
658  }
659 
661  {
662  return size3;
663  }
664 
666  {
667  return std::numeric_limits<SizeType>::max();
668  }
669 
671  {
672  return std::numeric_limits<SizeType>::max();
673  }
674 
676  {
677  return std::numeric_limits<SizeType>::max();
678  }
679 
681  {
682  if (this != &g) {
683  size1 = g.size1;
684  size2 = g.size2;
685  size3 = g.size3;
686  value = g.value;
687  }
688 
689  return *this;
690  }
691 
692  void swap(ScalarGrid& g)
693  {
694  if (this != &g) {
695  std::swap(size1, g.size1);
696  std::swap(size2, g.size2);
697  std::swap(size3, g.size3);
698  std::swap(value, g.value);
699  }
700  }
701 
702  friend void swap(ScalarGrid& g1, ScalarGrid& g2)
703  {
704  g1.swap(g2);
705  }
706 
708  {
709  size1 = m;
710  size2 = n;
711  size3 = o;
712  }
713 
714  private:
715  SizeType size1;
716  SizeType size2;
717  SizeType size3;
718  ValueType value;
719  };
720 
721  template <typename G>
723  {};
724 
725  template <typename G>
727  {};
728 
731 
734 
739 
744  } // namespace Math
745 } // namespace CDPL
746 
747 #endif // CDPL_MATH_GRID_HPP
CDPL::Math::Grid::operator-=
Grid & operator-=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:377
CDPL::Math::GridReference::assign
GridReference & assign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:190
CDPL::Math::ScalarGrid::resize
void resize(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:707
CDPL::Math::ZeroGrid::getSize2
SizeType getSize2() const
Definition: Math/Grid.hpp:536
CDPL::Math::GridReference::operator+=
GridReference & operator+=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:162
CDPL::Math::ZeroGrid::resize
void resize(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:586
CDPL::Math::GridReference::operator-=
GridReference & operator-=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:169
CDPL::Math::GridReference::getMaxSize2
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:123
CDPL::Math::Grid::GridTemporaryType
SelfType GridTemporaryType
Definition: Math/Grid.hpp:241
GridExpression.hpp
Definition of various grid expression types and operations.
CDPL::Math::GridReference::getSize1
SizeType getSize1() const
Definition: Math/Grid.hpp:98
CDPL::Math::Grid::Pointer
T * Pointer
Definition: Math/Grid.hpp:237
CDPL::Math::ZeroGrid::SizeType
std::size_t SizeType
Definition: Math/Grid.hpp:494
CDPL::Math::ScalarGrid::getMaxSize2
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:670
CDPL::Math::Grid::getSize3
SizeType getSize3() const
Definition: Math/Grid.hpp:313
CDPL::Math::ZeroGrid::swap
void swap(ZeroGrid &g)
Definition: Math/Grid.hpp:572
CDPL::Math::Grid::Reference
T & Reference
Definition: Math/Grid.hpp:232
CDPL::Math::GridReference::swap
void swap(GridReference &r)
Definition: Math/Grid.hpp:210
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::GridReference::operator()
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:78
CDPL::Math::ZeroGrid::ClosureType
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:496
CDPL::Math::GridReference::getSize2
SizeType getSize2() const
Definition: Math/Grid.hpp:103
CDPL::Math::ScalarGrid::getMaxSize1
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:665
CDPL::Math::GridReference::operator=
GridReference & operator=(const GridReference &r)
Definition: Math/Grid.hpp:148
CDPL::Math::Grid::isEmpty
bool isEmpty() const
Definition: Math/Grid.hpp:293
CDPL::Math::ZeroGrid::ZeroGrid
ZeroGrid(const ZeroGrid &m)
Definition: Math/Grid.hpp:506
CDPL::Math::Grid::minusAssign
Grid & minusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:420
CDPL::Math::GridReference::minusAssign
GridReference & minusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:204
CDPL::Math::ScalarGrid::ScalarGrid
ScalarGrid(SizeType m, SizeType n, SizeType o, const ValueType &v=ValueType())
Definition: Math/Grid.hpp:622
CDPL::Math::GridReference::plusAssign
GridReference & plusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:197
CDPL::Math::Grid::operator=
Grid & operator=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:349
CDPL::Math::Grid::operator=
Grid & operator=(const Grid &g)
Definition: Math/Grid.hpp:333
CDPL::Math::Grid::getMaxSize
SizeType getMaxSize() const
Definition: Math/Grid.hpp:318
CDPL::Math::Grid::swap
friend void swap(Grid &g1, Grid &g2)
Definition: Math/Grid.hpp:436
CDPL::Math::Grid::Grid
Grid(SizeType m, SizeType n, SizeType o, const ValueType &v)
Definition: Math/Grid.hpp:250
CDPL::Math::Grid::ArrayType
A ArrayType
Definition: Math/Grid.hpp:236
CDPL::Math::Grid::clear
void clear(const ValueType &v=ValueType())
Definition: Math/Grid.hpp:441
CDPL::Math::GridTemporaryTraits
Definition: TypeTraits.hpp:200
CDPL::Math::Grid::SizeType
A::size_type SizeType
Definition: Math/Grid.hpp:234
CDPL::Math::ScalarGrid::ConstReference
const T & ConstReference
Definition: Math/Grid.hpp:612
CDPL::Math::GridReference::GridType
G GridType
Definition: Math/Grid.hpp:59
CDPL_MATH_CHECK
#define CDPL_MATH_CHECK(expr, msg, e)
Definition: Check.hpp:36
CDPL::Math::ScalarGrid::operator()
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:628
CDPL::Math::Grid::swap
void swap(Grid &g)
Definition: Math/Grid.hpp:426
CDPL::Math::ScalarGrid::isEmpty
bool isEmpty() const
Definition: Math/Grid.hpp:640
CDPL::Math::ZeroGrid::operator()
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:509
CDPL::Math::Grid::operator()
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: Math/Grid.hpp:281
CDPL::Math::GridReference::ClosureType
SelfType ClosureType
Definition: Math/Grid.hpp:67
CDPL::Math::Grid::operator=
Grid & operator=(Grid &&g)
Definition: Math/Grid.hpp:342
CDPL::Math::GridReference::SizeType
G::SizeType SizeType
Definition: Math/Grid.hpp:65
CDPL::Math::ScalarGrid::ConstClosureType
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:616
CDPL::Math::Grid::getSize1
SizeType getSize1() const
Definition: Math/Grid.hpp:303
CDPL::Math::ScalarGrid::Reference
const T & Reference
Definition: Math/Grid.hpp:611
CDPL::Math::Grid::operator+=
Grid & operator+=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:363
CDPL::Math::Grid::plusAssign
Grid & plusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:413
CDPL::Math::ZeroGrid::operator=
ZeroGrid & operator=(const ZeroGrid &g)
Definition: Math/Grid.hpp:561
CDPL::Math::GridReference::getMaxSize3
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:128
CDPL::Base::IndexError
Thrown to indicate that an index is out of range.
Definition: Base/Exceptions.hpp:152
CDPL::Math::ScalarGrid::getSize1
SizeType getSize1() const
Definition: Math/Grid.hpp:650
CDPL::Math::FZeroGrid
ZeroGrid< float > FZeroGrid
Definition: Math/Grid.hpp:729
CDPL::Math::Grid::Grid
Grid()
Definition: Math/Grid.hpp:244
CDPL::Math::GridReference::Reference
std::conditional< std::is_const< G >::value, typename G::ConstReference, typename G::Reference >::type Reference
Definition: Math/Grid.hpp:63
CDPL::Math::Grid::operator=
Grid & operator=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:355
CDPL::Math::GridReference::GridReference
GridReference(GridType &g)
Definition: Math/Grid.hpp:70
CDPL::Math::ScalarGrid::GridTemporaryType
Grid< T > GridTemporaryType
Definition: Math/Grid.hpp:617
CDPL::Base::SizeError
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
CDPL::Math::ZeroGrid::ConstReference
const T & ConstReference
Definition: Math/Grid.hpp:493
CDPL::Math::ZeroGrid::swap
friend void swap(ZeroGrid &g1, ZeroGrid &g2)
Definition: Math/Grid.hpp:581
CDPL::Math::ScalarGrid
Definition: Math/Grid.hpp:605
CDPL::Math::GridReference::isEmpty
bool isEmpty() const
Definition: Math/Grid.hpp:133
CDPL::Math::ZeroGrid::getMaxSize1
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:546
TypeTraits.hpp
Definition of type traits.
CDPL::Math::Grid::getData
ArrayType & getData()
Definition: Math/Grid.hpp:323
CDPL::Math::GridReference::operator()
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:88
CDPL::Math::Grid::Grid
Grid(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:247
CDPL::Math::Grid::operator()
Reference operator()(SizeType i)
Definition: Math/Grid.hpp:269
CDPL::Math::ZeroGrid::ZeroGrid
ZeroGrid(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:503
CDPL::Math::GridReference::getSize3
SizeType getSize3() const
Definition: Math/Grid.hpp:108
CDPL::Math::ScalarGrid::operator()
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:634
CDPL::Math::Grid::getSize2
SizeType getSize2() const
Definition: Math/Grid.hpp:308
CDPL::Math::Grid::SharedPointer
std::shared_ptr< SelfType > SharedPointer
Definition: Math/Grid.hpp:242
CDPL::Math::DZeroGrid
ZeroGrid< double > DZeroGrid
Definition: Math/Grid.hpp:730
CDPL::Math::Grid::operator()
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:287
CDPL::Math::ZeroGrid::ConstClosureType
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:497
Functional.hpp
Definition of various functors.
CDPL::Math::Grid::operator()
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:275
CDPL::Math::ScalarGrid::swap
friend void swap(ScalarGrid &g1, ScalarGrid &g2)
Definition: Math/Grid.hpp:702
CDPL::Chem::CIPDescriptor::m
const unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
CDPL::Math::Grid::ClosureType
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:239
CDPL::Math::ZeroGrid::GridTemporaryType
Grid< T > GridTemporaryType
Definition: Math/Grid.hpp:498
CDPL::Chem::AtomType::T
const unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
CDPL::Math::FScalarGrid
ScalarGrid< float > FScalarGrid
Definition: Math/Grid.hpp:732
CDPL::Math::FGrid
Grid< float > FGrid
An unbounded dense grid holding floating point values of type float.
Definition: Math/Grid.hpp:738
Exceptions.hpp
Definition of exception classes.
CDPL::Math::ScalarGrid::DifferenceType
std::ptrdiff_t DifferenceType
Definition: Math/Grid.hpp:614
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::Grid::getData
const ArrayType & getData() const
Definition: Math/Grid.hpp:328
CDPL::Math::ZeroGrid::ZeroGrid
ZeroGrid()
Definition: Math/Grid.hpp:500
CDPL::Math::GridReference::getMaxSize1
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:118
CDPL::Math::GridReference::ConstClosureType
const SelfType ConstClosureType
Definition: Math/Grid.hpp:68
CDPL::Math::ScalarGrid::ScalarGrid
ScalarGrid()
Definition: Math/Grid.hpp:619
CDPL::Math::GridReference::ValueType
G::ValueType ValueType
Definition: Math/Grid.hpp:60
CDPL::Math::ZeroGrid::ValueType
T ValueType
Definition: Math/Grid.hpp:491
CDPL::Math::ZeroGrid
Definition: Math/Grid.hpp:486
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::GridReference::DifferenceType
G::DifferenceType DifferenceType
Definition: Math/Grid.hpp:66
CDPL::Math::ZeroGrid::DifferenceType
std::ptrdiff_t DifferenceType
Definition: Math/Grid.hpp:495
CDPL::Math::GridReference::getData
GridType & getData()
Definition: Math/Grid.hpp:143
CDPL::Math::ZeroGrid::getSize1
SizeType getSize1() const
Definition: Math/Grid.hpp:531
CDPL::Math::GridReference::swap
friend void swap(GridReference &r1, GridReference &r2)
Definition: Math/Grid.hpp:215
CDPL::Math::ScalarGrid::getSize2
SizeType getSize2() const
Definition: Math/Grid.hpp:655
CDPL::Math::ZeroGrid::Reference
const T & Reference
Definition: Math/Grid.hpp:492
CDPL::Math::GridReference::operator*=
std::enable_if< IsScalar< T >::value, GridReference >::type & operator*=(const T &t)
Definition: Math/Grid.hpp:176
CDPL::Math::GridReference::ConstReference
G::ConstReference ConstReference
Definition: Math/Grid.hpp:64
CDPL::Math::GridReference::operator()
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: Math/Grid.hpp:83
CDPL::Math::Grid
Definition: Math/Grid.hpp:226
CDPL::Math::Grid::Grid
Grid(Grid &&g)
Definition: Math/Grid.hpp:256
CDPL::Math::Grid::operator-=
Grid & operator-=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:383
CDPL::Math::Grid::DifferenceType
A::difference_type DifferenceType
Definition: Math/Grid.hpp:235
CDPL::Math::Grid::operator/=
std::enable_if< IsScalar< T1 >::value, Grid >::type & operator/=(const T1 &t)
Definition: Math/Grid.hpp:398
CDPL::Math::ScalarGrid::swap
void swap(ScalarGrid &g)
Definition: Math/Grid.hpp:692
CDPL::Math::ScalarGrid::ScalarGrid
ScalarGrid(const ScalarGrid &m)
Definition: Math/Grid.hpp:625
CDPL::Math::Grid::ValueType
T ValueType
Definition: Math/Grid.hpp:231
CDPL::Math::ScalarGrid::ValueType
T ValueType
Definition: Math/Grid.hpp:610
CDPL::Math::Grid::Grid
Grid(const GridExpression< E > &e)
Definition: Math/Grid.hpp:263
CDPL::Math::GridReference
Definition: Math/Grid.hpp:54
CDPL::Math::Grid::ConstPointer
const T * ConstPointer
Definition: Math/Grid.hpp:238
CDPL::Math::Grid::operator*=
std::enable_if< IsScalar< T1 >::value, Grid >::type & operator*=(const T1 &t)
Definition: Math/Grid.hpp:391
CDPL::Math::GridContainer
Definition: Expression.hpp:208
CDPL::Math::Grid::ConstReference
const T & ConstReference
Definition: Math/Grid.hpp:233
CDPL::Math::ScalarGrid::getSize
SizeType getSize() const
Definition: Math/Grid.hpp:645
CDPL::Math::ScalarGrid::operator=
ScalarGrid & operator=(const ScalarGrid &g)
Definition: Math/Grid.hpp:680
CDPL::Math::ZeroGrid::getMaxSize2
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:551
CDPL::Math::GridReference::getSize
SizeType getSize() const
Definition: Math/Grid.hpp:93
GridAssignment.hpp
Implementation of grid assignment routines.
CDPL::Math::DGrid
Grid< double > DGrid
An unbounded dense grid holding floating point values of type double.
Definition: Math/Grid.hpp:743
CDPL::Math::ZeroGrid::getSize
SizeType getSize() const
Definition: Math/Grid.hpp:526
Check.hpp
Definition of various preprocessor macros for error checking.
CDPL::Math::ZeroGrid::getSize3
SizeType getSize3() const
Definition: Math/Grid.hpp:541
CDPL::Math::ZeroGrid::isEmpty
bool isEmpty() const
Definition: Math/Grid.hpp:521
CDPL::Math::ScalarGrid::SizeType
std::size_t SizeType
Definition: Math/Grid.hpp:613
CDPL::Math::DScalarGrid
ScalarGrid< double > DScalarGrid
Definition: Math/Grid.hpp:733
CDPL::Math::GridReference::operator()
Reference operator()(SizeType i)
Definition: Math/Grid.hpp:73
CDPL::Math::GridReference::getData
const GridType & getData() const
Definition: Math/Grid.hpp:138
CDPL::Math::GridReference::operator=
GridReference & operator=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:155
CDPL::Math::Grid::getSize
SizeType getSize() const
Definition: Math/Grid.hpp:298
CDPL::Math::ZeroGrid::getMaxSize3
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:556
CDPL::Math::Grid::operator+=
Grid & operator+=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:369
CDPL::Math::ZeroGrid::operator()
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:515
CDPL::Math::ScalarGrid::ClosureType
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:615
CDPL::Chem::AtomType::A
const unsigned int A
A generic type that covers any element except hydrogen.
Definition: AtomType.hpp:617
CDPL::Math::ScalarGrid::getSize3
SizeType getSize3() const
Definition: Math/Grid.hpp:660
CDPL::Math::GridReference::getMaxSize
SizeType getMaxSize() const
Definition: Math/Grid.hpp:113
CDPL::Math::Grid::ConstClosureType
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:240
CDPL::Math::Grid::Grid
Grid(const Grid &g)
Definition: Math/Grid.hpp:253
CDPL::Math::GridReference::operator/=
std::enable_if< IsScalar< T >::value, GridReference >::type & operator/=(const T &t)
Definition: Math/Grid.hpp:183
CDPL::Math::ScalarGrid::getMaxSize3
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:675