Chemical Data Processing Library C++ API - Version 1.4.0
RegularGrid.hpp
Go to the documentation of this file.
1 /*
2  * RegularGrid.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_GRID_REGULARGRID_HPP
28 #define CDPL_GRID_REGULARGRID_HPP
29 
30 #include <memory>
31 
34 
35 
36 namespace CDPL
37 {
38 
39  namespace Grid
40  {
41 
52  template <typename T, typename CVT = T>
53  class RegularGrid : public SpatialGrid<T, CVT>,
54  public Math::RegularSpatialGrid<T, CVT>
55  {
56 
57  public:
61  typedef std::shared_ptr<RegularGrid> SharedPointer;
78 
86  Math::RegularSpatialGrid<T, CVT>(xs, ys, zs) {}
87 
96  Math::RegularSpatialGrid<T, CVT>(data, xs, ys, zs) {}
97 
103  Math::RegularSpatialGrid<T, CVT>(s) {}
104 
111  Math::RegularSpatialGrid<T, CVT>(data, s) {}
112 
114 
116 
122  ValueType& operator()(std::size_t i)
123  {
125  }
126 
132  const ValueType& operator()(std::size_t i) const
133  {
135  }
136 
141  std::size_t getNumElements() const
142  {
144  }
145 
151  void getCoordinates(std::size_t i, CoordinatesType& coords) const
152  {
154  }
155 
160  bool isEmpty() const
161  {
163  }
164  };
165 
170 
175  } // namespace Grid
176 } // namespace CDPL
177 
178 #endif // CDPL_GRID_REGULARGRID_HPP
Definition of a regular spatial grid data type.
Definition of a spatial grid data type.
Implementation of the Grid::SpatialGrid interface for regular spatial grids.
Definition: RegularGrid.hpp:55
Math::RegularSpatialGrid< T, CVT >::GridDataType GridDataType
The type of the underlying grid data storage.
Definition: RegularGrid.hpp:77
RegularGrid(const GridDataType &data, const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Constructs a RegularGrid initialized from data, with the given grid spacing in x, y and z direction.
Definition: RegularGrid.hpp:95
ValueType & operator()(std::size_t i)
Returns a reference to the grid element at linear index i.
Definition: RegularGrid.hpp:122
SpatialGrid< T, CVT >::CoordinatesType CoordinatesType
The type used to store the coordinates of a grid point.
Definition: RegularGrid.hpp:73
bool isEmpty() const
Tells whether the grid is empty.
Definition: RegularGrid.hpp:160
std::shared_ptr< RegularGrid > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated RegularGrid instances.
Definition: RegularGrid.hpp:61
RegularGrid(const GridDataType &data, const CoordinatesValueType &s)
Constructs a RegularGrid initialized from data with isotropic grid spacing.
Definition: RegularGrid.hpp:110
void getCoordinates(std::size_t i, CoordinatesType &coords) const
Returns the 3D coordinates of the grid element at linear index i.
Definition: RegularGrid.hpp:151
RegularGrid(const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Constructs an empty RegularGrid with the given grid spacing in x, y and z direction.
Definition: RegularGrid.hpp:85
SpatialGrid< T, CVT >::ValueType ValueType
The type of the stored grid data elements.
Definition: RegularGrid.hpp:65
std::size_t getNumElements() const
Returns the total number of grid elements.
Definition: RegularGrid.hpp:141
const ValueType & operator()(std::size_t i) const
Returns a const reference to the grid element at linear index i.
Definition: RegularGrid.hpp:132
RegularGrid(const CoordinatesValueType &s)
Constructs an empty RegularGrid with isotropic grid spacing.
Definition: RegularGrid.hpp:102
SpatialGrid< T, CVT >::CoordinatesValueType CoordinatesValueType
The value type of the grid point coordinate components.
Definition: RegularGrid.hpp:69
Abstract base class for attributed grids whose elements have a defined 3D position in space.
Definition: SpatialGrid.hpp:53
T ValueType
The grid element value type.
Definition: SpatialGrid.hpp:64
CVT CoordinatesValueType
The coordinate value type.
Definition: SpatialGrid.hpp:69
Fixed-size vector of dimension N backed by a C-array (no dynamic allocation).
Definition: Vector.hpp:2047
const ExpressionType & operator()() const
Returns a const reference to the derived grid expression class instance.
Definition: Expression.hpp:200
3D grid data structure combining a Math::Grid data store with a coordinate-system transformation that...
Definition: RegularSpatialGrid.hpp:127
bool isEmpty() const
Tells whether the grid is empty (zero cells along any dimension).
Definition: RegularSpatialGrid.hpp:637
RegularSpatialGrid(const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Constructs an empty grid with anisotropic per-axis step sizes.
Definition: RegularSpatialGrid.hpp:205
SizeType getSize() const
Returns the total number of cells of the grid.
Definition: RegularSpatialGrid.hpp:322
GD GridDataType
The underlying grid data container type.
Definition: RegularSpatialGrid.hpp:145
void getCoordinates(SizeType i, V &coords) const
Writes the world-space 3D position of the cell with linear index i into coords.
Definition: RegularSpatialGrid.hpp:478
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int s
Specifies that the stereocenter has s configuration.
Definition: CIPDescriptor.hpp:81
RegularGrid< float > FRegularGrid
A regular spatial grid storing single-precision floating-point values.
Definition: RegularGrid.hpp:169
RegularGrid< double > DRegularGrid
A regular spatial grid storing double-precision floating-point values.
Definition: RegularGrid.hpp:174
The namespace of the Chemical Data Processing Library.