avtDataRequest_p
avtOriginatingSource::BalanceLoad(avtContract_p contract)
{
    bool usesAllDomains =contract->GetDataRequest()->GetSIL().UsesAllDomains();

    //
    // If it shouldn't use load balancing, then it has to do with auxiliary
    // data coming through our meta-data mechanism.  Calling InitPipeline
    // would change the data attributes and it also causes an unnecessary
    // callback to our progress mechanism.
    //
    if (contract->ShouldUseLoadBalancing())
    {
        InitPipeline(contract);
    }
    else if (contract->DoingOnDemandStreaming())
    {
        GetOutput()->GetInfo().GetValidity().SetWhetherStreaming(true);
    }

    //
    // Allow the load balancer to split the load across processors.
    //
    bool dataReplicationOccurred = false;
    avtDataRequest_p rv = NULL;
    if (!UseLoadBalancer())
    {
        debug5 << "This source should not load balance the data." << endl;
        rv = contract->GetDataRequest();
    }
    else if (! contract->ShouldUseLoadBalancing())
    {
        debug5 << "This pipeline has indicated that no load balancing should "
               << "be used." << endl;
        rv = contract->GetDataRequest();
    }
    else if (loadBalanceFunction != NULL)
    {
        debug5 << "Using load balancer to reduce data." << endl;
        rv = loadBalanceFunction(loadBalanceFunctionArgs, contract);
        dataReplicationOccurred =
                              contract->ReplicateSingleDomainOnAllProcessors();
    }
    else
    {
        debug1 << "No load balancer exists to reduce data." << endl;
        rv = contract->GetDataRequest();
    }

    //
    // Return the portion for this processor.
    //
    rv->SetUsesAllDomains(usesAllDomains);

    //
    // Tell the output if we are doing data replication.
    //
    if (dataReplicationOccurred)
        GetOutput()->GetInfo().GetAttributes().SetDataIsReplicatedOnAllProcessors(true);

    return rv;
}