GeoMech data model and reader unit test framework.

This commit is contained in:
Jacob Støren
2015-04-23 13:24:15 +02:00
parent 1f2bea106f
commit 4737807b7b
14 changed files with 680 additions and 0 deletions

View 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
)

View File

@@ -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()
{
}

View File

@@ -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:
};

View 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>();
}

View 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:
};