Add optional argument preload=false to EclFile constructor
This commit is contained in:
@@ -35,7 +35,7 @@ namespace Opm { namespace EclIO {
|
||||
class EclFile
|
||||
{
|
||||
public:
|
||||
explicit EclFile(const std::string& filename);
|
||||
explicit EclFile(const std::string& filename, bool preload = false);
|
||||
bool formattedInput() { return formatted; }
|
||||
|
||||
void loadData(); // load all data
|
||||
|
||||
@@ -454,7 +454,7 @@ std::vector<double> readFormattedDoubArray(const std::string& file_str, const in
|
||||
|
||||
namespace Opm { namespace EclIO {
|
||||
|
||||
EclFile::EclFile(const std::string& filename) : inputFilename(filename)
|
||||
EclFile::EclFile(const std::string& filename, bool preload) : inputFilename(filename)
|
||||
{
|
||||
if (!fileExists(filename)){
|
||||
std::string message="Could not open EclFile: " + filename;
|
||||
@@ -512,8 +512,10 @@ EclFile::EclFile(const std::string& filename) : inputFilename(filename)
|
||||
|
||||
fileH.seekg(0, std::ios_base::end);
|
||||
this->ifStreamPos.push_back(static_cast<unsigned long>(fileH.tellg()));
|
||||
|
||||
fileH.close();
|
||||
|
||||
if (preload)
|
||||
this->loadData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -226,8 +226,7 @@ BOOST_AUTO_TEST_CASE(TestEcl_Write_formatted) {
|
||||
// loading vectors from formatted input file and write data back to a formatted file1
|
||||
// compare input and output file, and delete file.
|
||||
|
||||
EclFile file1(inputFile);
|
||||
file1.loadData();
|
||||
EclFile file1(inputFile, true);
|
||||
|
||||
std::vector<int> icon = file1.get<int>("ICON");
|
||||
std::vector<float> porv = file1.get<float>("PORV");
|
||||
|
||||
Reference in New Issue
Block a user