Skip to content

Octree Precompile #1639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/src/openni_change_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <pcl/io/openni_grabber.h>
#include <pcl/io/openni_grabber.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_pointcloud_changedetector.h>
#include <pcl/filters/extract_indices.h>

#include <pcl/console/parse.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_pointcloud_changedetector.h>

#include <iostream>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>

#include <iostream>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion features/include/pcl/features/impl/gfpfh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#define PCL_FEATURES_IMPL_GFPFH_H_

#include <pcl/features/gfpfh.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>
#include <pcl/common/eigen.h>

Expand Down
2 changes: 1 addition & 1 deletion filters/include/pcl/filters/impl/morphological_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include <pcl/common/common.h>
#include <pcl/common/io.h>
#include <pcl/filters/morphological_filter.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>

///////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
#define PCL_WORLD_MODEL_H_

#include <pcl/common/impl/common.hpp>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_impl.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/filter_indices.h>
#include <pcl/filters/crop_box.h>
Expand Down
4 changes: 2 additions & 2 deletions gpu/octree/test/test_approx_nearest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#pragma warning (disable: 4521)
#endif
#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>
#if defined _MSC_VER
#pragma warning (default: 4521)
#endif
Expand Down Expand Up @@ -146,4 +146,4 @@ TEST(PCL_OctreeGPU, approxNearesSearch)
cout << "count_pcl_better: " << count_pcl_better << endl;
cout << "avg_diff_pcl_better: " << diff_pcl_better << endl;

}
}
1 change: 0 additions & 1 deletion gpu/octree/test/test_bfrs_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#endif

#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>

#if defined _MSC_VER
#pragma warning (default: 4521)
Expand Down
2 changes: 1 addition & 1 deletion gpu/octree/test/test_host_radius_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>

#if defined _MSC_VER
#pragma warning (default: 4521)
Expand Down
4 changes: 2 additions & 2 deletions gpu/octree/test/test_knn_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#pragma warning (disable: 4521)
#endif
#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>
#include <pcl/octree/octree_search.h>
#if defined _MSC_VER
#pragma warning (default: 4521)
#endif
Expand Down Expand Up @@ -182,4 +182,4 @@ TEST(PCL_OctreeGPU, exactNeighbourSearch)
pairs_gpu.pop_back();
}
}
}
}
1 change: 0 additions & 1 deletion gpu/octree/test/test_radius_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#endif

#include <pcl/point_cloud.h>
#include <pcl/octree/octree.h>

#if defined _MSC_VER
#pragma warning (default: 4521)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#ifndef OCTREE_COMPRESSION_HPP
#define OCTREE_COMPRESSION_HPP

#include <pcl/octree/octree_pointcloud.h>
#include <pcl/compression/entropy_range_coder.h>

#include <iterator>
Expand All @@ -48,8 +47,6 @@
#include <iostream>
#include <stdio.h>

using namespace pcl::octree;

