Exemplo n.º 1
0
void
avtDataValidity::Write(avtDataObjectString &str,
                       const avtDataObjectWriter *wrtr)
{
    const int numVals = 20;
    int  vals[numVals];

    vals[0] = (zonesPreserved ? 1 : 0);
    vals[1] = (nodesPreserved ? 1 : 0);
    vals[2] = (originalZonesIntact ? 1 : 0);
    vals[3] = (dataMetaDataPreserved ? 1 : 0);
    vals[4] = (spatialMetaDataPreserved ? 1 : 0);
    vals[5] = (operationFailed ? 1 : 0);
    vals[6] = (usingAllData ? 1 : 0);
    vals[7] = (usingAllDomains ? 1 : 0);
    vals[8] = (streaming ? 1 : 0);
    vals[9] = (pointsWereTransformed ? 1 : 0);
    vals[10] = (wireframeRenderingIsInappropriate ? 1 : 0);
    vals[11] = (normalsAreInappropriate ? 1 : 0);
    vals[12]= (subdivisionOccurred ? 1 : 0);
    vals[13]= (notAllCellsSubdivided ? 1 : 0);
    vals[14]= (disjointElements ? 1 : 0);
    vals[15]= (queryable ? 1 : 0);
    vals[16]= (hasEverOwnedAnyDomain ? 1 : 0);
    vals[17] = (streamingPossible ? 1 : 0);
    vals[18]= (errorOccurred ? 1 : 0);
    vals[19]= static_cast<int>(errorString.size());
    wrtr->WriteInt(str, vals, numVals);

    str.Append((char *) errorString.c_str(), static_cast<int>(errorString.size()),
                     avtDataObjectString::DATA_OBJECT_STRING_SHOULD_MAKE_COPY); 
}
Exemplo n.º 2
0
void
SimEngineManager::WriteCallback(avtDataObjectString &do_str, void *cbdata)
{
    DOString *d = (DOString *)cbdata;

    // Get the string as a whole from the do_str.
    d->buffer = do_str.GetWholeString(d->size);
}
void
avtDataSetWriter::WriteDataTree(avtDataTree_p tree, avtDataObjectString &str)
{
    if (*tree == NULL||(tree->GetNChildren() <= 0 && tree->HasData() == false))
    {
        WriteInt(str, -1);
        return;
    }

    // get & write the number of children 
    int nc = tree->GetNChildren();
    WriteInt(str, nc);

    if (nc > 0)
    {
        for (int i = 0; i < nc; ++i)
        {
            if ( tree->ChildIsPresent(i) )
            {
                // write 1 to indicate child tree is present
                WriteInt(str, 1);
                // now write out this child tree
                WriteDataTree(tree->GetChild(i), str);
            }
            else 
            {
                // write 0 to indicate child tree is absent
                WriteInt(str, 0);
            }
        }
    }
    else
    {
        int len;
        int lengthAndChunkAndDSTAndLabel[4];
        unsigned char * s;
        DataSetType dst;

        // get the domain string and its length
        if (useCompression)
            s = tree->GetDataRepresentation().GetCompressedDataString(len, dst);
        else
            s = tree->GetDataRepresentation().GetDataString(len, dst);

        lengthAndChunkAndDSTAndLabel[0] = len;
        // write out the length 

        // write out the chunk index
        int chunk = tree->GetDataRepresentation().GetDomain();
        lengthAndChunkAndDSTAndLabel[1] = chunk;

        // write out the dataset's type.
        lengthAndChunkAndDSTAndLabel[2] = dst;

        // write out the label
        string label = tree->GetDataRepresentation().GetLabel();
        lengthAndChunkAndDSTAndLabel[3] = label.size();

        WriteInt(str, lengthAndChunkAndDSTAndLabel, 4);

        if (label.size() > 0)
        {
            str.Append((char *) label.c_str(), label.size(), 
                  avtDataObjectString::DATA_OBJECT_STRING_SHOULD_MAKE_COPY);
        }

        // write out the string 
        if (len > 0)
        {
            str.Append((char*) s, len, 
               avtDataObjectString::DATA_OBJECT_STRING_DOES_NOT_OWN_REFERENCE);
        }
    }
}