Rosetta  2020.28
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
numeric::VoxelGrid< typename > Class Template Referenceabstract

#include <VoxelGrid.hh>

Public Types

typedef T t_DataType
 
typedef platform::Size Size
 
typedef platform::Real Real
 
typedef xyzVector< RealVector
 
typedef std::pair< T const
*, T const * > 
t_DataTypeCOPtrPair
 
typedef std::pair< T const
*, Vector const * > 
t_DataTypeVectorCOPtrPair
 

Public Member Functions

 VoxelGrid (Real const &resolution=4.0, bool const &cache_edges=false)
 default constructor More...
 
virtual ~VoxelGrid ()
 destructor More...
 
virtual Vector const * ExtractPosition (t_DataType const &input) const =0
 extract the 3D coordinates of a given t_DataType input. TO BE IMPLEMENTED BY DERIVED CLASSES. More...
 
virtual bool IsSameItem (t_DataType const &item1, t_DataType const &item2) const =0
 check if two grid items are the same. TO BE IMPLEMENTED BY DERIVED CLASSES. More...
 
virtual bool IsRelevantItem (t_DataType const &item) const =0
 is item relevant to consider as neighbor. TO BE IMPLEMENTED BY DERIVED CLASSES. More...
 
Size GetNumberItems () const
 Get the number of items in the voxel grid. More...
 
Size GetDimension () const
 Get the actual internally used dimension of the voxel grid. More...
 
Real GetResolution () const
 Get the requested resolution by the user. More...
 
geometry::BoundingBox< Vector >
const & 
GetBoundingBox () const
 Get the bounding box of this grid. More...
 
utility::vector1
< utility::vector1
< t_DataTypeVectorCOPtrPair >
> const & 
GetGridItems () const
 Get the items of this grid. More...
 
utility::vector1< std::pair
< t_DataType const *, Real > > 
GetNeighbors (t_DataType const &input, Real const &neighborhood, bool check_relevance=false) const
 Find neighbors within a specified distance of a given DATA. More...
 
bool HasNeighbors (t_DataType const &input, Real const &neighborhood, bool check_relevance=false) const
 Has given DATA a neighbor in the grid within a specified distance. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighborsIn (VoxelGrid const &grid, Real const &neighborhood, bool check_relevance=false) const
 Find all neighbor pairs within a specified distance. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighbors (Real const &neighborhood, bool check_relevance=false) const
 Find all neighbor pairs within a specified distance. More...
 
void SetObjects (utility::vector1< t_DataType const * > const &new_data, bool check_relevance=false)
 Update the VoxelGrid with new data. More...
 
void InsertObject (t_DataType const &new_item, bool check_relevance=false)
 insert a new t_DataType object into the manager More...
 
void InsertObjects (utility::vector1< t_DataType const * > const &new_items, bool check_relevance=false)
 inserts multiple t_DataType objects into the manager More...
 
void RemoveObject (t_DataType const &item_to_remove)
 remove a t_DataType object from the manager More...
 
void RemoveObjects (utility::vector1< t_DataType const * > const &items_to_remove)
 remove multiple t_DataType objects from the manager More...
 
void Clear ()
 Remove all objects from the voxel grid while keeping the grid itself intact. More...
 
void Translate (Vector const &translation)
 Translate the grid. More...
 

Private Types

enum  BorderFlag {
  e_None = 0, e_XMin = 1, e_XMax = 2, e_YMin = 4,
  e_YMax = 8, e_ZMin = 16, e_ZMax = 32
}
 

Private Member Functions

Size GetIndex (Real const &X, Real const &Y, Real const &Z) const
 Get the position for the given coordinate vector. Places out-of-bounds vector in the bin closest to where they belong. More...
 
Size GetIndex (Vector const &pos) const
 Get the position for the given coordinate vector. Places out-of-bounds vector in the bin closest to where they belong. More...
 
void SetupGrid (Vector const &min_vals, Vector const &max_vals, Size const &expected_n_elements)
 Try to allocate a grid of a given size. If this size would cause the object to definitely exceed the max memory allotment, the grid will be truncated to include only the core. It is assumed that Resolution_ has been setup prior to this. More...
 
