void GridProperties<T>::handleMULTIREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty ) { const std::string& targetArray = record.getItem("ARRAY").get< std::string >(0); assertKeyword( targetArray ); GridProperty<T>& targetProperty = getOrCreateProperty( targetArray ); double inputValue = record.getItem("FACTOR").get<double>(0); int regionValue = record.getItem("REGION_NUMBER").get<int>(0); T factor = convertInputValue( inputValue ); std::vector<bool> mask; regionProperty.initMask( regionValue , mask); targetProperty.maskedMultiply( factor , mask); }
void GridProperties<T>::handleEQUALSRecord( const DeckRecord& record, BoxManager& boxManager) { const std::string& field = record.getItem("field").get< std::string >(0); double value = record.getItem("value").get< double >(0); if (supportsKeyword( field )) { GridProperty<T>& property = getOrCreateProperty( field ); T targetValue = convertInputValue( property , value ); setKeywordBox(record, boxManager); property.setScalar( targetValue , boxManager.getActiveBox() ); } else throw std::invalid_argument("Fatal error processing EQUALS keyword. Tried to set not defined keyword " + field); }
void GridProperties<T>::handleEQUALREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty ) { const std::string& targetArray = record.getItem("ARRAY").get< std::string >(0); if (supportsKeyword( targetArray )) { GridProperty<T>& targetProperty = getOrCreateProperty( targetArray ); double inputValue = record.getItem("VALUE").get<double>(0); int regionValue = record.getItem("REGION_NUMBER").get<int>(0); T targetValue = convertInputValue( targetProperty , inputValue ); std::vector<bool> mask; regionProperty.initMask( regionValue , mask); targetProperty.maskedSet( targetValue , mask); } else throw std::invalid_argument("Fatal error processing EQUALREG record - invalid/undefined keyword: " + targetArray); }
void GridProperties<T>::handleCOPYREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty ) { const std::string& srcArray = record.getItem("ARRAY").get< std::string >(0); const std::string& targetArray = record.getItem("TARGET_ARRAY").get< std::string >(0); if (!supportsKeyword( targetArray)) throw std::invalid_argument("Fatal error processing COPYREG record - invalid/undefined keyword: " + targetArray); if (!hasKeyword( srcArray )) throw std::invalid_argument("Fatal error processing COPYREG record - invalid/undefined keyword: " + srcArray); { int regionValue = record.getItem("REGION_NUMBER").get< int >(0); std::vector<bool> mask; GridProperty<T>& targetProperty = getOrCreateProperty( targetArray ); GridProperty<T>& srcProperty = getKeyword( srcArray ); regionProperty.initMask( regionValue , mask); targetProperty.maskedCopy( srcProperty , mask ); } }
const cfgPropertyStruct CFGManager::getOrCreateProperty(const string &_group, const string &_name, const char *val, CFGClient *newClient) { return getOrCreateProperty(_group, _name, std::string(val), newClient); }