Exemple #1
0
VFPProdTable::ALQ_TYPE getALQType( const DeckItem& item) {
    if (item.defaultApplied(0)) {
        return VFPProdTable::ALQ_UNDEF;
    } else {
        const std::string& alq_string = item.getTrimmedString(0);

        if (alq_string == "GRAT") {
            return VFPProdTable::ALQ_GRAT;
        }
        else if (alq_string == "IGLR") {
            return VFPProdTable::ALQ_IGLR;
        }
        else if (alq_string == "TGLR") {
            return VFPProdTable::ALQ_TGLR;
        }
        else if (alq_string == "PUMP") {
            return VFPProdTable::ALQ_PUMP;
        }
        else if (alq_string == "COMP") {
            return VFPProdTable::ALQ_COMP;
        }
        else if (alq_string == "BEAN") {
            return VFPProdTable::ALQ_BEAN;
        }
        else if (alq_string == "") {
            return VFPProdTable::ALQ_UNDEF;
        }
        else {
            throw std::invalid_argument("Invalid ALQ_DEF string: " + alq_string);
        }

        return VFPProdTable::ALQ_INVALID;
    }
}
Exemple #2
0
    void SimpleTable::init( const DeckItem& deckItem ) {
        this->addColumns();

        if ( (deckItem.size() % numColumns()) != 0)
            throw std::runtime_error("Number of columns in the data file is"
                    "inconsistent with the ones specified");

        size_t rows = deckItem.size() / numColumns();
        for (size_t colIdx = 0; colIdx < numColumns(); ++colIdx) {
            auto& column = getColumn( colIdx );
            for (size_t rowIdx = 0; rowIdx < rows; rowIdx++) {
                size_t deckItemIdx = rowIdx*numColumns() + colIdx;
                if (deckItem.defaultApplied(deckItemIdx))
                    column.addDefault( );
                else
                    column.addValue( deckItem.getSIDouble(deckItemIdx) );
            }
            if (colIdx > 0)
                column.applyDefaults(getColumn( 0 ));
        }
    }