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;
66 
74  Math::RegularSpatialGrid<T, CVT>(xs, ys, zs) {}
75 
84  Math::RegularSpatialGrid<T, CVT>(data, xs, ys, zs) {}
85 
91  Math::RegularSpatialGrid<T, CVT>(s) {}
92 
99  Math::RegularSpatialGrid<T, CVT>(data, s) {}
100 
102 
104 
110  ValueType& operator()(std::size_t i)
111  {
113  }
114 
120  const ValueType& operator()(std::size_t i) const
121  {
123  }
124 
129  std::size_t getNumElements() const
130  {
132  }
133 
139  void getCoordinates(std::size_t i, CoordinatesType& coords) const
140  {
142  }
143 
148  bool isEmpty() const
149  {
151  }
152  };
153 
158 
163  } // namespace Grid
164 } // namespace CDPL
165 
166 #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
Definition: RegularGrid.hpp:65
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:83
ValueType & operator()(std::size_t i)
Returns a reference to the grid element at linear index i.
Definition: RegularGrid.hpp:110
SpatialGrid< T, CVT >::CoordinatesType CoordinatesType
Definition: RegularGrid.hpp:64
bool isEmpty() const
Tells whether the grid is empty.
Definition: RegularGrid.hpp:148
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:98
void getCoordinates(std::size_t i, CoordinatesType &coords) const
Returns the 3D coordinates of the grid element at linear index i.
Definition: RegularGrid.hpp:139
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:73
SpatialGrid< T, CVT >::ValueType ValueType
Definition: RegularGrid.hpp:62
std::size_t getNumElements() const
Returns the total number of grid elements.
Definition: RegularGrid.hpp:129
const ValueType & operator()(std::size_t i) const
Returns a const reference to the grid element at linear index i.
Definition: RegularGrid.hpp:120
RegularGrid(const CoordinatesValueType &s)
Constructs an empty RegularGrid with isotropic grid spacing.
Definition: RegularGrid.hpp:90
SpatialGrid< T, CVT >::CoordinatesValueType CoordinatesValueType
Definition: RegularGrid.hpp:63
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:59
CVT CoordinatesValueType
The coordinate value type.
Definition: SpatialGrid.hpp:61
Fixed-size vector of dimension N backed by a C-array (no dynamic allocation).
Definition: Vector.hpp:1876
const ExpressionType & operator()() const
Returns a const reference to the derived grid expression.
Definition: Expression.hpp:190
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:599
RegularSpatialGrid(const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs)
Constructs an empty grid with anisotropic per-axis step sizes.
Definition: RegularSpatialGrid.hpp:167
SizeType getSize() const
Returns the total number of cells of the grid.
Definition: RegularSpatialGrid.hpp:284
GD GridDataType
The underlying grid data container type.
Definition: RegularSpatialGrid.hpp:137
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:440
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< double > DRegularGrid
A regular spatial grid storing double-precision floating-point values.
Definition: DRegularGridReader.hpp:42
RegularGrid< float > FRegularGrid
A regular spatial grid storing single-precision floating-point values.
Definition: RegularGrid.hpp:157
The namespace of the Chemical Data Processing Library.