Faults : Improved robustness of fault names including space

This commit is contained in:
Magne Sjaastad 2014-10-28 11:07:59 +01:00
parent 5bb0b99ace
commit 043584b1b1
2 changed files with 26 additions and 20 deletions

View File

@ -106,7 +106,9 @@ TEST(RigReservoirTest, WellTestErt)
well_info_free( well_info ); well_info_free( well_info );
} }
#endif
#if 0
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// This file contains test code taken from the test cases in ERT source code. /// This file contains test code taken from the test cases in ERT source code.
// There is a typedef issue (center) between ERT and QTextStream, so this file does not include any // There is a typedef issue (center) between ERT and QTextStream, so this file does not include any
@ -149,10 +151,12 @@ TEST(RigReservoirTest, ReadFaultsRecursively)
{ {
//TODO: Establish a way to define location of test model files //TODO: Establish a way to define location of test model files
QString filename("d:/Models/Statoil/TEST_RKMFAULTS/TEST_RKMFAULTS.DATA"); //QString filename("d:/Models/Statoil/TEST_RKMFAULTS/TEST_RKMFAULTS.DATA");
QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.DATA");
// QString filename("d:/gitroot/ResInsight/TestModels/fault_test/regular27cell.DATA"); // QString filename("d:/gitroot/ResInsight/TestModels/fault_test/regular27cell.DATA");
QString outFilename = "c:/tmp/TestModels/TEST_RKMFAULTS/msj_faults.txt"; QString outFilename = "d:/tmp/msj_faults.txt";
QFile outputFile(outFilename); QFile outputFile(outFilename);
{ {
if (!outputFile.open(QIODevice::WriteOnly)) if (!outputFile.open(QIODevice::WriteOnly))
@ -165,7 +169,8 @@ TEST(RigReservoirTest, ReadFaultsRecursively)
cvf::Collection<RigFault> faults; cvf::Collection<RigFault> faults;
RifEclipseInputFileTools::readFaultsInGridSection(filename, faults); std::vector<QString> filenamesWithFaults;
RifEclipseInputFileTools::readFaultsInGridSection(filename, faults, filenamesWithFaults);
// EXPECT_EQ(4, faults.size()); // EXPECT_EQ(4, faults.size());
@ -178,21 +183,21 @@ TEST(RigReservoirTest, ReadFaultsRecursively)
for (size_t faceType = 0; faceType < 6; faceType++) for (size_t faceType = 0; faceType < 6; faceType++)
{ {
cvf::StructGridInterface::FaceType faceEnum = cvf::StructGridInterface::FaceType(faceType); cvf::StructGridInterface::FaceType faceEnum = cvf::StructGridInterface::FaceType(faceType);
const std::vector<cvf::CellRange>& cellRanges = rigFault->cellRangeForFace(faceEnum); // const std::vector<cvf::CellRange>& cellRanges = rigFault->cellRangeForFace(faceEnum);
//
for (size_t i = 0; i < cellRanges.size(); i++) // for (size_t i = 0; i < cellRanges.size(); i++)
{ // {
cvf::Vec3st min, max; // cvf::Vec3st min, max;
cellRanges[i].range(min, max); // cellRanges[i].range(min, max);
//
QString tmp; // QString tmp;
tmp = tmp.sprintf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d \n", min.x(), min.y(), min.z(), max.x(), max.y(), max.z()); // tmp = tmp.sprintf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d \n", min.x(), min.y(), min.z(), max.x(), max.y(), max.z());
//
outStream << tmp; // outStream << tmp;
//
// printf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d ", min.x(), min.y(), min.z(), max.x(), max.y(), max.z()); // // printf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d ", min.x(), min.y(), min.z(), max.x(), max.y(), max.z());
// printf("\n"); // // printf("\n");
} // }
} }
} }
} }

View File

@ -906,6 +906,9 @@ void RifEclipseInputFileTools::readFaults(QFile &data, qint64 filePos, cvf::Coll
// Replace tab with space to be able to split the string using space as splitter // Replace tab with space to be able to split the string using space as splitter
line.replace("\t", " "); line.replace("\t", " ");
// Replace character ' used to mark start and end of fault name
line.remove("'");
QStringList entries = line.split(" ", QString::SkipEmptyParts); QStringList entries = line.split(" ", QString::SkipEmptyParts);
if (entries.size() < 8) if (entries.size() < 8)
{ {
@ -913,7 +916,6 @@ void RifEclipseInputFileTools::readFaults(QFile &data, qint64 filePos, cvf::Coll
} }
QString name = entries[0]; QString name = entries[0];
name.remove("'");
int i1, i2, j1, j2, k1, k2; int i1, i2, j1, j2, k1, k2;
i1 = entries[1].toInt(); i1 = entries[1].toInt();
@ -924,7 +926,6 @@ void RifEclipseInputFileTools::readFaults(QFile &data, qint64 filePos, cvf::Coll
k2 = entries[6].toInt(); k2 = entries[6].toInt();
QString faceString = entries[7]; QString faceString = entries[7];
faceString.remove("'");
cvf::StructGridInterface::FaceEnum cellFaceEnum = RifEclipseInputFileTools::faceEnumFromText(faceString); cvf::StructGridInterface::FaceEnum cellFaceEnum = RifEclipseInputFileTools::faceEnumFromText(faceString);