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

In-place LeafNode::ModifyValue

XMLWordPrintable

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

      The current implementation of LeafNode::modifyValue() copies the value before modifying:

      template<typename ModifyOp>
      void modifyValue(Index offset, const ModifyOp& op)
      {
          ValueType val = mBuffer[offset];
          op(val);
          mBuffer.setValue(offset, val);
          mValueMask.setOn(offset);
      }
      

      For a custom value type, this copy can prove expensive, so an in-place alternative would be more desirable:

      template<typename ModifyOp>
      void modifyValue(Index offset, const ModifyOp& op)
      {
          ValueType& val = mBuffer[offset];
          op(val);
          mValueMask.setOn(offset);
      }
      

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

              Created:
              Updated: