mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
GeoMech data model and reader unit test framework.
This commit is contained in:
19
ApplicationCode/GeoMech/OdbReader/CMakeLists.txt
Normal file
19
ApplicationCode/GeoMech/OdbReader/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project (RifOdbReader)
|
||||
|
||||
add_definitions(-DHKS_NT)
|
||||
add_definitions(-DABQ_WIN86_64)
|
||||
|
||||
include_directories(
|
||||
${RI_ODB_API_DIR}/include
|
||||
${RigGeoMechDataModel_SOURCE_DIR}
|
||||
${LibCore_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
RifOdbReader.h
|
||||
RifOdbReader.cpp
|
||||
RifGeoMechReaderInterface.h
|
||||
RifGeoMechReaderInterface.cpp
|
||||
)
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifGeoMechReaderInterface.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifGeoMechReaderInterface::RifGeoMechReaderInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifGeoMechReaderInterface::~RifGeoMechReaderInterface()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include <vector>
|
||||
|
||||
class RigGeoMechCaseData;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Data interface base class
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifGeoMechReaderInterface : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RifGeoMechReaderInterface();
|
||||
virtual ~RifGeoMechReaderInterface();
|
||||
|
||||
virtual bool open(const std::string& fileName, RigGeoMechCaseData* geoMechCase) = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual std::vector<double> timeSteps() = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
109
ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp
Normal file
109
ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifOdbReader.h"
|
||||
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFemPart.h"
|
||||
|
||||
#include <odb_API.h>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifOdbReader::RifOdbReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifOdbReader::~RifOdbReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void readOdbFile(const std::string& fileName, RigGeoMechCaseData* geoMechCase)
|
||||
{
|
||||
CVF_ASSERT(geoMechCase);
|
||||
|
||||
odb_String path = fileName.c_str();
|
||||
|
||||
odb_Odb& odb = openOdb(path);
|
||||
|
||||
odb_Assembly& rootAssembly = odb.rootAssembly();
|
||||
|
||||
RigFemPart* part = new RigFemPart;
|
||||
|
||||
const odb_SequenceNode& nodes = rootAssembly.nodes();
|
||||
|
||||
const odb_SequenceElement& elements = rootAssembly.elements();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifOdbReader::open(const std::string& fileName, RigGeoMechCaseData* geoMechCase)
|
||||
{
|
||||
odb_initializeAPI();
|
||||
|
||||
int status = 0;
|
||||
|
||||
try
|
||||
{
|
||||
readOdbFile(fileName, geoMechCase);
|
||||
}
|
||||
|
||||
catch (const nex_Exception& nex)
|
||||
{
|
||||
status = 1;
|
||||
fprintf(stderr, "%s\n", nex.UserReport().CStr());
|
||||
fprintf(stderr, "ODB Application exited with error(s)\n");
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
status = 1;
|
||||
fprintf(stderr, "ODB Application exited with error(s)\n");
|
||||
}
|
||||
|
||||
odb_finalizeAPI();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifOdbReader::close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RifOdbReader::timeSteps()
|
||||
{
|
||||
return std::vector<double>();
|
||||
}
|
||||
45
ApplicationCode/GeoMech/OdbReader/RifOdbReader.h
Normal file
45
ApplicationCode/GeoMech/OdbReader/RifOdbReader.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifGeoMechReaderInterface.h"
|
||||
#include <string>
|
||||
|
||||
class RigGeoMechCaseData;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Data interface base class
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifOdbReader : public RifGeoMechReaderInterface
|
||||
{
|
||||
|
||||
public:
|
||||
RifOdbReader();
|
||||
virtual ~RifOdbReader();
|
||||
|
||||
virtual bool open(const std::string& fileName, RigGeoMechCaseData* geoMechCase);
|
||||
virtual void close();
|
||||
|
||||
virtual std::vector<double> timeSteps();
|
||||
|
||||
private:
|
||||
};
|
||||
Reference in New Issue
Block a user