Chemical Data Processing Library C++ API - Version 1.2.0
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
Definition of exception classes.
Definition of various preprocessor macros for error checking.
#define CDPL_MATH_CHECK(expr, msg, e)
Definition: Check.hpp:36
Definition of various functors.
Implementation of grid assignment routines.
Definition of various grid expression types and operations.
Definition of type traits.
Thrown to indicate that an index is out of range.
Definition: Base/Exceptions.hpp:152
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
Definition: Expression.hpp:208
Definition: Expression.hpp:120
Definition: Math/Grid.hpp:54
GridReference & assign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:190
GridReference(GridType &g)
Definition: Math/Grid.hpp:70
std::conditional< std::is_const< G >::value, typename G::ConstReference, typename G::Reference >::type Reference
Definition: Math/Grid.hpp:63
friend void swap(GridReference &r1, GridReference &r2)
Definition: Math/Grid.hpp:215
GridReference & minusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:204
GridType & getData()
Definition: Math/Grid.hpp:143
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: Math/Grid.hpp:83
G::SizeType SizeType
Definition: Math/Grid.hpp:65
bool isEmpty() const
Definition: Math/Grid.hpp:133
SizeType getSize2() const
Definition: Math/Grid.hpp:103
GridReference & operator+=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:162
std::enable_if< IsScalar< T >::value, GridReference >::type & operator/=(const T &t)
Definition: Math/Grid.hpp:183
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:78
SizeType getMaxSize() const
Definition: Math/Grid.hpp:113
GridReference & operator=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:155
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:123
std::enable_if< IsScalar< T >::value, GridReference >::type & operator*=(const T &t)
Definition: Math/Grid.hpp:176
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:128
G::ValueType ValueType
Definition: Math/Grid.hpp:60
GridReference & plusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:197
const GridType & getData() const
Definition: Math/Grid.hpp:138
SizeType getSize3() const
Definition: Math/Grid.hpp:108
GridReference & operator-=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:169
G::DifferenceType DifferenceType
Definition: Math/Grid.hpp:66
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:118
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:88
SizeType getSize1() const
Definition: Math/Grid.hpp:98
G GridType
Definition: Math/Grid.hpp:59
SizeType getSize() const
Definition: Math/Grid.hpp:93
GridReference & operator=(const GridReference &r)
Definition: Math/Grid.hpp:148
Reference operator()(SizeType i)
Definition: Math/Grid.hpp:73
G::ConstReference ConstReference
Definition: Math/Grid.hpp:64
const SelfType ConstClosureType
Definition: Math/Grid.hpp:68
SelfType ClosureType
Definition: Math/Grid.hpp:67
void swap(GridReference &r)
Definition: Math/Grid.hpp:210
Definition: Math/Grid.hpp:226
T * Pointer
Definition: Math/Grid.hpp:237
A::size_type SizeType
Definition: Math/Grid.hpp:234
Grid & operator+=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:369
Grid & operator=(const Grid &g)
Definition: Math/Grid.hpp:333
void resize(SizeType m, SizeType n, SizeType o, bool preserve=true, const ValueType &v=ValueType())
Definition: Math/Grid.hpp:446
Grid & operator-=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:377
Reference operator()(SizeType i, SizeType j, SizeType k)
Definition: Math/Grid.hpp:281
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:275
Grid(SizeType m, SizeType n, SizeType o, const ValueType &v)
Definition: Math/Grid.hpp:250
Grid(Grid &&g)
Definition: Math/Grid.hpp:256
std::shared_ptr< SelfType > SharedPointer
Definition: Math/Grid.hpp:242
Grid()
Definition: Math/Grid.hpp:244
Grid & operator=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:349
const T * ConstPointer
Definition: Math/Grid.hpp:238
std::enable_if< IsScalar< T1 >::value, Grid >::type & operator*=(const T1 &t)
Definition: Math/Grid.hpp:391
Grid & assign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:405
A::difference_type DifferenceType
Definition: Math/Grid.hpp:235
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:287
T & Reference
Definition: Math/Grid.hpp:232
Grid & operator=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:355
Grid & operator-=(const GridExpression< E > &e)
Definition: Math/Grid.hpp:383
SizeType getMaxSize() const
Definition: Math/Grid.hpp:318
const ArrayType & getData() const
Definition: Math/Grid.hpp:328
void clear(const ValueType &v=ValueType())
Definition: Math/Grid.hpp:441
SizeType getSize2() const
Definition: Math/Grid.hpp:308
friend void swap(Grid &g1, Grid &g2)
Definition: Math/Grid.hpp:436
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:240
Grid & operator+=(const GridContainer< C > &c)
Definition: Math/Grid.hpp:363
void swap(Grid &g)
Definition: Math/Grid.hpp:426
Grid(const Grid &g)
Definition: Math/Grid.hpp:253
Grid & operator=(Grid &&g)
Definition: Math/Grid.hpp:342
SelfType GridTemporaryType
Definition: Math/Grid.hpp:241
Reference operator()(SizeType i)
Definition: Math/Grid.hpp:269
const T & ConstReference
Definition: Math/Grid.hpp:233
ArrayType & getData()
Definition: Math/Grid.hpp:323
bool isEmpty() const
Definition: Math/Grid.hpp:293
SizeType getSize1() const
Definition: Math/Grid.hpp:303
Grid(const GridExpression< E > &e)
Definition: Math/Grid.hpp:263
std::enable_if< IsScalar< T1 >::value, Grid >::type & operator/=(const T1 &t)
Definition: Math/Grid.hpp:398
A ArrayType
Definition: Math/Grid.hpp:236
Grid & plusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:413
SizeType getSize() const
Definition: Math/Grid.hpp:298
Grid & minusAssign(const GridExpression< E > &e)
Definition: Math/Grid.hpp:420
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:239
T ValueType
Definition: Math/Grid.hpp:231
SizeType getSize3() const
Definition: Math/Grid.hpp:313
Grid(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:247
Definition: Math/Grid.hpp:605
ScalarGrid()
Definition: Math/Grid.hpp:619
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:675
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:665
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:628
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:615
SizeType getSize1() const
Definition: Math/Grid.hpp:650
friend void swap(ScalarGrid &g1, ScalarGrid &g2)
Definition: Math/Grid.hpp:702
ScalarGrid(const ScalarGrid &m)
Definition: Math/Grid.hpp:625
ScalarGrid(SizeType m, SizeType n, SizeType o, const ValueType &v=ValueType())
Definition: Math/Grid.hpp:622
bool isEmpty() const
Definition: Math/Grid.hpp:640
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:634
const T & Reference
Definition: Math/Grid.hpp:611
std::size_t SizeType
Definition: Math/Grid.hpp:613
SizeType getSize3() const
Definition: Math/Grid.hpp:660
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:616
ScalarGrid & operator=(const ScalarGrid &g)
Definition: Math/Grid.hpp:680
const T & ConstReference
Definition: Math/Grid.hpp:612
Grid< T > GridTemporaryType
Definition: Math/Grid.hpp:617
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:670
void swap(ScalarGrid &g)
Definition: Math/Grid.hpp:692
SizeType getSize2() const
Definition: Math/Grid.hpp:655
SizeType getSize() const
Definition: Math/Grid.hpp:645
void resize(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:707
T ValueType
Definition: Math/Grid.hpp:610
std::ptrdiff_t DifferenceType
Definition: Math/Grid.hpp:614
Definition: Math/Grid.hpp:486
SizeType getMaxSize3() const
Definition: Math/Grid.hpp:556
ZeroGrid & operator=(const ZeroGrid &g)
Definition: Math/Grid.hpp:561
Grid< T > GridTemporaryType
Definition: Math/Grid.hpp:498
SizeType getSize2() const
Definition: Math/Grid.hpp:536
SizeType getSize3() const
Definition: Math/Grid.hpp:541
SizeType getSize() const
Definition: Math/Grid.hpp:526
void swap(ZeroGrid &g)
Definition: Math/Grid.hpp:572
SizeType getMaxSize2() const
Definition: Math/Grid.hpp:551
friend void swap(ZeroGrid &g1, ZeroGrid &g2)
Definition: Math/Grid.hpp:581
ZeroGrid(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:503
T ValueType
Definition: Math/Grid.hpp:491
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: Math/Grid.hpp:515
ConstReference operator()(SizeType i) const
Definition: Math/Grid.hpp:509
const T & Reference
Definition: Math/Grid.hpp:492
SizeType getMaxSize1() const
Definition: Math/Grid.hpp:546
ZeroGrid(const ZeroGrid &m)
Definition: Math/Grid.hpp:506
const GridReference< const SelfType > ConstClosureType
Definition: Math/Grid.hpp:497
std::ptrdiff_t DifferenceType
Definition: Math/Grid.hpp:495
ZeroGrid()
Definition: Math/Grid.hpp:500
GridReference< SelfType > ClosureType
Definition: Math/Grid.hpp:496
SizeType getSize1() const
Definition: Math/Grid.hpp:531
const T & ConstReference
Definition: Math/Grid.hpp:493
std::size_t SizeType
Definition: Math/Grid.hpp:494
void resize(SizeType m, SizeType n, SizeType o)
Definition: Math/Grid.hpp:586
bool isEmpty() const
Definition: Math/Grid.hpp:521
constexpr unsigned int A
A generic type that covers any element except hydrogen.
Definition: AtomType.hpp:637
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int r
Specifies that the stereocenter has r configuration.
Definition: CIPDescriptor.hpp:76
constexpr unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
Grid< double > DGrid
An unbounded dense grid holding floating point values of type double.
Definition: Math/Grid.hpp:743
ScalarGrid< float > FScalarGrid
Definition: Math/Grid.hpp:732
ZeroGrid< double > DZeroGrid
Definition: Math/Grid.hpp:730
Grid< float > FGrid
An unbounded dense grid holding floating point values of type float.
Definition: Math/Grid.hpp:738
ZeroGrid< float > FZeroGrid
Definition: Math/Grid.hpp:729
ScalarGrid< double > DScalarGrid
Definition: Math/Grid.hpp:733
The namespace of the Chemical Data Processing Library.
Definition: TypeTraits.hpp:200