Example #1
0
/**********************************************************************************
* AUTHOR        : Naveen Sundar G.
* DATE          : 10-AUGUST-2007
* NAME          : toIntVector
* DESCRIPTION   : This method converts the feature instance to an intVector.
* ARGUMENTS     : The integer vector passed by reference
* RETURNS       : 0 on success.
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
*************************************************************************************/
int L7ShapeFeature::toIntVector(intVector& intVec)
{
	intVec.push_back(m_x);
	intVec.push_back(m_y);
	intVec.push_back(m_xFirstDerv);
	intVec.push_back(m_yFirstDerv);
	intVec.push_back(m_xSecondDerv);
	intVec.push_back(m_ySecondDerv);
	intVec.push_back(m_curvature);
	intVec.push_back(m_penUp);

	return SUCCESS;
}
Example #2
0
void
Dyna3DFile::GetMaterials(intVector &matnos, stringVector &matnames, doubleVector &matdens)
{
    for(int i = 0; i < materialCards.size(); ++i)
    {
        matnos.push_back(materialCards[i].materialNumber);
        matnames.push_back(materialCards[i].materialName);
        matdens.push_back(materialCards[i].density);
    }
}
bool
DatabaseCorrelation::GetCorrelatedTimeStates(int state, intVector &states) const
{
    bool retval = false;

    if(state >= 0 && state < numStates)
    {
        states.clear();
        int index = state;
        for(size_t i = 0; i < databaseNames.size(); ++i)
        {
            states.push_back(indices[index]);
            index += numStates;
        }
        retval = true;
    }

    return retval;
}
Example #4
0
// compute the distribution of correspondence statuses in this order:
// connected, paused, observed, expected, blacklisted, alternate, silent
void SM_ComputeDistribution( intVector &dist )
{
    // reset the distribution
    dist.clear();
    for (int i=0; i<3; i++)
        dist.push_back( 0 );

    // populate the distribution
    for ( corresVector::iterator iter = cq.begin(); iter != cq.end(); iter++ ) {
        switch ( iter->status() ) {
        case _CONNECTED:
            dist[0]++;
            break;
        case _EXPECTED:
            dist[1]++;
            break;
        case _BLACKLISTED:
            dist[2]++;
            break;
        default:
            assert( false );
        }
    }
}
void
avtFVCOMParticleFileFormat::GetCycles(intVector &cyc)
{
    const char *mName = "avtFVCOMParticleFileObject::GetCycles: ";

    debug4 << mName << endl;

    int ncid;
    ncid=fileObject->GetFileHandle(); 

    size_t ntimesteps;
    int time_id;
    int status = nc_inq_dimid(ncid, "time", &time_id);
    if (status != NC_NOERR) fileObject-> HandleError(status);


    status = nc_inq_dimlen(ncid, time_id, &ntimesteps);
    if (status != NC_NOERR) fileObject-> HandleError(status);


    char varname[NC_MAX_NAME+1];
    nc_type vartype;
    int  varndims;
    int  vardims[NC_MAX_VAR_DIMS];
    int  varnatts;
    int cycle_id;
    status = nc_inq_varid (ncid, "cycle", &cycle_id);
    if (status != NC_NOERR) 
      {
        fileObject-> HandleError(status);
        debug4 << "Could not find variable: cycle" << endl;
        return;
      }

    // Now get variable type!
    status = nc_inq_var(ncid, cycle_id, varname, &vartype, &varndims, 
            vardims, &varnatts);
    if (status != NC_NOERR) fileObject-> HandleError(status);

    if (varndims != 1 )
    {
        debug4 << mName << "Cycles has the wrong dimensions" << endl; 
    
    }

    else if (varndims == 1)
    {
        if(vartype == NC_INT)
        {
            debug4 << "IINT returned to cyc as NC_INT" << endl;
        int *ci = new int[ntimesteps+1];
            fileObject->ReadVariableInto("iint", INTEGERARRAY_TYPE, ci);
        for(int n=0; n<ntimesteps; ++n)
            {
                cyc.push_back(ci[n]);
            }
            delete [] ci;
        }
        else if(vartype == NC_FLOAT )
        { 
            debug4 << "iint is float: Returned to cyc as INT" << endl;

            float *cf = new float[ntimesteps+1];
            fileObject->ReadVariableInto("cycle", FLOATARRAY_TYPE, cf);
   
            for(int n=0; n<ntimesteps; ++n)
            {
                cyc.push_back(int(cf[n]));
            }

            delete [] cf;
        }
    }
    else    
    {
        debug4 << "Could not return cycles: Wrong variable type" << endl;
    }
}