Rosetta  2021.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
protocols::match::Bool3DGrid Class Reference

#include <BumpGrid.hh>

Inheritance diagram for protocols::match::Bool3DGrid:
Inheritance graph
[legend]

Public Types

typedef core::Size Size
 
typedef core::Real Real
 
typedef core::Vector Vector
 
typedef
numeric::geometry::BoundingBox
< core::Vector
BoundingBox
 
typedef
numeric::geometry::hashing::Bin3D 
Bin3D
 
typedef
utility::fixedsizearray1
< Vector, 8 > 
CornerPoints
 
typedef std::pair
< Bool3DGrid::Size, unsigned
char > 
index_mask_pair
 

Public Member Functions

 Bool3DGrid ()
 Creation and initialization. More...
 
 ~Bool3DGrid () override
 
void set_bounding_box (BoundingBox const &bb)
 
void set_bin_width (Real width)
 
Bool3DGrid create_grid_for_sphere (Vector const &center, Real radius) const
 create a grid for the input sphere that aligns to this grid, such that it is large enough to hold a particular sphere. More...
 
Bool3DGrid create_grid_for_bb (BoundingBox const &bb)
 create a grid for the input bounding box that aligns to this grid More...
 
Bin3D dimsizes () const
 Accessors. More...
 
Real bin_width () const
 
CornerPoints corners (Bin3D const &bin) const
 
BoundingBox bin_extrema (Bin3D const &bin) const
 bounding box points for a bin. More...
 
Vector bin_center (Bin3D const &bin) const
 
bool occupied (Vector const &) const
 
bool occupied (Bin3D const &bin) const
 
BoundingBox actual_bb () const
 
void set_value_for_bin (Bin3D const &bin, bool setting)
 set the boolean value for a particular bin. The bin dimensions are indexed from 0 to nbins-1. More...
 
void or_by_sphere_conservative (Vector const &center, Real radius)
 Set the value to true for any voxel that is wholy contained by the given sphere. A voxel is wholy contained iff all 8 corners of the voxel are within the sphere. More...
 
void or_by_sphere_liberal (Vector const &center, Real radius)
 Set the value to true for any voxel that is partially contained by a given sphere. A voxel is partially contained iff any of the 8 corners of the voxel are within the sphere. More...
 
void or_by_spheres_conservative (utility::vector1< std::pair< Vector, Real > > const &spheres)
 Consider a voxel filled if each of its corners are covered, even if they are covered by seperate spheres. Dangerous, in that some voxels will be counted as being fully occupied when they are only partially occupied. More...
 
void or_by_box_liberal (BoundingBox const &bb)
 Turn the values of all the bins that overlap with the volume in this bounding box to true. More...
 
void or_with (Bool3DGrid const &other)
 Performs a boolean OR on the voxels shared by the two grids, and ignores all voxels that are not shared by the two grids. These grids must be "compatible", in that the lower corner of other must lie on a grid point of this. More...
 
void and_with (Bool3DGrid const &other)
 Performs a boolean AND on the voxels shared by the two grids, and ignores all voxels that are not shared by the two grids. These grids must be "compatible", in that the lower corner of other must lie on a grid point of this. More...
 
void subtract (Bool3DGrid const &other)
 Sets any voxel on this grid to "false" which is true on the other grid. but does not set any voxel to "true" on this grid – even if the other voxel is "false". More...
 
void clear ()
 Set all values in all bins to false. More...
 

Private Member Functions

index_mask_pair index_and_mask_for_point (Vector const &point) const
 
index_mask_pair index_and_mask_for_bin (Bin3D const &bin) const
 
Bin3D bin_for_point (Vector const &point) const
 
void reset_grid ()
 
unsigned char mask_from_offsets (core::Size xmod2, core::Size ymod2, core::Size zmod2) const
 
unsigned char negmask_from_offsets (core::Size xmod2, core::Size ymod2, core::Size zmod2) const
 
core::Size byte_index_from_doublebin (Bin3D const &halfbin) const
 

Private Attributes

BoundingBox bb_
 
BoundingBox bb_extended_
 
Real bin_width_
 
Real bin_width_2x_
 
Real half_bin_width_root_three_
 
Bin3D dimsizes_
 
Bin3D dimprods_
 
Bin3D halfdimsizes_
 
Bin3D halfdimprods_
 
Bin3D supervoxel_dimsizes_
 
Bin3D supervoxel_dimprods_
 
