2015-04-23 06:24:15 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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>
|
2015-04-27 06:47:41 -05:00
|
|
|
#include <map>
|
2015-04-23 06:24:15 -05:00
|
|
|
|
2015-04-27 03:25:04 -05:00
|
|
|
class RigFemPartCollection;
|
2015-04-23 06:24:15 -05:00
|
|
|
|
2015-04-30 02:31:33 -05:00
|
|
|
class odb_Odb;
|
|
|
|
class odb_Frame;
|
2015-05-06 02:47:19 -05:00
|
|
|
class odb_Instance;
|
2015-04-30 02:31:33 -05:00
|
|
|
|
2015-05-04 07:31:12 -05:00
|
|
|
enum RifOdbResultPosition
|
|
|
|
{
|
|
|
|
NODAL,
|
|
|
|
ELEMENT_NODAL,
|
|
|
|
INTEGRATION_POINT
|
|
|
|
};
|
|
|
|
|
2015-04-23 06:24:15 -05:00
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
// Data interface base class
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
class RifOdbReader : public RifGeoMechReaderInterface
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
RifOdbReader();
|
|
|
|
virtual ~RifOdbReader();
|
|
|
|
|
2015-05-04 07:31:12 -05:00
|
|
|
virtual bool openFile(const std::string& fileName);
|
2015-05-04 04:03:20 -05:00
|
|
|
|
|
|
|
virtual bool readFemParts(RigFemPartCollection* geoMechCase);
|
2015-04-30 06:59:34 -05:00
|
|
|
virtual std::vector<std::string> stepNames();
|
|
|
|
virtual std::vector<double> frameTimes(int stepIndex);
|
|
|
|
|
2015-05-04 07:31:12 -05:00
|
|
|
virtual std::map<std::string, std::vector<std::string> > scalarNodeFieldAndComponentNames();
|
|
|
|
virtual std::map<std::string, std::vector<std::string> > scalarElementNodeFieldAndComponentNames();
|
|
|
|
virtual std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldAndComponentNames();
|
2015-04-30 06:59:34 -05:00
|
|
|
|
|
|
|
virtual void readScalarNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
|
|
|
virtual void readScalarElementNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
|
|
|
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);
|
2015-04-30 02:31:33 -05:00
|
|
|
|
|
|
|
private:
|
2015-05-04 07:31:12 -05:00
|
|
|
bool buildMetaData();
|
2015-04-30 06:59:34 -05:00
|
|
|
void close();
|
|
|
|
size_t resultItemCount(const std::string& fieldName, int stepIndex, int frameIndex) const;
|
|
|
|
odb_Frame stepFrame(int stepIndex, int frameIndex) const;
|
2015-05-06 02:47:19 -05:00
|
|
|
odb_Instance* instance(int instanceIndex);
|
2015-05-04 07:31:12 -05:00
|
|
|
int componentIndex(RifOdbResultPosition position, const std::string& fieldName, const std::string& componentName) const;
|
|
|
|
std::vector<std::string> componentNames(RifOdbResultPosition position, const std::string& fieldName) const;
|
|
|
|
std::map<std::string, std::vector<std::string> > fieldAndComponentNames(RifOdbResultPosition position);
|
2015-04-23 06:24:15 -05:00
|
|
|
|
2015-04-30 09:35:21 -05:00
|
|
|
static void initializeOdbAPI();
|
|
|
|
static void finalizeOdbAPI();
|
2015-04-30 07:05:46 -05:00
|
|
|
|
2015-04-23 06:24:15 -05:00
|
|
|
private:
|
2015-05-04 07:31:12 -05:00
|
|
|
odb_Odb* m_odb;
|
|
|
|
std::map< std::pair<RifOdbResultPosition, std::string>, std::vector<std::string> > m_resultsMetaData;
|
2015-05-06 02:47:19 -05:00
|
|
|
std::map< int, std::map<int, int> > m_instanceToNodeIdToIdxMap;
|
|
|
|
std::map< int, std::map<int, int> > m_instanceToElementIdToIdxMap;
|
2015-05-04 07:31:12 -05:00
|
|
|
|
|
|
|
static bool sm_odbAPIInitialized;
|
2015-04-23 06:24:15 -05:00
|
|
|
};
|