Real GetSqDistanceOutsideBoundingBox (Vector const &point) const
 Compute distance from this point to the nearest edge of the bounding box of all given points, provided the point is outside the box. More...
 
Real GetSqDistanceOutsideBoundingBox (Vector const &min_box, Vector const &max_box) const
 Compute distance from another grid's bounding box to the nearest edge of this bounding box provided that the MIN and MAX is outside of this bounding box. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighborsMultiDimensional (Real const &neighborhood, bool check_relevance=false) const
 Find all neighbor pairs of this grid within a specified distance. More...
 
utility::vector1< std::pair
< t_DataType const *, Real > > 
GetNeighborsMultiDimensional (t_DataType const &obj, Real const &neighborhood, bool check_relevance=false) const
 Find all neighbors of this object within a specified distance. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighborsMultiDimensional (VoxelGrid< t_DataType > const &grid, Real const &neighborhood, bool check_relevance=false) const
 Find all neighbors between the input and this grid within a specified distance. More...
 
bool HasNeighborsMultiDimensional (t_DataType const &obj, Real const &neighborhood, bool check_relevance=false) const
 Has given object a neighbor in the grid within a specified distance. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighbors1D (Real const &neighborhood, bool check_relevance=false) const
 Find all neighbor pairs of this 1D grid within a specified distance. More...
 
utility::vector1< std::pair
< t_DataType const *, Real > > 
GetNeighbors1D (t_DataType const &obj, Real const &neighborhood, bool check_relevance=false) const
 Find all neighbors of this object within a specified distance. More...
 
utility::vector1< std::pair
< t_DataTypeCOPtrPair, Real > > 
GetNeighbors1D (VoxelGrid< t_DataType > const &grid, Real const &neighborhood, bool check_relevance=false) const
 Find all neighbors between the input and this grid within a specified distance. More...
 
bool HasNeighbors1D (t_DataType const &obj, Real const &neighborhood, bool check_relevance=false) const
 Has given object a neighbor in the grid within a specified distance. More...
 

Private Attributes

utility::vector1
< utility::vector1
< t_DataTypeVectorCOPtrPair > > 
Assignments_
 
utility::vector1
< utility::vector1
< utility::vector1
< t_DataTypeVectorCOPtrPair > > > 
Edges_
 
utility::vector1
< utility::vector1
< utility::vector1
< t_DataTypeVectorCOPtrPair > > > 
EdgesComplete_
 
utility::vector1< SizeBorderFlags_
 
Size NBinsX_
 
Size NBinsY_
 
Size NBinsZ_
 
Real Resolution_
 
bool CacheEdges_
 
Real ResolutionX_
 
Real ResolutionY_
 
Real ResolutionZ_
 
Real MinResolution_
 
Real MinX_
 
Real MinY_
 
Real MinZ_
 
geometry::BoundingBox< VectorBox_
 
Size NDimensional_
 
Size NItems_
 
Size MinNumberElements_
 
Size MaxNumberElements_
 

Member Typedef Documentation

template<typename >
typedef platform::Real numeric::VoxelGrid< typename >::Real
template<typename >
typedef platform::Size numeric::VoxelGrid< typename >::Size
template<typename >
typedef T numeric::VoxelGrid< typename >::t_DataType
template<typename >
typedef std::pair< T const *, T const * > numeric::VoxelGrid< typename >::t_DataTypeCOPtrPair
template<typename >
typedef std::pair< T const *, Vector const * > numeric::VoxelGrid< typename >::t_DataTypeVectorCOPtrPair
template<typename >
typedef xyzVector<Real> numeric::VoxelGrid< typename >::Vector

Member Enumeration Documentation

template<typename >
enum numeric::VoxelGrid::BorderFlag
private
Enumerator
e_None 
e_XMin 
e_XMax 
e_YMin 
e_YMax 
e_ZMin 
e_ZMax 

Constructor & Destructor Documentation

template<typename T >
numeric::VoxelGrid< T >::VoxelGrid ( Real const &  resolution = 4.0,
bool const &  cache_edges = false 
)

default constructor

template<typename T >
numeric::VoxelGrid< T >::~VoxelGrid ( )
virtual

destructor

Member Function Documentation

template<typename T >
void numeric::VoxelGrid< T >::Clear ( )