utility::vector0< unsigned char > grid_
 

Static Private Attributes

static const core::Size n_doublebins_per_supervoxel = 4
 

Member Typedef Documentation

typedef numeric::geometry::hashing::Bin3D protocols::match::Bool3DGrid::Bin3D
typedef numeric::geometry::BoundingBox< core::Vector > protocols::match::Bool3DGrid::BoundingBox
typedef utility::fixedsizearray1< Vector, 8 > protocols::match::Bool3DGrid::CornerPoints

Constructor & Destructor Documentation

protocols::match::Bool3DGrid::Bool3DGrid ( )

Creation and initialization.

protocols::match::Bool3DGrid::~Bool3DGrid ( )
overridedefault

Member Function Documentation

BoundingBox protocols::match::Bool3DGrid::actual_bb ( ) const
inline

References bb_extended_.

void protocols::match::Bool3DGrid::and_with ( Bool3DGrid const &  other)

Performs a boolean AND on the voxels shared by the two grids, and ignores all voxels that are not shared by the two grids. These grids must be "compatible", in that the lower corner of other must lie on a grid point of this.

References bb_, bin_width_, grid_, index_and_mask_for_bin(), protocols::mean_field::max(), and protocols::mean_field::min().

Bool3DGrid::Vector protocols::match::Bool3DGrid::bin_center ( Bin3D const &  bin) const
Bool3DGrid::BoundingBox protocols::match::Bool3DGrid::bin_extrema ( Bin3D const &  bin) const

bounding box points for a bin.

References bb_, and bin_width_.

Bool3DGrid::Bin3D protocols::match::Bool3DGrid::bin_for_point ( Vector const &  point) const
private

References bb_, bin_width_, and dimsizes_.

Referenced by or_by_box_liberal().

Real protocols::match::Bool3DGrid::bin_width ( ) const
inline
Bool3DGrid::Size protocols::match::Bool3DGrid::byte_index_from_doublebin ( Bin3D const &  halfbin) const
private
void protocols::match::Bool3DGrid::clear ( )

Set all values in all bins to false.

References grid_.

Bool3DGrid::CornerPoints protocols::match::Bool3DGrid::corners ( Bin3D const &  bin) const
Bool3DGrid protocols::match::Bool3DGrid::create_grid_for_bb ( BoundingBox const &  bb)

create a grid for the input bounding box that aligns to this grid

References bb_, bin_width_, set_bin_width(), and set_bounding_box().

Bool3DGrid protocols::match::Bool3DGrid::create_grid_for_sphere ( Vector const &  center,
Real  radius 
) const

create a grid for the input sphere that aligns to this grid, such that it is large enough to hold a particular sphere.

References bb_, bin_width_, bin_width_2x_, set_bin_width(), and set_bounding_box().

Bool3DGrid::Bin3D protocols::match::Bool3DGrid::dimsizes ( ) const
Bool3DGrid::index_mask_pair protocols::match::Bool3DGrid::index_and_mask_for_bin ( Bin3D const &  bin) const
private
Bool3DGrid::index_mask_pair protocols::match::Bool3DGrid::index_and_mask_for_point ( Vector const &  point) const
private
unsigned char protocols::match::Bool3DGrid::mask_from_offsets ( core::Size  xmod2,
core::Size  ymod2,
core::Size  zmod2 
) const
private
unsigned char protocols::match::Bool3DGrid::negmask_from_offsets ( core::Size  xmod2,
core::Size  ymod2,
core::Size  zmod2 
) const
private

Referenced by set_value_for_bin().

bool protocols::match::Bool3DGrid::occupied ( Vector const &  point) const
bool protocols::match::Bool3DGrid::occupied ( Bin3D const &  bin) const
void protocols::match::Bool3DGrid::or_by_box_liberal ( BoundingBox const &  bb)

Turn the values of all the bins that overlap with the volume in this bounding box to true.

References bb_, bin_for_point(), and set_value_for_bin().

void protocols::match::Bool3DGrid::or_by_sphere_conservative ( Vector const &  center,
Real  radius 
)

Set the value to true for any voxel that is wholy contained by the given sphere. A voxel is wholy contained iff all 8 corners of the voxel are within the sphere.

Sets the value of a voxel to true if all eight corners of the voxel are contained by the sphere.

References bb_extended_, bin_center(), bin_width_, corners(), dimsizes_, half_bin_width_root_three_, and set_value_for_bin().

