RDKit: RDGeom::UniformGrid3D Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | List of all members
RDGeom::UniformGrid3D Class Reference

`#include <UniformGrid3D.h>`

Inheritance diagram for RDGeom::UniformGrid3D:

## Public Member Functions
| UniformGrid3D (double dimX, double dimY, double dimZ, double spacing=0.5, RDKit::DiscreteValueVect::DiscreteValueType valType=RDKit::DiscreteValueVect::TWOBITVALUE, const RDGeom::Point3D *offset=nullptr)
| ctor
| UniformGrid3D (const UniformGrid3D &other)
| copy ctor
| UniformGrid3D (const std::string &pkl)
| construct from a string pickle
| UniformGrid3D (const char *pkl, unsigned int)
| construct from a text pickle
UniformGrid3D & | operator= (const UniformGrid3D &other)
| ~UniformGrid3D () override
int | getGridPointIndex (const Point3D &point) const override
| Get the index of the grid point closest to point.
int | getVal (const Point3D &point) const override
| Get the value at the grid point closest to the specified point.
unsigned int | getVal (unsigned int pointId) const override
| Get the value at a specified grid point.
void | setVal (const Point3D &point, unsigned int val) override
| Set the value at the grid point closest to the specified point.
Point3D | getGridPointLoc (unsigned int pointId) const override
| get the location of the specified grid point
void | setVal (unsigned int pointId, unsigned int val) override
| Set the value at the specified grid point.
unsigned int | getSize () const override
| get the size of the grid (number of grid points)
void | setSphereOccupancy (const Point3D &center, double radius, double stepSize, int maxNumLayers=-1, bool ignoreOutOfBound=true)
| set the occupancy for a multi-layered sphere
int | getGridIndex (unsigned int xi, unsigned int yi, unsigned int zi) const
| get the index of the grid point given the x, y, z indices
void | getGridIndices (unsigned int idx, unsigned int &xi, unsigned int &yi, unsigned int &zi) const
| get the x, y, and z indices of a grid-point index
unsigned int | getNumX () const
| get the number of grid points along x-axis
unsigned int | getNumY () const
| get the number of grid points along y-axis
unsigned int | getNumZ () const
| get the number of grid points along z-axis
const Point3D & | getOffset () const
| get the grid's offset
double | getSpacing () const
| get the grid's spacing
const RDKit::DiscreteValueVect * | getOccupancyVect () const override
| return a const pointer to our occupancy vector
virtual bool | compareParams (const UniformGrid3D &other) const
| returns true if the grid `other` has parameters compatible with ours.
UniformGrid3D & | operator|= (const UniformGrid3D &other)
| calculates the union between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.
UniformGrid3D & | operator&= (const UniformGrid3D &other)
| calculates the intersection between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.
UniformGrid3D & | operator+= (const UniformGrid3D &other)
| calculates the sum of the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.
UniformGrid3D & | operator-= (const UniformGrid3D &other)
| calculates the difference between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.
std::string | toString () const
| create and return a pickle
UniformGrid3D | operator& (const UniformGrid3D &other) const
Public Member Functions inherited from RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >
virtual | ~Grid3D ()

## Detailed Description

Definition at line 19 of file UniformGrid3D.h.

## Constructor & Destructor Documentation

## ◆ UniformGrid3D() [1/4]

RDGeom::UniformGrid3D::UniformGrid3D | ( | double | dimX,
|  | double | dimY,
|  | double | dimZ,
|  | double | spacing = 0.5,
|  | RDKit::DiscreteValueVect::DiscreteValueType | valType = RDKit::DiscreteValueVect::TWOBITVALUE,
|  | const RDGeom::Point3D * | offset = nullptr )
| inline

ctor

Definition at line 38 of file UniformGrid3D.h.

References RDKit::DiscreteValueVect::TWOBITVALUE.

Referenced by compareParams(), operator&(), operator&=(), operator+=(), operator-=(), operator=(), operator|=(), and UniformGrid3D().

## ◆ UniformGrid3D() [2/4]

RDGeom::UniformGrid3D::UniformGrid3D | ( | const UniformGrid3D & | other | ) |

copy ctor

References UniformGrid3D().

## ◆ UniformGrid3D() [3/4]

RDGeom::UniformGrid3D::UniformGrid3D | ( | const std::string & | pkl | ) |

construct from a string pickle

## ◆ UniformGrid3D() [4/4]

RDGeom::UniformGrid3D::UniformGrid3D | ( | const char * | pkl,
|  | unsigned int | )

construct from a text pickle

## ◆ ~UniformGrid3D()

RDGeom::UniformGrid3D::~UniformGrid3D | ( |  | ) |
| override

## Member Function Documentation

## ◆ compareParams()

virtual bool RDGeom::UniformGrid3D::compareParams | ( | const UniformGrid3D & | other | ) | const
| virtual

returns true if the grid `other` has parameters compatible with ours.

References UniformGrid3D().

Referenced by operator&().

## ◆ getGridIndex()

int RDGeom::UniformGrid3D::getGridIndex | ( | unsigned int | xi,
|  | unsigned int | yi,
|  | unsigned int | zi ) const

get the index of the grid point given the x, y, z indices

Returns
  the integer value, -1 if the indices are outside the grid

## ◆ getGridIndices()

void RDGeom::UniformGrid3D::getGridIndices | ( | unsigned int | idx,
|  | unsigned int & | xi,
|  | unsigned int & | yi,
|  | unsigned int & | zi ) const