Remove all objects from the voxel grid while keeping the grid itself intact.

template<typename >
virtual Vector const* numeric::VoxelGrid< typename >::ExtractPosition ( t_DataType const &  input) const
pure virtual

extract the 3D coordinates of a given t_DataType input. TO BE IMPLEMENTED BY DERIVED CLASSES.

Parameters
inputreference to object T
template<typename T >
geometry::BoundingBox< xyzVector< Real > > const & numeric::VoxelGrid< T >::GetBoundingBox ( ) const
template<typename T >
Size numeric::VoxelGrid< T >::GetDimension ( ) const

Get the actual internally used dimension of the voxel grid.

template<typename T >
utility::vector1< utility::vector1< std::pair< T const *, xyzVector< Real > const * > > > const & numeric::VoxelGrid< T >::GetGridItems ( ) const
template<typename T >
Size numeric::VoxelGrid< T >::GetIndex ( Real const &  X,
Real const &  Y,
Real const &  Z 
) const
private

Get the position for the given coordinate vector. Places out-of-bounds vector in the bin closest to where they belong.

Parameters
X,Y,Zthe position of interest

References max(), and min().

template<typename T >
Size numeric::VoxelGrid< T >::GetIndex ( Vector const &  pos) const
private

Get the position for the given coordinate vector. Places out-of-bounds vector in the bin closest to where they belong.

Parameters
posthe position of interest

References numeric::xyzVector< typename >::x(), numeric::xyzVector< typename >::y(), and numeric::xyzVector< typename >::z().

template<typename T >
utility::vector1< std::pair< T const *, Real > > numeric::VoxelGrid< T >::GetNeighbors ( t_DataType const &  input,
Real const &  neighborhood,
bool  check_relevance = false 
) const

Find neighbors within a specified distance of a given DATA.

Parameters
inputdatapoint of interest
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant
template<typename T >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighbors ( Real const &  neighborhood,
bool  check_relevance = false 
) const

Find all neighbor pairs within a specified distance.

