int
simv2_UnstructuredMesh_setGlobalNodeIds(visit_handle h, visit_handle gln)
{
    int retval = VISIT_ERROR;
    VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setGlobalNodeIds");
    if(obj != NULL)
    {
        // Get the global node id information
        int owner, dataType, nComps, nTuples;
        void *data = 0;
        if(simv2_VariableData_getData(gln, owner, dataType, nComps, nTuples, data) == VISIT_ERROR)
        {
            VisItError("Could not obtain global node id information.");
            return VISIT_ERROR;
        }

        if(nComps != 1)
        {
            VisItError("Global node id arrays must have 1 component.");
            return VISIT_ERROR;
        }

        if(dataType != VISIT_DATATYPE_LONG && dataType != VISIT_DATATYPE_INT)
        {
            VisItError("Global node id arrays must contain either int or long elements.");
            return VISIT_ERROR;
        }

        obj->FreeGlobalNodeIds();
        obj->globalNodeIds = gln;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_DomainList_check(visit_handle h)
{
    int retval = VISIT_ERROR;
    VisIt_DomainList *obj = GetObject(h, "simv2_DomainList_check");
    if(obj != NULL)
    {
        if(obj->mydoms != VISIT_INVALID_HANDLE)
        {
            int owner, dataType, nComps = 0, nTuples = 0;
            void *data = NULL;
            if(simv2_VariableData_getData(obj->mydoms, owner, dataType, nComps,
                nTuples, data) == VISIT_OKAY)
            {
                int *doms = (int*)data;
                for(int i = 0; i < nTuples; ++i)
                {
                    if(doms[i] < 0 || doms[i] >= obj->alldoms)
                    {
                        VisItError("The domain list contained out of range domain numbers");
                        return VISIT_ERROR;
                    }
                }
            }

            if(nTuples <= 0)
            {
                VisItError("No domains were supplied for the DomainList");
                return VISIT_ERROR;
            }
        }
        retval = VISIT_OKAY;
    }
    return retval;
}
static int
simv2_UnstructuredMesh_setCoords_helper(const char *fname,
    visit_handle h, visit_handle *cHandles, int ndims)
{
    int retval = VISIT_ERROR;

    // Get the coordinates
    int owner[3], dataType[3], nComps[3], nTuples[3];
    void *data[3] = {0,0,0};
    for(int i = 0; i < ndims; ++i)
    {
        if(simv2_VariableData_getData(cHandles[i], owner[i], dataType[i], nComps[i], 
            nTuples[i], data[i]) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }

        // Error checking.
        if(nComps[i] != 1)
        {
            VisItError("Coordinates must have 1 component");
            return VISIT_ERROR;
        }
        if(dataType[i] != VISIT_DATATYPE_FLOAT &&
           dataType[i] != VISIT_DATATYPE_DOUBLE)
        {
            VisItError("Coordinates must contain float or double data");
            return VISIT_ERROR;
        }
    }

    for(int i = 1; i < ndims; ++i)
    {
        if(nTuples[0] != nTuples[i])
        {
            VisItError("Coordinates must contain the same number of tuples.");
            return VISIT_ERROR;
        }
        if(dataType[0] != dataType[i])
        {
            VisItError("Coordinates must be the same data type.");
            return VISIT_ERROR;
        }
    }

    VisIt_UnstructuredMesh *obj = GetObject(h, fname);
    if(obj != NULL)
    {
        obj->ndims = ndims;
        obj->coordMode = VISIT_COORD_MODE_SEPARATE;
        obj->FreeCoordinates();
        obj->xcoords = cHandles[0];
        obj->ycoords = cHandles[1];
        obj->zcoords = (ndims == 3) ?  cHandles[2] : VISIT_INVALID_HANDLE;
        obj->coords = VISIT_INVALID_HANDLE;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_SpeciesData_check(visit_handle h)
{
    int retval = VISIT_ERROR;
    VisIt_SpeciesData *obj = GetObject(h, "simv2_SpeciesData_getMixedSpecies");
    if(obj != NULL)
    {
        if(obj->speciesNames.empty())
        {
            VisItError("The species names were not set");
            return VISIT_ERROR;
        }
        if(obj->species == VISIT_INVALID_HANDLE)
        {
            VisItError("The species values were not set");
            return VISIT_ERROR;
        }
        if(obj->speciesMF == VISIT_INVALID_HANDLE)
        {
            VisItError("The speciesMF values were not set");
            return VISIT_ERROR;
        }
        if(obj->mixedSpecies == VISIT_INVALID_HANDLE)
        {
            VisItError("The mixedSpecies values were not set");
            return VISIT_ERROR;
        }

        retval = VISIT_OKAY;
    }
    return retval;

}
/*******************************************************************************
 * Modifications:
 *
 *   Cihan Altinay, Tue Aug 31 18:18:46 PDT 2010
 *   Fix bug with setting ghost cells.
 *
 ******************************************************************************/
int
simv2_UnstructuredMesh_setRealIndices(visit_handle h, int minval, int maxval)
{
    if(minval < 0)
    {
        VisItError("The first real zone must be >= 0.");
        return VISIT_ERROR;
    }
    if(maxval < 0)
    {
        VisItError("The last real zone must be >= 0.");
        return VISIT_ERROR;
    }
    if(maxval < minval)
    {
        VisItError("The last real zone must greater than the first real zone.");
        return VISIT_ERROR;
    }

    VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setRealIndices");
    int retval = VISIT_ERROR;
    if(obj != NULL)
    {
        obj->firstRealZone = minval;
        obj->lastRealZone = maxval;
        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_UnstructuredMesh_setGhostNodes(visit_handle h, visit_handle gn)
{
    int retval = VISIT_ERROR;
    VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setGhostNodes");
    if(obj != NULL)
    {
        // Get the ghost node information
        int owner, dataType, nComps, nTuples;
        void *data = 0;
        if(simv2_VariableData_getData(gn, owner, dataType, nComps, nTuples, data) == VISIT_ERROR)
        {
            VisItError("Could not obtain ghost node information.");
            return VISIT_ERROR;
        }

        if(nComps != 1)
        {
            VisItError("Ghost node arrays must have 1 component.");
            return VISIT_ERROR;
        }

        if(dataType != VISIT_DATATYPE_CHAR && dataType != VISIT_DATATYPE_INT)
        {
            VisItError("Ghost node arrays must contain either char or int elements.");
            return VISIT_ERROR;
        }

        obj->FreeGhostNodes();
        obj->ghostNodes = gn;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_CSGMesh_setRegions(visit_handle h, visit_handle typeflags, 
    visit_handle leftids, visit_handle rightids)
{
    int retval = VISIT_ERROR;
    visit_handle cHandles[3];
    cHandles[0] = typeflags;
    cHandles[1] = leftids;
    cHandles[2] = rightids;

    // Get the coordinates
    int owner[3], dataType[3], nComps[3], nTuples[3];
    void *data[3] = {0,0,0};
    for(int i = 0; i < 3; ++i)
    {
        if(simv2_VariableData_getData(cHandles[i], owner[i], dataType[i], nComps[i], 
            nTuples[i], data[i]) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }

        // Error checking.
        if(nComps[i] != 1)
        {
            VisItError("Region arrays must have 1 component");
            return VISIT_ERROR;
        }
        if(nTuples[i] <= 0)
        {
            VisItError("Region arrays must not be empty");
            return VISIT_ERROR;
        }
        if(dataType[i] != VISIT_DATATYPE_INT)
        {
            VisItError("Region arrays must contain integer data");
            return VISIT_ERROR;
        }
    }

    for(int i = 1; i < 3; ++i)
    {
        if(nTuples[0] != nTuples[i])
        {
            VisItError("Region arrays must contain the same number of tuples.");
            return VISIT_ERROR;
        }
    }

    VisIt_CSGMesh *obj = GetObject(h);
    if(obj != NULL)
    {
        obj->FreeRegions();
        obj->typeflags = typeflags;
        obj->leftids = leftids;
        obj->rightids = rightids;

        retval = VISIT_OKAY;
    }
    return retval;
}
static int
simv2_CurveData_setCoords_helper(visit_handle h, visit_handle *cHandles, 
    int ndims, const char *fname)
{
    int retval = VISIT_ERROR;
    VisIt_CurveData *obj = GetObject(h, fname);

    // Get the coordinates
    int owner[3], dataType[3], nComps[3], nTuples[3];
    void *data[3] = {0,0,0};
    for(int i = 0; i < ndims; ++i)
    {
        if(simv2_VariableData_getData(cHandles[i], owner[i], dataType[i], nComps[i], 
            nTuples[i], data[i]) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }

        // Error checking.
        if(nComps[i] != 1)
        {
            VisItError("Coordinates must have 1 component");
            return VISIT_ERROR;
        }
        if(!((i == 0 && dataType[i] == VISIT_DATATYPE_INT) ||
              dataType[i] == VISIT_DATATYPE_FLOAT ||
              dataType[i] == VISIT_DATATYPE_DOUBLE))
        {
            VisItError("Coordinates must contain int, float, or double data");
            return VISIT_ERROR;
        }
    }

    for(int i = 1; i < ndims; ++i)
    {
        if(nTuples[0] != nTuples[i])
        {
            VisItError("Coordinates must contain the same number of tuples.");
            return VISIT_ERROR;
        }
    }

    if(obj != NULL)
    {
        obj->FreeCoordinates();
        obj->xcoords = cHandles[0];
        obj->ycoords = cHandles[1];

        retval = VISIT_OKAY;
    }
    return retval;
}
Exemple #9
0
int
simv2_VariableMetaData_check(visit_handle h)
{
    VisIt_VariableMetaData *obj = GetObject(h, "simv2_VariableMetaData_check");
    int retval = VISIT_ERROR;
    if(obj != NULL)
    {
        if(obj->name == "")
        {
            VisItError("VariableMetaData needs a name");
            return VISIT_ERROR;
        }
        if(obj->meshName == "")
        {
            VisItError("VariableMetaData needs a mesh name");
            return VISIT_ERROR;
        }
        // Check/override the number of components.
        switch(obj->type)
        {
        case VISIT_VARTYPE_SCALAR:
        case VISIT_VARTYPE_MATERIAL:
        case VISIT_VARTYPE_MATSPECIES:
        case VISIT_VARTYPE_MESH:
        case VISIT_VARTYPE_CURVE:
            obj->numComponents = 1;
            break;
        case VISIT_VARTYPE_VECTOR:
            obj->numComponents = 3;
            break;
        case VISIT_VARTYPE_TENSOR:
            obj->numComponents = 9;
            break;
        case VISIT_VARTYPE_SYMMETRIC_TENSOR:
            obj->numComponents = 6;
            break;
        case VISIT_VARTYPE_LABEL:
        case VISIT_VARTYPE_ARRAY:
            if(obj->numComponents < 1)
            {
                VisItError("VariableMetaData needs numComponents >= 1 for labels and arrays.");
                return VISIT_ERROR;
            }
            break;
        }

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_CSGMesh_setExtents(visit_handle h, double min[3], double max[3])
{
    int retval = VISIT_ERROR;
    VisIt_CSGMesh *obj = GetObject(h);
    if(obj != NULL)
    {
        for(int i = 0; i < 3; ++i)
        {
            if(min[i] >= max[i])
            { 
                VisItError("CSGMesh's min extents must be smaller than the max extents");
                return VISIT_ERROR;
            }
        }

        for(int i = 0; i < 3; ++i)
        {
            obj->min_extents[i] = min[i];
            obj->max_extents[i] = max[i];
        }

        retval = VISIT_OKAY;
    }
    return retval;
}
Exemple #11
0
int
simv2_VariableMetaData_setType(visit_handle h, int val)
{
    if(val != VISIT_VARTYPE_SCALAR &&
       val != VISIT_VARTYPE_VECTOR &&
       val != VISIT_VARTYPE_TENSOR &&
       val != VISIT_VARTYPE_SYMMETRIC_TENSOR &&
       val != VISIT_VARTYPE_MATERIAL &&
       val != VISIT_VARTYPE_MATSPECIES &&
       val != VISIT_VARTYPE_LABEL &&
       val != VISIT_VARTYPE_ARRAY &&
       val != VISIT_VARTYPE_MESH &&
       val != VISIT_VARTYPE_CURVE)
    {
        VisItError("The value for type must be one of: VISIT_VARTYPE_SCALAR, VISIT_VARTYPE_VECTOR, VISIT_VARTYPE_TENSOR, VISIT_VARTYPE_SYMMETRIC_TENSOR, VISIT_VARTYPE_MATERIAL, VISIT_VARTYPE_MATSPECIES, VISIT_VARTYPE_LABEL, VISIT_VARTYPE_ARRAY, VISIT_VARTYPE_MESH, VISIT_VARTYPE_CURVE");
        return VISIT_ERROR;
    }
    int retval = VISIT_ERROR;
    VisIt_VariableMetaData *obj = GetObject(h, "simv2_VariableMetaData_setType");
    if(obj != NULL)
    {
        obj->type = val;
        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_UnstructuredMesh_setConnectivity(visit_handle h, int nzones, visit_handle conn)
{
    // Get the connectivity
    int owner, dataType, nComps, nTuples;
    void *data = 0;
    if(simv2_VariableData_getData(conn, owner, dataType, nComps, nTuples, 
        data) == VISIT_ERROR)
    {
        return VISIT_ERROR;
    }

    if(nComps != 1)
    {
        VisItError("The connectivity array must have 1 component.");
        return VISIT_ERROR;
    }
    if(nTuples <= 0)
    {
        VisItError("The connectivity array is empty.");
        return VISIT_ERROR;
    }
    if(dataType != VISIT_DATATYPE_INT)
    {
        VisItError("The connectivity array must contain integers.");
        return VISIT_ERROR;
    }
    if(nzones <= 0)
    {
        VisItError("The number of zones must be greater than zero.");
        return VISIT_ERROR;
    }

    VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setConnectivity");
    int retval = VISIT_ERROR;
    if(obj != NULL)
    {
        obj->nzones = nzones;
        if(obj->lastRealZone == -1)
            obj->lastRealZone = nzones - 1;
        obj->FreeConnectivity();
        obj->connectivity = conn;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_DomainList_setDomains(visit_handle h, int alldoms, visit_handle mydoms)
{
    int retval = VISIT_ERROR;
    VisIt_DomainList *obj = GetObject(h, "simv2_DomainList_setDomains");

    if(alldoms < 1)
    {
        VisItError("There must be at least 1 domain.");
        return VISIT_ERROR;
    }
 
    if(mydoms != VISIT_INVALID_HANDLE)
    {
        // Get the domains
        int owner, dataType, nComps, nTuples;
        void *data = 0;
        if(simv2_VariableData_getData(mydoms, owner, dataType, nComps, 
           nTuples, data) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }

        // Error checking.
        if(nComps != 1)
        {
            VisItError("DomainList must have 1 component");
            return VISIT_ERROR;
        }
        if(dataType != VISIT_DATATYPE_INT)
        {
            VisItError("DomainList must contain int data");
            return VISIT_ERROR;
        }
    }

    if(obj != NULL)
    {
        obj->FreeDomains();
        obj->mydoms = mydoms;
        obj->alldoms = alldoms;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_CSGMesh_check(visit_handle h)
{
    VisIt_CSGMesh *obj = GetObject(h);
    int retval = VISIT_ERROR;
    if(obj != NULL)
    {
        if(obj->typeflags == VISIT_INVALID_HANDLE)
        {
            VisItError("The CSGMesh object does not have regions.");
            return VISIT_ERROR;
        }
        if(obj->zonelist == VISIT_INVALID_HANDLE)
        {
            VisItError("The CSGMesh object does not a zone list.");
            return VISIT_ERROR;
        }

        if(obj->boundaryTypes == VISIT_INVALID_HANDLE)
        {
            VisItError("The CSGMesh object does not have boundary types.");
            return VISIT_ERROR;
        }

        if(obj->boundaryCoeffs == VISIT_INVALID_HANDLE)
        {
            VisItError("The CSGMesh object does not have boundary coefficients.");
            return VISIT_ERROR;
        }

        for(int i = 0; i < 3; ++i)
        {
            if(obj->min_extents[i] == DBL_MAX || obj->max_extents[i] == -DBL_MAX)
            {
                VisItError("The CSGMesh object does not have valid extents.");
                return VISIT_ERROR;
            }
        }

        retval = VISIT_OKAY;
    }

    return retval;
}
static VisIt_CSGMesh *
GetObject(visit_handle h)
{
    VisIt_CSGMesh *obj = (VisIt_CSGMesh *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_CSG_MESH)
        {
            VisItError("The provided handle does not point to a CSGMesh object.");
            obj = NULL;
        }
    }
    else
    {
        VisItError("An invalid handle was provided.");
    }

    return obj;
}
int
simv2_UnstructuredMesh_setCoords(visit_handle h, visit_handle coords)
{
    int retval = VISIT_ERROR;

    // Get the coordinates
    int owner, dataType, nComps, nTuples;
    void *data = 0;
    if(simv2_VariableData_getData(coords, owner, dataType, nComps, nTuples, 
        data) == VISIT_ERROR)
    {
        return VISIT_ERROR;
    }

    // Error checking.
    if(nComps != 2 && nComps != 3)
    {
        VisItError("Interleaved coordinates must have 2 or 3 components");
        return VISIT_ERROR;
    }
    if(dataType != VISIT_DATATYPE_FLOAT &&
       dataType != VISIT_DATATYPE_DOUBLE)
    {
        VisItError("Coordinates must contain float or double data");
        return VISIT_ERROR;
    }

    VisIt_UnstructuredMesh *obj = GetObject(h, "simv2_UnstructuredMesh_setCoords");
    if(obj != NULL)
    {
        obj->ndims = nComps;
        obj->coordMode = VISIT_COORD_MODE_INTERLEAVED;
        obj->FreeCoordinates();
        obj->xcoords = VISIT_INVALID_HANDLE;
        obj->ycoords = VISIT_INVALID_HANDLE;
        obj->zcoords = VISIT_INVALID_HANDLE;
        obj->coords = coords;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_ExpressionMetaData_check(visit_handle h)
{
    VisIt_ExpressionMetaData *obj = GetObject(h, "simv2_ExpressionMetaData_check");
    int retval = VISIT_ERROR;
    if(obj != NULL)
    {
        if(obj->name == "")
        {
            VisItError("ExpressionMetaData needs a name");
            return VISIT_ERROR;
        }
        if(obj->definition == "")
        {
            VisItError("ExpressionMetaData needs a definition");
            return VISIT_ERROR;
        }
        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_OptionList_setValue(visit_handle h, const char *name, int type, void *value)
{
    if(name == NULL)
    {
        VisItError("An invalid key string was provided");
        return VISIT_ERROR;
    }
    if(value == NULL)
    {
        VisItError("An invalid value was provided");
        return VISIT_ERROR;
    }
    int retval = VISIT_ERROR;
    VisIt_OptionList *obj = GetObject(h, "simv2_OptionList_setValue");
    if(obj != NULL)
    {
        obj->setValue(name, type, value);
        retval = VISIT_OKAY;
    }
    return retval;  
}
int
simv2_CSGMesh_setBoundaryCoeffs(visit_handle h, visit_handle boundaryCoeffs)
{
    int retval = VISIT_ERROR;
    VisIt_CSGMesh *obj = GetObject(h);
    if(obj != NULL)
    {
        int owner, dataType, nComps, nTuples;
        void *data = NULL;
        if(simv2_VariableData_getData(boundaryCoeffs, owner, dataType, nComps, 
            nTuples, data) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }
        // Error checking.
        if(nComps != 1)
        {
            VisItError("CSGMesh's boundary Coeffs array must have 1 component");
            return VISIT_ERROR;
        }
        if(nTuples <= 0)
        {
            VisItError("CSGMesh's boundary Coeffs array must not be empty");
            return VISIT_ERROR;
        }
        if(dataType != VISIT_DATATYPE_DOUBLE &&
           dataType != VISIT_DATATYPE_FLOAT)
        {
            VisItError("CSGMesh's boundary Coeffs array must contain float or double data");
            return VISIT_ERROR;
        }

        obj->FreeBoundaryCoeffs();
        obj->boundaryCoeffs = boundaryCoeffs;

        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_SpeciesData_setSpeciesMF(visit_handle h, visit_handle val)
{
    // How many arrays make up the variable.
    int nArr = 1;
    if(simv2_VariableData_getNumArrays(val, &nArr) == VISIT_ERROR)
    {
        return VISIT_ERROR;
    }
    if(nArr != 1)
    {
        VisItError("speciesMF must have 1 component.");
        return VISIT_ERROR;
    }

    int owner, dataType, nComps, nTuples;
    void *data = NULL;
    if(simv2_VariableData_getData(val, owner, dataType, nComps, nTuples, data) ==
            VISIT_ERROR)
    {
        return VISIT_ERROR;
    }
    if(dataType != VISIT_DATATYPE_FLOAT &&
            dataType != VISIT_DATATYPE_DOUBLE)
    {
        VisItError("simv2_SpeciesData_setSpeciesMF: speciesMF requires float or double data");
        return VISIT_ERROR;
    }

    int retval = VISIT_ERROR;
    VisIt_SpeciesData *obj = GetObject(h, "simv2_SpeciesData_setSpeciesMF");
    if(obj != NULL)
    {
        obj->speciesMF = val;
        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_CSGMesh_setZonelist(visit_handle h, visit_handle zonelist)
{
    int retval = VISIT_ERROR;
    VisIt_CSGMesh *obj = GetObject(h);
    if(obj != NULL)
    {
        int owner, dataType, nComps, nTuples;
        void *data = NULL;
        if(simv2_VariableData_getData(zonelist, owner, dataType, nComps, 
            nTuples, data) == VISIT_ERROR)
        {
            return VISIT_ERROR;
        }
        // Error checking.
        if(nComps != 1)
        {
            VisItError("Zonelist array must have 1 component");
            return VISIT_ERROR;
        }
        if(nTuples <= 0)
        {
            VisItError("Zonelist array must not be empty");
            return VISIT_ERROR;
        }
        if(dataType != VISIT_DATATYPE_INT)
        {
            VisItError("Zonelist array must contain integer data");
            return VISIT_ERROR;
        }

        obj->FreeZonelist();
        obj->zonelist = zonelist;

        retval = VISIT_OKAY;
    }
    return retval;
}
static VisIt_SpeciesData *
GetObject(visit_handle h, const char *fname)
{
    char tmp[100];
    VisIt_SpeciesData *obj = (VisIt_SpeciesData *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_SPECIES_DATA)
        {
            SNPRINTF(tmp, 100, "%s: The provided handle does not point to "
                     "a SpeciesData object.", fname);
            VisItError(tmp);
            obj = NULL;
        }
    }
    else
    {
        SNPRINTF(tmp, 100, "%s: An invalid handle was provided.", fname);
        VisItError(tmp);
    }

    return obj;
}
static VisIt_UnstructuredMesh *
GetObject(visit_handle h, const char *fname)
{
    char tmp[100];
    VisIt_UnstructuredMesh *obj = (VisIt_UnstructuredMesh *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_UNSTRUCTURED_MESH)
        {
            SNPRINTF(tmp, 100, "%s: The provided handle does not point to an "
                "UnstructuredMesh object.", fname);
            VisItError(tmp);
            obj = NULL;
        }
    }
    else
    {
        SNPRINTF(tmp, 100, "%s: An invalid handle was provided.", fname);
        VisItError(tmp);
    }

    return obj;
}
static VisIt_OptionList *
GetObject(visit_handle h, const char *fname)
{
    char tmp[100];
    VisIt_OptionList *obj = (VisIt_OptionList *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_OPTIONLIST)
        {
            SNPRINTF(tmp, 100, "%s: The provided handle does not point to "
                "a OptionList object.", fname);
            VisItError(tmp);
            obj = NULL;
        }
    }
    else
    {
        SNPRINTF(tmp, 100, "%s: An invalid handle was provided.", fname);
        VisItError(tmp);
    }

    return obj;
}
static VisIt_CommandMetaData *
GetObject(visit_handle h, const char *fname)
{
    char tmp[150];
    VisIt_CommandMetaData *obj = (VisIt_CommandMetaData *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_COMMANDMETADATA)
        {
            SNPRINTF(tmp, 150, "%s: The provided handle does not point to "
                     "a CommandMetaData object.", fname);
            VisItError(tmp);
            obj = NULL;
        }
    }
    else
    {
        SNPRINTF(tmp, 150, "%s: An invalid handle was provided.", fname);
        VisItError(tmp);
    }

    return obj;
}
int
simv2_SpeciesData_setMixedSpecies(visit_handle h, visit_handle val)
{
    // How many arrays make up the variable.
    int nArr = 1;
    if(simv2_VariableData_getNumArrays(val, &nArr) == VISIT_ERROR)
    {
        return VISIT_ERROR;
    }
    if(nArr != 1)
    {
        VisItError("mixedSpecies must have 1 component.");
        return VISIT_ERROR;
    }

    int owner, dataType, nComps, nTuples;
    void *data = NULL;
    if(simv2_VariableData_getData(val, owner, dataType, nComps, nTuples, data) ==
            VISIT_ERROR)
    {
        return VISIT_ERROR;
    }
    if(dataType != VISIT_DATATYPE_INT)
    {
        VisItError("simv2_SpeciesData_setMixedSpecies: mixedSpecies requires int data");
        return VISIT_ERROR;
    }

    int retval = VISIT_ERROR;
    VisIt_SpeciesData *obj = GetObject(h, "simv2_SpeciesData_setMixedSpecies");
    if(obj != NULL)
    {
        obj->mixedSpecies = val;
        retval = VISIT_OKAY;
    }
    return retval;
}
int
simv2_OptionList_getValue(visit_handle h, int index, void **value)
{
    if(value == NULL)
    {
        VisItError("An invalid return variable was provided");
        return VISIT_ERROR;
    }
    int retval = VISIT_ERROR;
    VisIt_OptionList *obj = GetObject(h, "simv2_OptionList_getName");
    if(obj != NULL)
    {
        if(index >= 0 && index < static_cast<int>(obj->values.size()))
        {
            *value = SimV2Variant_getValue(obj->values[index]);
            retval = VISIT_OKAY;
        }
        else
        {
            VisItError("An invalid index was provided");
        }
    }
    return retval; 
}
int
simv2_OptionList_getName(visit_handle h, int index, char **name)
{
    if(name == NULL)
    {
        VisItError("An invalid return variable was provided");
        return VISIT_ERROR;
    }
    int retval = VISIT_ERROR;
    VisIt_OptionList *obj = GetObject(h, "simv2_OptionList_getName");
    if(obj != NULL)
    {
        if(index >= 0 && index < static_cast<int>(obj->keys.size()))
        {
            *name = strdup(obj->keys[index].c_str());
            retval = VISIT_OKAY;
        }
        else
        {
            VisItError("An invalid index was provided");
        }
    }
    return retval; 
}
int
simv2_OptionList_getType(visit_handle h, int index, int *type)
{
    if(type == NULL)
    {
        VisItError("An invalid return variable was provided");
        return VISIT_ERROR;
    }
    int retval = VISIT_ERROR;
    VisIt_OptionList *obj = GetObject(h, "simv2_OptionList_getType");
    if(obj != NULL)
    {
        if(index >= 0 && index < static_cast<int>(obj->values.size()))
        {
            *type = obj->values[index].type;
            retval = VISIT_OKAY;
        }
        else
        {
            VisItError("An invalid index was provided");
        }
    }
    return retval; 
}
static VisIt_VariableData *
GetVariableDataObject(visit_handle h, const char *fname)
{
    char tmp[100];
    VisIt_VariableData *obj = (VisIt_VariableData *)VisItGetPointer(h);
    if(obj != NULL)
    {
        if(obj->objectType() != VISIT_VARIABLE_DATA)
        {
            SNPRINTF(tmp, 100, "%s: The provided handle does not point to a "
                "VariableData object.", fname);
            VisItError(tmp);
            obj = NULL;
        }
    }
    else
    {
        SNPRINTF(tmp, 100, "%s: An invalid handle was provided for a "
            "VariableData object.", fname);
        VisItError(tmp);
    }

    return obj;
}