namespace pcl
{
namespace io
Expand Down
5 changes: 1 addition & 4 deletions io/src/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@
*
* Author: Julius Kammerl ([email protected])
*/

#define PCL_NO_PRECOMPILE
#include <pcl/impl/instantiate.hpp>
#include <pcl/point_types.h>

#include <pcl/octree/octree.h>
#include <pcl/octree/octree_impl.h>

#include <pcl/compression/entropy_range_coder.h>
#include <pcl/compression/impl/entropy_range_coder.hpp>

Expand Down
2 changes: 0 additions & 2 deletions octree/include/pcl/octree/impl/octree_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#include <vector>

#include <pcl/impl/instantiate.hpp>
#include <pcl/point_types.h>
#include <pcl/octree/octree.h>

namespace pcl
{
Expand Down
5 changes: 0 additions & 5 deletions octree/include/pcl/octree/impl/octree_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
#ifndef PCL_OCTREE_ITERATOR_HPP_
#define PCL_OCTREE_ITERATOR_HPP_

#include <vector>
#include <assert.h>

#include <pcl/common/common.h>

namespace pcl
{
namespace octree
Expand Down
3 changes: 1 addition & 2 deletions octree/include/pcl/octree/impl/octree_pointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
#ifndef PCL_OCTREE_POINTCLOUD_HPP_
#define PCL_OCTREE_POINTCLOUD_HPP_

#include <vector>
#include <assert.h>

#include <pcl/common/common.h>

#include <pcl/octree/impl/octree_base.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you not include octree_base.h instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit tricky.
Actually including neither octree_base.h nor octree_base.hpp should not be necessary at this point. But since OctreePointCloudAdjacency, for example, is used somewhere else in PCL with a custom LeafContainer and PCL_NO_PRECOMPILE is turned off, OctreePointCloudAdjacency is not instantiated for these LeafContainers. That's why octree_pointcloud_adjacency.hpp includes octree_pointcloud.hpp which in turn includes the octree_base.hpp in order to provide the implementation for that case.
However, perhaps it would make more sense to change the other code somewhere in PCL (don't look up the location, yet) to always include the required octree hpp files and remove the nested hpp includes in the octree module. That would yield a uniform include structure in the octree module.
Hope my thoughts are understandable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since OctreePointCloudAdjacency, for example, is used somewhere else in PCL with a custom LeafContainer and PCL_NO_PRECOMPILE is turned off, OctreePointCloudAdjacency is not instantiated for these LeafContainers.

Would it not make more sense to make the instantiation there (where the custom leaf container is used) then? The same way it is done in supervoxel clustering.

This comment of course entailing the change to the include structure in the octree module, to make it uniform with the rest of the library.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only point left to discuss right?


//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT, typename BranchContainerT, typename OctreeT>
Expand Down
11 changes: 10 additions & 1 deletion octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@
#ifndef PCL_OCTREE_POINTCLOUD_ADJACENCY_HPP_
#define PCL_OCTREE_POINTCLOUD_ADJACENCY_HPP_

#include <pcl/octree/octree_pointcloud_adjacency.h>
#include <pcl/console/print.h>
#include <pcl/common/geometry.h>
/*
* OctreePointCloudAdjacency is not precompiled, since it's used in other
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this makes sense.

* parts of PCL with custom LeafContainers. So if PCL_NO_PRECOMPILE is NOT
* used, octree_pointcloud_adjacency.h includes this file but octree_pointcloud.h
* would not include the implementation because it's precompiled. So we need to
* include it here "manually".
*/
#include <pcl/octree/impl/octree_pointcloud.hpp>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT, typename BranchContainerT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
#ifndef PCL_OCTREE_VOXELCENTROID_HPP
#define PCL_OCTREE_VOXELCENTROID_HPP

#include <pcl/octree/octree_pointcloud_voxelcentroid.h>
/*
* OctreePointCloudVoxelcontroid is not precompiled, since it's used in other
* parts of PCL with custom LeafContainers. So if PCL_NO_PRECOMPILE is NOT
* used, octree_pointcloud_voxelcentroid.h includes this file but octree_pointcloud.h
* would not include the implementation because it's precompiled. So we need to
* include it here "manually".
*/
#include <pcl/octree/impl/octree_pointcloud.hpp>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT, typename BranchContainerT> bool
Expand Down
7 changes: 2 additions & 5 deletions octree/include/pcl/octree/impl/octree_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,8 @@
#ifndef PCL_OCTREE_SEARCH_IMPL_H_
#define PCL_OCTREE_SEARCH_IMPL_H_

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

#include <pcl/common/common.h>
#include <assert.h>


//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT, typename BranchContainerT> bool
pcl::octree::OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::voxelSearch (const PointT& point,
Expand Down Expand Up @@ -864,4 +859,6 @@ pcl::octree::OctreePointCloudSearch<PointT, LeafContainerT, BranchContainerT>::g
return (voxel_count);
}

#define PCL_INSTANTIATE_OctreePointCloudSearch(T) template class PCL_EXPORTS pcl::octree::OctreePointCloudSearch<T>;

#endif // PCL_OCTREE_SEARCH_IMPL_H_
1 change: 1 addition & 0 deletions octree/include/pcl/octree/octree.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <pcl/octree/octree_pointcloud_pointvector.h>
#include <pcl/octree/octree_pointcloud_changedetector.h>
#include <pcl/octree/octree_pointcloud_voxelcentroid.h>
#include <pcl/octree/octree_pointcloud_adjacency.h>

#include <pcl/octree/octree_search.h>

Expand Down
14 changes: 7 additions & 7 deletions octree/include/pcl/octree/octree2buf_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@

#include <vector>

#include "octree_nodes.h"
#include "octree_container.h"
#include "octree_key.h"
#include "octree_iterator.h"
#include <pcl/octree/octree_nodes.h>
#include <pcl/octree/octree_container.h>
#include <pcl/octree/octree_key.h>
#include <pcl/octree/octree_iterator.h>

#include <stdio.h>
#include <string.h>

namespace pcl
{
Expand Down Expand Up @@ -920,7 +918,9 @@ namespace pcl
}
}

//#include "impl/octree2buf_base.hpp"
#ifdef PCL_NO_PRECOMPILE
#include <pcl/octree/impl/octree2buf_base.hpp>
#endif

#endif

13 changes: 7 additions & 6 deletions octree/include/pcl/octree/octree_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@
#ifndef PCL_OCTREE_TREE_BASE_H
#define PCL_OCTREE_TREE_BASE_H

#include <cstddef>
#include <vector>

#include "octree_nodes.h"
#include "octree_container.h"
#include "octree_key.h"
#include "octree_iterator.h"
#include <pcl/octree/octree_nodes.h>
#include <pcl/octree/octree_container.h>
#include <pcl/octree/octree_key.h>
#include <pcl/octree/octree_iterator.h>

namespace pcl
{
Expand Down Expand Up @@ -594,7 +593,9 @@ namespace pcl
}
}

//#include "impl/octree_base.hpp"
#ifdef PCL_NO_PRECOMPILE
#include <pcl/octree/impl/octree_base.hpp>
#endif

#endif

1 change: 0 additions & 1 deletion octree/include/pcl/octree/octree_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#ifndef PCL_OCTREE_CONTAINER_H
#define PCL_OCTREE_CONTAINER_H

#include <string.h>
#include <vector>
#include <cstddef>

Expand Down
12 changes: 7 additions & 5 deletions octree/include/pcl/octree/octree_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@
#include <vector>
#include <deque>

#include "octree_nodes.h"
#include "octree_key.h"

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/octree/octree_nodes.h>
#include <pcl/octree/octree_key.h>

#include <iterator>

Expand Down Expand Up @@ -619,5 +616,10 @@ namespace pcl
}
}