Parameters
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant
template<typename T >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighbors1D ( Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbor pairs of this 1D grid within a specified distance.

Parameters
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References numeric::xyzVector< typename >::distance_squared(), and runtime_assert_msg.

template<typename T >
utility::vector1< std::pair< T const *, Real > > numeric::VoxelGrid< T >::GetNeighbors1D ( t_DataType const &  obj,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbors of this object within a specified distance.

Parameters
objobject to look for neighbors
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References numeric::xyzVector< typename >::distance_squared(), make_symmdef_file_denovo::pos, and runtime_assert_msg.

template<typename T >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighbors1D ( VoxelGrid< t_DataType > const &  grid,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbors between the input and this grid within a specified distance.

Parameters
gridinput grid in which to look for objects that are neighbors of this grid
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References numeric::xyzVector< typename >::distance_squared(), numeric::VoxelGrid< typename >::GetBoundingBox(), numeric::VoxelGrid< typename >::GetGridItems(), numeric::geometry::BoundingBox< typename >::lower(), make_symmdef_file_denovo::pos, runtime_assert_msg, and numeric::geometry::BoundingBox< typename >::upper().

template<typename >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighborsIn ( VoxelGrid< typename > const &  grid,
Real const &  neighborhood,
bool  check_relevance = false 
) const

Find all neighbor pairs within a specified distance.

Parameters
gridother grid to search for neighbors with this grid
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant
template<typename T >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighborsMultiDimensional ( Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbor pairs of this grid within a specified distance.

Parameters
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References numeric::xyzVector< typename >::distance_squared(), make_symmdef_file_denovo::pos, runtime_assert_msg, and numeric::crick_equations::z().

template<typename T >
utility::vector1< std::pair< T const *, Real > > numeric::VoxelGrid< T >::GetNeighborsMultiDimensional ( t_DataType const &  obj,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbors of this object within a specified distance.

Parameters
objobject to look for neighbors
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References begin, numeric::xyzVector< typename >::distance_squared(), basic::options::OptionKeys::cutoutdomain::end, make_symmdef_file_denovo::pos, runtime_assert_msg, and numeric::crick_equations::z().

template<typename T >
utility::vector1< std::pair< std::pair< T const *, T const * >, Real > > numeric::VoxelGrid< T >::GetNeighborsMultiDimensional ( VoxelGrid< t_DataType > const &  grid,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Find all neighbors between the input and this grid within a specified distance.

Parameters
gridinput grid in which to look for objects that are neighbors of this grid
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return neighboring objects which are relevant

References begin, numeric::xyzVector< typename >::distance_squared(), basic::options::OptionKeys::cutoutdomain::end, numeric::VoxelGrid< typename >::GetBoundingBox(), numeric::VoxelGrid< typename >::GetGridItems(), numeric::geometry::BoundingBox< typename >::lower(), make_symmdef_file_denovo::pos, runtime_assert_msg, numeric::geometry::BoundingBox< typename >::upper(), and numeric::crick_equations::z().

template<typename T >
Size numeric::VoxelGrid< T >::GetNumberItems ( ) const

Get the number of items in the voxel grid.

template<typename T >
Real numeric::VoxelGrid< T >::GetResolution ( ) const

Get the requested resolution by the user.

template<typename T >
Real numeric::VoxelGrid< T >::GetSqDistanceOutsideBoundingBox ( Vector const &  point) const
private

Compute distance from this point to the nearest edge of the bounding box of all given points, provided the point is outside the box.

Parameters
pointpoint of interest

References numeric::xyzVector< typename >::x(), numeric::xyzVector< typename >::y(), and numeric::xyzVector< typename >::z().

template<typename T >
Real numeric::VoxelGrid< T >::GetSqDistanceOutsideBoundingBox ( Vector const &  min_box,
Vector const &  max_box 
) const
private

Compute distance from another grid's bounding box to the nearest edge of this bounding box provided that the MIN and MAX is outside of this bounding box.

Parameters
min_boxmin of the grid of interest
min_boxmax of the grid of interest

References numeric::xyzVector< typename >::x(), numeric::xyzVector< typename >::y(), and numeric::xyzVector< typename >::z().

template<typename T >
bool numeric::VoxelGrid< T >::HasNeighbors ( t_DataType const &  input,
Real const &  neighborhood,
bool  check_relevance = false 
) const

Has given DATA a neighbor in the grid within a specified distance.

Parameters
inputdatapoint of interest
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return true if neighboring objects are relevant
template<typename T >
bool numeric::VoxelGrid< T >::HasNeighbors1D ( t_DataType const &  obj,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Has given object a neighbor in the grid within a specified distance.

Parameters
objobject to look for neighbors
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return true if neighboring objects are relevant

References numeric::xyzVector< typename >::distance_squared(), make_symmdef_file_denovo::pos, and runtime_assert_msg.

template<typename T >
bool numeric::VoxelGrid< T >::HasNeighborsMultiDimensional ( t_DataType const &  obj,
Real const &  neighborhood,
bool  check_relevance = false 
) const
private

Has given object a neighbor in the grid within a specified distance.

Parameters
objobject to look for neighbors
neighborhoodrange in which to search for neighbors; must be <= resolution
check_relevancecheck and only return true if neighboring objects are relevant

References begin, numeric::xyzVector< typename >::distance_squared(), basic::options::OptionKeys::cutoutdomain::end, make_symmdef_file_denovo::pos, runtime_assert_msg, and numeric::crick_equations::z().

template<typename T >
void numeric::VoxelGrid< T >::InsertObject ( t_DataType const &  new_item,
bool  check_relevance = false 
)

insert a new t_DataType object into the manager

Parameters
new_itemreference to item to insert
check_relevancecheck and only insert if object is relevant for neighbor calculation

References ObjexxFCL::index().

template<typename T >
void numeric::VoxelGrid< T >::InsertObjects ( utility::vector1< t_DataType const * > const &  new_items,
bool  check_relevance = false 
)

inserts multiple t_DataType objects into the manager

Parameters
new_itemsvector of references to items to insert
check_relevancecheck and only insert if objects are relevant for neighbor calculation
template<typename >
virtual bool numeric::VoxelGrid< typename >::IsRelevantItem ( t_DataType const &  item) const
pure virtual

is item relevant to consider as neighbor. TO BE IMPLEMENTED BY DERIVED CLASSES.

Parameters
itemitem to check
template<typename >
virtual bool numeric::VoxelGrid< typename >::IsSameItem ( t_DataType const &  item1,
t_DataType const &  item2 
) const
pure virtual

check if two grid items are the same. TO BE IMPLEMENTED BY DERIVED CLASSES.

Parameters
item1first comparison item
item2second comparison item
template<typename T >
void numeric::VoxelGrid< T >::RemoveObject ( t_DataType const &  item_to_remove)

remove a t_DataType object from the manager

Parameters
item_to_removereference to the item to remove

References ObjexxFCL::index(), and make_symmdef_file_denovo::pos.

template<typename T >
void numeric::VoxelGrid< T >::RemoveObjects ( utility::vector1< t_DataType const * > const &  items_to_remove)

remove multiple t_DataType objects from the manager

Parameters
items_to_removevector of references to items to remove
template<typename T >
void numeric::VoxelGrid< T >::SetObjects ( utility::vector1< t_DataType const * > const &  new_data,
bool  check_relevance = false 
)

Update the VoxelGrid with new data.

Parameters
new_dataVector of the new data
check_relevancecheck if objects are relevant for neighbor calculation and only insert those

References ObjexxFCL::index(), max(), and min().

template<typename T >
void numeric::VoxelGrid< T >::SetupGrid ( Vector const &  min_vals,
Vector const &  max_vals,
Size const &  expected_n_elements 
)
private

Try to allocate a grid of a given size. If this size would cause the object to definitely exceed the max memory allotment, the grid will be truncated to include only the core. It is assumed that Resolution_ has been setup prior to this.

Parameters
min_valsdimension of bounding box
max_valsdimension of bounding box

References erraser_analysis::diff, max(), min(), make_symmdef_file_denovo::pos, runtime_assert_msg, erraser_single_res_analysis::score, numeric::crick_equations::x(), numeric::xyzVector< typename >::x(), numeric::crick_equations::y(), numeric::xyzVector< typename >::y(), numeric::crick_equations::z(), and numeric::xyzVector< typename >::z().

template<typename T >
void numeric::VoxelGrid< T >::Translate ( Vector const &  translation)

Member Data Documentation

template<typename >
utility::vector1< utility::vector1< t_DataTypeVectorCOPtrPair> > numeric::VoxelGrid< typename >::Assignments_
private
template<typename >
utility::vector1< Size > numeric::VoxelGrid< typename >::BorderFlags_
private
template<typename >
geometry::BoundingBox< Vector > numeric::VoxelGrid< typename >::Box_
private
template<typename >
bool numeric::VoxelGrid< typename >::CacheEdges_
private
template<typename >
utility::vector1< utility::vector1< utility::vector1< t_DataTypeVectorCOPtrPair> > > numeric::VoxelGrid< typename >::Edges_
private
template<typename >
utility::vector1< utility::vector1< utility::vector1< t_DataTypeVectorCOPtrPair> > > numeric::VoxelGrid< typename >::EdgesComplete_
private
template<typename >
Size numeric::VoxelGrid< typename >::MaxNumberElements_
private
template<typename >
Size numeric::VoxelGrid< typename >::MinNumberElements_
private
template<typename >
Real numeric::VoxelGrid< typename >::MinResolution_
private
template<typename >
Real numeric::VoxelGrid< typename >::MinX_
private
template<typename >
Real numeric::VoxelGrid< typename >::MinY_
private
template<typename >
Real numeric::VoxelGrid< typename >::MinZ_
private
template<typename >
Size numeric::VoxelGrid< typename >::NBinsX_
private
template<typename >
Size numeric::VoxelGrid< typename >::NBinsY_
private
template<typename >
Size numeric::VoxelGrid< typename >::NBinsZ_
private
template<typename >
Size numeric::VoxelGrid< typename >::NDimensional_
private
template<typename >
Size numeric::VoxelGrid< typename >::NItems_
private
template<typename >
Real numeric::VoxelGrid< typename >::Resolution_
private
template<typename >
Real numeric::VoxelGrid< typename >::ResolutionX_
private
template<typename >
Real numeric::VoxelGrid< typename >::ResolutionY_
private
template<typename >
Real numeric::VoxelGrid< typename >::ResolutionZ_
private

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