void protocols::match::Bool3DGrid::or_by_sphere_liberal ( Vector const &  center,
Real  radius 
)

Set the value to true for any voxel that is partially contained by a given sphere. A voxel is partially contained iff any of the 8 corners of the voxel are within the sphere.

Sets the value of a voxel to true if any volume of a voxel is inside the sphere. Handles edge cases properly where a voxel is glanced by a sphere at a face, but where the corners of the voxel are not contained by the sphere, and when a sphere is entirely contained within a voxel.

References bb_extended_, bin_center(), bin_width_, core::conformation::membrane::center, corners(), dimsizes_, half_bin_width_root_three_, and set_value_for_bin().

void protocols::match::Bool3DGrid::or_by_spheres_conservative ( utility::vector1< std::pair< Vector, Real > > const &  spheres)

Consider a voxel filled if each of its corners are covered, even if they are covered by seperate spheres. Dangerous, in that some voxels will be counted as being fully occupied when they are only partially occupied.

The sphere list should describe spheres by the centers and by their square radii, not by their radii.

References corners(), dimsizes_, and set_value_for_bin().

void protocols::match::Bool3DGrid::or_with ( Bool3DGrid const &  other)

Performs a boolean OR on the voxels shared by the two grids, and ignores all voxels that are not shared by the two grids. These grids must be "compatible", in that the lower corner of other must lie on a grid point of this.

References bb_, bin_width_, grid_, index_and_mask_for_bin(), protocols::mean_field::max(), and protocols::mean_field::min().

void protocols::match::Bool3DGrid::reset_grid ( )
private
void protocols::match::Bool3DGrid::set_bin_width ( Real  width)
void protocols::match::Bool3DGrid::set_bounding_box ( BoundingBox const &  bb)

References bb_, and reset_grid().

Referenced by create_grid_for_bb(), and create_grid_for_sphere().

void protocols::match::Bool3DGrid::set_value_for_bin ( Bin3D const &  bin,
bool  setting 
)

set the boolean value for a particular bin. The bin dimensions are indexed from 0 to nbins-1.

References byte_index_from_doublebin(), grid_, mask_from_offsets(), and negmask_from_offsets().

Referenced by or_by_box_liberal(), or_by_sphere_conservative(), or_by_sphere_liberal(), and or_by_spheres_conservative().

void protocols::match::Bool3DGrid::subtract ( Bool3DGrid const &  other)

Sets any voxel on this grid to "false" which is true on the other grid. but does not set any voxel to "true" on this grid – even if the other voxel is "false".

Set all the values in this grid to "false" that are true in the other grid.

References bb_, bin_width_, grid_, index_and_mask_for_bin(), protocols::mean_field::max(), and protocols::mean_field::min().

Member Data Documentation

BoundingBox protocols::match::Bool3DGrid::bb_
private
BoundingBox protocols::match::Bool3DGrid::bb_extended_
private
Real protocols::match::Bool3DGrid::bin_width_
private
Real protocols::match::Bool3DGrid::bin_width_2x_
private
Bin3D protocols::match::Bool3DGrid::dimprods_
private

Referenced by reset_grid().

Bin3D protocols::match::Bool3DGrid::dimsizes_
private
utility::vector0< unsigned char > protocols::match::Bool3DGrid::grid_
private

Each byte represents the boolean "covered" status for 8 voxels in a double-voxel. The double voxel

Referenced by and_with(), clear(), occupied(), or_with(), reset_grid(), set_value_for_bin(), and subtract().

Real protocols::match::Bool3DGrid::half_bin_width_root_three_
private
Bin3D protocols::match::Bool3DGrid::halfdimprods_
private

Referenced by reset_grid().

Bin3D protocols::match::Bool3DGrid::halfdimsizes_
private
const core::Size protocols::match::Bool3DGrid::n_doublebins_per_supervoxel = 4
staticprivate

creates super voxels of size 8x8x8 = 512 bits -> 64 bytes = cache line size on Core2 Duo, though this size should not have a very large effect for caches of larger or smaller size. The main point of the super voxel is to allow data locality as it's very often the same region of space that's being queried repeatedly during rotamer building.

Referenced by byte_index_from_doublebin(), and reset_grid().

Bin3D protocols::match::Bool3DGrid::supervoxel_dimprods_
private
Bin3D protocols::match::Bool3DGrid::supervoxel_dimsizes_
private

Referenced by reset_grid().


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