get the x, y, and z indices of a grid-point index

## ◆ getGridPointIndex()

int RDGeom::UniformGrid3D::getGridPointIndex | ( | const Point3D & | point | ) | const
| overridevirtual

Get the index of the grid point closest to point.

Returns
  the integer index, -1 if the specified point is outside the grid

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ getGridPointLoc()

Point3D RDGeom::UniformGrid3D::getGridPointLoc | ( | unsigned int | pointId | ) | const
| overridevirtual

get the location of the specified grid point

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ getNumX()

unsigned int RDGeom::UniformGrid3D::getNumX | ( |  | ) | const
| inline

get the number of grid points along x-axis

Definition at line 118 of file UniformGrid3D.h.

## ◆ getNumY()

unsigned int RDGeom::UniformGrid3D::getNumY | ( |  | ) | const
| inline

get the number of grid points along y-axis

Definition at line 121 of file UniformGrid3D.h.

## ◆ getNumZ()

unsigned int RDGeom::UniformGrid3D::getNumZ | ( |  | ) | const
| inline

get the number of grid points along z-axis

Definition at line 124 of file UniformGrid3D.h.

## ◆ getOccupancyVect()

const RDKit::DiscreteValueVect * RDGeom::UniformGrid3D::getOccupancyVect | ( |  | ) | const
| inlineoverridevirtual

return a const pointer to our occupancy vector

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

Definition at line 133 of file UniformGrid3D.h.

## ◆ getOffset()

const Point3D & RDGeom::UniformGrid3D::getOffset | ( |  | ) | const
| inline

get the grid's offset

Definition at line 127 of file UniformGrid3D.h.

## ◆ getSize()

unsigned int RDGeom::UniformGrid3D::getSize | ( |  | ) | const
| inlineoverridevirtual

get the size of the grid (number of grid points)

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

Definition at line 86 of file UniformGrid3D.h.

## ◆ getSpacing()

double RDGeom::UniformGrid3D::getSpacing | ( |  | ) | const
| inline

get the grid's spacing

Definition at line 130 of file UniformGrid3D.h.

## ◆ getVal() [1/2]

int RDGeom::UniformGrid3D::getVal | ( | const Point3D & | point | ) | const
| overridevirtual

Get the value at the grid point closest to the specified point.

Returns
  the integer value, -1 if the specified index is outside the grid

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ getVal() [2/2]

unsigned int RDGeom::UniformGrid3D::getVal | ( | unsigned int | pointId | ) | const
| overridevirtual

Get the value at a specified grid point.

Returns
  the unsigned integer value

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ operator&()

UniformGrid3D RDGeom::UniformGrid3D::operator& | ( | const UniformGrid3D & | other | ) | const
| inline

Definition at line 164 of file UniformGrid3D.h.

References compareParams(), PRECONDITION, and UniformGrid3D().

## ◆ operator&=()

UniformGrid3D & RDGeom::UniformGrid3D::operator&= | ( | const UniformGrid3D & | other | ) |

calculates the intersection between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.

References UniformGrid3D().

## ◆ operator+=()

UniformGrid3D & RDGeom::UniformGrid3D::operator+= | ( | const UniformGrid3D & | other | ) |

calculates the sum of the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.

References UniformGrid3D().

## ◆ operator-=()

UniformGrid3D & RDGeom::UniformGrid3D::operator-= | ( | const UniformGrid3D & | other | ) |

calculates the difference between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.

References UniformGrid3D().

## ◆ operator=()

UniformGrid3D & RDGeom::UniformGrid3D::operator= | ( | const UniformGrid3D & | other | ) |

References UniformGrid3D().

## ◆ operator|=()

UniformGrid3D & RDGeom::UniformGrid3D::operator|= | ( | const UniformGrid3D & | other | ) |

calculates the union between the data on this grid and that on `other`. This grid is modified. NOTE that the grids must have the same parameters.

References UniformGrid3D().

## ◆ setSphereOccupancy()

void RDGeom::UniformGrid3D::setSphereOccupancy | ( | const Point3D & | center,
|  | double | radius,
|  | double | stepSize,
|  | int | maxNumLayers = -1,
|  | bool | ignoreOutOfBound = true )

set the occupancy for a multi-layered sphere

This function encodes the occupancy for a sphere and multiple layers around it

Parameters

  center | location of the sphere center
  radius | Radius of the base sphere
  stepSize | thickness of each layer on top of the base sphere
  maxNumLayers | maximum number of layers, if -1 this is determined by the number of bits used per grid points in the storage
  ignoreOutOfBound | if true, ignore if center is outside the grid, otherwise throw an exception

## ◆ setVal() [1/2]

void RDGeom::UniformGrid3D::setVal | ( | const Point3D & | point,
|  | unsigned int | val )
| overridevirtual

Set the value at the grid point closest to the specified point.

doesn't do anything if the point is outside the grid

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ setVal() [2/2]

void RDGeom::UniformGrid3D::setVal | ( | unsigned int | pointId,
|  | unsigned int | val )
| overridevirtual

Set the value at the specified grid point.

Implements RDGeom::Grid3D< RDKit::DiscreteValueVect, int, unsigned int >.

## ◆ toString()

std::string RDGeom::UniformGrid3D::toString | ( |  | ) | const

create and return a pickle

The documentation for this class was generated from the following file:

- UniformGrid3D.h