#4683 Fix line endings and execute clang-format

This commit is contained in:
Magne Sjaastad 2019-09-06 10:56:04 +02:00
parent e99b008884
commit 3a317504bb
3 changed files with 140 additions and 96 deletions

View File

@ -1,17 +1,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.
//
/////////////////////////////////////////////////////////////////////////////////
@ -21,88 +21,88 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "Riu3dSelectionManager.h"
CAF_PDM_SOURCE_INIT(RimGeoMechGeometrySelectionItem, "GeoMechGeometrySelectionItem");
CAF_PDM_SOURCE_INIT( RimGeoMechGeometrySelectionItem, "GeoMechGeometrySelectionItem" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimGeoMechGeometrySelectionItem::RimGeoMechGeometrySelectionItem()
{
CAF_PDM_InitObject("GeoMech Topology Item", "", "", "");
CAF_PDM_InitObject( "GeoMech Topology Item", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "GridIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "CellIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_elementFace, "m_elementFace", "ElementFace", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "HasIntersectionTriangle", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_0, "m_intersectionTriangle_0", "IntersectionTriangle_0", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_1, "m_intersectionTriangle_1", "IntersectionTriangle_1", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_2, "m_intersectionTriangle_2", "IntersectionTriangle_2", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "LocalIntersectionPoint", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_gridIndex, "m_gridIndex", "GridIndex", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_cellIndex, "m_cellIndex", "CellIndex", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_elementFace, "m_elementFace", "ElementFace", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_hasIntersectionTriangle,
"m_hasIntersectionTriangle",
"HasIntersectionTriangle",
"",
"",
"" );
CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_0, "m_intersectionTriangle_0", "IntersectionTriangle_0", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_1, "m_intersectionTriangle_1", "IntersectionTriangle_1", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_2, "m_intersectionTriangle_2", "IntersectionTriangle_2", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_localIntersectionPoint, "m_localIntersectionPoint", "LocalIntersectionPoint", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimGeoMechGeometrySelectionItem::~RimGeoMechGeometrySelectionItem()
{
}
RimGeoMechGeometrySelectionItem::~RimGeoMechGeometrySelectionItem() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechGeometrySelectionItem::setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem)
void RimGeoMechGeometrySelectionItem::setFromSelectionItem( const RiuGeoMechSelectionItem* selectionItem )
{
m_geoMechCase = selectionItem->m_view->geoMechCase();
m_gridIndex = selectionItem->m_gridIndex;
m_cellIndex = selectionItem->m_cellIndex;
m_elementFace = selectionItem->m_elementFace;
m_gridIndex = selectionItem->m_gridIndex;
m_cellIndex = selectionItem->m_cellIndex;
m_elementFace = selectionItem->m_elementFace;
m_hasIntersectionTriangle = selectionItem->m_hasIntersectionTriangle;
m_intersectionTriangle_0 = cvf::Vec3d(selectionItem->m_intersectionTriangle[0]);
m_intersectionTriangle_1 = cvf::Vec3d(selectionItem->m_intersectionTriangle[1]);
m_intersectionTriangle_2 = cvf::Vec3d(selectionItem->m_intersectionTriangle[2]);
m_intersectionTriangle_0 = cvf::Vec3d( selectionItem->m_intersectionTriangle[0] );
m_intersectionTriangle_1 = cvf::Vec3d( selectionItem->m_intersectionTriangle[1] );
m_intersectionTriangle_2 = cvf::Vec3d( selectionItem->m_intersectionTriangle[2] );
m_localIntersectionPoint = selectionItem->m_localIntersectionPointInDisplay;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechGeometrySelectionItem::geometrySelectionText() const
{
QString text;
/*
if (m_geoMechCase)
{
text += m_geoMechCase->caseUserDescription();
}
else
{
text = "No case";
}
text += ", ";
text += QString("Grid index %1").arg(m_gridIndex);
text += ", ";
text += RigTimeHistoryResultAccessor::geometrySelectionText(m_geoMechCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
*/
/*
if (m_geoMechCase)
{
text += m_geoMechCase->caseUserDescription();
}
else
{
text = "No case";
}
text += ", ";
text += QString("Grid index %1").arg(m_gridIndex);
text += ", ";
text += RigTimeHistoryResultAccessor::geometrySelectionText(m_geoMechCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
*/
return text;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimGeoMechGeometrySelectionItem::geoMechCase() const
{
return m_geoMechCase;
}

View File

@ -3,17 +3,17 @@
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -24,8 +24,6 @@
class RivTernaryScalarMapper;
/*
Thoughts on organizing the texture coords generation a bit.
@ -38,8 +36,8 @@ class RivTernaryScalarMapper;
When evaluating, we normally use the geometry as starting point, as that often is
a subset of the total results/geometry domain.
To make this efficient, a minimum of internal storage should be used, so we want
to make the mappings as a set of functions called for each (or a few) texture
To make this efficient, a minimum of internal storage should be used, so we want
to make the mappings as a set of functions called for each (or a few) texture
coordinate positions
The mapping is then actually accessed in the opposite way of the above, while calculated in the 1-3 order
@ -50,22 +48,23 @@ class RivTernaryScalarMapper;
ResultValue->ResultPointValue->GeometryPointValue->Texture/ColorValue
In ResInsight (for now)
the ResultPointValue will be the same for all the corresponding GeometryPoints,
the ResultPointValue will be the same for all the corresponding GeometryPoints,
which means each quadvertex has the same texcoord for all corners.
Proposal:
----------
Let the FaceValue to Face vertex texture coordinate mapping be the same for all.
Extract that from the code floating around.
Create a PrimitiveFaceIdx to CellIdx with Face mapper class that handles the lookup,
Create a PrimitiveFaceIdx to CellIdx with Face mapper class that handles the lookup,
created by the geometry generation
Create separate calculators/mappers/Strategies to create FaceValues from results.
Test Code
-----------
// Example code
// Example code
// 1. CellCenterToCellFace
// 2. CellFace to Quad Corners
// 3. Quad Corner Values to tex coords
@ -80,11 +79,12 @@ class RivTernaryScalarMapper;
texCoords[i*4 + 2] = texCoord;
texCoords[i*4 + 3] = texCoord;
}
Texturing needs in ResInsight:
* ScalarMapper
* Handle HugeVal/nan
* PipeCellTransparency
* PipeCellTransparency
- includes geometry point to cell mapping
* Modify the Scalarmapper Texture
* The domain values to convert pr geometry point
@ -101,23 +101,38 @@ class RivTernaryScalarMapper;
class CellEdgeEffectGenerator : public caf::EffectGenerator
{
public:
explicit CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper);
explicit CellEdgeEffectGenerator( const cvf::ScalarMapper* edgeScalarMapper );
void setScalarMapper(const cvf::ScalarMapper* cellScalarMapper);
void setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper);
void setScalarMapper( const cvf::ScalarMapper* cellScalarMapper );
void setTernaryScalarMapper( const RivTernaryScalarMapper* ternaryScalarMapper );
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
void setFaceCulling(caf::FaceCulling faceCulling) { m_cullBackfaces = faceCulling; }
void setDefaultCellColor(cvf::Color3f color) { m_defaultCellColor = color; }
void disableLighting(bool disable) { m_disableLighting = disable; }
void setOpacityLevel( float opacity )
{
m_opacityLevel = cvf::Math::clamp( opacity, 0.0f, 1.0f );
}
void setUndefinedColor( cvf::Color3f color )
{
m_undefinedColor = color;
}
void setFaceCulling( caf::FaceCulling faceCulling )
{
m_cullBackfaces = faceCulling;
}
void setDefaultCellColor( cvf::Color3f color )
{
m_defaultCellColor = color;
}
void disableLighting( bool disable )
{
m_disableLighting = disable;
}
protected:
bool isEqual( const EffectGenerator* other ) const override;
EffectGenerator* copy() const override;
bool isEqual( const EffectGenerator* other ) const override;
EffectGenerator* copy() const override;
void updateForShaderBasedRendering(cvf::Effect* effect) const override;
void updateForFixedFunctionRendering(cvf::Effect* effect) const override;
void updateForShaderBasedRendering( cvf::Effect* effect ) const override;
void updateForFixedFunctionRendering( cvf::Effect* effect ) const override;
private:
cvf::cref<cvf::ScalarMapper> m_edgeScalarMapper;
@ -125,12 +140,11 @@ private:
cvf::cref<cvf::ScalarMapper> m_cellScalarMapper;
mutable cvf::ref<cvf::TextureImage> m_cellTextureImage;
cvf::cref<RivTernaryScalarMapper> m_ternaryCellScalarMapper;
cvf::cref<RivTernaryScalarMapper> m_ternaryCellScalarMapper;
float m_opacityLevel;
caf::FaceCulling m_cullBackfaces;
cvf::Color3f m_undefinedColor;
cvf::Color3f m_defaultCellColor;
bool m_disableLighting;
float m_opacityLevel;
caf::FaceCulling m_cullBackfaces;
cvf::Color3f m_undefinedColor;
cvf::Color3f m_defaultCellColor;
bool m_disableLighting;
};

View File

@ -31,17 +31,17 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, BasicTestSetCurrentFolder)
TEST( RifEclipseSummaryTest, BasicTestSetCurrentFolder )
{
RifReaderEclipseSummary eclSummary;
static const QString testDataRootFolder = QString("%1/SummaryData/Reek/").arg(TEST_DATA_DIR);
static const QString testDataRootFolder = QString( "%1/SummaryData/Reek/" ).arg( TEST_DATA_DIR );
QString summaryFileName = testDataRootFolder + "3_R001_REEK-1.SMSPEC";
bool hasWarning = false;
std::vector<RifRestartFileInfo> originFileInfos = eclSummary.getRestartFiles(summaryFileName, &hasWarning);
EXPECT_TRUE(originFileInfos.empty());
std::vector<RifRestartFileInfo> originFileInfos = eclSummary.getRestartFiles( summaryFileName, &hasWarning );
EXPECT_TRUE( originFileInfos.empty() );
}
/*
@ -142,7 +142,10 @@ RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
}
}
@ -170,7 +173,10 @@ RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
}
* /
}
@ -194,7 +200,10 @@ RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
TEST(RifEclipseSummaryTest, BasicReadKeywordTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
@ -205,7 +214,10 @@ TEST(RifEclipseSummaryTest, BasicReadKeywordTest)
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFileName, NULL);
std::vector<std::string> dataFileNames = RifEclipseSummaryTools::findSummaryDataFiles(filename);
@ -221,7 +233,10 @@ TEST(RifEclipseSummaryTest, BasicReadKeywordTest)
TEST(RifEclipseSummaryTest, DISABLE_BasicReadKeywordTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
@ -272,7 +287,10 @@ TEST(RifEclipseSummaryTest, DISABLE_BasicReadKeywordTest)
TEST(RifEclipseSummaryTest, BasicReadDataTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
@ -308,7 +326,10 @@ TEST(RifEclipseSummaryTest, BasicReadDataTest)
printDateAndValues(dateTimes, values);
}
@ -672,7 +693,10 @@ TEST(RifEclipseSummaryTest, DISABLED_BasicTestSetCurrentFolder)
{
/ *
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
@ -700,14 +724,20 @@ TEST(RifEclipseSummaryTest, DISABLED_BasicTest)
{
/ *
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010";
eclSummary->open(filename);