RandomBallCover  1.2.1
 Hosted by GitHub
Functions | Variables
testsRBC_RGBD.cpp File Reference

Google Test Unit Tests for the kernels associated with the Random Ball Cover data structure. More...

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
#include <chrono>
#include <random>
#include <limits>
#include <cmath>
#include <gtest/gtest.h>
#include <CLUtils.hpp>
#include <RBC/algorithms.hpp>
#include <RBC/tests/helper_funcs.hpp>
Include dependency graph for testsRBC_RGBD.cpp:

Functions

void fread (const char *path, char *data, size_t n)
 Reads in a binary file. More...
 
unsigned int clean_data (std::vector< cl_float4 >::iterator dBegin, std::vector< cl_float4 >::iterator dEnd, std::vector< cl_float4 >::iterator cBegin, std::vector< cl_float4 >::iterator cEnd)
 Finds the invalid points (zero coordinates) and pushes them to the end of the sequences. More...
 
template<typename iterator >
void random_unique (iterator cBegin, iterator dBegin, iterator rcBegin, iterator rdBegin, size_t n, size_t rn)
 Picks a number of elements uniformly at random without replacement from the input sequences. More...
 
 TEST (RBC, rbcRGBD)
 Tests the RBCSearch class on an 8-D point cloud. More...
 
int main (int argc, char **argv)
 

Variables

bool profiling
 
const std::vector< std::string > kernel_files
 

Detailed Description

Google Test Unit Tests for the kernels associated with the Random Ball Cover data structure.

Note
Use the --profiling flag to enable profiling of the kernels.
The benchmarks in these tests are against naive CPU implementations of the associated algorithms. They are used only for testing purposes, and not for examining the performance of their GPU alternatives.
Author
Nick Lamprianidis
Version
1.2.1
Date
2015
Copyright (c) 2015 Nick Lamprianidis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Function Documentation

unsigned int clean_data ( std::vector< cl_float4 >::iterator  dBegin,
std::vector< cl_float4 >::iterator  dEnd,
std::vector< cl_float4 >::iterator  cBegin,
std::vector< cl_float4 >::iterator  cEnd 
)

Finds the invalid points (zero coordinates) and pushes them to the end of the sequences.

Parameters
[in]dBegininput iterator to the initial position of the sequence with the pc4d data.
[in]dEndinput iterator past the last position of the sequence with the pc4d data.
[in]cBegininput iterator to the initial position of the sequence with the rgba data.
[in]cEndinput iterator past the last position of the sequence with the rgba data.
Returns
The number of invalid points.
void fread ( const char *  path,
char *  data,
size_t  n 
)

Reads in a binary file.

Parameters
[in]pathpath to the file.
[out]dataarray that receives the data.
[in]nnumber of bytes to read.
int main ( int  argc,
char **  argv 
)
template<typename iterator >
void random_unique ( iterator  cBegin,
iterator  dBegin,
iterator  rcBegin,
iterator  rdBegin,
size_t  n,
size_t  rn 
)

Picks a number of elements uniformly at random without replacement from the input sequences.

The function implements a Fisher-Yates shuffle.

Parameters
[in]cBegininput iterator to the initial position of the sequence with the rgba/pc4d data.
[in]dBegininput iterator to the initial position of the sequence with the pc4d/rgba data.
[out]rcBeginoutput iterator to the initial position of the sequence with the chosen rgba/pc4d data.
[out]rdBeginoutput iterator to the initial position of the sequence with the chosen pc4d/rgba data.
[in]nnumber of points in the input sequences.
[in]rnnumber of points in the output sequences.
TEST ( RBC  ,
rbcRGBD   
)

Tests the RBCSearch class on an 8-D point cloud.

The class computes the NNs of a set of queries.

Variable Documentation

const std::vector<std::string> kernel_files
Initial value:
= { "kernels/rbc_kernels.cl",
"kernels/scan_kernels.cl",
"kernels/reduce_kernels.cl" }
bool profiling