avtDataTree_p
avtDataTreeIterator::ExecuteDataTree(vtkDataSet* ds, int dom, std::string label)
{
    vtkDataSet *out_ds = ExecuteData(ds, dom, label);
    if (out_ds == NULL)
    {
        return NULL;
    }

    return new avtDataTree(out_ds, dom, label);
}
avtDataTree_p
avtDataTreeIterator::ExecuteDataTree(avtDataRepresentation *in_dr)
{
    avtDataRepresentation *out_dr = ExecuteData(in_dr);

    if (out_dr == NULL)
    {
        return NULL;
    }

    // This code ends up creating a copy of out_dr in the data tree.
    avtDataTree_p retval = new avtDataTree(out_dr);

    // If the derived type created a new avtDataRepresentation instance then
    // it's been copied in the avtDataTree. We need to remove the instance
    // that was returned or we'll end up with a VTK reference count leak.
    if(out_dr != in_dr)
    {
        delete out_dr;
    }

    return retval;
}