mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
System : Replaced tab with four spaces in ApplicationCode and subfolders
This commit is contained in:
@@ -108,7 +108,7 @@ void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, doub
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigCaseCellResultsData::resultCount() const
|
||||
{
|
||||
return m_cellScalarResults.size();
|
||||
return m_cellScalarResults.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -136,9 +136,9 @@ const std::vector< std::vector<double> > & RigCaseCellResultsData::cellScalarRes
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector<double> > & RigCaseCellResultsData::cellScalarResults( size_t scalarResultIndex )
|
||||
{
|
||||
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
|
||||
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
|
||||
|
||||
return m_cellScalarResults[scalarResultIndex];
|
||||
return m_cellScalarResults[scalarResultIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
RigGridBase* grid(size_t index);
|
||||
size_t gridCount() const;
|
||||
|
||||
RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
|
||||
: m_resultsData(cellResultsData),
|
||||
: m_resultsData(cellResultsData),
|
||||
m_scalarResultIndex(scalarResultIndex)
|
||||
{
|
||||
|
||||
@@ -41,26 +41,26 @@ RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, si
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
|
||||
{
|
||||
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (values[i] < min)
|
||||
{
|
||||
min = values[i];
|
||||
}
|
||||
if (values[i] < min)
|
||||
{
|
||||
min = values[i];
|
||||
}
|
||||
|
||||
if (values[i] > max)
|
||||
{
|
||||
max = values[i];
|
||||
}
|
||||
}
|
||||
if (values[i] > max)
|
||||
{
|
||||
max = values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -70,24 +70,24 @@ void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, d
|
||||
{
|
||||
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (values[i] < pos && values[i] > 0)
|
||||
{
|
||||
pos = values[i];
|
||||
}
|
||||
if (values[i] < pos && values[i] > 0)
|
||||
{
|
||||
pos = values[i];
|
||||
}
|
||||
|
||||
if (values[i] > neg && values[i] < 0)
|
||||
{
|
||||
neg = values[i];
|
||||
}
|
||||
}
|
||||
if (values[i] > neg && values[i] < 0)
|
||||
{
|
||||
neg = values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, d
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
|
||||
{
|
||||
for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++)
|
||||
{
|
||||
for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++)
|
||||
{
|
||||
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, tIdx);
|
||||
|
||||
histogramCalculator.addData(values);
|
||||
}
|
||||
histogramCalculator.addData(values);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -36,14 +36,14 @@ class RigNativeStatCalc : public RigStatisticsCalculator
|
||||
public:
|
||||
RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex);
|
||||
|
||||
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
|
||||
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
|
||||
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
|
||||
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
|
||||
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
|
||||
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
|
||||
|
||||
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
|
||||
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
|
||||
virtual size_t timeStepCount();
|
||||
|
||||
private:
|
||||
RigCaseCellResultsData* m_resultsData;
|
||||
RigCaseCellResultsData* m_resultsData;
|
||||
size_t m_scalarResultIndex;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
static void addNnc(RigMainGrid* grid, size_t i1, size_t j1, size_t k1, size_t i2, size_t j2, size_t k2, std::vector<RigConnection> &nncConnections);
|
||||
void addWellData(RigCaseData* eclipseCase, RigGridBase* grid);
|
||||
static void appendCells(size_t nodeStartIndex, size_t cellCount, RigGridBase* hostGrid, std::vector<RigCell>& cells);
|
||||
|
||||
|
||||
static void appendNodes(const cvf::Vec3d& min, const cvf::Vec3d& max, const cvf::Vec3st& cubeDimension, std::vector<cvf::Vec3d>& nodes);
|
||||
static void appendCubeNodes(const cvf::Vec3d& min, const cvf::Vec3d& max, std::vector<cvf::Vec3d>& nodes);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellScalar(size_t gridLocalCellIndex) const
|
||||
{
|
||||
return HUGE_VAL;
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -34,7 +34,7 @@ double RigHugeValResultAccessor::cellScalar(size_t gridLocalCellIndex) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigHugeValResultAccessor::cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const
|
||||
{
|
||||
return cellScalar(gridLocalCellIndex);
|
||||
return cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
class RigHugeValResultAccessor : public RigResultAccessor
|
||||
{
|
||||
public:
|
||||
virtual double cellScalar(size_t gridLocalCellIndex) const;
|
||||
virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
virtual double cellScalar(size_t gridLocalCellIndex) const;
|
||||
virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
virtual double cellScalarGlobIdx(size_t globCellIndex) const;
|
||||
virtual double cellFaceScalarGlobIdx(size_t globCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
};
|
||||
|
||||
@@ -41,30 +41,30 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName)
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName)
|
||||
{
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
|
||||
if (uiResultName == RimDefines::combinedTransmissibilityResultName())
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
||||
if (uiResultName == RimDefines::combinedTransmissibilityResultName())
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
||||
|
||||
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX");
|
||||
cvf::ref<RigResultAccessor> yTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANY");
|
||||
cvf::ref<RigResultAccessor> zTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANZ");
|
||||
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX");
|
||||
cvf::ref<RigResultAccessor> yTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANY");
|
||||
cvf::ref<RigResultAccessor> zTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANZ");
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p());
|
||||
cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p());
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if (uiResultName == RimDefines::combinedMultResultName())
|
||||
{
|
||||
cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor(grid);
|
||||
@@ -116,38 +116,38 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
||||
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName,
|
||||
RimDefines::ResultCatType resultType)
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName,
|
||||
RimDefines::ResultCatType resultType)
|
||||
{
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
|
||||
RigGridBase *grid = eclipseCase->grid(gridIndex);
|
||||
RigGridBase *grid = eclipseCase->grid(gridIndex);
|
||||
|
||||
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t scalarSetIndex = eclipseCase->results(porosityModel)->findScalarResultIndex(resultType, uiResultName);
|
||||
if (scalarSetIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
size_t scalarSetIndex = eclipseCase->results(porosityModel)->findScalarResultIndex(resultType, uiResultName);
|
||||
if (scalarSetIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -177,56 +177,56 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeResultAccessor
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t resultIndex)
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t resultIndex)
|
||||
{
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
if (!eclipseCase) return NULL;
|
||||
if (!eclipseCase) return NULL;
|
||||
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
if (!grid) return NULL;
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
if (!grid) return NULL;
|
||||
|
||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultIndex);
|
||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultIndex);
|
||||
|
||||
if (timeStepIndex >= scalarSetResults.size())
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
if (timeStepIndex >= scalarSetResults.size())
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
std::vector<double>* resultValues = NULL;
|
||||
if (timeStepIndex < scalarSetResults.size())
|
||||
{
|
||||
resultValues = &(scalarSetResults[timeStepIndex]);
|
||||
}
|
||||
std::vector<double>* resultValues = NULL;
|
||||
if (timeStepIndex < scalarSetResults.size())
|
||||
{
|
||||
resultValues = &(scalarSetResults[timeStepIndex]);
|
||||
}
|
||||
|
||||
if (!resultValues || resultValues->size() == 0)
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
if (!resultValues || resultValues->size() == 0)
|
||||
{
|
||||
return new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultIndex);
|
||||
if (useGlobalActiveIndex)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object = new RigAllGridCellsResultAccessor(grid, resultValues);
|
||||
return object;
|
||||
}
|
||||
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultIndex);
|
||||
if (useGlobalActiveIndex)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<RigResultAccessor> object = new RigAllGridCellsResultAccessor(grid, resultValues);
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,20 +36,20 @@ public:
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName);
|
||||
|
||||
static cvf::ref<RigResultAccessor>
|
||||
createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName,
|
||||
RimDefines::ResultCatType resultType);
|
||||
static cvf::ref<RigResultAccessor>
|
||||
createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
const QString& uiResultName,
|
||||
RimDefines::ResultCatType resultType);
|
||||
|
||||
static cvf::ref<RigResultAccessor>
|
||||
createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t resultIndex);
|
||||
static cvf::ref<RigResultAccessor>
|
||||
createResultAccessor(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t resultIndex);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigCa
|
||||
size_t timeStepIndex,
|
||||
QString& uiResultName)
|
||||
{
|
||||
if (!eclipseCase) return NULL;
|
||||
if (!eclipseCase) return NULL;
|
||||
|
||||
if (!eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
@@ -56,12 +56,12 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigCa
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex, size_t scalarResultIndex)
|
||||
{
|
||||
if (!eclipseCase) return NULL;
|
||||
if (!eclipseCase) return NULL;
|
||||
|
||||
if (!eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
@@ -69,10 +69,10 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigCa
|
||||
}
|
||||
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
if (!grid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!grid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarResultIndex);
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ RigTernaryResultAccessor::RigTernaryResultAccessor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTernaryResultAccessor::setTernaryResultAccessors(RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat)
|
||||
{
|
||||
m_soilAccessor = soil;
|
||||
m_sgasAccessor = sgas;
|
||||
m_swatAccessor = swat;
|
||||
m_soilAccessor = soil;
|
||||
m_sgasAccessor = sgas;
|
||||
m_swatAccessor = swat;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -45,48 +45,48 @@ void RigTernaryResultAccessor::setTernaryResultAccessors(RigResultAccessor* soil
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2d RigTernaryResultAccessor::cellScalar(size_t gridLocalCellIndex) const
|
||||
{
|
||||
double soil = 0.0;
|
||||
double sgas = 0.0;
|
||||
double soil = 0.0;
|
||||
double sgas = 0.0;
|
||||
|
||||
if (m_soilAccessor.notNull())
|
||||
{
|
||||
soil = m_soilAccessor->cellScalar(gridLocalCellIndex);
|
||||
if (m_soilAccessor.notNull())
|
||||
{
|
||||
soil = m_soilAccessor->cellScalar(gridLocalCellIndex);
|
||||
|
||||
if (m_sgasAccessor.notNull())
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else if (m_swatAccessor.notNull())
|
||||
{
|
||||
sgas = 1.0 - soil - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
sgas = 1.0 - soil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_sgasAccessor.notNull())
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar(gridLocalCellIndex);
|
||||
if (m_sgasAccessor.notNull())
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else if (m_swatAccessor.notNull())
|
||||
{
|
||||
sgas = 1.0 - soil - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
sgas = 1.0 - soil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_sgasAccessor.notNull())
|
||||
{
|
||||
sgas = m_sgasAccessor->cellScalar(gridLocalCellIndex);
|
||||
|
||||
if (m_swatAccessor.notNull())
|
||||
{
|
||||
soil = 1.0 - sgas - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
soil = 1.0 - sgas;
|
||||
}
|
||||
}
|
||||
else if (m_swatAccessor.notNull())
|
||||
{
|
||||
soil = 1.0 - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
}
|
||||
if (m_swatAccessor.notNull())
|
||||
{
|
||||
soil = 1.0 - sgas - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
soil = 1.0 - sgas;
|
||||
}
|
||||
}
|
||||
else if (m_swatAccessor.notNull())
|
||||
{
|
||||
soil = 1.0 - m_swatAccessor->cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return cvf::Vec2d(soil, sgas);
|
||||
return cvf::Vec2d(soil, sgas);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,5 +94,5 @@ cvf::Vec2d RigTernaryResultAccessor::cellScalar(size_t gridLocalCellIndex) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2d RigTernaryResultAccessor::cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const
|
||||
{
|
||||
return cellScalar(gridLocalCellIndex);
|
||||
return cellScalar(gridLocalCellIndex);
|
||||
}
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
class RigTernaryResultAccessor : public RigResultAccessor2d
|
||||
{
|
||||
public:
|
||||
RigTernaryResultAccessor();
|
||||
RigTernaryResultAccessor();
|
||||
|
||||
/// Requires two of the arguments to be present
|
||||
void setTernaryResultAccessors(RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat);
|
||||
/// Requires two of the arguments to be present
|
||||
void setTernaryResultAccessors(RigResultAccessor* soil, RigResultAccessor* sgas, RigResultAccessor* swat);
|
||||
|
||||
/// Returns [SOIL, SGAS] regardless of which one of the three is missing. if Soil or SWat is missing, it is calculated
|
||||
/// based on the two others
|
||||
virtual cvf::Vec2d cellScalar(size_t gridLocalCellIndex) const;
|
||||
virtual cvf::Vec2d cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
/// Returns [SOIL, SGAS] regardless of which one of the three is missing. if Soil or SWat is missing, it is calculated
|
||||
/// based on the two others
|
||||
virtual cvf::Vec2d cellScalar(size_t gridLocalCellIndex) const;
|
||||
virtual cvf::Vec2d cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
|
||||
|
||||
private:
|
||||
cvf::ref<RigResultAccessor> m_soilAccessor;
|
||||
cvf::ref<RigResultAccessor> m_sgasAccessor;
|
||||
cvf::ref<RigResultAccessor> m_swatAccessor;
|
||||
cvf::ref<RigResultAccessor> m_soilAccessor;
|
||||
cvf::ref<RigResultAccessor> m_sgasAccessor;
|
||||
cvf::ref<RigResultAccessor> m_swatAccessor;
|
||||
};
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ GeometryTools::inPlaneLineIntersect3D( const cvf::Vec3d& planeNormal,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double GeometryTools::linePointSquareDist(const cvf::Vec3d& p1, const cvf::Vec3d& p2, const cvf::Vec3d& p3)
|
||||
double GeometryTools::linePointSquareDist(const cvf::Vec3d& p1, const cvf::Vec3d& p2, const cvf::Vec3d& p3)
|
||||
{
|
||||
cvf::Vec3d v31 = p3 - p1;
|
||||
cvf::Vec3d v21 = p2 - p1;
|
||||
@@ -713,9 +713,9 @@ EarClipTesselator::EarClipTesselator():
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// \brief Do the main processing/actual triangulation
|
||||
/// \param triangleIndices Array that will receive the indices of the triangles resulting from the triangulation
|
||||
/// \return true when a tesselation was successully created
|
||||
/// \brief Do the main processing/actual triangulation
|
||||
/// \param triangleIndices Array that will receive the indices of the triangles resulting from the triangulation
|
||||
/// \return true when a tesselation was successully created
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
bool EarClipTesselator::calculateTriangles( std::vector<size_t>* triangleIndices )
|
||||
@@ -729,61 +729,61 @@ bool EarClipTesselator::calculateTriangles( std::vector<size_t>* triangleIndices
|
||||
|
||||
// We want m_polygonIndices to be a counter-clockwise polygon to make the validation test work
|
||||
|
||||
if (calculateProjectedPolygonArea() < 0 )
|
||||
{
|
||||
m_polygonIndices.reverse();
|
||||
}
|
||||
if (calculateProjectedPolygonArea() < 0 )
|
||||
{
|
||||
m_polygonIndices.reverse();
|
||||
}
|
||||
|
||||
std::list<size_t>::iterator u, v, w;
|
||||
|
||||
// If we loop two times around polygon without clipping a single triangle we are toast.
|
||||
size_t count = 2*numVertices; // error detection
|
||||
size_t count = 2*numVertices; // error detection
|
||||
|
||||
v = m_polygonIndices.end(); //nv - 1;
|
||||
v = m_polygonIndices.end(); //nv - 1;
|
||||
--v;
|
||||
|
||||
while (numVertices > 2)
|
||||
{
|
||||
// if we loop, it is probably a non-simple polygon
|
||||
if (count <= 0 )
|
||||
{
|
||||
// Triangulate: ERROR - probable bad polygon!
|
||||
return false;
|
||||
}
|
||||
while (numVertices > 2)
|
||||
{
|
||||
// if we loop, it is probably a non-simple polygon
|
||||
if (count <= 0 )
|
||||
{
|
||||
// Triangulate: ERROR - probable bad polygon!
|
||||
return false;
|
||||
}
|
||||
--count;
|
||||
|
||||
// Three consecutive vertices in current polygon, <u,v,w>
|
||||
// previous
|
||||
u = v;
|
||||
if (u == m_polygonIndices.end()) u = m_polygonIndices.begin(); // if (nv <= u) u = 0;
|
||||
// Three consecutive vertices in current polygon, <u,v,w>
|
||||
// previous
|
||||
u = v;
|
||||
if (u == m_polygonIndices.end()) u = m_polygonIndices.begin(); // if (nv <= u) u = 0;
|
||||
|
||||
// new v
|
||||
v = u; ++v; //u + 1;
|
||||
if (v == m_polygonIndices.end()) v = m_polygonIndices.begin(); //if (nv <= v) v = 0;
|
||||
// new v
|
||||
v = u; ++v; //u + 1;
|
||||
if (v == m_polygonIndices.end()) v = m_polygonIndices.begin(); //if (nv <= v) v = 0;
|
||||
|
||||
// next
|
||||
w = v; ++w; //v + 1;
|
||||
if (w == m_polygonIndices.end()) w = m_polygonIndices.begin(); //if (nv <= w) w = 0;
|
||||
// next
|
||||
w = v; ++w; //v + 1;
|
||||
if (w == m_polygonIndices.end()) w = m_polygonIndices.begin(); //if (nv <= w) w = 0;
|
||||
|
||||
|
||||
if ( isTriangleValid(u, v, w) )
|
||||
{
|
||||
// Indices of the vertices
|
||||
triangleIndices->push_back(*u);
|
||||
triangleIndices->push_back(*v);
|
||||
triangleIndices->push_back(*w);
|
||||
if ( isTriangleValid(u, v, w) )
|
||||
{
|
||||
// Indices of the vertices
|
||||
triangleIndices->push_back(*u);
|
||||
triangleIndices->push_back(*v);
|
||||
triangleIndices->push_back(*w);
|
||||
|
||||
// Remove v from remaining polygon
|
||||
// Remove v from remaining polygon
|
||||
m_polygonIndices.erase(v);
|
||||
v = w;
|
||||
numVertices--;
|
||||
numVertices--;
|
||||
|
||||
// Resets error detection counter
|
||||
count = 2*numVertices;
|
||||
}
|
||||
}
|
||||
// Resets error detection counter
|
||||
count = 2*numVertices;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -801,15 +801,15 @@ bool EarClipTesselator::isTriangleValid( std::list<size_t>::const_iterator u, st
|
||||
|
||||
if ( m_areaTolerance > (((B[m_X]-A[m_X])*(C[m_Y]-A[m_Y])) - ((B[m_Y]-A[m_Y])*(C[m_X]-A[m_X]))) ) return false;
|
||||
|
||||
std::list<size_t>::const_iterator c;
|
||||
std::list<size_t>::const_iterator c;
|
||||
std::list<size_t>::const_iterator outside;
|
||||
for (c = m_polygonIndices.begin(); c != m_polygonIndices.end(); ++c)
|
||||
{
|
||||
for (c = m_polygonIndices.begin(); c != m_polygonIndices.end(); ++c)
|
||||
{
|
||||
// The polygon points that actually make up the triangle candidate does not count
|
||||
// (but the same points on different positions in the polygon does!
|
||||
// Except those one off the triangle, that references the start or end of the triangle)
|
||||
|
||||
if ( (c == u) || (c == v) || (c == w)) continue;
|
||||
if ( (c == u) || (c == v) || (c == w)) continue;
|
||||
|
||||
// Originally the below tests was not included which resulted in missing triangles sometimes
|
||||
|
||||
@@ -827,10 +827,10 @@ bool EarClipTesselator::isTriangleValid( std::list<size_t>::const_iterator u, st
|
||||
|
||||
cvf::Vec3d P = (*m_nodeCoords)[*c];
|
||||
|
||||
if (isPointInsideTriangle(A, B, C, P)) return false;
|
||||
}
|
||||
if (isPointInsideTriangle(A, B, C, P)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -843,19 +843,19 @@ bool EarClipTesselator::isPointInsideTriangle(const cvf::Vec3d& A, const cvf::Ve
|
||||
{
|
||||
CVF_ASSERT(m_X > -1 && m_Y > -1);
|
||||
|
||||
double ax = C[m_X] - B[m_X]; double ay = C[m_Y] - B[m_Y];
|
||||
double bx = A[m_X] - C[m_X]; double by = A[m_Y] - C[m_Y];
|
||||
double cx = B[m_X] - A[m_X]; double cy = B[m_Y] - A[m_Y];
|
||||
double ax = C[m_X] - B[m_X]; double ay = C[m_Y] - B[m_Y];
|
||||
double bx = A[m_X] - C[m_X]; double by = A[m_Y] - C[m_Y];
|
||||
double cx = B[m_X] - A[m_X]; double cy = B[m_Y] - A[m_Y];
|
||||
|
||||
double apx= P[m_X] - A[m_X]; double apy= P[m_Y] - A[m_Y];
|
||||
double bpx= P[m_X] - B[m_X]; double bpy= P[m_Y] - B[m_Y];
|
||||
double cpx= P[m_X] - C[m_X]; double cpy= P[m_Y] - C[m_Y];
|
||||
double apx= P[m_X] - A[m_X]; double apy= P[m_Y] - A[m_Y];
|
||||
double bpx= P[m_X] - B[m_X]; double bpy= P[m_Y] - B[m_Y];
|
||||
double cpx= P[m_X] - C[m_X]; double cpy= P[m_Y] - C[m_Y];
|
||||
|
||||
double aCROSSbp = ax*bpy - ay*bpx;
|
||||
double cCROSSap = cx*apy - cy*apx;
|
||||
double bCROSScp = bx*cpy - by*cpx;
|
||||
double aCROSSbp = ax*bpy - ay*bpx;
|
||||
double cCROSSap = cx*apy - cy*apx;
|
||||
double bCROSScp = bx*cpy - by*cpx;
|
||||
double tol = 0;
|
||||
return ((aCROSSbp >= tol) && (bCROSScp >= tol) && (cCROSSap >= tol));
|
||||
return ((aCROSSbp >= tol) && (bCROSScp >= tol) && (cCROSSap >= tol));
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -866,21 +866,21 @@ double EarClipTesselator::calculateProjectedPolygonArea() const
|
||||
{
|
||||
CVF_ASSERT(m_X > -1 && m_Y > -1);
|
||||
|
||||
double A = 0;
|
||||
double A = 0;
|
||||
|
||||
std::list<size_t>::const_iterator p = m_polygonIndices.end();
|
||||
std::list<size_t>::const_iterator p = m_polygonIndices.end();
|
||||
--p;
|
||||
|
||||
std::list<size_t>::const_iterator q = m_polygonIndices.begin();
|
||||
while (q != m_polygonIndices.end())
|
||||
{
|
||||
A += (*m_nodeCoords)[*p][m_X] * (*m_nodeCoords)[*q][m_Y] - (*m_nodeCoords)[*q][m_X]*(*m_nodeCoords)[*p][m_Y];
|
||||
std::list<size_t>::const_iterator q = m_polygonIndices.begin();
|
||||
while (q != m_polygonIndices.end())
|
||||
{
|
||||
A += (*m_nodeCoords)[*p][m_X] * (*m_nodeCoords)[*q][m_Y] - (*m_nodeCoords)[*q][m_X]*(*m_nodeCoords)[*p][m_Y];
|
||||
|
||||
p = q;
|
||||
q++;
|
||||
}
|
||||
p = q;
|
||||
q++;
|
||||
}
|
||||
|
||||
return A*0.5;
|
||||
return A*0.5;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -104,22 +104,22 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// \brief Test if a point touches a polygon within the specified tolerance
|
||||
/// \brief Test if a point touches a polygon within the specified tolerance
|
||||
///
|
||||
/// \param polygonNorm Polygon normal
|
||||
/// \param pPolygonVerts Array of polygon vertice coordinates
|
||||
/// \param piVertexIndices Array of integer node indices for this polygon
|
||||
/// \param iNumVerts Number of vertices in polygon
|
||||
/// \param point The point to be checked
|
||||
/// \param polygonNorm Polygon normal
|
||||
/// \param pPolygonVerts Array of polygon vertice coordinates
|
||||
/// \param piVertexIndices Array of integer node indices for this polygon
|
||||
/// \param iNumVerts Number of vertices in polygon
|
||||
/// \param point The point to be checked
|
||||
/// \param tolerance Tolerance in length
|
||||
/// \param touchedEdgeIndex returns -1 if point is inside, and edge index if point touches an edge.
|
||||
/// \return true if point lies inside or on the border of the polygon.
|
||||
/// \return true if point lies inside or on the border of the polygon.
|
||||
///
|
||||
/// \assumpt Assumes that the polygon is planar
|
||||
/// \comment First check if point is on an edge, Then check if it is inside by
|
||||
/// \assumpt Assumes that the polygon is planar
|
||||
/// \comment First check if point is on an edge, Then check if it is inside by
|
||||
/// counting the number of times a ray from point along positive X axis
|
||||
/// crosses an edge. Odd number says inside.
|
||||
/// \author SP (really by Eric Haines) and JJS
|
||||
/// \author SP (really by Eric Haines) and JJS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename VerticeArrayType, typename PolygonArrayType, typename IndexType>
|
||||
bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNormal,
|
||||
@@ -135,7 +135,7 @@ bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNor
|
||||
int X = (Z + 1) % 3;
|
||||
int Y = (Z + 2) % 3;
|
||||
|
||||
int crossings;
|
||||
int crossings;
|
||||
|
||||
int xBelowVx0;
|
||||
int yBelowVx0;
|
||||
@@ -146,7 +146,7 @@ bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNor
|
||||
|
||||
double dv0;
|
||||
|
||||
cvf::uint j;
|
||||
cvf::uint j;
|
||||
|
||||
// Check if point is on an edge or vertex
|
||||
size_t firstIdx;
|
||||
@@ -179,19 +179,19 @@ bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNor
|
||||
{
|
||||
// cleverness: bobble between filling endpoints of edges, so that the previous edge's shared endpoint is maintained.
|
||||
if (j & 0x1)
|
||||
{
|
||||
{
|
||||
vtx0 = vertices[indices[j]].ptr();
|
||||
yBelowVx0 = (dv0 = vtx0[Y] - point[Y]) >= 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
vtx1 = vertices[indices[j]].ptr();
|
||||
yBelowVx1 = (vtx1[Y] >= point[Y]);
|
||||
yBelowVx1 = (vtx1[Y] >= point[Y]);
|
||||
}
|
||||
|
||||
// check if Y of point is between Y of Vx0 and Vx1
|
||||
if (yBelowVx0 != yBelowVx1)
|
||||
{
|
||||
{
|
||||
// check if X of point is not between X of Vx0 and Vx1
|
||||
if ( (xBelowVx0 = (vtx0[X] >= point[X])) == (vtx1[X] >= point[X]) )
|
||||
{
|
||||
@@ -200,9 +200,9 @@ bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNor
|
||||
else
|
||||
{
|
||||
// compute intersection of polygon segment with X ray, note if > point's X.
|
||||
crossings += (vtx0[X] - dv0*(vtx1[X] - vtx0[X])/(vtx1[Y] - vtx0[Y])) >= point[X];
|
||||
}
|
||||
}
|
||||
crossings += (vtx0[X] - dv0*(vtx1[X] - vtx0[X])/(vtx1[Y] - vtx0[Y])) >= point[X];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test if crossings is odd. If we care about its winding number > 0, then just: inside_flag = crossings > 0;
|
||||
|
||||
Reference in New Issue
Block a user