ExtractPointFunction2DAttributes.code 1.91 KB
Newer Older
1 2 3 4 5
Target: xml2info
Function: ExtractPointFunction2DCommonPluginInfo::GetCreatedExpressions
Declaration: virtual ExpressionList *GetCreatedExpressions(const avtDatabaseMetaData *);
Definition:
ExpressionList *
6
ExtractPointFunction2DCommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md) const
7 8 9 10 11 12 13 14 15 16
{
    char name[1024];
    char defn[1024];
    ExpressionList *el = new ExpressionList;

    for (int i = 0 ; i < md->GetNumArrays() ; i++)
    {
        const char *array = md->GetArrays(i).name.c_str();
        const char *mesh = md->GetArrays(i).meshName.c_str();

17 18 19
        if (md->GetArrays(i).hideFromGUI || !md->GetArrays(i).validVariable)
            continue;

20 21 22 23 24 25
        Expression e;
        sprintf(name, "operators/ExtractPointFunction2D/%s", array);
        e.SetName(name);
        e.SetType(Expression::ScalarMeshVar);
        e.SetFromOperator(true);
        e.SetOperatorName("ExtractPointFunction2D");
26
        sprintf(defn, "cell_constant(<%s>, 0)", mesh);
27 28 29 30
        e.SetDefinition(defn);
        el->AddExpressions(e);
    }

31 32 33 34 35 36 37
    const ExpressionList &oldEL = md->GetExprList();
    for (int i = 0 ; i < oldEL.GetNumExpressions() ; i++)
    {
        const Expression &e = oldEL.GetExpressions(i);
        if (e.GetType() == Expression::ArrayMeshVar)
        {
            {
38
                if (e.GetFromOperator() || e.GetAutoExpression())
39 40 41 42 43 44 45 46 47 48 49 50 51 52
                    continue; // weird ordering behavior otherwise
                Expression e2;
                sprintf(name, "operators/ExtractPointFunction2D/%s", e.GetName().c_str());
                e2.SetName(name);
                e2.SetType(Expression::ScalarMeshVar);
                e2.SetFromOperator(true);
                e2.SetOperatorName("ExtractPointFunction2D");
                sprintf(defn, "cell_constant(<%s>, 0.)", e.GetName().c_str());
                e2.SetDefinition(defn);
                el->AddExpressions(e2);
            }
        }
    }

53 54
    return el;
}