00001 /* 00002 00003 Copyright (c) 2015, Simon Lynen, Google Inc. 00004 You can contact the author at <slynen at google dot com> 00005 00006 All rights reserved. 00007 00008 Redistribution and use in source and binary forms, with or without 00009 modification, are permitted provided that the following conditions are met: 00010 * Redistributions of source code must retain the above copyright 00011 notice, this list of conditions and the following disclaimer. 00012 * Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in the 00014 documentation and/or other materials provided with the distribution. 00015 * Neither the name of the <organization> nor the 00016 names of its contributors may be used to endorse or promote products 00017 derived from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY 00023 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 00030 */ 00031 00032 #include "nabo/nabo.h" 00033 00034 /* 00035 * These tests ensure that the instantiation of Nabo Trees with non-matching 00036 * matrix types is not allowed. 00037 */ 00038 template <typename MatrixType> 00039 int testFunction() 00040 { 00041 MatrixType M = MatrixType::Random(3, 100); 00042 MatrixType q = MatrixType::Random(3, 5); 00043 00044 #ifdef NABO_TYPE_CREATE 00045 Nabo::NNSearchF* nns = Nabo::NNSearchF::create(M); 00046 #endif // NABO_TYPE_CREATE 00047 00048 #ifdef NABO_TYPE_BRUTE_FORCE 00049 Nabo::NNSearchF* nns = Nabo::NNSearchF::createBruteForce(M); 00050 #endif // NABO_TYPE_BRUTE_FORCE 00051 00052 #ifdef NABO_TYPE_LINEAR_HEAP 00053 Nabo::NNSearchF* nns = Nabo::NNSearchF::createKDTreeLinearHeap(M); 00054 #endif // NABO_TYPE_TREE_HEAP 00055 00056 #ifdef NABO_TYPE_TREE_HEAP 00057 Nabo::NNSearchF* nns = Nabo::NNSearchF::createKDTreeTreeHeap(M); 00058 #endif // NABO_TYPE_TREE_HEAP 00059 delete nns; 00060 return 0; 00061 } 00062 int main(int /*argc*/, char** /*argv*/) 00063 { 00064 // Ensure that the test as such compiles. 00065 #ifdef NABO_EIGEN_DYNAMIC_TYPE 00066 int value = testFunction<Eigen::MatrixXf>(); 00067 #endif // NABO_EIGEN_DYNAMIC_TYPE 00068 00069 #ifdef NABO_EIGEN_SEMI_DYNAMIC_TYPE 00070 int value = testFunction<Eigen::Matrix<float, 5, Eigen::Dynamic> >(); 00071 #endif // NABO_EIGEN_SEMI_DYNAMIC_TYPE 00072 return value; 00073 }