Uploaded image for project: 'OpenVDB'
  1. OpenVDB
  2. OVDB-38

Modernization of some Point Methods

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • Points

      A few improvements to modernize some of the existing point methods.

      Specifically:

      1) There's a common convention in the core library that many free functions take a "threaded" parameter to allow for quickly enabling/disabling threading, which defaults to true.

      2) It would be good to switch to LeafManager::foreach() and LeafManager::reduce() where possible as this simplifies the implementation and makes #1 possible with less code.

      3) Switching to lambdas instead of using a separate struct in very simple cases generates fewer lines and more readable code.

      Here's an example of the implementation of all three improvements with an existing method from points/PointAttribute.h:

      template <typename PointDataTreeT>
      inline void compactAttributes(PointDataTreeT& tree, bool threaded = true)
      {
          tree::LeafManager<PointDataTreeT> leafManager(tree);
          leafManager.foreach(
              [&](typename PointDataTree::LeafNodeType& leaf, size_t /*idx*/) {
                  leaf.compactAttributes();
              },
          threaded);
      }

            Unassigned Unassigned
            danrbailey danrbailey
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: