void SummaryComparator::printUnits(){ std::vector<double> timeVec1, timeVec2; setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc) setDataSets(timeVec1, timeVec2); for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){ std::cout << stringlist_iget(keysLong, jvar) << " unit: " << ecl_sum_get_unit(ecl_sum_fileShort, stringlist_iget(keysLong, jvar)) << std::endl; } }
void IntegrationTest::getIntegrationTest(const char* keyword){ if(stringlist_contains(keysShort,keyword) && stringlist_contains(keysLong, keyword)){ std::vector<double> timeVec1, timeVec2; setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc) setDataSets(timeVec1, timeVec2); if(printSpecificKeyword){ printDataOfSpecificKeyword(timeVec1, timeVec2, keyword); } if(findVolumeError){ WellProductionVolume volume = getSpecificWellVolume(timeVec1, timeVec2, keyword); if(volume.error == 0){ std::cout << "For keyword " << keyword << " the total production volume is 0" << std::endl; } else{ std::cout << "For keyword " << keyword << " the total production volume is "<< volume.total; std::cout << ", the error volume is " << volume.error << " the error ratio is " << volume.error/volume.total << std::endl; } } checkForKeyword(timeVec1, timeVec2, keyword); return; } OPM_THROW(std::invalid_argument, "The keyword used is not common for the two files."); }
void IntegrationTest::getIntegrationTest(){ std::vector<double> timeVec1, timeVec2; setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc) setDataSets(timeVec1, timeVec2); int ivar = 0; if(!allowDifferentAmountOfKeywords){ if(stringlist_get_size(keysShort) != stringlist_get_size(keysLong)){ OPM_THROW(std::invalid_argument, "Different ammont of keywords in the two summary files."); } } if(printKeyword){ printKeywords(); return; } std::string keywordWithGreatestErrorRatio; double greatestRatio = 0; //Iterates over all keywords from the restricted file, use iterator "ivar". Searches for a match in the file with more keywords, use the itarator "jvar". while(ivar < stringlist_get_size(keysShort)){ const char* keyword = stringlist_iget(keysShort, ivar); if(oneOfTheMainVariables){ std::string keywordString(keyword); std::string substr = keywordString.substr(0,4); if(substr!= mainVariable){ ivar++; continue; } } for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){ if (strcmp(keyword, stringlist_iget(keysLong, jvar)) == 0){ //When the keywords are equal, proceed in comparing summary files. /* if(!checkUnits(keyword)){ OPM_THROW(std::runtime_error, "For keyword " << keyword << " the unit of the two files is not equal. Not possible to compare."); } //Comparing the unit of the two vectors.*/ checkForKeyword(timeVec1, timeVec2, keyword); if(findVectorWithGreatestErrorRatio){ WellProductionVolume volume = getSpecificWellVolume(timeVec1,timeVec2, keyword); findGreatestErrorRatio(volume,greatestRatio, keyword, keywordWithGreatestErrorRatio); } break; } //will only enter here if no keyword match if(jvar == stringlist_get_size(keysLong)-1){ if(!allowDifferentAmountOfKeywords){ OPM_THROW(std::invalid_argument, "No match on keyword"); } } } ivar++; } if(findVectorWithGreatestErrorRatio){ std::cout << "The keyword " << keywordWithGreatestErrorRatio << " had the greatest error ratio, which was " << greatestRatio << std::endl; } if((findVolumeError || oneOfTheMainVariables) && !findVectorWithGreatestErrorRatio){ evaluateWellProductionVolume(); } if(allowSpikes){ std::cout << "checkWithSpikes succeeded." << std::endl; } }