コード例 #1
0
void
avtModelBasedClusteringFilter::Execute()
{
    std::string vlibdir = GetVisItLibraryDirectory() + VISIT_SLASH_CHAR + "r_support";
    std::string vlibrdir  = vlibdir  + VISIT_SLASH_CHAR + "Rscripts" + VISIT_SLASH_CHAR;
    
    avtRModelBasedClusteringFilter *f = new avtRModelBasedClusteringFilter;
    f->codeDir = vlibrdir;
    f->atts = atts;

    f->SetInput(GetInput());
    
    avtContract_p spec = GetInput()->GetOriginatingSource()->GetGeneralContract();
    avtDataObject_p dob = f->GetOutput();

    dob->Update(spec);
    avtDataTree_p tree = f->GetTypedOutput()->GetDataTree();

    //Set the output variable properly.
    int nleaves;
    vtkDataSet **leaves = tree->GetAllLeaves(nleaves);
    for (int i = 0; i < nleaves; i++)
    {
        if (leaves[i]->GetPointData()->GetScalars())
            leaves[i]->GetPointData()->GetScalars()->SetName(pipelineVariable);
        else if (leaves[i]->GetCellData()->GetScalars())
            leaves[i]->GetCellData()->GetScalars()->SetName(pipelineVariable);
    }
    delete [] leaves;

    SetOutputDataTree(tree);
    delete f;
}
コード例 #2
0
std::string
GetVisItLibraryDirectory()
{
    return GetVisItLibraryDirectory(VISIT_VERSION);
}
コード例 #3
0
void
avtPeaksOverThresholdFilter::Execute()
{
    if (atts.GetDataAnalysisYearRangeEnabled())
    {
        if (atts.GetDataYearBegin() < atts.GetDataAnalysisYear1() ||
                atts.GetDataYearBegin() > atts.GetDataAnalysisYear2())
        {
            EXCEPTION1(ImproperUseException, "Invalid data analysis begin year.");
        }

        if (atts.GetDataAnalysisYear1() >= atts.GetDataAnalysisYear2())
        {
            EXCEPTION1(ImproperUseException, "Invalid data analysis year range.");
        }
        if (atts.GetDataAnalysisYear1() < atts.GetDataYearBegin() ||
                atts.GetDataAnalysisYear2() < atts.GetDataYearBegin())
        {
            EXCEPTION1(ImproperUseException, "Invalid data analysis year range.");
        }
    }
    if (atts.GetEnsemble())
    {
        if (!atts.GetDataAnalysisYearRangeEnabled())
        {
            EXCEPTION1(ImproperUseException, "Ensemble usage requires year range to be set.");
        }
    }

    int t1 = visitTimer->StartTimer();
    avtRPOTFilter *f = new avtRPOTFilter();

    std::string vlibdir = GetVisItLibraryDirectory() + VISIT_SLASH_CHAR + "r_support";
    std::string vlibrdir  = vlibdir  + VISIT_SLASH_CHAR + "Rscripts" + VISIT_SLASH_CHAR;
    f->codeDir = vlibrdir;
    f->atts = atts;

    f->SetInput(GetInput());

    avtContract_p spec = GetInput()->GetOriginatingSource()->GetGeneralContract();
    avtDataObject_p dob = f->GetOutput();

    dob->Update(spec);
    avtDataTree_p tree = f->GetTypedOutput()->GetDataTree();

    visitTimer->StopTimer(t1, "avtPeaksOverThreshold: call avtRPOTFilter");

    //Set the output variable properly.
    int nleaves;
    vtkDataSet **leaves = tree->GetAllLeaves(nleaves);
    for (int i = 0; i < nleaves; i++)
    {
        if (leaves[i]->GetPointData()->GetScalars())
            leaves[i]->GetPointData()->GetScalars()->SetName(pipelineVariable);
        else if (leaves[i]->GetCellData()->GetScalars())
            leaves[i]->GetCellData()->GetScalars()->SetName(pipelineVariable);
    }
    delete [] leaves;

    SetOutputDataTree(tree);
    delete f;
}