Merge pull request #3319 from tskille/update_make_ext_smry
update of make_ext_smry program
This commit is contained in:
commit
a7531d6b94
@ -91,9 +91,12 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
auto lap0 = std::chrono::system_clock::now();
|
auto lap0 = std::chrono::system_clock::now();
|
||||||
|
|
||||||
|
int num_esmry = argc-argOffset;
|
||||||
|
std::vector<bool> status(num_esmry, false);
|
||||||
|
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
for (int f = argOffset; f < argc; f ++){
|
for (int f = 0; f < num_esmry; f ++){
|
||||||
std::filesystem::path inputFileName = argv[f];
|
std::filesystem::path inputFileName = argv[f + argOffset];
|
||||||
|
|
||||||
std::filesystem::path esmryFileName = inputFileName.parent_path() / inputFileName.stem();
|
std::filesystem::path esmryFileName = inputFileName.parent_path() / inputFileName.stem();
|
||||||
esmryFileName = esmryFileName += ".ESMRY";
|
esmryFileName = esmryFileName += ".ESMRY";
|
||||||
@ -101,15 +104,23 @@ int main(int argc, char **argv) {
|
|||||||
if (Opm::EclIO::fileExists(esmryFileName) && (force))
|
if (Opm::EclIO::fileExists(esmryFileName) && (force))
|
||||||
remove (esmryFileName);
|
remove (esmryFileName);
|
||||||
|
|
||||||
Opm::EclIO::ESmry smryFile(argv[f]);
|
try {
|
||||||
if (!smryFile.make_esmry_file()){
|
Opm::EclIO::ESmry smry{ argv[f + argOffset] };
|
||||||
std::cout << "\n! Warning, smspec already have one lod file, existing kept use option -f to replace this" << std::endl;
|
status[f] = smry.make_esmry_file();
|
||||||
|
if (! status[f]) {
|
||||||
|
std::cerr << "\n! Warning, smspec already have one esmry file, existing kept use option -f to replace this\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
std::cerr << "\n! Warning, could not open summary file " << argv[f + argOffset] << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto n_converted = std::count(status.begin(), status.end(), true);
|
||||||
|
|
||||||
auto lap1 = std::chrono::system_clock::now();
|
auto lap1 = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds1 = lap1-lap0;
|
std::chrono::duration<double> elapsed_seconds1 = lap1-lap0;
|
||||||
std::cout << "\nruntime for creating " << (argc-argOffset) << " ESMRY files: " << elapsed_seconds1.count() << " seconds\n" << std::endl;
|
std::cout << "\nruntime for creating " << n_converted << " ESMRY files: " << elapsed_seconds1.count() << " seconds\n" << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user