mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Ensemble surface import and statistics
This commit is contained in:
committed by
GitHub
parent
d1e81f3c1e
commit
966bcd1e77
@@ -10,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModelTemplateCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModelPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSurfaceCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSurface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.h
|
||||
@@ -31,6 +32,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModelTemplateCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModelPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcStimPlanModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSurfaceCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSurface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.cpp
|
||||
|
||||
91
ApplicationLibCode/ProjectDataModelCommands/RimcSurface.cpp
Normal file
91
ApplicationLibCode/ProjectDataModelCommands/RimcSurface.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor ASA
|
||||
//
|
||||
// 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 "RimcSurface.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimcDataContainerString.h"
|
||||
|
||||
#include "RigSurface.h"
|
||||
|
||||
#include "RifSurfaceExporter.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSurface, RimcSurface_exportToFile, "ExportToFile" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcSurface_exportToFile::RimcSurface_exportToFile( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Export Surface To fiole", "", "", "Export a surface to file" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_fileName, "FileName", "", "", "", "Filename to export surface to" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurface_exportToFile::execute()
|
||||
{
|
||||
RimSurface* surface = self<RimSurface>();
|
||||
|
||||
auto dataObject = new RimcDataContainerString();
|
||||
|
||||
if ( surface )
|
||||
{
|
||||
RigSurface* surfaceData = surface->surfaceData();
|
||||
|
||||
RifSurfaceExporter::writeGocadTSurfFile( m_fileName(),
|
||||
surface->userDescription(),
|
||||
surfaceData->vertices(),
|
||||
surfaceData->triangleIndices() );
|
||||
|
||||
dataObject->m_stringValues = { m_fileName() };
|
||||
}
|
||||
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSurface_exportToFile::resultIsPersistent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcSurface_exportToFile::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerString() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSurface_exportToFile::isNullptrValidResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
48
ApplicationLibCode/ProjectDataModelCommands/RimcSurface.h
Normal file
48
ApplicationLibCode/ProjectDataModelCommands/RimcSurface.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor ASA
|
||||
//
|
||||
// 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 "RimSurface.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcSurface_exportToFile : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcSurface_exportToFile( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_fileName;
|
||||
};
|
||||
@@ -19,7 +19,9 @@
|
||||
|
||||
#include "SurfaceCommands/RicImportSurfacesFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimFileSurface.h"
|
||||
#include "RimGridCaseSurface.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
|
||||
@@ -30,6 +32,7 @@
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSurfaceCollection, RimcSurfaceCollection_importSurface, "ImportSurface" );
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSurfaceCollection, RimcSurfaceCollection_addFolder, "AddFolder" );
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSurfaceCollection, RimcSurfaceCollection_newSurface, "NewSurface" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -130,3 +133,52 @@ bool RimcSurfaceCollection_addFolder::isNullptrValidResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcSurfaceCollection_newSurface::RimcSurfaceCollection_newSurface( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "New Surface", "", "", "Create a new surface" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_kIndex, "KIndex", "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurfaceCollection_newSurface::execute()
|
||||
{
|
||||
RimSurfaceCollection* coll = self<RimSurfaceCollection>();
|
||||
if ( coll && m_case )
|
||||
{
|
||||
RimSurface* surface = coll->addGridCaseSurface( m_case(), m_kIndex );
|
||||
return surface;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSurfaceCollection_newSurface::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcSurfaceCollection_newSurface::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimGridCaseSurface );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSurfaceCollection_newSurface::isNullptrValidResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
class RimSurface;
|
||||
class RimSurfaceCollection;
|
||||
class RimCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -70,3 +71,23 @@ public:
|
||||
private:
|
||||
caf::PdmField<QString> m_folderName;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcSurfaceCollection_newSurface : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcSurfaceCollection_newSurface( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<int> m_kIndex;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user