/*
* Note: Since octree iterators depend on octrees, don't precompile them.
*/
#include <pcl/octree/impl/octree_iterator.hpp>

#endif

2 changes: 0 additions & 2 deletions octree/include/pcl/octree/octree_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
#ifndef PCL_OCTREE_KEY_H
#define PCL_OCTREE_KEY_H

#include <string>

namespace pcl
{
namespace octree
Expand Down
3 changes: 0 additions & 3 deletions octree/include/pcl/octree/octree_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
#include <cstddef>

#include <assert.h>
#include <cstring>

#include <string.h>

#include <Eigen/Core>

Expand Down
6 changes: 1 addition & 5 deletions octree/include/pcl/octree/octree_pointcloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@
#ifndef PCL_OCTREE_POINTCLOUD_H
#define PCL_OCTREE_POINTCLOUD_H

#include "octree_base.h"
//#include "octree2buf_base.h"
#include <pcl/octree/octree_base.h>

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

#include <queue>
#include <vector>
#include <algorithm>
#include <iostream>

namespace pcl
{
Expand Down
7 changes: 2 additions & 5 deletions octree/include/pcl/octree/octree_pointcloud_adjacency.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
#ifndef PCL_OCTREE_POINTCLOUD_ADJACENCY_H_
#define PCL_OCTREE_POINTCLOUD_ADJACENCY_H_

#include <pcl/console/print.h>
#include <pcl/common/geometry.h>
#include <pcl/octree/boost.h>
#include <pcl/octree/octree_impl.h>
#include <pcl/octree/octree_pointcloud.h>
#include <pcl/octree/octree_pointcloud_adjacency_container.h>

#include <set>
Expand Down Expand Up @@ -247,9 +245,8 @@ namespace pcl

}

//#ifdef PCL_NO_PRECOMPILE
// Note: Do not precompile this octree type because it is typically used with custom leaf containers.
#include <pcl/octree/impl/octree_pointcloud_adjacency.hpp>
//#endif

#endif // PCL_OCTREE_POINTCLOUD_ADJACENCY_H_

3 changes: 2 additions & 1 deletion octree/include/pcl/octree/octree_pointcloud_changedetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
#ifndef PCL_OCTREE_CHANGEDETECTOR_H
#define PCL_OCTREE_CHANGEDETECTOR_H

#include "octree_pointcloud.h"
#include <pcl/octree/octree_pointcloud.h>
#include <pcl/octree/octree2buf_base.h>

namespace pcl
{
Expand Down
Loading