Add keyword Name as identifier for a well in addition to well name given in quotes

p4#: 22184
This commit is contained in:
Magne Sjaastad
2013-08-19 09:46:31 +02:00
parent 178dd88aa0
commit 5580145bf9

View File

@@ -249,14 +249,34 @@ void RimWellPathAsciiFileReader::readAllWellData(QString filePath)
size_t quoteStartIdx = line.find_first_of("'`<60><><EFBFBD>");
size_t quoteEndIdx = line.find_last_of("'`<60><><EFBFBD>");
std::string wellName;
if (quoteStartIdx < line.size() -1 )
{
// Extract the text between the quotes
wellName = line.substr(quoteStartIdx + 1, quoteEndIdx - 1 - quoteStartIdx);
}
else if (quoteStartIdx > line.length() && quoteEndIdx > line.length())
{
// Did not find any quotes
// Look for keyword Name
std::string lineLowerCase = line;
transform(lineLowerCase.begin(), lineLowerCase.end(), lineLowerCase.begin(), ::tolower );
std::string token = "name ";
size_t firstNameIdx = lineLowerCase.find_first_of(token);
if (firstNameIdx < lineLowerCase.length())
{
wellName = line.substr(firstNameIdx + token.length());
}
}
if (wellName.size() > 0)
{
// Create a new Well data
fileWellDataArray.push_back(WellData());
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();
// Extract the text between the quotes
std::string wellName = line.substr(quoteStartIdx + 1, quoteEndIdx - 1 - quoteStartIdx);
fileWellDataArray.back().m_name = wellName.c_str();
}
}