Chemical Data Processing Library C++ API - Version 1.2.0
SpatialGrid.hpp
Go to the documentation of this file.
1 /*
2  * SpatialGrid.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_SPATIALGRID_HPP
28 #define CDPL_GRID_SPATIALGRID_HPP
29 
30 #include <memory>
31 
33 #include "CDPL/Math/Vector.hpp"
34 
35 
36 namespace CDPL
37 {
38 
39  namespace Grid
40  {
41 
45  template <typename T, typename CVT = T>
46  class SpatialGrid : public AttributedGrid
47  {
48 
49  public:
50  typedef std::shared_ptr<SpatialGrid> SharedPointer;
51  typedef T ValueType;
52  typedef CVT CoordinatesValueType;
54 
55  virtual ValueType& operator()(std::size_t i) = 0;
56 
57  virtual const ValueType& operator()(std::size_t i) const = 0;
58 
59  virtual void getCoordinates(std::size_t i, CoordinatesType& coords) const = 0;
60 
61  protected:
63  {
65  return *this;
66  }
67  };
68 
71  } // namespace Grid
72 } // namespace CDPL
73 
74 #endif // CDPL_GRID_SPATIALGRID_HPP
Definition of a grid data type.
Definition of vector data types.
AttributedGrid.
Definition: AttributedGrid.hpp:46
AttributedGrid & operator=(const AttributedGrid &grid)
Definition: AttributedGrid.hpp:58
SpatialGrid.
Definition: SpatialGrid.hpp:47
T ValueType
Definition: SpatialGrid.hpp:51
Math::CVector< CVT, 3 > CoordinatesType
Definition: SpatialGrid.hpp:53
CVT CoordinatesValueType
Definition: SpatialGrid.hpp:52
SpatialGrid & operator=(const SpatialGrid &grid)
Definition: SpatialGrid.hpp:62
std::shared_ptr< SpatialGrid > SharedPointer
Definition: SpatialGrid.hpp:50
virtual const ValueType & operator()(std::size_t i) const =0
virtual ValueType & operator()(std::size_t i)=0
virtual void getCoordinates(std::size_t i, CoordinatesType &coords) const =0
Definition: Vector.hpp:1053
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
SpatialGrid< float > FSpatialGrid
Definition: SpatialGrid.hpp:69
SpatialGrid< double > DSpatialGrid
Definition: SpatialGrid.hpp:70
The namespace of the Chemical Data Processing Library.