#3349 Fracture Scaling : Improve naming in UI

This commit is contained in:
Magne Sjaastad
2018-09-14 08:25:27 +02:00
parent b49e7a7aaf
commit 35b728c133
7 changed files with 62 additions and 36 deletions

View File

@@ -2,17 +2,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -22,26 +22,32 @@
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimProject.h"
#include "RimFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT(RicfScaleFractureTemplate, "scaleFractureTemplate");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RicfScaleFractureTemplate::RicfScaleFractureTemplate()
{
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
RICF_InitField(&m_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
RICF_InitField(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
RICF_InitField(&m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "");
// clang-format off
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
RICF_InitField(&m_halfLengthScaleFactor, "halfLength", 1.0, "HalfLengthScaleFactor", "", "", "");
RICF_InitField(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
RICF_InitField(&m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "");
RICF_InitField(&m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor", "", "", "");
RICF_InitField(&m_OBSOLETE_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
// clang-format on
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicfScaleFractureTemplate::execute()
{
@@ -59,15 +65,27 @@ void RicfScaleFractureTemplate::execute()
return;
}
RimFractureTemplateCollection* templColl = !project->allFractureTemplateCollections().empty() ? project->allFractureTemplateCollections()[0] : nullptr;
RimFractureTemplateCollection* templColl =
!project->allFractureTemplateCollections().empty() ? project->allFractureTemplateCollections()[0] : nullptr;
RimFractureTemplate* templ = templColl ? templColl->fractureTemplate(m_id) : nullptr;
if (!templ)
{
RiaLogging::error(QString("scaleFractureTemplate: Fracture template not found. Id=%1").arg(m_id));
return;
}
templ->setScaleFactors(m_widthScaleFactor, m_heightScaleFactor, m_dFactorScaleFactor, m_conductivityScaleFactor);
templ->setScaleFactors(m_halfLengthScaleFactor, m_heightScaleFactor, m_dFactorScaleFactor, m_conductivityScaleFactor);
templ->loadDataAndUpdateGeometryHasChanged();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfScaleFractureTemplate::initAfterRead()
{
if (m_OBSOLETE_widthScaleFactor != m_OBSOLETE_widthScaleFactor.defaultValue())
{
m_halfLengthScaleFactor = m_OBSOLETE_widthScaleFactor;
}
}

View File

@@ -38,10 +38,15 @@ public:
virtual void execute() override;
private:
void initAfterRead() override;
private:
caf::PdmField<int> m_id;
caf::PdmField<double> m_widthScaleFactor;
caf::PdmField<double> m_halfLengthScaleFactor;
caf::PdmField<double> m_heightScaleFactor;
caf::PdmField<double> m_dFactorScaleFactor;
caf::PdmField<double> m_conductivityScaleFactor;
caf::PdmField<double> m_OBSOLETE_widthScaleFactor;
};