Example #1
0
ExpressionList *
CracksClipperCommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md)
{
    int i;
    char name[1024], defn[1024];
    ExpressionList *el = new ExpressionList;
    int numMeshes = md->GetNumMeshes();
    for (i = 0 ; i < numMeshes ; i++)
    {
        const avtMeshMetaData *mmd = md->GetMesh(i);
        {
            Expression e2;
            sprintf(name, "operators/CracksClipper/%s/den", mmd->name.c_str());
            e2.SetName(name);
            e2.SetType(Expression::ScalarMeshVar);
            e2.SetFromOperator(true);
            e2.SetOperatorName("CracksClipper");
            sprintf(defn, "cell_constant(%s, 0.)", mmd->name.c_str());
            e2.SetDefinition(defn);
            el->AddExpressions(e2);
        }
    }
    const ExpressionList &oldEL = md->GetExprList();
    for (i = 0 ; i < oldEL.GetNumExpressions() ; i++)
    {
        const Expression &e = oldEL.GetExpressions(i);
    }
    return el;
}
ExpressionList *
ExtractPointFunction2DCommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md)
{
    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();

        Expression e;
        sprintf(name, "operators/ExtractPointFunction2D/%s", array);
        e.SetName(name);
        e.SetType(Expression::ScalarMeshVar);
        e.SetFromOperator(true);
        e.SetOperatorName("ExtractPointFunction2D");
        sprintf(defn, "cell_constant(<%s>, 0)", mesh);
        e.SetDefinition(defn);
        el->AddExpressions(e);
    }

    const ExpressionList &oldEL = md->GetExprList();
    for (int i = 0 ; i < oldEL.GetNumExpressions() ; i++)
    {
        const Expression &e = oldEL.GetExpressions(i);
        if (e.GetType() == Expression::ArrayMeshVar)
        {
            {
                if (e.GetFromOperator())
                    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);
            }
        }
    }

    return el;
}
ExpressionList * 
FTLECommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md)
{
    int i;
    char name[1024], defn[1024];
    ExpressionList *el = new ExpressionList;
    int numVectors = md->GetNumVectors();
    for (i = 0 ; i < numVectors ; i++)
    {
        const avtVectorMetaData *mmd = md->GetVector(i);
        {
            Expression e2;
            sprintf(name, "operators/FTLE/%s", mmd->name.c_str());
            e2.SetName(name);
            e2.SetType(Expression::ScalarMeshVar);
            e2.SetFromOperator(true);
            e2.SetOperatorName("FTLE");
            sprintf(defn, "cell_constant(<%s>, 0.)", mmd->name.c_str());
            e2.SetDefinition(defn);
            el->AddExpressions(e2);
        }
    }
    const ExpressionList &oldEL = md->GetExprList();
    for (i = 0 ; i < oldEL.GetNumExpressions() ; i++)
    {
        const Expression &e = oldEL.GetExpressions(i);
        if (e.GetType() == Expression::VectorMeshVar)
        {
            {
                if (e.GetFromOperator())
                    continue; // weird ordering behavior otherwise
                Expression e2;
                sprintf(name, "operators/FTLE/%s", e.GetName().c_str());
                e2.SetName(name);
                e2.SetType(Expression::ScalarMeshVar);
                e2.SetFromOperator(true);
                e2.SetOperatorName("FTLE");
                sprintf(defn, "cell_constant(<%s>, 0.)", e.GetName().c_str());
                e2.SetDefinition(defn);
                el->AddExpressions(e2);
            }
        }
    }
    return el;
}
Example #4
0
void
VisItDataServerPrivate::DefineVectorExpression(const std::string &name, const std::string &def)
{
    Expression expr;
    expr.SetName(name);
    expr.SetDefinition(def);
    expr.SetType(Expression::VectorMeshVar);
    exprList.AddExpressions(expr);
}
Example #5
0
// ****************************************************************************
// Method:  ModelFitCommonPluginInfo::GetCreatedExpressions
//
// Purpose:
//   Get the expressions this operator can generate.
//
// Arguments:
//   md         the metadata to create our expressions around
//
// Programmer:  Rob Sisneros
// Creation:    omitted
//
//  Modifications:
//   Jeremy Meredith, Thu Jan 12 13:28:49 EST 2012
//   Some files, like curves, don't have expressions.  Don't assume
//   we have any meshes in our file.
//   
// ****************************************************************************
ExpressionList *
ModelFitCommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md)
{
    int i;
    int numMeshes = md->GetNumMeshes();
    if (numMeshes == 0)
        return NULL;

    Expression *e = new Expression();

    char mesh[1024];
    strcpy(mesh, md->GetMesh(0)->name.c_str());

    std::string varname = "operators/ModelFit/model"; //(";
    //varname += mesh;
    //varname += ")";
    e->SetName(varname);
    char defn[1024];
    sprintf(defn, "point_constant(%s, 0)", mesh);
    e->SetDefinition(defn);
    e->SetMeshName(std::string(mesh));
    e->SetType(Expression::ScalarMeshVar);
    e->SetFromOperator(true);
    e->SetOperatorName("ModelFit");
    ExpressionList *expressions = new ExpressionList;
    expressions->AddExpressions(*e);
    delete e;

    e = new Expression();

    varname = "operators/ModelFit/distance"; //(";
    //varname += mesh;
    //varname += ")";
    e->SetName(varname);
    sprintf(defn, "point_constant(%s, 0)", mesh);
    e->SetDefinition(defn);
    e->SetMeshName(std::string(mesh));
    e->SetType(Expression::ScalarMeshVar);
    e->SetFromOperator(true);
    e->SetOperatorName("ModelFit");
    expressions->AddExpressions(*e);

    return expressions;
}
Example #6
0
void
AddExpression(ExpressionList &new_list, std::string &var, int time)
{
    char exp_name[1024];
    SNPRINTF(exp_name, 1024, "AVT_TRACE_HIST_%s", var.c_str());
    char exp_defn[1024];
    const char *meshname = var.c_str(); // The expression language will let
                                        // you put in a variable for the
                                        // meshname since it can use that to 
                                        // find the meshname.
    meshname = "quadmesh";
    SNPRINTF(exp_defn, 1024, "pos_cmfe(<[%d]i:%s>, %s, 0.)", time, 
                                                var.c_str(), meshname);

    Expression exp;
    exp.SetName(exp_name);
    exp.SetDefinition(exp_defn);
    exp.SetType(Expression::Unknown);
    new_list.AddExpressions(exp);
}
ExpressionList * 
SurfaceNormalCommonPluginInfo::GetCreatedExpressions(const avtDatabaseMetaData *md)
{
    int i;
    char name[1024], defn[1024];
    ExpressionList *el = new ExpressionList;
    int numMeshes = md->GetNumMeshes();
    for (i = 0 ; i < numMeshes ; i++)
    {
        const avtMeshMetaData *mmd = md->GetMesh(i);
        {
            Expression e2;
            sprintf(name, "operators/SurfaceNormal/%s", mmd->name.c_str());
            e2.SetName(name);
            e2.SetType(Expression::VectorMeshVar);
            e2.SetFromOperator(true);
            e2.SetOperatorName("SurfaceNormal");
            sprintf(defn, "cell_constant(<%s>, 0.)", mmd->name.c_str());
            e2.SetDefinition(defn);
            el->AddExpressions(e2);
        }
    }
    return el;
}
avtContract_p
avtVolumeFilter::ModifyContract(avtContract_p contract)
{
    avtContract_p newcontract = NULL;

    if (primaryVariable != NULL)
    {
        delete [] primaryVariable;
    }

    avtDataRequest_p ds = new avtDataRequest(contract->GetDataRequest());
    const char *var = ds->GetVariable();

    bool setupExpr = false;
    char exprDef[128];
    std::string exprName = (std::string)"_expr_" + (std::string)var;

    if (atts.GetScaling() == VolumeAttributes::Linear)
    {
#ifdef HAVE_LIBSLIVR
        if ((atts.GetRendererType() == VolumeAttributes::RayCastingSLIVR) ||
            ((atts.GetRendererType() == VolumeAttributes::RayCasting) && (atts.GetSampling() == VolumeAttributes::Trilinear)))
            ds->SetDesiredGhostDataType(GHOST_ZONE_DATA);
#endif
        newcontract = new avtContract(contract, ds);
        primaryVariable = new char[strlen(var)+1];
        strcpy(primaryVariable, var);
    }
    else if (atts.GetScaling() == VolumeAttributes::Log)
    {
        setupExpr = true;
        if (atts.GetUseColorVarMin())
        {
            char m[16];
            SNPRINTF(m, 16, "%f", atts.GetColorVarMin());
            SNPRINTF(exprDef, 128, "log10withmin(<%s>, %s)", var, m);
        }
        else
        {
            SNPRINTF(exprDef, 128, "log10(<%s>)", var);
        }
        avtDataRequest_p nds = new avtDataRequest(exprName.c_str(),
                               ds->GetTimestep(), ds->GetRestriction());
        nds->AddSecondaryVariable(var);
#ifdef HAVE_LIBSLIVR
        if ((atts.GetRendererType() == VolumeAttributes::RayCastingSLIVR) ||
            ((atts.GetRendererType() == VolumeAttributes::RayCasting) && (atts.GetSampling() == VolumeAttributes::Trilinear)))
            nds->SetDesiredGhostDataType(GHOST_ZONE_DATA);
#endif
        newcontract = new avtContract(contract, nds);
        primaryVariable = new char[exprName.size()+1];
        strcpy(primaryVariable, exprName.c_str());
    }
    else // VolumeAttributes::Skew)
    {
        setupExpr = true;
        SNPRINTF(exprDef, 128, "var_skew(<%s>, %f)", var,
                 atts.GetSkewFactor());
        avtDataRequest_p nds =
            new avtDataRequest(exprName.c_str(),
                               ds->GetTimestep(), ds->GetRestriction());
        nds->AddSecondaryVariable(var);
#ifdef HAVE_LIBSLIVR
        if ((atts.GetRendererType() == VolumeAttributes::RayCastingSLIVR) ||
            ((atts.GetRendererType() == VolumeAttributes::RayCasting) && (atts.GetSampling() == VolumeAttributes::Trilinear)))
            nds->SetDesiredGhostDataType(GHOST_ZONE_DATA);
#endif
        newcontract = new avtContract(contract, nds);
        primaryVariable = new char[strlen(exprName.c_str())+1];
        strcpy(primaryVariable, exprName.c_str());
    }

    if (setupExpr)
    {
        ExpressionList *elist = ParsingExprList::Instance()->GetList();
        Expression *e = NULL;
        for (int i = 0 ; i < elist->GetNumExpressions() ; i++)
        {
            if (elist->GetExpressions(i).GetName() == exprName)
            {
                e = &(elist->GetExpressions(i));
                break;
            }
        }
        bool shouldDelete = false;
        if (e == NULL)
        {
            e = new Expression();
            shouldDelete = true;
        }

        e->SetName(exprName.c_str());
        e->SetDefinition(exprDef);
        e->SetType(Expression::ScalarMeshVar);
        elist->AddExpressions(*e);
        if (shouldDelete)
            delete e;
    }

    newcontract->NoStreaming();
    newcontract->SetHaveRectilinearMeshOptimizations(true);
    return newcontract;
}
Example #9
0
avtContract_p
avtVectorFilter::ModifyContract(avtContract_p contract)
{
    avtContract_p rv = contract;
    avtDataRequest_p ds = contract->GetDataRequest();

    //
    // Create the expression definition
    //
    string edef = string("magnitude(<") + ds->GetVariable() + string(">)");


    ExpressionList *elist = ParsingExprList::Instance()->GetList();
    Expression *e = new Expression();
        
    e->SetName(magVarName.c_str());
    e->SetDefinition(edef.c_str());
    e->SetType(Expression::ScalarMeshVar);
    elist->AddExpressions(*e);
    delete e;

    // Create a new dcontract so that we can add the secondary var.
    avtDataRequest_p nds = new avtDataRequest(ds->GetVariable(),
                ds->GetTimestep(), ds->GetRestriction());
    nds->AddSecondaryVariable(magVarName.c_str());
    rv = new avtContract(contract, nds);
    rv->SetCalculateVariableExtents(magVarName, true);
    
    // If we're not using the stride, then we have to calculate
    // the per-domain vectorc count by dividing by the number of
    // domains, which we can't calculate if we're streaming.
    if (!useStride)
        rv->NoStreaming();

    avtDataAttributes &data = GetInput()->GetInfo().GetAttributes();
    if (contract->GetDataRequest()->MayRequireZones() || 
        contract->GetDataRequest()->MayRequireNodes() ||
        origOnly)
    {
        keepNodeZone = true;
        if (data.ValidActiveVariable())
        {
            if (data.GetCentering() == AVT_NODECENT)
            {
                rv->GetDataRequest()->TurnNodeNumbersOn();
            }
            else if (data.GetCentering() == AVT_ZONECENT)
            {
                rv->GetDataRequest()->TurnZoneNumbersOn();
            }
        }
        else 
        {
            // canot determine variable centering, so turn on both
            // node numbers and zone numbers.
            rv->GetDataRequest()->TurnNodeNumbersOn();
            rv->GetDataRequest()->TurnZoneNumbersOn();
        }
    }
    else
    {
        keepNodeZone = false;
    }

    return rv;
}
avtContract_p
avtCracksClipperFilter::ModifyContract(avtContract_p inContract)
{
    calculateDensity = false;

    if (strncmp(pipelineVariable, "operators/CracksClipper",
                strlen("operators/CracksClipper")) == 0)
    {
        calculateDensity = true;
        varname = pipelineVariable;
    }

    // Retrieve secondary variables, if any, to pass along to the 
    // newly created DataSpec
    avtDataRequest_p inDR = inContract->GetDataRequest();
    avtDataRequest_p outDR; 
    avtDataAttributes &inAtts = GetInput()->GetInfo().GetAttributes();
    if (calculateDensity)
    {
        outDR = new avtDataRequest(inDR, inAtts.GetMeshname().c_str());   
    }
    else
    {
        outDR = new avtDataRequest(inDR);
    }


    std::vector<CharStrRef> vars2 = inDR->GetSecondaryVariablesWithoutDuplicates();

    // Add any previously existing SecondaryVariables.
    for (size_t i = 0; i < vars2.size(); i++)
    {
        outDR->AddSecondaryVariable(*(vars2[i]));
    }
    // Add secondary variables necessary for CracksClipper
    outDR->AddSecondaryVariable(atts.GetCrack1Var().c_str());
    outDR->AddSecondaryVariable(atts.GetCrack2Var().c_str());
    outDR->AddSecondaryVariable(atts.GetCrack3Var().c_str());
    outDR->AddSecondaryVariable(atts.GetStrainVar().c_str());

    if (calculateDensity)
    {
        outDR->AddSecondaryVariable(atts.GetInMassVar().c_str());
    }


    ExpressionList *elist = ParsingExprList::Instance()->GetList();
    Expression *e = new Expression();

    std::string edef = std::string("volume2(<") + inAtts.GetMeshname() + 
                       std::string(">)");
    e->SetName("cracks_vol");
    e->SetDefinition(edef.c_str());
    e->SetType(Expression::ScalarMeshVar);
    elist->AddExpressions(*e);
    delete e;

    outDR->AddSecondaryVariable("cracks_vol");


    avtContract_p rv = new avtContract(inContract, outDR);

    //
    // Since this filter 'clips' the dataset, the zone and possibly
    // node numbers will be invalid, request them when needed.
    //
    if (inContract->GetDataRequest()->MayRequireZones() || 
        inContract->GetDataRequest()->MayRequireNodes())
    {
        if (inAtts.ValidActiveVariable())
        {
            if (inAtts.GetCentering() == AVT_NODECENT)
            {
                rv->GetDataRequest()->TurnNodeNumbersOn();
            }
            else if (inAtts.GetCentering() == AVT_ZONECENT)
            {
                rv->GetDataRequest()->TurnZoneNumbersOn();
            }
        }
        else 
        {
            // canot determine variable centering, so turn on both
            // node numbers and zone numbers.
            rv->GetDataRequest()->TurnNodeNumbersOn();
            rv->GetDataRequest()->TurnZoneNumbersOn();
        }
    }
    return rv; 
}
Example #11
0
int main(int argc, char *argv[])
{
    int  i;

    bool parallel = false;
#ifdef PARALLEL
    parallel = true;
    PAR_Init(argc, argv);
#endif
    VisItInit::Initialize(argc, argv);

    //
    // Initialize the plugin readers.
    //
    DatabasePluginManager *dbmgr = new DatabasePluginManager;
    dbmgr->Initialize(DatabasePluginManager::Engine, parallel);
    dbmgr->LoadPluginsNow();
    if (PAR_Rank() == 0)
        cerr << endl; // whitespace after some expected plugin loading errors

    if (argc < 4)
    {
        UsageAndExit(dbmgr, argv[0]);
    }

    string assumedFormat = "";
    bool noOptions = false;
    bool doClean = false;
    bool disableMIR = false;
    bool disableExpressions = false;
    vector<string> vars;
    int target_chunks = -1;
    bool outputZonal = false;
    long long target_zones = -1;
    //EngineDatabasePluginInfo *edpir = NULL;
    if (argc > 4)
    {
        for (int i = 4 ; i < argc ; i++)
        {
            if (strcmp(argv[i], "-clean") == 0)
                doClean = true;
            else if (strcmp(argv[i], "-nomir") == 0)
                disableMIR = true;
            else if (strcmp(argv[i], "-noexpr") == 0)
                disableExpressions = true;
            else if (strcmp(argv[i], "-variable") == 0)
            {
                if ((i+1) >= argc)
                    UsageAndExit(dbmgr, argv[0]);
                i++;
                vars.push_back(argv[i]);
            }
            else if (strcmp(argv[i], "-output_zonal") == 0)
            {
                outputZonal = true;
            }
            else if (strcmp(argv[i], "-target_chunks") == 0)
            {
                if ((i+1) >= argc)
                    UsageAndExit(dbmgr, argv[0]);
                i++;
                target_chunks = atoi(argv[i]);
            }
            else if (strcmp(argv[i], "-target_zones") == 0)
            {
                if ((i+1) >= argc)
                    UsageAndExit(dbmgr, argv[0]);
                i++;
                target_zones = 0;
                int nchars = strlen(argv[i]);
                for (int j = 0 ; j < nchars ; j++)
                {
                    if (isdigit(argv[i][j]))
                    {
                        target_zones *= 10;
                        target_zones += argv[i][j] - '0';
                    }
                }
            }
            else if (strcmp(argv[i], "-assume_format") == 0)
            {
                if ((i+1) >= argc)
                    UsageAndExit(dbmgr, argv[0]);
                i++;

                assumedFormat = argv[i];
            }
            else if (strcmp(argv[i], "-no_options") == 0)
                noOptions = true;

            else
            {
                //Ignore....
            }
        }
    }


    //
    // Handle read options if we need to.
    //
    HandleReadOptions(noOptions, dbmgr, argv[0], assumedFormat);

    //
    // Instantiate the database.
    //
    avtDatabase *db = NULL;
    vector<string> pluginList;
    TRY
    {
        if (strstr(argv[1], ".visit") != NULL)
            db = avtDatabaseFactory::VisitFile(dbmgr, argv[1], 0, pluginList);
        else
            db = avtDatabaseFactory::FileList(dbmgr, argv+1, 1, 0, pluginList);
    }
    CATCHALL
    {
        if (PAR_Rank() == 0)
            cerr << "The file " << argv[1] << " does not exist or could "
                 << "not be opened." << endl;
        PAR_Exit();
        exit(EXIT_FAILURE);
    }
    ENDTRY

    if (db == NULL)
    {
        if (PAR_Rank() == 0)
            cerr << "Could not open file " << argv[1] << ".  Tried using plugins ";
        for (size_t i = 0 ; i < pluginList.size() ; i++)
        {
            if (PAR_Rank() == 0)
            {
                cerr << pluginList[i];
                if (i != pluginList.size()-1)
                    cerr << ", ";
                else
                    cerr << endl;
            }
        }
    }

    //
    // Set the write options as the default.
    // Walk through the write options and have the user iterate over them
    // from the command line. [MCM] I believe predicating ONLY the FillOptions...
    // call on value of noOptions permits write options to flow from config
    // file settings correctly.
    //
    EngineDatabasePluginInfo *edpi = GetPluginInfo(dbmgr, argv[0], argv[3]);
    DBOptionsAttributes *opts = edpi->GetWriteOptions();
    if (!noOptions)
        FillOptionsFromCommandline(opts);
    edpi->SetWriteOptions(opts);

    //
    // Make sure this format has a writer.
    //
    avtDatabaseWriter *wrtr = edpi->GetWriter();
    if (wrtr == NULL)
    {
        if (PAR_Rank() == 0)
            cerr << "No writer defined for file type " << argv[3] << ".\n"
                 << "Please see a VisIt developer." << endl;
        UsageAndExit(dbmgr, argv[0]);
    }
    if (doClean)
        wrtr->SetShouldAlwaysDoMIR(doClean);
    if (disableMIR)
        wrtr->SetShouldNeverDoMIR(disableMIR);
    if (disableExpressions)
        wrtr->SetShouldNeverDoExpressions(disableExpressions);
    if (target_zones > 0)
    {
        bool canDoIt = wrtr->SetTargetZones(target_zones);
        if (!canDoIt)
        {
            if (PAR_Rank() == 0)
                cerr << "This writer does not support the \"-target_zones\" option"
                     << endl;
            UsageAndExit(dbmgr, argv[0]);
        }
    }
    if (target_chunks > 0)
    {
        bool canDoIt = wrtr->SetTargetChunks(target_chunks);
        if (!canDoIt)
        {
            if (PAR_Rank() == 0)
                cerr << "This writer does not support the \"-target_chunks\" "
                     << "option" << endl;
            UsageAndExit(dbmgr, argv[0]);
        }
    }
    if (outputZonal)
    {
        bool canDoIt = wrtr->SetOutputZonal(outputZonal);
        if (!canDoIt)
        {
            if (PAR_Rank() == 0)
                cerr << "This writer does not support the \"-output_zonal\" "
                     << "option" << endl;
            UsageAndExit(dbmgr, argv[0]);
        }
    }

    //
    // Figure out which mesh to operate on.
    // Assume MetaData for timestep 0 is sufficient for what we need here
    //
    const avtDatabaseMetaData *md = db->GetMetaData(0);
    //const avtMeshMetaData *mmd = NULL;
    string meshname = "";
    if (md->GetNumMeshes() >= 1)
    {
        if (md->GetNumMeshes() > 1)
        {
            if (PAR_Rank() == 0)
            {
                cerr << "There are multiple meshes in the file.  This program can "
                     << "only\nhandle one mesh at a time.  I am using mesh: ";
                cerr << md->GetMesh(0)->name << endl;
            }
        }
        meshname = md->GetMesh(0)->name;
    }
    else if (md->GetNumMeshes() < 1)
    {
        if (md->GetNumCurves() > 0)
        {
            if (PAR_Rank() == 0)
                cerr << "Cannot find any meshes, converting curves." << endl;
            meshname = md->GetCurve(0)->name;
        }
        else
        {
            if (PAR_Rank() == 0)
                cerr << "Cannot find any valid meshes or curves to convert.\n"
                     << "Giving up." << endl;
            PAR_Exit();
            exit(EXIT_FAILURE);
        }
    }

#ifndef DISABLE_EXPRESSIONS
    //
    // Hook up the expressions we have associated with the database, so
    // we can get those as well.
    //
    Parser *p = new ExprParser(new avtExprNodeFactory());
    ParsingExprList *l = new ParsingExprList(p);
    ExpressionList *list = l->GetList();
    for (i = 0 ; i < md->GetNumberOfExpressions() ; i++)
    {
        const Expression *e = md->GetExpression(i);
        list->AddExpressions(*e);
    }
#endif

    if (PAR_Rank() == 0)
        cerr << "Operating on " << md->GetNumStates() << " timestep(s)." << endl;
    for (i = 0 ; i < md->GetNumStates() ; i++)
    {
         avtDataObject_p dob = db->GetOutput(meshname.c_str(), i);
#ifndef DISABLE_EXPRESSIONS
         avtExpressionEvaluatorFilter eef;
         eef.SetInput(dob);
         dob = eef.GetOutput();
#endif
         wrtr->SetInput(dob);

         char filename[1024];
         if (strstr(argv[2], "%") != NULL)
             sprintf(filename, argv[2], i);
         else if (md->GetNumStates() == 1)
             strcpy(filename, argv[2]);
         else
             sprintf(filename, "%04d.%s", i, argv[2]);
        
         TRY
         {
             if (vars.size())
             {
                 wrtr->Write("", filename, md, vars, false);
             }
             else
             {
                 wrtr->Write(filename, md);
             } 
         }
         CATCH2(VisItException, e)
         {
             if (PAR_Rank() == 0)
             {
                 cerr << "Error encountered.  Unable to write files." << endl;
                 cerr << "Error was: " << endl;
                 cerr << e.Message() << endl;
             }
             break;
         }
         ENDTRY
    }

    delete dbmgr;

#ifdef PARALLEL
    PAR_Exit();
#endif

    return 0;
}