mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixing assert due to m_odb not set
There still are troubles closing two instances accessing same file.
This commit is contained in:
@@ -95,13 +95,14 @@ void RifOdbReader::close()
|
||||
}
|
||||
|
||||
|
||||
void readOdbFile(const std::string& fileName, RigFemPartCollection* femParts)
|
||||
void RifOdbReader::readOdbFile(const std::string& fileName, RigFemPartCollection* femParts)
|
||||
{
|
||||
CVF_ASSERT(femParts);
|
||||
|
||||
odb_String path = fileName.c_str();
|
||||
|
||||
odb_Odb& odb = openOdb(path);
|
||||
m_odb = &odb;
|
||||
|
||||
odb_Assembly& rootAssembly = odb.rootAssembly();
|
||||
odb_InstanceRepository instanceRepository = odb.rootAssembly().instances();
|
||||
@@ -243,7 +244,7 @@ bool RifOdbReader::readFemParts(const std::string& fileName, RigFemPartCollectio
|
||||
|
||||
try
|
||||
{
|
||||
readOdbFile(fileName, femParts);
|
||||
this->readOdbFile(fileName, femParts);
|
||||
}
|
||||
|
||||
catch (const nex_Exception& nex)
|
||||
@@ -509,37 +510,3 @@ void RifOdbReader::readDisplacements(int partIndex, int stepIndex, int frameInde
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifOdbReader::openFile(const std::string& fileName)
|
||||
{
|
||||
close();
|
||||
CVF_ASSERT(m_odb == NULL);
|
||||
|
||||
if (!sm_odbAPIInitialized)
|
||||
{
|
||||
initializeOdbAPI();
|
||||
}
|
||||
|
||||
odb_String path = fileName.c_str();
|
||||
|
||||
try
|
||||
{
|
||||
m_odb = &openOdb(path);
|
||||
}
|
||||
|
||||
catch (const nex_Exception& nex)
|
||||
{
|
||||
fprintf(stderr, "%s\n", nex.UserReport().CStr());
|
||||
fprintf(stderr, "ODB Application exited with error(s)\n");
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
fprintf(stderr, "ODB Application exited with error(s)\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,16 +53,15 @@ public:
|
||||
virtual void readScalarIntegrationPointField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
||||
virtual void readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements);
|
||||
|
||||
bool openFile(const std::string& fileName);
|
||||
|
||||
private:
|
||||
void close();
|
||||
size_t resultItemCount(const std::string& fieldName, int stepIndex, int frameIndex) const;
|
||||
odb_Frame stepFrame(int stepIndex, int frameIndex) const;
|
||||
int componentIndex(const std::string& fieldName, const std::string& componentName) const;
|
||||
void readOdbFile(const std::string& fileName, RigFemPartCollection* femParts);
|
||||
|
||||
static void initializeOdbAPI();
|
||||
static void finalizeOdbAPI();
|
||||
static void initializeOdbAPI();
|
||||
static void finalizeOdbAPI();
|
||||
|
||||
private:
|
||||
odb_Odb* m_odb;
|
||||
|
||||
Reference in New Issue
Block a user