Exemple #1
0
void PicParams::extractVectorOfProfiles(InputData &ifile, string varname, vector<ProfileStructure*> &Pvec, int ispec)
{
    Pvec.resize(3);
    vector<PyObject*> pvec = ifile.extract_pyVec(varname, "Species", ispec);
    int len = pvec.size();
    if( len==3 ) {
        for(int i=0; i<len; i++) {
            Pvec[i] = new ProfileStructure();
            if( !extractProfile(ifile, pvec[i], *(Pvec[i])) )
                ERROR("For species #" << ispec << ", "<<varname<<"["<<i<<"] not understood");
        }
    } else if ( len==1 ) {
        Pvec[0] = new ProfileStructure();
        if( !extractProfile(ifile, pvec[0], *(Pvec[0])) )
            ERROR("For species #" << ispec << ", "<<varname<<" not understood");
        Pvec[1] = Pvec[0];
        Pvec[2] = Pvec[0];
    } else {
        ERROR("For species #" << ispec << ", "<<varname<<" needs 1 or 3 components.");
    }
}