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:
@@ -21,6 +21,6 @@
|
||||
|
||||
// Company and Application name
|
||||
// These two together will become the registry key
|
||||
const char RI_COMPANY_NAME[] = "Ceetron";
|
||||
const char RI_APPLICATION_NAME[] = "ResInsight";
|
||||
const char RI_COMPANY_NAME[] = "Ceetron";
|
||||
const char RI_APPLICATION_NAME[] = "ResInsight";
|
||||
|
||||
|
@@ -152,7 +152,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
//cvf::Trace::enable(false);
|
||||
|
||||
m_preferences = new RiaPreferences;
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(m_preferences);
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(m_preferences);
|
||||
applyPreferences();
|
||||
|
||||
if (useShaders())
|
||||
@@ -568,7 +568,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
m_project->writeFile();
|
||||
|
||||
m_preferences->lastUsedProjectFileName = fileName;
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -892,7 +892,7 @@ RimWellLogPlot* RiaApplication::activeWellLogPlot()
|
||||
void RiaApplication::setUseShaders(bool enable)
|
||||
{
|
||||
m_preferences->useShaders = enable;
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -924,7 +924,7 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
|
||||
void RiaApplication::setShowPerformanceInfo(bool enable)
|
||||
{
|
||||
m_preferences->showHud = enable;
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
|
||||
@@ -2245,7 +2245,7 @@ void RiaApplication::regressionTestConfigureProject()
|
||||
{
|
||||
resvView->faultCollection->setShowFaultsOutsideFilters(false);
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = resvView->faultResultSettings->showCustomFaultResult.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = resvView->faultResultSettings->showCustomFaultResult.uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
uiFieldHandle->setValueFromUi(false);
|
||||
|
@@ -134,7 +134,7 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection(SelectionToggle
|
||||
{
|
||||
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>* >(uiObjectHandle->objectToggleField());
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = field->uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = field->uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
if (state == TOGGLE_ON) uiFieldHandle->setValueFromUi(true);
|
||||
|
@@ -503,8 +503,8 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa
|
||||
return false;
|
||||
}
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, eclipseCase->mainGrid()->gridIndex(), porosityModel, timeStep, resultName);
|
||||
if (resultAccessor.isNull())
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, eclipseCase->mainGrid()->gridIndex(), porosityModel, timeStep, resultName);
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -517,7 +517,7 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa
|
||||
{
|
||||
for (i = 0; i < eclipseCase->mainGrid()->cellCountI(); i++)
|
||||
{
|
||||
double resultValue = resultAccessor->cellScalar(eclipseCase->mainGrid()->cellIndexFromIJK(i, j, k));
|
||||
double resultValue = resultAccessor->cellScalar(eclipseCase->mainGrid()->cellIndexFromIJK(i, j, k));
|
||||
if (resultValue == HUGE_VAL)
|
||||
{
|
||||
resultValue = undefinedValue;
|
||||
|
@@ -35,15 +35,15 @@ class RigFemNativeStatCalc : public RigStatisticsCalculator
|
||||
public:
|
||||
RigFemNativeStatCalc(RigFemPartResultsCollection* femResultCollection, const RigFemResultAddress& resVarAddr);
|
||||
|
||||
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:
|
||||
RigFemPartResultsCollection* m_resultsData;
|
||||
RigFemPartResultsCollection* m_resultsData;
|
||||
RigFemResultAddress m_resVarAddr;
|
||||
};
|
||||
|
||||
|
@@ -164,7 +164,7 @@ RifOdbReader::RifOdbReader()
|
||||
odb_initializeAPI();
|
||||
}
|
||||
|
||||
m_odb = NULL;
|
||||
m_odb = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -172,7 +172,7 @@ RifOdbReader::RifOdbReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifOdbReader::~RifOdbReader()
|
||||
{
|
||||
close();
|
||||
close();
|
||||
|
||||
if (--sm_instanceCount == 0)
|
||||
{
|
||||
@@ -185,11 +185,11 @@ RifOdbReader::~RifOdbReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifOdbReader::close()
|
||||
{
|
||||
if (m_odb)
|
||||
{
|
||||
m_odb->close();
|
||||
m_odb = NULL;
|
||||
}
|
||||
if (m_odb)
|
||||
{
|
||||
m_odb->close();
|
||||
m_odb = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -197,17 +197,17 @@ void RifOdbReader::close()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifOdbReader::openFile(const std::string& fileName, std::string* errorMessage)
|
||||
{
|
||||
close();
|
||||
CVF_ASSERT(m_odb == NULL);
|
||||
close();
|
||||
CVF_ASSERT(m_odb == NULL);
|
||||
|
||||
odb_String path = fileName.c_str();
|
||||
odb_String path = fileName.c_str();
|
||||
|
||||
try
|
||||
{
|
||||
m_odb = &openOdb(path, true);
|
||||
}
|
||||
try
|
||||
{
|
||||
m_odb = &openOdb(path, true);
|
||||
}
|
||||
|
||||
catch (const nex_Exception& nex)
|
||||
catch (const nex_Exception& nex)
|
||||
{
|
||||
if (errorMessage)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ bool RifOdbReader::openFile(const std::string& fileName, std::string* errorMessa
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,13 +239,13 @@ bool RifOdbReader::openFile(const std::string& fileName, std::string* errorMessa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifOdbReader::assertMetaDataLoaded()
|
||||
{
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
|
||||
if (m_resultsMetaData.empty())
|
||||
{
|
||||
{
|
||||
m_resultsMetaData = readResultsMetaData(m_odb);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -254,11 +254,11 @@ void RifOdbReader::assertMetaDataLoaded()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map< RifOdbReader::RifOdbResultKey, std::vector<std::string> > RifOdbReader::readResultsMetaData(odb_Odb* odb)
|
||||
{
|
||||
CVF_ASSERT(odb != NULL);
|
||||
CVF_ASSERT(odb != NULL);
|
||||
|
||||
std::map< RifOdbResultKey, std::vector<std::string> > resultsMap;
|
||||
|
||||
const odb_StepRepository& stepRepository = odb->steps();
|
||||
const odb_StepRepository& stepRepository = odb->steps();
|
||||
odb_StepRepositoryIT stepIt(stepRepository);
|
||||
stepIt.first();
|
||||
|
||||
@@ -268,56 +268,56 @@ std::map< RifOdbReader::RifOdbResultKey, std::vector<std::string> > RifOdbReader
|
||||
if (stepFrames.size() > 1)
|
||||
{
|
||||
// Optimization: Get results metadata for the second frame of the first step only
|
||||
const odb_Frame& frame = stepFrames.constGet(1);
|
||||
|
||||
const odb_FieldOutputRepository& fieldCon = frame.fieldOutputs();
|
||||
odb_FieldOutputRepositoryIT fieldConIT(fieldCon);
|
||||
const odb_Frame& frame = stepFrames.constGet(1);
|
||||
|
||||
const odb_FieldOutputRepository& fieldCon = frame.fieldOutputs();
|
||||
odb_FieldOutputRepositoryIT fieldConIT(fieldCon);
|
||||
|
||||
for (fieldConIT.first(); !fieldConIT.isDone(); fieldConIT.next())
|
||||
{
|
||||
const odb_FieldOutput& field = fieldCon[fieldConIT.currentKey()];
|
||||
|
||||
const odb_SequenceFieldLocation& fieldLocations = field.locations();
|
||||
for (int loc = 0; loc < fieldLocations.size(); loc++)
|
||||
{
|
||||
const odb_FieldLocation& fieldLocation = fieldLocations.constGet(loc);
|
||||
for (fieldConIT.first(); !fieldConIT.isDone(); fieldConIT.next())
|
||||
{
|
||||
const odb_FieldOutput& field = fieldCon[fieldConIT.currentKey()];
|
||||
|
||||
const odb_SequenceFieldLocation& fieldLocations = field.locations();
|
||||
for (int loc = 0; loc < fieldLocations.size(); loc++)
|
||||
{
|
||||
const odb_FieldLocation& fieldLocation = fieldLocations.constGet(loc);
|
||||
|
||||
std::string fieldName = field.name().CStr();
|
||||
odb_SequenceString components = field.componentLabels();
|
||||
std::string fieldName = field.name().CStr();
|
||||
odb_SequenceString components = field.componentLabels();
|
||||
|
||||
std::vector<std::string> compVec;
|
||||
std::vector<std::string> compVec;
|
||||
|
||||
int numComp = components.size();
|
||||
for (int comp = 0; comp < numComp; comp++)
|
||||
{
|
||||
compVec.push_back(components[comp].CStr());
|
||||
}
|
||||
int numComp = components.size();
|
||||
for (int comp = 0; comp < numComp; comp++)
|
||||
{
|
||||
compVec.push_back(components[comp].CStr());
|
||||
}
|
||||
|
||||
switch (fieldLocation.position())
|
||||
{
|
||||
case odb_Enum::NODAL:
|
||||
switch (fieldLocation.position())
|
||||
{
|
||||
case odb_Enum::NODAL:
|
||||
resultsMap[RifOdbResultKey(NODAL, fieldName)] = compVec;
|
||||
break;
|
||||
break;
|
||||
|
||||
case odb_Enum::ELEMENT_NODAL:
|
||||
resultsMap[RifOdbResultKey(ELEMENT_NODAL, fieldName)] = compVec;
|
||||
break;
|
||||
break;
|
||||
|
||||
case odb_Enum::INTEGRATION_POINT:
|
||||
case odb_Enum::INTEGRATION_POINT:
|
||||
resultsMap[RifOdbResultKey(INTEGRATION_POINT, fieldName)] = compVec;
|
||||
resultsMap[RifOdbResultKey(ELEMENT_NODAL, fieldName)] = compVec;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stepFrames.release();
|
||||
|
||||
return resultsMap;
|
||||
return resultsMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ std::map< RifOdbReader::RifOdbResultKey, std::vector<std::string> > RifOdbReader
|
||||
bool RifOdbReader::readFemParts(RigFemPartCollection* femParts)
|
||||
{
|
||||
CVF_ASSERT(femParts);
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
|
||||
|
||||
odb_Assembly& rootAssembly = m_odb->rootAssembly();
|
||||
@@ -418,7 +418,7 @@ bool RifOdbReader::readFemParts(RigFemPartCollection* femParts)
|
||||
modelProgress.incrementProgress();
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -426,18 +426,18 @@ bool RifOdbReader::readFemParts(RigFemPartCollection* femParts)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RifOdbReader::stepNames()
|
||||
{
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
|
||||
std::vector<std::string> stepNames;
|
||||
std::vector<std::string> stepNames;
|
||||
|
||||
odb_StepRepository stepRepository = m_odb->steps();
|
||||
odb_StepRepositoryIT sIter(stepRepository);
|
||||
for (sIter.first(); !sIter.isDone(); sIter.next())
|
||||
{
|
||||
stepNames.push_back(stepRepository[sIter.currentKey()].name().CStr());
|
||||
}
|
||||
odb_StepRepository stepRepository = m_odb->steps();
|
||||
odb_StepRepositoryIT sIter(stepRepository);
|
||||
for (sIter.first(); !sIter.isDone(); sIter.next())
|
||||
{
|
||||
stepNames.push_back(stepRepository[sIter.currentKey()].name().CStr());
|
||||
}
|
||||
|
||||
return stepNames;
|
||||
return stepNames;
|
||||
}
|
||||
|
||||
|
||||
@@ -446,25 +446,25 @@ std::vector<std::string> RifOdbReader::stepNames()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RifOdbReader::frameTimes(int stepIndex)
|
||||
{
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
CVF_ASSERT(m_odb != NULL);
|
||||
|
||||
odb_StepRepository& stepRepository = m_odb->steps();
|
||||
odb_StepRepository& stepRepository = m_odb->steps();
|
||||
|
||||
odb_StepList stepList = stepRepository.stepList();
|
||||
odb_Step& step = stepList.Get(stepIndex);
|
||||
|
||||
odb_SequenceFrame& stepFrames = step.frames();
|
||||
odb_StepList stepList = stepRepository.stepList();
|
||||
odb_Step& step = stepList.Get(stepIndex);
|
||||
|
||||
odb_SequenceFrame& stepFrames = step.frames();
|
||||
|
||||
std::vector<double> frameValues;
|
||||
std::vector<double> frameValues;
|
||||
|
||||
int numFrames = stepFrames.size();
|
||||
for (int f = 0; f < numFrames; f++)
|
||||
{
|
||||
odb_Frame frame = stepFrames.constGet(f);
|
||||
frameValues.push_back(frame.frameValue());
|
||||
}
|
||||
int numFrames = stepFrames.size();
|
||||
for (int f = 0; f < numFrames; f++)
|
||||
{
|
||||
odb_Frame frame = stepFrames.constGet(f);
|
||||
frameValues.push_back(frame.frameValue());
|
||||
}
|
||||
|
||||
return frameValues;
|
||||
return frameValues;
|
||||
}
|
||||
|
||||
|
||||
@@ -485,24 +485,24 @@ std::vector<std::string> RifOdbReader::elementSetNames(int partIndex)
|
||||
|
||||
int currentInstance = 0;
|
||||
odb_InstanceRepositoryIT instIt(instances);
|
||||
for (instIt.first(); !instIt.isDone(); instIt.next(), currentInstance++)
|
||||
{
|
||||
for (instIt.first(); !instIt.isDone(); instIt.next(), currentInstance++)
|
||||
{
|
||||
const odb_Instance& instance = instIt.currentValue();
|
||||
|
||||
if (currentInstance == partIndex)
|
||||
{
|
||||
const odb_SetRepository& sets = rootAssembly.elementSets();
|
||||
|
||||
odb_SetRepositoryIT setIt(sets);
|
||||
for (setIt.first(); !setIt.isDone(); setIt.next())
|
||||
{
|
||||
|
||||
odb_SetRepositoryIT setIt(sets);
|
||||
for (setIt.first(); !setIt.isDone(); setIt.next())
|
||||
{
|
||||
const odb_Set& set = setIt.currentValue();
|
||||
setNames.push_back(set.name().CStr());
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_partElementSetNames[partIndex] = setNames;
|
||||
}
|
||||
@@ -524,16 +524,16 @@ std::vector<size_t> RifOdbReader::elementSet(int partIndex, int setIndex)
|
||||
const odb_Set& set = rootAssembly.elementSets()[odb_String(setNames[setIndex].c_str())];
|
||||
odb_SequenceString instanceNames = set.instanceNames();
|
||||
|
||||
const odb_SequenceElement& setElements = set.elements(instanceNames[partIndex]);
|
||||
int elementCount = setElements.size();
|
||||
const odb_SequenceElement& setElements = set.elements(instanceNames[partIndex]);
|
||||
int elementCount = setElements.size();
|
||||
|
||||
std::vector<size_t> elementIndexes;
|
||||
elementIndexes.resize(elementCount);
|
||||
|
||||
for (int i = 0; i < elementCount; i++)
|
||||
{
|
||||
for (int i = 0; i < elementCount; i++)
|
||||
{
|
||||
elementIndexes[i] = setElements.element(i).index();
|
||||
}
|
||||
}
|
||||
|
||||
return elementIndexes;
|
||||
}
|
||||
@@ -571,14 +571,14 @@ std::map<std::string, std::vector<std::string> > RifOdbReader::scalarIntegration
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const odb_Frame& RifOdbReader::stepFrame(int stepIndex, int frameIndex) const
|
||||
{
|
||||
CVF_ASSERT(m_odb);
|
||||
CVF_ASSERT(m_odb);
|
||||
|
||||
const odb_StepRepository& stepRepository = m_odb->steps();
|
||||
const odb_StepList& stepList = stepRepository.stepList();
|
||||
const odb_StepRepository& stepRepository = m_odb->steps();
|
||||
const odb_StepList& stepList = stepRepository.stepList();
|
||||
const odb_Step& step = stepList.ConstGet(stepIndex);
|
||||
const odb_SequenceFrame& stepFrames = step.frames();
|
||||
const odb_SequenceFrame& stepFrames = step.frames();
|
||||
|
||||
return stepFrames.constGet(frameIndex);
|
||||
return stepFrames.constGet(frameIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -616,20 +616,20 @@ size_t RifOdbReader::resultItemCount(const std::string& fieldName, int partIndex
|
||||
odb_Instance* partInstance = instance(partIndex);
|
||||
CVF_ASSERT(partInstance != NULL);
|
||||
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = instanceFieldOutput.bulkDataBlocks();
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = instanceFieldOutput.bulkDataBlocks();
|
||||
|
||||
size_t resultItemCount = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
size_t resultItemCount = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
resultItemCount += bulkData.length();
|
||||
}
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
resultItemCount += bulkData.length();
|
||||
}
|
||||
|
||||
return resultItemCount;
|
||||
return resultItemCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -648,21 +648,21 @@ size_t RifOdbReader::componentsCount(const std::string& fieldName, ResultPositio
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifOdbReader::componentIndex(const RifOdbResultKey& result, const std::string& componentName)
|
||||
{
|
||||
std::vector<std::string> compNames = componentNames(result);
|
||||
std::vector<std::string> compNames = componentNames(result);
|
||||
|
||||
// If there are no component names, we expect the field to be a pure scalar.
|
||||
// Then an empty string is the valid component name
|
||||
if (!compNames.size() && componentName == "") return 0;
|
||||
|
||||
for (size_t i = 0; i < compNames.size(); i++)
|
||||
{
|
||||
if (compNames[i] == componentName)
|
||||
{
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < compNames.size(); i++)
|
||||
{
|
||||
if (compNames[i] == componentName)
|
||||
{
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -674,15 +674,15 @@ std::vector<std::string> RifOdbReader::componentNames(const RifOdbResultKey& res
|
||||
assertMetaDataLoaded();
|
||||
|
||||
std::map< RifOdbResultKey, std::vector<std::string> >::const_iterator resMapIt = m_resultsMetaData.find(result);
|
||||
if (resMapIt != m_resultsMetaData.end())
|
||||
{
|
||||
if (resMapIt != m_resultsMetaData.end())
|
||||
{
|
||||
std::vector<std::string> compNames;
|
||||
compNames = resMapIt->second;
|
||||
return compNames;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CVF_ASSERT(false);
|
||||
return std::vector<std::string>();
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
|
||||
@@ -697,12 +697,12 @@ std::map<std::string, std::vector<std::string> > RifOdbReader::fieldAndComponent
|
||||
|
||||
std::map< RifOdbResultKey, std::vector<std::string> >::const_iterator resMapIt;
|
||||
for (resMapIt = m_resultsMetaData.begin(); resMapIt != m_resultsMetaData.end(); resMapIt++)
|
||||
{
|
||||
{
|
||||
if (resMapIt->first.resultPostion == position)
|
||||
{
|
||||
fieldsAndComponents[resMapIt->first.fieldName] = resMapIt->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fieldsAndComponents;
|
||||
}
|
||||
@@ -713,42 +713,42 @@ std::map<std::string, std::vector<std::string> > RifOdbReader::fieldAndComponent
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifOdbReader::readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements)
|
||||
{
|
||||
CVF_ASSERT(displacements);
|
||||
CVF_ASSERT(displacements);
|
||||
|
||||
odb_Instance* partInstance = instance(partIndex);
|
||||
CVF_ASSERT(partInstance != NULL);
|
||||
|
||||
size_t dataSize = resultItemCount("U", partIndex, stepIndex, frameIndex);
|
||||
if (dataSize > 0)
|
||||
{
|
||||
displacements->resize(dataSize);
|
||||
}
|
||||
size_t dataSize = resultItemCount("U", partIndex, stepIndex, frameIndex);
|
||||
if (dataSize > 0)
|
||||
{
|
||||
displacements->resize(dataSize);
|
||||
}
|
||||
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()["U"].getSubset(*partInstance);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = instanceFieldOutput.bulkDataBlocks();
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()["U"].getSubset(*partInstance);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = instanceFieldOutput.bulkDataBlocks();
|
||||
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
||||
|
||||
if (bulkData.numberOfNodes() > 0)
|
||||
{
|
||||
int numNodes = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
if (bulkData.numberOfNodes() > 0)
|
||||
{
|
||||
int numNodes = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
float* data = bulkDataGetter.data();
|
||||
|
||||
for (int i = 0; i < numNodes; i++)
|
||||
{
|
||||
(*displacements)[i + dataIndex].set(data[i*numComp], data[i*numComp + 1], data[i*numComp + 2]);
|
||||
}
|
||||
for (int i = 0; i < numNodes; i++)
|
||||
{
|
||||
(*displacements)[i + dataIndex].set(data[i*numComp], data[i*numComp + 1], data[i*numComp + 2]);
|
||||
}
|
||||
|
||||
dataIndex += numNodes*numComp;
|
||||
}
|
||||
}
|
||||
dataIndex += numNodes*numComp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ void RifOdbReader::readDisplacements(int partIndex, int stepIndex, int frameInde
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifOdbReader::readNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues)
|
||||
{
|
||||
CVF_ASSERT(resultValues);
|
||||
CVF_ASSERT(resultValues);
|
||||
|
||||
odb_Instance* partInstance = instance(partIndex);
|
||||
CVF_ASSERT(partInstance != NULL);
|
||||
@@ -769,42 +769,42 @@ void RifOdbReader::readNodeField(const std::string& fieldName, int partIndex, in
|
||||
|
||||
size_t dataSize = nodeIdToIdxMap.size();
|
||||
|
||||
if (dataSize > 0)
|
||||
{
|
||||
if (dataSize > 0)
|
||||
{
|
||||
for (int comp = 0; comp < compCount; comp++)
|
||||
{
|
||||
{
|
||||
CVF_ASSERT((*resultValues)[comp]);
|
||||
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::NODAL);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
||||
|
||||
int numNodes = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int numNodes = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int* nodeLabels = bulkData.nodeLabels();
|
||||
float* data = bulkDataGetter.data();
|
||||
|
||||
for (int nIdx = 0; nIdx < numNodes; nIdx++)
|
||||
{
|
||||
for (int nIdx = 0; nIdx < numNodes; nIdx++)
|
||||
{
|
||||
for (int comp = 0; comp < numComp; comp++)
|
||||
{
|
||||
std::vector<float>* singleComponentValues = (*resultValues)[comp];
|
||||
(*singleComponentValues)[nodeIdToIdxMap[nodeLabels[nIdx]]] = data[nIdx*numComp + comp];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -824,36 +824,36 @@ void RifOdbReader::readElementNodeField(const std::string& fieldName,
|
||||
CVF_ASSERT(compCount == resultValues->size());
|
||||
|
||||
size_t dataSize = resultItemCount(fieldName, partIndex, stepIndex, frameIndex);
|
||||
if (dataSize > 0)
|
||||
{
|
||||
if (dataSize > 0)
|
||||
{
|
||||
for (int comp = 0; comp < compCount; comp++)
|
||||
{
|
||||
{
|
||||
CVF_ASSERT((*resultValues)[comp]);
|
||||
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::ELEMENT_NODAL);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
|
||||
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
|
||||
CVF_ASSERT(elementIdToIdxMap.size() > 0);
|
||||
|
||||
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
||||
|
||||
int numValues = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int numValues = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int elemCount = bulkData.numberOfElements();
|
||||
int elemNodeCount = numValues/elemCount;
|
||||
int* elementLabels = bulkData.elementLabels();
|
||||
int elemNodeCount = numValues/elemCount;
|
||||
int* elementLabels = bulkData.elementLabels();
|
||||
float* data = bulkDataGetter.data();
|
||||
|
||||
for (int elem = 0; elem < elemCount; elem++)
|
||||
@@ -873,7 +873,7 @@ void RifOdbReader::readElementNodeField(const std::string& fieldName,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -891,36 +891,36 @@ void RifOdbReader::readIntegrationPointField(const std::string& fieldName, int p
|
||||
CVF_ASSERT(compCount == resultValues->size());
|
||||
|
||||
size_t dataSize = resultItemCount(fieldName, partIndex, stepIndex, frameIndex);
|
||||
if (dataSize > 0)
|
||||
{
|
||||
if (dataSize > 0)
|
||||
{
|
||||
for (int comp = 0; comp < compCount; comp++)
|
||||
{
|
||||
{
|
||||
CVF_ASSERT((*resultValues)[comp]);
|
||||
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
(*resultValues)[comp]->resize(dataSize, std::numeric_limits<float>::infinity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_Frame& frame = stepFrame(stepIndex, frameIndex);
|
||||
const odb_FieldOutput& instanceFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*partInstance);
|
||||
const odb_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::INTEGRATION_POINT);
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
|
||||
|
||||
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
|
||||
CVF_ASSERT(elementIdToIdxMap.size() > 0);
|
||||
|
||||
|
||||
size_t dataIndex = 0;
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
int numBlocks = seqFieldBulkData.size();
|
||||
for (int block = 0; block < numBlocks; block++)
|
||||
{
|
||||
const odb_FieldBulkData& bulkData = seqFieldBulkData[block];
|
||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
||||
|
||||
int numValues = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int numValues = bulkData.length();
|
||||
int numComp = bulkData.width();
|
||||
int elemCount = bulkData.numberOfElements();
|
||||
int ipCount = numValues/elemCount;
|
||||
int* elementLabels = bulkData.elementLabels();
|
||||
int ipCount = numValues/elemCount;
|
||||
int* elementLabels = bulkData.elementLabels();
|
||||
float* data = bulkDataGetter.data();
|
||||
|
||||
RigElementType eType = toRigElementType(bulkData.baseElementType());
|
||||
@@ -945,5 +945,5 @@ void RifOdbReader::readIntegrationPointField(const std::string& fieldName, int p
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
RifOdbReader();
|
||||
virtual ~RifOdbReader();
|
||||
|
||||
virtual bool openFile(const std::string& fileName, std::string* errorMessage);
|
||||
virtual bool openFile(const std::string& fileName, std::string* errorMessage);
|
||||
|
||||
virtual bool readFemParts(RigFemPartCollection* geoMechCase);
|
||||
virtual std::vector<std::string> stepNames();
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
private:
|
||||
enum ResultPosition
|
||||
{
|
||||
NODAL,
|
||||
ELEMENT_NODAL,
|
||||
INTEGRATION_POINT
|
||||
NODAL,
|
||||
ELEMENT_NODAL,
|
||||
INTEGRATION_POINT
|
||||
};
|
||||
|
||||
class RifOdbResultKey
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
size_t resultItemCount(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex);
|
||||
size_t componentsCount(const std::string& fieldName, ResultPosition position);
|
||||
const odb_Frame& stepFrame(int stepIndex, int frameIndex) const;
|
||||
odb_Instance* instance(int instanceIndex);
|
||||
odb_Instance* instance(int instanceIndex);
|
||||
|
||||
int componentIndex(const RifOdbResultKey& result, const std::string& componentName);
|
||||
std::vector<std::string> componentNames(const RifOdbResultKey& result);
|
||||
@@ -108,5 +108,5 @@ private:
|
||||
std::vector< std::map<int, int> > m_nodeIdToIdxMaps;
|
||||
std::vector< std::map<int, int> > m_elementIdToIdxMaps;
|
||||
|
||||
static size_t sm_instanceCount;
|
||||
static size_t sm_instanceCount;
|
||||
};
|
||||
|
@@ -41,84 +41,84 @@ TEST(OdbReaderTest, BasicTests)
|
||||
cvf::DebugTimer timer("DebugTimer");
|
||||
timer.reportTime();
|
||||
|
||||
reader->openFile(TEST_FILE);
|
||||
reader->openFile(TEST_FILE);
|
||||
reader->readFemParts(femData.p());
|
||||
|
||||
EXPECT_EQ(1, femData->partCount());
|
||||
EXPECT_EQ(4320, femData->part(0)->elementCount());
|
||||
EXPECT_EQ(HEX8, femData->part(0)->elementType(0));
|
||||
|
||||
EXPECT_EQ(true, reader->stepNames().size() == 1);
|
||||
EXPECT_EQ(true, reader->stepNames().size() == 1);
|
||||
|
||||
std::vector<std::string> steps = reader->stepNames();
|
||||
EXPECT_EQ(true, steps.at(0).find("Date_20100930") >= 0);
|
||||
EXPECT_EQ(2, reader->frameTimes(0).size());
|
||||
EXPECT_EQ(1.0, reader->frameTimes(0)[1]);
|
||||
std::vector<std::string> steps = reader->stepNames();
|
||||
EXPECT_EQ(true, steps.at(0).find("Date_20100930") >= 0);
|
||||
EXPECT_EQ(2, reader->frameTimes(0).size());
|
||||
EXPECT_EQ(1.0, reader->frameTimes(0)[1]);
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarNodeFieldsMap = reader->scalarNodeFieldAndComponentNames();
|
||||
EXPECT_EQ(3, scalarNodeFieldsMap.size());
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarElementNodeFieldsMap = reader->scalarElementNodeFieldAndComponentNames();
|
||||
EXPECT_EQ(0, scalarElementNodeFieldsMap.size());
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldsMap = reader->scalarIntegrationPointFieldAndComponentNames();
|
||||
EXPECT_EQ(6, scalarIntegrationPointFieldsMap.size());
|
||||
std::map<std::string, std::vector<std::string> > scalarNodeFieldsMap = reader->scalarNodeFieldAndComponentNames();
|
||||
EXPECT_EQ(3, scalarNodeFieldsMap.size());
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarElementNodeFieldsMap = reader->scalarElementNodeFieldAndComponentNames();
|
||||
EXPECT_EQ(0, scalarElementNodeFieldsMap.size());
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldsMap = reader->scalarIntegrationPointFieldAndComponentNames();
|
||||
EXPECT_EQ(6, scalarIntegrationPointFieldsMap.size());
|
||||
|
||||
std::vector<float> displacementValues;
|
||||
reader->readScalarNodeField("U", "U2", 0, 0, 1, &displacementValues);
|
||||
EXPECT_EQ(5168, displacementValues.size());
|
||||
std::vector<float> displacementValues;
|
||||
reader->readScalarNodeField("U", "U2", 0, 0, 1, &displacementValues);
|
||||
EXPECT_EQ(5168, displacementValues.size());
|
||||
|
||||
std::vector<float> integrationPointS22;
|
||||
std::vector<float> integrationPointS22;
|
||||
timer.restart();
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
timer.reportLapTime("Read S/S22");
|
||||
timer.restart();
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
timer.reportLapTime("Read S/S22 2nd time");
|
||||
timer.restart();
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
timer.reportLapTime("Read S/S22 3rd time");
|
||||
EXPECT_EQ(34560, integrationPointS22.size());
|
||||
EXPECT_FLOAT_EQ(-1921117.3, integrationPointS22[0]);
|
||||
EXPECT_FLOAT_EQ(-1408592.5, integrationPointS22[1]);
|
||||
EXPECT_FLOAT_EQ(-1345666.9, integrationPointS22[2]);
|
||||
EXPECT_FLOAT_EQ(-1921117.3, integrationPointS22[0]);
|
||||
EXPECT_FLOAT_EQ(-1408592.5, integrationPointS22[1]);
|
||||
EXPECT_FLOAT_EQ(-1345666.9, integrationPointS22[2]);
|
||||
|
||||
std::vector<float> elementNodeS11;
|
||||
std::vector<float> elementNodeS11;
|
||||
reader->readScalarElementNodeField("S", "S11", 0, 0, 1, &elementNodeS11);
|
||||
EXPECT_EQ(34560, elementNodeS11.size());
|
||||
EXPECT_FLOAT_EQ(-2074357.3, elementNodeS11[0]);
|
||||
EXPECT_FLOAT_EQ(-1353137.5, elementNodeS11[1]);
|
||||
EXPECT_FLOAT_EQ(-1144559.4, elementNodeS11[2]);
|
||||
EXPECT_EQ(34560, elementNodeS11.size());
|
||||
EXPECT_FLOAT_EQ(-2074357.3, elementNodeS11[0]);
|
||||
EXPECT_FLOAT_EQ(-1353137.5, elementNodeS11[1]);
|
||||
EXPECT_FLOAT_EQ(-1144559.4, elementNodeS11[2]);
|
||||
|
||||
std::vector<float> integrationPointE33;
|
||||
reader->readScalarIntegrationPointField("E", "E33", 0, 0, 1, &integrationPointE33);
|
||||
EXPECT_EQ(34560, integrationPointE33.size());
|
||||
std::vector<float> integrationPointE33;
|
||||
reader->readScalarIntegrationPointField("E", "E33", 0, 0, 1, &integrationPointE33);
|
||||
EXPECT_EQ(34560, integrationPointE33.size());
|
||||
|
||||
std::vector<float> integrationPointTEMP;
|
||||
reader->readScalarIntegrationPointField("TEMP", "", 0, 0, 1, &integrationPointTEMP);
|
||||
EXPECT_EQ(34560, integrationPointTEMP.size());
|
||||
std::vector<float> integrationPointTEMP;
|
||||
reader->readScalarIntegrationPointField("TEMP", "", 0, 0, 1, &integrationPointTEMP);
|
||||
EXPECT_EQ(34560, integrationPointTEMP.size());
|
||||
|
||||
std::vector<cvf::Vec3f> displacements;
|
||||
reader->readDisplacements(0, 0, 1, &displacements);
|
||||
EXPECT_EQ(5168, displacements.size());
|
||||
EXPECT_FLOAT_EQ(0.047638997, displacements[1].y());
|
||||
EXPECT_FLOAT_EQ(-0.0036307564, displacements[6].x());
|
||||
EXPECT_FLOAT_EQ(0.065709047, displacements[6].y());
|
||||
EXPECT_FLOAT_EQ(-0.059760433, displacements[6].z());
|
||||
std::vector<cvf::Vec3f> displacements;
|
||||
reader->readDisplacements(0, 0, 1, &displacements);
|
||||
EXPECT_EQ(5168, displacements.size());
|
||||
EXPECT_FLOAT_EQ(0.047638997, displacements[1].y());
|
||||
EXPECT_FLOAT_EQ(-0.0036307564, displacements[6].x());
|
||||
EXPECT_FLOAT_EQ(0.065709047, displacements[6].y());
|
||||
EXPECT_FLOAT_EQ(-0.059760433, displacements[6].z());
|
||||
|
||||
std::vector<float> porValues;
|
||||
reader->readScalarNodeField("POR", "", 0, 0, 1, &porValues);
|
||||
EXPECT_EQ(5168, porValues.size());
|
||||
std::vector<float> porValues;
|
||||
reader->readScalarNodeField("POR", "", 0, 0, 1, &porValues);
|
||||
EXPECT_EQ(5168, porValues.size());
|
||||
|
||||
std::vector<float> voidrValues;
|
||||
reader->readScalarIntegrationPointField("VOIDR", "", 0, 0, 0, &voidrValues);
|
||||
EXPECT_EQ(34560, voidrValues.size());
|
||||
EXPECT_FLOAT_EQ(0.22864963, voidrValues[0]);
|
||||
EXPECT_FLOAT_EQ(0.23406270, voidrValues[1]);
|
||||
EXPECT_FLOAT_EQ(0.24549910, voidrValues[2]);
|
||||
std::vector<float> voidrValues;
|
||||
reader->readScalarIntegrationPointField("VOIDR", "", 0, 0, 0, &voidrValues);
|
||||
EXPECT_EQ(34560, voidrValues.size());
|
||||
EXPECT_FLOAT_EQ(0.22864963, voidrValues[0]);
|
||||
EXPECT_FLOAT_EQ(0.23406270, voidrValues[1]);
|
||||
EXPECT_FLOAT_EQ(0.24549910, voidrValues[2]);
|
||||
|
||||
timer.restart();
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
reader->readScalarIntegrationPointField("S", "S22", 0, 0, 1, &integrationPointS22);
|
||||
timer.reportLapTime("Read S/S22 final time");
|
||||
}
|
||||
|
||||
|
@@ -31,14 +31,14 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(TernaryScalarMapperTest, BasicFunctions)
|
||||
{
|
||||
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
|
||||
cvf::ref<cvf::TextureImage> texImage = new cvf::TextureImage;
|
||||
scalarMapper->updateTexture(texImage.p(), 1.0);
|
||||
cvf::ref<cvf::TextureImage> texImage = new cvf::TextureImage;
|
||||
scalarMapper->updateTexture(texImage.p(), 1.0);
|
||||
|
||||
QImage img = cvfqt::Utils::toQImage(*(texImage.p()));
|
||||
QImage img = cvfqt::Utils::toQImage(*(texImage.p()));
|
||||
|
||||
img.save("c:/tmp/test.png");
|
||||
img.save("c:/tmp/test.png");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -46,58 +46,58 @@ TEST(TernaryScalarMapperTest, BasicFunctions)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(TernaryScalarMapperTest, TextureMapping)
|
||||
{
|
||||
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
|
||||
// Without opacity
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
// Without opacity
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(1.0, 0.0, false);
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(1.0, 0.0, false);
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(3.0, 3.0, false);
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(3.0, 3.0, false);
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(-1.0, -1.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(-1.0, -1.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.5, 3.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.25, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.5, 3.0, false);
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.25, texCoord.y());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Opacity
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, true);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
|
||||
}
|
||||
|
||||
|
||||
// Opacity
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 0.0, true);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(0.5, texCoord.y());
|
||||
}
|
||||
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, true);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.y());
|
||||
}
|
||||
{
|
||||
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(0.0, 1.0, true);
|
||||
EXPECT_DOUBLE_EQ(0.0, texCoord.x());
|
||||
EXPECT_DOUBLE_EQ(1.0, texCoord.y());
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ CellEdgeEffectGenerator::CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeSc
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellEdgeEffectGenerator::setScalarMapper(const cvf::ScalarMapper* cellScalarMapper)
|
||||
{
|
||||
m_cellScalarMapper = cellScalarMapper;
|
||||
m_cellScalarMapper = cellScalarMapper;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -65,7 +65,7 @@ void CellEdgeEffectGenerator::setScalarMapper(const cvf::ScalarMapper* cellScala
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellEdgeEffectGenerator::setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper)
|
||||
{
|
||||
m_ternaryCellScalarMapper = ternaryScalarMapper;
|
||||
m_ternaryCellScalarMapper = ternaryScalarMapper;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,8 +78,8 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
if (otherCellFaceEffectGenerator
|
||||
&& m_cellScalarMapper.p() == otherCellFaceEffectGenerator->m_cellScalarMapper.p()
|
||||
&& m_edgeScalarMapper.p() == otherCellFaceEffectGenerator->m_edgeScalarMapper.p()
|
||||
&& m_ternaryCellScalarMapper.p() == otherCellFaceEffectGenerator->m_ternaryCellScalarMapper.p()
|
||||
&& m_cullBackfaces == otherCellFaceEffectGenerator->m_cullBackfaces
|
||||
&& m_ternaryCellScalarMapper.p() == otherCellFaceEffectGenerator->m_ternaryCellScalarMapper.p()
|
||||
&& m_cullBackfaces == otherCellFaceEffectGenerator->m_cullBackfaces
|
||||
&& m_opacityLevel == otherCellFaceEffectGenerator->m_opacityLevel
|
||||
&& m_undefinedColor == otherCellFaceEffectGenerator->m_undefinedColor
|
||||
&& m_defaultCellColor == otherCellFaceEffectGenerator->m_defaultCellColor
|
||||
@@ -114,8 +114,8 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
|
||||
{
|
||||
CellEdgeEffectGenerator * newEffect = new CellEdgeEffectGenerator(m_edgeScalarMapper.p());
|
||||
newEffect->setScalarMapper(m_cellScalarMapper.p());
|
||||
newEffect->setTernaryScalarMapper(m_ternaryCellScalarMapper.p());
|
||||
newEffect->setScalarMapper(m_cellScalarMapper.p());
|
||||
newEffect->setTernaryScalarMapper(m_ternaryCellScalarMapper.p());
|
||||
newEffect->m_edgeTextureImage = m_edgeTextureImage;
|
||||
newEffect->m_cellTextureImage = m_cellTextureImage;
|
||||
|
||||
@@ -133,54 +133,54 @@ caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellEdgeEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) const
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
|
||||
// Set up shader program
|
||||
// Set up shader program
|
||||
|
||||
cvf::ShaderProgramGenerator shaderGen("CellEdgeFaceShaderProgramGenerator", cvf::ShaderSourceProvider::instance());
|
||||
{
|
||||
QFile data(":/Shader/fs_CellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
cvf::ShaderProgramGenerator shaderGen("CellEdgeFaceShaderProgramGenerator", cvf::ShaderSourceProvider::instance());
|
||||
{
|
||||
QFile data(":/Shader/fs_CellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
|
||||
shaderGen.addFragmentCode(cvfString);
|
||||
}
|
||||
}
|
||||
shaderGen.addFragmentCode(cvfString);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ternaryCellScalarMapper.notNull())
|
||||
{
|
||||
{
|
||||
QFile data(":/Shader/vs_2dTextureCellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
if (m_ternaryCellScalarMapper.notNull())
|
||||
{
|
||||
{
|
||||
QFile data(":/Shader/vs_2dTextureCellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
|
||||
shaderGen.addVertexCode(cvfString);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
QFile data(":/Shader/vs_CellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
shaderGen.addVertexCode(cvfString);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
QFile data(":/Shader/vs_CellFace.glsl");
|
||||
if (data.open(QFile::ReadOnly))
|
||||
{
|
||||
QTextStream in(&data);
|
||||
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
QString data = in.readAll();
|
||||
cvf::String cvfString = cvfqt::Utils::toString(data);
|
||||
|
||||
shaderGen.addVertexCode(cvfString);
|
||||
}
|
||||
}
|
||||
}
|
||||
shaderGen.addVertexCode(cvfString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_disableLighting)
|
||||
{
|
||||
@@ -203,11 +203,11 @@ void CellEdgeEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect)
|
||||
|
||||
cvf::ref<cvf::TextureImage> modifiedCellTextImage;
|
||||
m_edgeScalarMapper->updateTexture(m_edgeTextureImage.p());
|
||||
if (m_ternaryCellScalarMapper.notNull())
|
||||
{
|
||||
m_ternaryCellScalarMapper->updateTexture(m_cellTextureImage.p(), m_opacityLevel);
|
||||
modifiedCellTextImage = m_cellTextureImage;
|
||||
}
|
||||
if (m_ternaryCellScalarMapper.notNull())
|
||||
{
|
||||
m_ternaryCellScalarMapper->updateTexture(m_cellTextureImage.p(), m_opacityLevel);
|
||||
modifiedCellTextImage = m_cellTextureImage;
|
||||
}
|
||||
else if (m_cellScalarMapper.notNull())
|
||||
{
|
||||
m_cellScalarMapper->updateTexture(m_cellTextureImage.p());
|
||||
|
@@ -101,10 +101,10 @@ class RivTernaryScalarMapper;
|
||||
class CellEdgeEffectGenerator : public caf::EffectGenerator
|
||||
{
|
||||
public:
|
||||
CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper);
|
||||
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; }
|
||||
@@ -125,9 +125,9 @@ 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;
|
||||
float m_opacityLevel;
|
||||
caf::FaceCulling m_cullBackfaces;
|
||||
cvf::Color3f m_undefinedColor;
|
||||
cvf::Color3f m_defaultCellColor;
|
||||
|
@@ -42,141 +42,141 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel)
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel)
|
||||
{
|
||||
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
|
||||
// Create result access objects
|
||||
// Create result access objects
|
||||
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
|
||||
localCoords->resize(vertexCount);
|
||||
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
|
||||
localCoords->resize(vertexCount);
|
||||
|
||||
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
|
||||
faceIndexArray->resize(vertexCount);
|
||||
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
|
||||
faceIndexArray->resize(vertexCount);
|
||||
|
||||
cvf::ref<cvf::FloatArray> cellColorTextureCoordArray = new cvf::FloatArray;
|
||||
cellColorTextureCoordArray->resize(vertexCount);
|
||||
cvf::ref<cvf::FloatArray> cellColorTextureCoordArray = new cvf::FloatArray;
|
||||
cellColorTextureCoordArray->resize(vertexCount);
|
||||
|
||||
// Build six cell face color arrays
|
||||
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
|
||||
colorArray->resize(vertexCount);
|
||||
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
|
||||
}
|
||||
// Build six cell face color arrays
|
||||
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
|
||||
colorArray->resize(vertexCount);
|
||||
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
|
||||
}
|
||||
|
||||
cvf::ScalarMapper* cellResultScalarMapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
|
||||
cvf::ScalarMapper* cellResultScalarMapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
|
||||
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
|
||||
|
||||
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
|
||||
cvf::ref<cvf::UIntArray> gridCellToWellindexMap;
|
||||
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
|
||||
cvf::ref<cvf::UIntArray> gridCellToWellindexMap;
|
||||
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex));
|
||||
gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(gridIndex);
|
||||
}
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex));
|
||||
gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(gridIndex);
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
|
||||
{
|
||||
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
|
||||
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
|
||||
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
|
||||
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
|
||||
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
|
||||
{
|
||||
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
|
||||
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
|
||||
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
|
||||
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
|
||||
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
|
||||
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
|
||||
{
|
||||
cvf::StructGridInterface::FaceType cellFace = quadToCellFaceMapper->cellFace(quadIdx);
|
||||
double scalarValue = cellCenterDataAccessObject->cellFaceScalar(cellIndex, cellFace);
|
||||
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
|
||||
{
|
||||
cvf::StructGridInterface::FaceType cellFace = quadToCellFaceMapper->cellFace(quadIdx);
|
||||
double scalarValue = cellCenterDataAccessObject->cellFaceScalar(cellIndex, cellFace);
|
||||
|
||||
{
|
||||
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
|
||||
if (scalarValue != HUGE_VAL)
|
||||
{
|
||||
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
// If we are dealing with wellcells, the default is transparent.
|
||||
// we need to make cells opaque if there are no wellpipe through them.
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
|
||||
if (wellIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if (!(*isWellPipeVisible)[wellIndex])
|
||||
{
|
||||
cellColorTextureCoord += 2.0f; // The shader must interpret values in the range 2-3 as "opaque"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellColorTextureCoord = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
}
|
||||
{
|
||||
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
|
||||
if (scalarValue != HUGE_VAL)
|
||||
{
|
||||
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
// If we are dealing with wellcells, the default is transparent.
|
||||
// we need to make cells opaque if there are no wellpipe through them.
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
|
||||
if (wellIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if (!(*isWellPipeVisible)[wellIndex])
|
||||
{
|
||||
cellColorTextureCoord += 2.0f; // The shader must interpret values in the range 2-3 as "opaque"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellColorTextureCoord = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
}
|
||||
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 0, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 1, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 2, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 3, cellColorTextureCoord);
|
||||
}
|
||||
}
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 0, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 1, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 2, cellColorTextureCoord);
|
||||
cellColorTextureCoordArray->set(quadIdx * 4 + 3, cellColorTextureCoord);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float edgeColor;
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
float edgeColor;
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
|
||||
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
|
||||
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
|
||||
|
||||
if (!hideScalarValue(scalarValue, ignoredScalarValue, 1e-2))
|
||||
{
|
||||
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
}
|
||||
{
|
||||
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
}
|
||||
|
||||
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
||||
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
||||
|
||||
colArr->set(quadIdx * 4 + 0, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 1, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 2, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 3, edgeColor);
|
||||
}
|
||||
}
|
||||
colArr->set(quadIdx * 4 + 0, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 1, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 2, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 3, edgeColor);
|
||||
}
|
||||
}
|
||||
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorCell", cellColorTextureCoordArray.p()));
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorCell", cellColorTextureCoordArray.p()));
|
||||
|
||||
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
|
||||
geo->setVertexAttribute(faceIntAttribute.p());
|
||||
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
|
||||
geo->setVertexAttribute(faceIntAttribute.p());
|
||||
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
|
||||
}
|
||||
|
||||
bool RivCellEdgeGeometryUtils::hideScalarValue(double scalarValue, double scalarValueToHide, double tolerance)
|
||||
@@ -188,96 +188,96 @@ bool RivCellEdgeGeometryUtils::hideScalarValue(double scalarValue, double scalar
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
|
||||
{
|
||||
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
|
||||
localCoords->resize(vertexCount);
|
||||
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
|
||||
localCoords->resize(vertexCount);
|
||||
|
||||
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
|
||||
faceIndexArray->resize(vertexCount);
|
||||
cvf::ref<cvf::IntArray> faceIndexArray = new cvf::IntArray;
|
||||
faceIndexArray->resize(vertexCount);
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> vCellColorTextureCoordArray = new cvf::Vec2fArray;
|
||||
vCellColorTextureCoordArray->resize(vertexCount);
|
||||
cvf::ref<cvf::Vec2fArray> vCellColorTextureCoordArray = new cvf::Vec2fArray;
|
||||
vCellColorTextureCoordArray->resize(vertexCount);
|
||||
|
||||
// Build six cell face color arrays
|
||||
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
|
||||
colorArray->resize(vertexCount);
|
||||
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
|
||||
}
|
||||
// Build six cell face color arrays
|
||||
cvf::Collection<cvf::FloatArray> cellEdgeColorTextureCoordsArrays;
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
cvf::ref<cvf::FloatArray> colorArray = new cvf::FloatArray;
|
||||
colorArray->resize(vertexCount);
|
||||
cellEdgeColorTextureCoordsArrays.push_back(colorArray.p());
|
||||
}
|
||||
|
||||
RivTernaryScalarMapper* ternaryCellResultScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
|
||||
RivTernaryScalarMapper* ternaryCellResultScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
cvf::ScalarMapper* edgeResultScalarMapper = cellEdgeResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
|
||||
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
|
||||
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
gridIndex,
|
||||
quadToCellFaceMapper);
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
gridIndex,
|
||||
quadToCellFaceMapper);
|
||||
|
||||
texturer.createTextureCoords(vCellColorTextureCoordArray.p());
|
||||
texturer.createTextureCoords(vCellColorTextureCoordArray.p());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
|
||||
{
|
||||
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
|
||||
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
|
||||
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
|
||||
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
|
||||
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
|
||||
{
|
||||
localCoords->set(quadIdx * 4 + 0, cvf::Vec2f(0, 0));
|
||||
localCoords->set(quadIdx * 4 + 1, cvf::Vec2f(1, 0));
|
||||
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
|
||||
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
|
||||
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx));
|
||||
|
||||
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
|
||||
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
|
||||
|
||||
float edgeColor;
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
float edgeColor;
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
||||
|
||||
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
|
||||
double scalarValue = cellEdgeResultAccessor->cellFaceScalar(cellIndex, static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx));
|
||||
|
||||
if (!hideScalarValue(scalarValue, ignoredScalarValue, 1e-2))
|
||||
{
|
||||
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
}
|
||||
{
|
||||
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
}
|
||||
|
||||
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
||||
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
||||
|
||||
colArr->set(quadIdx * 4 + 0, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 1, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 2, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 3, edgeColor);
|
||||
}
|
||||
}
|
||||
colArr->set(quadIdx * 4 + 0, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 1, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 2, edgeColor);
|
||||
colArr->set(quadIdx * 4 + 3, edgeColor);
|
||||
}
|
||||
}
|
||||
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_cellTextureCoord", vCellColorTextureCoordArray.p()));
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_localCoord", localCoords.p()));
|
||||
geo->setVertexAttribute(new cvf::Vec2fVertexAttribute("a_cellTextureCoord", vCellColorTextureCoordArray.p()));
|
||||
|
||||
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
|
||||
geo->setVertexAttribute(faceIntAttribute.p());
|
||||
cvf::ref<cvf::IntVertexAttributeDirect> faceIntAttribute = new cvf::IntVertexAttributeDirect("a_face", faceIndexArray.p());
|
||||
geo->setVertexAttribute(faceIntAttribute.p());
|
||||
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosI", cellEdgeColorTextureCoordsArrays.at(0)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegI", cellEdgeColorTextureCoordsArrays.at(1)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosJ", cellEdgeColorTextureCoordsArrays.at(2)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegJ", cellEdgeColorTextureCoordsArrays.at(3)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorPosK", cellEdgeColorTextureCoordsArrays.at(4)));
|
||||
geo->setVertexAttribute(new cvf::FloatVertexAttribute("a_colorNegK", cellEdgeColorTextureCoordsArrays.at(5)));
|
||||
|
||||
}
|
||||
|
||||
@@ -285,28 +285,28 @@ void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t tim
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid)
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultColors->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultColors->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
size_t cubeFaceIdx;
|
||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
size_t cubeFaceIdx;
|
||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
|
||||
return cellEdgeResultAccessor;
|
||||
return cellEdgeResultAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -314,26 +314,26 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeCenterResult
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellCenterResultAccessor(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, RigCaseData* eclipseCase, const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = NULL;
|
||||
cvf::ref<RigResultAccessor> resultAccessor = NULL;
|
||||
|
||||
if (cellResultColors->hasResult())
|
||||
{
|
||||
if (!cellResultColors->hasDynamicResult())
|
||||
{
|
||||
// Static result values are located at time step 0
|
||||
timeStepIndex = 0;
|
||||
}
|
||||
if (cellResultColors->hasResult())
|
||||
{
|
||||
if (!cellResultColors->hasDynamicResult())
|
||||
{
|
||||
// Static result values are located at time step 0
|
||||
timeStepIndex = 0;
|
||||
}
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, timeStepIndex, cellResultColors->resultVariable());
|
||||
}
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, timeStepIndex, cellResultColors->resultVariable());
|
||||
}
|
||||
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
resultAccessor = new RigHugeValResultAccessor;
|
||||
}
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
resultAccessor = new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
return resultAccessor;
|
||||
return resultAccessor;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,8 +24,8 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class DrawableGeo;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class DrawableGeo;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
}
|
||||
|
||||
class RimCellEdgeColors;
|
||||
@@ -38,36 +38,36 @@ class RigCaseData;
|
||||
class RivCellEdgeGeometryUtils
|
||||
{
|
||||
public:
|
||||
static void addCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
static void addCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
|
||||
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
|
||||
|
||||
private:
|
||||
static cvf::ref<RigResultAccessor> createCellCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid);
|
||||
static cvf::ref<RigResultAccessor> createCellCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid);
|
||||
|
||||
static cvf::ref<RigResultAccessor> createCellEdgeCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid);
|
||||
static cvf::ref<RigResultAccessor> createCellEdgeCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid);
|
||||
|
||||
static bool hideScalarValue(double scalarValue, double scalarValueToHide, double tolerance);
|
||||
};
|
||||
|
@@ -50,8 +50,8 @@ public:
|
||||
|
||||
// Mapping between cells and geometry
|
||||
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper() { return m_quadMapper.p(); }
|
||||
const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); }
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper() { return m_quadMapper.p(); }
|
||||
const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); }
|
||||
|
||||
// Generated geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
|
@@ -115,16 +115,16 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_nativeFaultGenerator->quadToCellFaceMapper());
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_nativeFaultGenerator->quadToCellFaceMapper());
|
||||
|
||||
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
|
||||
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_nativeFaultFaces.p(), m_nativeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RivTextureCoordsCreator texturer(cellResultColors,
|
||||
@@ -132,50 +132,50 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
|
||||
m_grid->gridIndex(),
|
||||
m_nativeFaultGenerator->quadToCellFaceMapper());
|
||||
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
texturer.createTextureCoords(m_nativeFaultFacesTextureCoords.p());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_nativeFaultFaces.p(), m_nativeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_oppositeFaultFaces.notNull())
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_oppositeFaultGenerator->quadToCellFaceMapper());
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_oppositeFaultGenerator->quadToCellFaceMapper());
|
||||
|
||||
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
|
||||
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
RivTextureCoordsCreator texturer(cellResultColors,
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_oppositeFaultGenerator->quadToCellFaceMapper());
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
RivTextureCoordsCreator texturer(cellResultColors,
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_oppositeFaultGenerator->quadToCellFaceMapper());
|
||||
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
|
||||
texturer.createTextureCoords(m_oppositeFaultFacesTextureCoords.p());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_oppositeFaultFaces.p(), m_oppositeFaultFacesTextureCoords.p(), mapper, m_opacityLevel, this->faceCullingMode(), eclipseView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -185,30 +185,30 @@ void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipse
|
||||
{
|
||||
updateNNCColors(cellResultColors);
|
||||
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_nativeFaultGenerator->quadToCellFaceMapper(),
|
||||
m_grid->gridIndex(),
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_nativeFaultGenerator->quadToCellFaceMapper(),
|
||||
m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, this->faceCullingMode(), cellResultColors->reservoirView()->isLightingDisabled());
|
||||
|
||||
m_nativeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
m_nativeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_oppositeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_oppositeFaultGenerator->quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
if (m_oppositeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_oppositeFaultGenerator->quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, this->faceCullingMode(), cellResultColors->reservoirView()->isLightingDisabled());
|
||||
|
||||
m_oppositeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
m_oppositeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int priFaultGeo = 1;
|
||||
|
@@ -230,37 +230,37 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
|
||||
cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;
|
||||
|
||||
// Outer surface
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper, m_opacityLevel, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
RivTextureCoordsCreator texturer(cellResultColors,
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RivTextureCoordsCreator texturer(cellResultColors,
|
||||
timeStepIndex,
|
||||
m_grid->gridIndex(),
|
||||
m_surfaceGenerator.quadToCellFaceMapper());
|
||||
if (!texturer.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper, m_opacityLevel, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -268,17 +268,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
|
||||
{
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultColors, cellEdgeResultColors, m_opacityLevel, m_defaultColor, caf::FC_NONE, cellResultColors->reservoirView()->isLightingDisabled());
|
||||
|
||||
m_surfaceFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
m_surfaceFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -203,10 +203,10 @@ void RivReservoirPartMgr::setFaultForceVisibility(bool isGeneratedByFilter)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirPartMgr::updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
|
||||
{
|
||||
if (m_faultsPartMgr.notNull())
|
||||
{
|
||||
m_faultsPartMgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
}
|
||||
if (m_faultsPartMgr.notNull())
|
||||
{
|
||||
m_faultsPartMgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -67,9 +67,9 @@ public:
|
||||
|
||||
// Faults
|
||||
void updateFaultColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
|
||||
void updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
void appendFaultPartsToModel(cvf::ModelBasicList* model);
|
||||
void updateFaultCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
void appendFaultPartsToModel(cvf::ModelBasicList* model);
|
||||
void appendFaultLabelPartsToModel(cvf::ModelBasicList* model);
|
||||
private:
|
||||
|
||||
|
@@ -800,7 +800,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(propertyFilter->resultDefinition()->porosityModel());
|
||||
RigCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStepIndex, propertyFilter->resultDefinition->resultVariable(), propertyFilter->resultDefinition->resultType());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStepIndex, propertyFilter->resultDefinition->resultVariable(), propertyFilter->resultDefinition->resultType());
|
||||
CVF_ASSERT(resultAccessor.notNull());
|
||||
|
||||
//#pragma omp parallel for schedule(dynamic)
|
||||
@@ -867,7 +867,7 @@ void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType,
|
||||
void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
|
||||
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -875,8 +875,8 @@ void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
|
||||
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
|
||||
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -52,16 +52,16 @@ public:
|
||||
void updateCellResultColor (RivCellSetEnum geometryType, size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors);
|
||||
void updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
|
||||
// Faults
|
||||
void appendFaultsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType);
|
||||
void appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex);
|
||||
void updateFaultColors(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
|
||||
void updateFaultCellEdgeResultColor( RivCellSetEnum geometryType, size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
void updateFaultCellEdgeResultColor( RivCellSetEnum geometryType, size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors);
|
||||
|
||||
// Fault labels
|
||||
RivCellSetEnum geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes) const;
|
||||
|
@@ -41,13 +41,13 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivScalarMapperUtils::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
|
||||
{
|
||||
CVF_ASSERT(part && textureCoords && mapper);
|
||||
CVF_ASSERT(part && textureCoords && mapper);
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
|
||||
if (dg) dg->setTextureCoordArray(textureCoords);
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
|
||||
if (dg) dg->setTextureCoordArray(textureCoords);
|
||||
|
||||
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
|
||||
part->setEffect(scalarEffect.p());
|
||||
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
|
||||
part->setEffect(scalarEffect.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -55,55 +55,55 @@ void RivScalarMapperUtils::applyTextureResultsToPart(cvf::Part* part, cvf::Vec2f
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivScalarMapperUtils::applyTernaryTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
|
||||
{
|
||||
CVF_ASSERT(part && textureCoords && mapper);
|
||||
CVF_ASSERT(part && textureCoords && mapper);
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
|
||||
if (dg) dg->setTextureCoordArray(textureCoords);
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(part->drawable());
|
||||
if (dg) dg->setTextureCoordArray(textureCoords);
|
||||
|
||||
cvf::ref<cvf::Effect> scalarEffect = RivScalarMapperUtils::createTernaryScalarMapperEffect(mapper, opacityLevel, faceCulling, disableLighting);
|
||||
part->setEffect(scalarEffect.p());
|
||||
part->setEffect(scalarEffect.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGeo* dg,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
float opacityLevel,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
float opacityLevel,
|
||||
cvf::Color3f defaultColor,
|
||||
caf::FaceCulling faceCulling,
|
||||
bool disableLighting)
|
||||
{
|
||||
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultColors->legendConfig()->scalarMapper());
|
||||
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultColors->legendConfig()->scalarMapper());
|
||||
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
|
||||
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
|
||||
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
|
||||
}
|
||||
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
|
||||
}
|
||||
|
||||
cellFaceEffectGen.setOpacityLevel(opacityLevel);
|
||||
cellFaceEffectGen.setDefaultCellColor(defaultColor);
|
||||
cellFaceEffectGen.setOpacityLevel(opacityLevel);
|
||||
cellFaceEffectGen.setDefaultCellColor(defaultColor);
|
||||
cellFaceEffectGen.setFaceCulling(faceCulling);
|
||||
cellFaceEffectGen.disableLighting(disableLighting);
|
||||
|
||||
cvf::ref<cvf::Effect> eff = cellFaceEffectGen.generateCachedEffect();
|
||||
return eff;
|
||||
return eff;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -111,17 +111,17 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Effect> RivScalarMapperUtils::createScalarMapperEffect(const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
|
||||
{
|
||||
CVF_ASSERT(mapper);
|
||||
CVF_ASSERT(mapper);
|
||||
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||
scalarEffgen.setOpacityLevel(opacityLevel);
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
caf::ScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||
scalarEffgen.setOpacityLevel(opacityLevel);
|
||||
scalarEffgen.setFaceCulling(faceCulling);
|
||||
scalarEffgen.disableLighting(disableLighting);
|
||||
|
||||
cvf::ref<cvf::Effect> scalarEffect = scalarEffgen.generateCachedEffect();
|
||||
|
||||
return scalarEffect;
|
||||
return scalarEffect;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -129,15 +129,15 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createScalarMapperEffect(const cvf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Effect> RivScalarMapperUtils::createTernaryScalarMapperEffect(const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting)
|
||||
{
|
||||
CVF_ASSERT(mapper);
|
||||
CVF_ASSERT(mapper);
|
||||
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
RivTernaryScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||
scalarEffgen.setOpacityLevel(opacityLevel);
|
||||
caf::PolygonOffset polygonOffset = caf::PO_1;
|
||||
RivTernaryScalarMapperEffectGenerator scalarEffgen(mapper, polygonOffset);
|
||||
scalarEffgen.setOpacityLevel(opacityLevel);
|
||||
scalarEffgen.setFaceCulling(faceCulling);
|
||||
scalarEffgen.disableLighting(disableLighting);
|
||||
cvf::ref<cvf::Effect> scalarEffect = scalarEffgen.generateCachedEffect();
|
||||
|
||||
return scalarEffect;
|
||||
return scalarEffect;
|
||||
}
|
||||
|
||||
|
@@ -26,11 +26,11 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ScalarMapper;
|
||||
class Part;
|
||||
class Effect;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class DrawableGeo;
|
||||
class ScalarMapper;
|
||||
class Part;
|
||||
class Effect;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
class RivTernaryScalarMapper;
|
||||
@@ -46,13 +46,13 @@ public:
|
||||
static void applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting);
|
||||
static void applyTernaryTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const RivTernaryScalarMapper* mapper, float opacityLevel, caf::FaceCulling faceCulling, bool disableLighting);
|
||||
|
||||
static cvf::ref<cvf::Effect> createCellEdgeEffect(cvf::DrawableGeo* dg,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
float opacityLevel,
|
||||
static cvf::ref<cvf::Effect> createCellEdgeEffect(cvf::DrawableGeo* dg,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
float opacityLevel,
|
||||
cvf::Color3f defaultColor,
|
||||
caf::FaceCulling faceCulling,
|
||||
bool disableLighting);
|
||||
|
@@ -33,15 +33,15 @@
|
||||
class RivTernaryResultToTextureMapper : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivTernaryResultToTextureMapper(const RivTernaryScalarMapper* scalarMapper, const RigPipeInCellEvaluator* pipeInCellEvaluator)
|
||||
RivTernaryResultToTextureMapper(const RivTernaryScalarMapper* scalarMapper, const RigPipeInCellEvaluator* pipeInCellEvaluator)
|
||||
: m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator)
|
||||
{}
|
||||
|
||||
cvf::Vec2f getTexCoord(double soil, double sgas, size_t cellIndex) const
|
||||
{
|
||||
bool isTransparent = m_pipeInCellEvaluator->isWellPipeInCell(cellIndex);
|
||||
bool isTransparent = m_pipeInCellEvaluator->isWellPipeInCell(cellIndex);
|
||||
|
||||
return m_scalarMapper->mapToTextureCoord(soil, sgas, isTransparent);
|
||||
return m_scalarMapper->mapToTextureCoord(soil, sgas, isTransparent);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -26,10 +26,10 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryScalarMapper::RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor)
|
||||
: m_undefScalarColor(undefScalarColor),
|
||||
m_textureSize(128, 256)
|
||||
: m_undefScalarColor(undefScalarColor),
|
||||
m_textureSize(128, 256)
|
||||
{
|
||||
setTernaryRanges(0.0, 1.0, 0.0, 1.0);
|
||||
setTernaryRanges(0.0, 1.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -61,12 +61,12 @@ cvf::Vec2f RivTernaryScalarMapper::mapToTextureCoord(double soil, double sgas, b
|
||||
/// F *
|
||||
/// * *
|
||||
/// * *
|
||||
/// * * Texture in this region is assigned the given opacity level
|
||||
/// * * Texture in this region is assigned the given opacity level
|
||||
/// * *
|
||||
/// D *********** E
|
||||
/// C * SGAS
|
||||
/// * *
|
||||
/// * * Texture in this region is opaque
|
||||
/// * * Texture in this region is opaque
|
||||
/// * *
|
||||
/// * *
|
||||
/// A *********** B
|
||||
@@ -74,48 +74,48 @@ cvf::Vec2f RivTernaryScalarMapper::mapToTextureCoord(double soil, double sgas, b
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image, float opacityLevel) const
|
||||
{
|
||||
CVF_ASSERT(image);
|
||||
image->allocate(m_textureSize.x(), m_textureSize.y());
|
||||
CVF_ASSERT(image);
|
||||
image->allocate(m_textureSize.x(), m_textureSize.y());
|
||||
|
||||
// For now fill with white so we can see any errors more easily
|
||||
image->fill(cvf::Color4ub(cvf::Color3::WHITE));
|
||||
// For now fill with white so we can see any errors more easily
|
||||
image->fill(cvf::Color4ub(cvf::Color3::WHITE));
|
||||
|
||||
|
||||
|
||||
cvf::uint halfTextureHeight = m_textureSize.y() / 2;
|
||||
|
||||
// Create texture
|
||||
|
||||
|
||||
cvf::uint halfTextureHeight = m_textureSize.y() / 2;
|
||||
|
||||
// Create texture
|
||||
|
||||
float xStride = static_cast<float>(1.0f / m_textureSize.x());
|
||||
float yStride = static_cast<float>(1.0f / halfTextureHeight);
|
||||
float xStride = static_cast<float>(1.0f / m_textureSize.x());
|
||||
float yStride = static_cast<float>(1.0f / halfTextureHeight);
|
||||
|
||||
float sgas_red = 0.0f;
|
||||
for (cvf::uint yPos = 0; yPos < halfTextureHeight; yPos++)
|
||||
{
|
||||
float soil_green = 0.0f;
|
||||
for (cvf::uint xPos = 0; xPos < m_textureSize.x() - yPos; xPos++)
|
||||
{
|
||||
float swat_blue = 1.0f - sgas_red - soil_green;
|
||||
float sgas_red = 0.0f;
|
||||
for (cvf::uint yPos = 0; yPos < halfTextureHeight; yPos++)
|
||||
{
|
||||
float soil_green = 0.0f;
|
||||
for (cvf::uint xPos = 0; xPos < m_textureSize.x() - yPos; xPos++)
|
||||
{
|
||||
float swat_blue = 1.0f - sgas_red - soil_green;
|
||||
|
||||
cvf::Color3f floatCol(sgas_red, soil_green, swat_blue);
|
||||
cvf::Color3f floatCol(sgas_red, soil_green, swat_blue);
|
||||
|
||||
cvf::ubyte rByteCol = floatCol.rByte();
|
||||
cvf::ubyte gByteCol = floatCol.gByte();
|
||||
cvf::ubyte bByteCol = floatCol.bByte();
|
||||
cvf::ubyte rByteCol = floatCol.rByte();
|
||||
cvf::ubyte gByteCol = floatCol.gByte();
|
||||
cvf::ubyte bByteCol = floatCol.bByte();
|
||||
|
||||
const cvf::Color4ub clr(rByteCol, gByteCol, bByteCol, 255);
|
||||
image->setPixel(xPos, yPos, clr);
|
||||
const cvf::Color4ub clr(rByteCol, gByteCol, bByteCol, 255);
|
||||
image->setPixel(xPos, yPos, clr);
|
||||
|
||||
// Set opacity
|
||||
const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast<cvf::ubyte>(255 * opacityLevel));
|
||||
image->setPixel(xPos, yPos + halfTextureHeight, clrOpacity);
|
||||
// Set opacity
|
||||
const cvf::Color4ub clrOpacity(rByteCol, gByteCol, bByteCol, static_cast<cvf::ubyte>(255 * opacityLevel));
|
||||
image->setPixel(xPos, yPos + halfTextureHeight, clrOpacity);
|
||||
|
||||
soil_green += xStride;
|
||||
}
|
||||
sgas_red += yStride;
|
||||
}
|
||||
soil_green += xStride;
|
||||
}
|
||||
sgas_red += yStride;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -123,12 +123,12 @@ bool RivTernaryScalarMapper::updateTexture(cvf::TextureImage* image, float opaci
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryScalarMapper::setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper)
|
||||
{
|
||||
m_rangeMinSoil = soilLower;
|
||||
m_rangeMaxSoil = soilUpper;
|
||||
m_soilFactor = 1.0 / (soilUpper - soilLower);
|
||||
m_rangeMinSoil = soilLower;
|
||||
m_rangeMaxSoil = soilUpper;
|
||||
m_soilFactor = 1.0 / (soilUpper - soilLower);
|
||||
|
||||
m_rangeMinSgas = sgasLower;
|
||||
m_rangeMaxSgas = sgasUpper;
|
||||
m_sgasFactor = 1.0 / (sgasUpper - sgasLower);
|
||||
m_rangeMinSgas = sgasLower;
|
||||
m_rangeMaxSgas = sgasUpper;
|
||||
m_sgasFactor = 1.0 / (sgasUpper - sgasLower);
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class TextureImage;
|
||||
class TextureImage;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -35,23 +35,23 @@ namespace cvf
|
||||
class RivTernaryScalarMapper : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor);
|
||||
RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor);
|
||||
|
||||
void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper);
|
||||
void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper);
|
||||
|
||||
cvf::Vec2f mapToTextureCoord(double soil, double sgas, bool isTransparent) const;
|
||||
bool updateTexture(cvf::TextureImage* image, float opacityLevel) const;
|
||||
cvf::Vec2f mapToTextureCoord(double soil, double sgas, bool isTransparent) const;
|
||||
bool updateTexture(cvf::TextureImage* image, float opacityLevel) const;
|
||||
|
||||
private:
|
||||
cvf::Color3f m_undefScalarColor;
|
||||
cvf::Vec2ui m_textureSize;
|
||||
cvf::Color3f m_undefScalarColor;
|
||||
cvf::Vec2ui m_textureSize;
|
||||
|
||||
double m_rangeMaxSoil;
|
||||
double m_rangeMinSoil;
|
||||
double m_soilFactor;
|
||||
double m_rangeMaxSoil;
|
||||
double m_rangeMinSoil;
|
||||
double m_soilFactor;
|
||||
|
||||
double m_rangeMaxSgas;
|
||||
double m_rangeMinSgas;
|
||||
double m_sgasFactor;
|
||||
double m_rangeMaxSgas;
|
||||
double m_rangeMinSgas;
|
||||
double m_sgasFactor;
|
||||
};
|
||||
|
||||
|
@@ -47,13 +47,13 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryScalarMapperEffectGenerator::RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset)
|
||||
: m_undefinedColor(cvf::Color3::GRAY)
|
||||
: m_undefinedColor(cvf::Color3::GRAY)
|
||||
{
|
||||
m_scalarMapper = scalarMapper;
|
||||
m_polygonOffset = polygonOffset;
|
||||
m_opacityLevel = 1.0f;
|
||||
m_faceCulling = caf::FC_NONE;
|
||||
m_enableDepthWrite = true;
|
||||
m_scalarMapper = scalarMapper;
|
||||
m_polygonOffset = polygonOffset;
|
||||
m_opacityLevel = 1.0f;
|
||||
m_faceCulling = caf::FC_NONE;
|
||||
m_enableDepthWrite = true;
|
||||
m_disableLighting = false;
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ RivTernaryScalarMapperEffectGenerator::RivTernaryScalarMapperEffectGenerator(con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect) const
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
|
||||
cvf::ShaderProgramGenerator gen("ScalarMapperMeshEffectGenerator", cvf::ShaderSourceProvider::instance());
|
||||
gen.addVertexCode(cvf::ShaderSourceRepository::vs_Standard);
|
||||
gen.addFragmentCode(cvf::ShaderSourceRepository::src_Texture);
|
||||
cvf::ShaderProgramGenerator gen("ScalarMapperMeshEffectGenerator", cvf::ShaderSourceProvider::instance());
|
||||
gen.addVertexCode(cvf::ShaderSourceRepository::vs_Standard);
|
||||
gen.addFragmentCode(cvf::ShaderSourceRepository::src_Texture);
|
||||
|
||||
if (m_disableLighting)
|
||||
{
|
||||
@@ -78,27 +78,27 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E
|
||||
gen.addFragmentCode(cvf::ShaderSourceRepository::fs_Standard);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::ShaderProgram> prog = gen.generate();
|
||||
eff->setShaderProgram(prog.p());
|
||||
cvf::ref<cvf::ShaderProgram> prog = gen.generate();
|
||||
eff->setShaderProgram(prog.p());
|
||||
|
||||
// Result mapping texture
|
||||
// Result mapping texture
|
||||
|
||||
m_textureImage = new cvf::TextureImage();
|
||||
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
|
||||
m_textureImage = new cvf::TextureImage();
|
||||
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
|
||||
|
||||
cvf::ref<cvf::Texture> texture = new cvf::Texture(m_textureImage.p());
|
||||
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
||||
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
|
||||
sampler->setMinFilter(cvf::Sampler::NEAREST);
|
||||
sampler->setMagFilter(cvf::Sampler::NEAREST);
|
||||
cvf::ref<cvf::Texture> texture = new cvf::Texture(m_textureImage.p());
|
||||
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
||||
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
|
||||
sampler->setMinFilter(cvf::Sampler::NEAREST);
|
||||
sampler->setMagFilter(cvf::Sampler::NEAREST);
|
||||
|
||||
cvf::ref<cvf::RenderStateTextureBindings> texBind = new cvf::RenderStateTextureBindings;
|
||||
texBind->addBinding(texture.p(), sampler.p(), "u_texture2D");
|
||||
eff->setRenderState(texBind.p());
|
||||
cvf::ref<cvf::RenderStateTextureBindings> texBind = new cvf::RenderStateTextureBindings;
|
||||
texBind->addBinding(texture.p(), sampler.p(), "u_texture2D");
|
||||
eff->setRenderState(texBind.p());
|
||||
|
||||
// Hardware independent:
|
||||
// Hardware independent:
|
||||
|
||||
updateCommonEffect(eff.p());
|
||||
updateCommonEffect(eff.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -106,31 +106,31 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf::Effect* effect) const
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
cvf::ref<cvf::Effect> eff = effect;
|
||||
|
||||
cvf::ref<cvf::RenderStateMaterial_FF> mat = new cvf::RenderStateMaterial_FF(cvf::Color3::WHITE);
|
||||
eff->setRenderState(mat.p());
|
||||
cvf::ref<cvf::RenderStateMaterial_FF> mat = new cvf::RenderStateMaterial_FF(cvf::Color3::WHITE);
|
||||
eff->setRenderState(mat.p());
|
||||
|
||||
cvf::ref<cvf::RenderStateLighting_FF> lighting = new cvf::RenderStateLighting_FF;
|
||||
lighting->enableTwoSided(true);
|
||||
cvf::ref<cvf::RenderStateLighting_FF> lighting = new cvf::RenderStateLighting_FF;
|
||||
lighting->enableTwoSided(true);
|
||||
lighting->enable(!m_disableLighting);
|
||||
eff->setRenderState(lighting.p());
|
||||
eff->setRenderState(lighting.p());
|
||||
|
||||
// Result mapping texture
|
||||
// Result mapping texture
|
||||
|
||||
m_textureImage = new cvf::TextureImage;
|
||||
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
|
||||
m_textureImage = new cvf::TextureImage;
|
||||
m_scalarMapper->updateTexture(m_textureImage.p(), m_opacityLevel);
|
||||
|
||||
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(m_textureImage.p());
|
||||
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
||||
texture->setMinFilter(cvf::Texture2D_FF::NEAREST);
|
||||
texture->setMagFilter(cvf::Texture2D_FF::NEAREST);
|
||||
cvf::ref<cvf::RenderStateTextureMapping_FF> texMapping = new cvf::RenderStateTextureMapping_FF(texture.p());
|
||||
eff->setRenderState(texMapping.p());
|
||||
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(m_textureImage.p());
|
||||
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
||||
texture->setMinFilter(cvf::Texture2D_FF::NEAREST);
|
||||
texture->setMagFilter(cvf::Texture2D_FF::NEAREST);
|
||||
cvf::ref<cvf::RenderStateTextureMapping_FF> texMapping = new cvf::RenderStateTextureMapping_FF(texture.p());
|
||||
eff->setRenderState(texMapping.p());
|
||||
|
||||
// Hardware independent:
|
||||
// Hardware independent:
|
||||
|
||||
updateCommonEffect(eff.p());
|
||||
updateCommonEffect(eff.p());
|
||||
|
||||
}
|
||||
|
||||
@@ -140,48 +140,48 @@ void RivTernaryScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryScalarMapperEffectGenerator::updateCommonEffect(cvf::Effect* effect) const
|
||||
{
|
||||
CVF_ASSERT(effect);
|
||||
CVF_ASSERT(effect);
|
||||
|
||||
if (m_polygonOffset != caf::PO_NONE)
|
||||
{
|
||||
cvf::ref<cvf::RenderStatePolygonOffset> polyOffset = EffectGenerator::createAndConfigurePolygonOffsetRenderState(m_polygonOffset);
|
||||
effect->setRenderState(polyOffset.p());
|
||||
}
|
||||
if (m_polygonOffset != caf::PO_NONE)
|
||||
{
|
||||
cvf::ref<cvf::RenderStatePolygonOffset> polyOffset = EffectGenerator::createAndConfigurePolygonOffsetRenderState(m_polygonOffset);
|
||||
effect->setRenderState(polyOffset.p());
|
||||
}
|
||||
|
||||
// Simple transparency
|
||||
if (m_opacityLevel < 1.0f)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateBlending> blender = new cvf::RenderStateBlending;
|
||||
blender->configureTransparencyBlending();
|
||||
effect->setRenderState(blender.p());
|
||||
}
|
||||
// Simple transparency
|
||||
if (m_opacityLevel < 1.0f)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateBlending> blender = new cvf::RenderStateBlending;
|
||||
blender->configureTransparencyBlending();
|
||||
effect->setRenderState(blender.p());
|
||||
}
|
||||
|
||||
// Backface culling
|
||||
if (m_faceCulling != caf::FC_NONE)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateCullFace> faceCulling = new cvf::RenderStateCullFace;
|
||||
if (m_faceCulling == caf::FC_BACK)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::BACK);
|
||||
}
|
||||
else if (m_faceCulling == caf::FC_FRONT)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::FRONT);
|
||||
}
|
||||
else if (m_faceCulling == caf::FC_FRONT_AND_BACK)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::FRONT_AND_BACK);
|
||||
}
|
||||
// Backface culling
|
||||
if (m_faceCulling != caf::FC_NONE)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateCullFace> faceCulling = new cvf::RenderStateCullFace;
|
||||
if (m_faceCulling == caf::FC_BACK)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::BACK);
|
||||
}
|
||||
else if (m_faceCulling == caf::FC_FRONT)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::FRONT);
|
||||
}
|
||||
else if (m_faceCulling == caf::FC_FRONT_AND_BACK)
|
||||
{
|
||||
faceCulling->setMode(cvf::RenderStateCullFace::FRONT_AND_BACK);
|
||||
}
|
||||
|
||||
effect->setRenderState(faceCulling.p());
|
||||
}
|
||||
effect->setRenderState(faceCulling.p());
|
||||
}
|
||||
|
||||
if (!m_enableDepthWrite)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
|
||||
depth->enableDepthWrite(false);
|
||||
effect->setRenderState(depth.p());
|
||||
}
|
||||
if (!m_enableDepthWrite)
|
||||
{
|
||||
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
|
||||
depth->enableDepthWrite(false);
|
||||
effect->setRenderState(depth.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,26 +190,26 @@ void RivTernaryScalarMapperEffectGenerator::updateCommonEffect(cvf::Effect* effe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTernaryScalarMapperEffectGenerator::isEqual(const EffectGenerator* other) const
|
||||
{
|
||||
const RivTernaryScalarMapperEffectGenerator* otherTextureResultEffect = dynamic_cast<const RivTernaryScalarMapperEffectGenerator*>(other);
|
||||
const RivTernaryScalarMapperEffectGenerator* otherTextureResultEffect = dynamic_cast<const RivTernaryScalarMapperEffectGenerator*>(other);
|
||||
|
||||
if (otherTextureResultEffect)
|
||||
{
|
||||
if (m_scalarMapper.p() == otherTextureResultEffect->m_scalarMapper
|
||||
&& m_polygonOffset == otherTextureResultEffect->m_polygonOffset
|
||||
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
|
||||
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
|
||||
&& m_faceCulling == otherTextureResultEffect->m_faceCulling
|
||||
&& m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite
|
||||
if (otherTextureResultEffect)
|
||||
{
|
||||
if (m_scalarMapper.p() == otherTextureResultEffect->m_scalarMapper
|
||||
&& m_polygonOffset == otherTextureResultEffect->m_polygonOffset
|
||||
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
|
||||
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
|
||||
&& m_faceCulling == otherTextureResultEffect->m_faceCulling
|
||||
&& m_enableDepthWrite == otherTextureResultEffect->m_enableDepthWrite
|
||||
&& m_disableLighting == otherTextureResultEffect->m_disableLighting)
|
||||
{
|
||||
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p(), m_opacityLevel);
|
||||
{
|
||||
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p(), m_opacityLevel);
|
||||
|
||||
return RivTernaryScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
|
||||
}
|
||||
}
|
||||
return RivTernaryScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -217,15 +217,15 @@ bool RivTernaryScalarMapperEffectGenerator::isEqual(const EffectGenerator* other
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
|
||||
{
|
||||
RivTernaryScalarMapperEffectGenerator* scEffGen = new RivTernaryScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
|
||||
scEffGen->m_textureImage = m_textureImage;
|
||||
scEffGen->m_opacityLevel = m_opacityLevel;
|
||||
scEffGen->m_undefinedColor = m_undefinedColor;
|
||||
scEffGen->m_faceCulling = m_faceCulling;
|
||||
scEffGen->m_enableDepthWrite = m_enableDepthWrite;
|
||||
RivTernaryScalarMapperEffectGenerator* scEffGen = new RivTernaryScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
|
||||
scEffGen->m_textureImage = m_textureImage;
|
||||
scEffGen->m_opacityLevel = m_opacityLevel;
|
||||
scEffGen->m_undefinedColor = m_undefinedColor;
|
||||
scEffGen->m_faceCulling = m_faceCulling;
|
||||
scEffGen->m_enableDepthWrite = m_enableDepthWrite;
|
||||
scEffGen->m_disableLighting = m_disableLighting;
|
||||
|
||||
return scEffGen;
|
||||
return scEffGen;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,22 +236,22 @@ caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTernaryScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2)
|
||||
{
|
||||
if (texImg1 == NULL && texImg2 == NULL) return true;
|
||||
if (texImg1 == NULL && texImg2 == NULL) return true;
|
||||
|
||||
if (texImg1 != NULL && texImg2 != NULL
|
||||
&& texImg1->height() == texImg2->height()
|
||||
&& texImg1->width() == texImg2->width()
|
||||
&& texImg1->width() > 0 && texImg1->height() > 0
|
||||
&& texImg1->pixel(0, 0) == texImg2->pixel(0, 0)
|
||||
&& texImg1->pixel(texImg1->width() - 1, texImg1->height() - 1) == texImg2->pixel(texImg1->width() - 1, texImg1->height() - 1)
|
||||
&& texImg1->pixel(texImg1->width() / 2, texImg1->height() / 2) == texImg2->pixel(texImg1->width() / 2, texImg1->height() / 2)
|
||||
&& texImg1->pixel(texImg1->width() / 4, texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 4, texImg1->height() / 4)
|
||||
&& texImg1->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4)
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (texImg1 != NULL && texImg2 != NULL
|
||||
&& texImg1->height() == texImg2->height()
|
||||
&& texImg1->width() == texImg2->width()
|
||||
&& texImg1->width() > 0 && texImg1->height() > 0
|
||||
&& texImg1->pixel(0, 0) == texImg2->pixel(0, 0)
|
||||
&& texImg1->pixel(texImg1->width() - 1, texImg1->height() - 1) == texImg2->pixel(texImg1->width() - 1, texImg1->height() - 1)
|
||||
&& texImg1->pixel(texImg1->width() / 2, texImg1->height() / 2) == texImg2->pixel(texImg1->width() / 2, texImg1->height() / 2)
|
||||
&& texImg1->pixel(texImg1->width() / 4, texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 4, texImg1->height() / 4)
|
||||
&& texImg1->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4) == texImg2->pixel(texImg1->width() / 2 + texImg1->width() / 4, texImg1->height() / 2 + texImg1->height() / 4)
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ class RivTernaryScalarMapper;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class TextureImage;
|
||||
class TextureImage;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -36,36 +36,36 @@ namespace cvf
|
||||
class RivTernaryScalarMapperEffectGenerator : public caf::EffectGenerator
|
||||
{
|
||||
public:
|
||||
RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset);
|
||||
RivTernaryScalarMapperEffectGenerator(const RivTernaryScalarMapper* scalarMapper, caf::PolygonOffset polygonOffset);
|
||||
|
||||
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_faceCulling = faceCulling; }
|
||||
void enableDepthWrite(bool enableWrite) { m_enableDepthWrite = enableWrite; }
|
||||
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_faceCulling = faceCulling; }
|
||||
void enableDepthWrite(bool enableWrite) { m_enableDepthWrite = enableWrite; }
|
||||
void disableLighting(bool disable) { m_disableLighting = disable; }
|
||||
|
||||
|
||||
public:
|
||||
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
|
||||
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
|
||||
|
||||
protected:
|
||||
virtual bool isEqual(const caf::EffectGenerator* other) const;
|
||||
virtual caf::EffectGenerator* copy() const;
|
||||
virtual bool isEqual(const caf::EffectGenerator* other) const;
|
||||
virtual caf::EffectGenerator* copy() const;
|
||||
|
||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||
|
||||
private:
|
||||
void updateCommonEffect(cvf::Effect* effect) const;
|
||||
void updateCommonEffect(cvf::Effect* effect) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RivTernaryScalarMapper> m_scalarMapper;
|
||||
mutable cvf::ref<cvf::TextureImage> m_textureImage;
|
||||
caf::PolygonOffset m_polygonOffset;
|
||||
float m_opacityLevel;
|
||||
cvf::Color3f m_undefinedColor;
|
||||
caf::FaceCulling m_faceCulling;
|
||||
bool m_enableDepthWrite;
|
||||
cvf::cref<RivTernaryScalarMapper> m_scalarMapper;
|
||||
mutable cvf::ref<cvf::TextureImage> m_textureImage;
|
||||
caf::PolygonOffset m_polygonOffset;
|
||||
float m_opacityLevel;
|
||||
cvf::Color3f m_undefinedColor;
|
||||
caf::FaceCulling m_faceCulling;
|
||||
bool m_enableDepthWrite;
|
||||
bool m_disableLighting;
|
||||
};
|
||||
|
||||
|
@@ -38,11 +38,11 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
size_t timeStepIndex,
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper)
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
size_t timeStepIndex,
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper)
|
||||
{
|
||||
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
|
||||
@@ -55,12 +55,12 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");
|
||||
cvf::ref<RigResultAccessor> sgas = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS");
|
||||
cvf::ref<RigResultAccessor> swat = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SWAT");
|
||||
|
||||
m_resultAccessor = new RigTernaryResultAccessor();
|
||||
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
|
||||
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");
|
||||
cvf::ref<RigResultAccessor> sgas = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS");
|
||||
cvf::ref<RigResultAccessor> swat = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SWAT");
|
||||
|
||||
m_resultAccessor = new RigTernaryResultAccessor();
|
||||
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
|
||||
|
||||
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = new RigPipeInCellEvaluator( cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex),
|
||||
eclipseCase->gridCellToWellIndex(gridIndex));
|
||||
@@ -76,17 +76,17 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
|
||||
{
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTernaryTextureCoordsCreator::createTextureCoords(
|
||||
cvf::Vec2fArray* quadTextureCoords,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigTernaryResultAccessor* resultAccessor,
|
||||
const RivTernaryResultToTextureMapper* texMapper)
|
||||
cvf::Vec2fArray* quadTextureCoords,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigTernaryResultAccessor* resultAccessor,
|
||||
const RivTernaryResultToTextureMapper* texMapper)
|
||||
{
|
||||
CVF_ASSERT(quadTextureCoords && quadMapper && resultAccessor && texMapper);
|
||||
|
||||
@@ -94,7 +94,7 @@ void RivTernaryTextureCoordsCreator::createTextureCoords(
|
||||
quadTextureCoords->resize(numVertices);
|
||||
cvf::Vec2f* rawPtr = quadTextureCoords->ptr();
|
||||
|
||||
cvf::Vec2d resultValue;
|
||||
cvf::Vec2d resultValue;
|
||||
cvf::Vec2f texCoord;
|
||||
|
||||
#pragma omp parallel for private(texCoord, resultValue)
|
||||
|
@@ -31,7 +31,7 @@ class RimTernaryLegendConfig;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,22 +41,22 @@ namespace cvf
|
||||
class RivTernaryTextureCoordsCreator
|
||||
{
|
||||
public:
|
||||
RivTernaryTextureCoordsCreator( RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
size_t timeStepIndex,
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
|
||||
RivTernaryTextureCoordsCreator( RimEclipseCellColors* cellResultColors,
|
||||
RimTernaryLegendConfig* ternaryLegendConfig,
|
||||
size_t timeStepIndex,
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
|
||||
|
||||
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
|
||||
|
||||
private:
|
||||
static void createTextureCoords(cvf::Vec2fArray* quadTextureCoords,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigTernaryResultAccessor* resultAccessor,
|
||||
const RigTernaryResultAccessor* resultAccessor,
|
||||
const RivTernaryResultToTextureMapper* texMapper);
|
||||
|
||||
private:
|
||||
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
|
||||
cvf::ref<RigTernaryResultAccessor> m_resultAccessor;
|
||||
cvf::ref<RigTernaryResultAccessor> m_resultAccessor;
|
||||
cvf::ref<RivTernaryResultToTextureMapper> m_texMapper;
|
||||
};
|
||||
|
@@ -61,12 +61,12 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextureCoordsCreator::isValid()
|
||||
{
|
||||
if (m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,17 +74,17 @@ bool RivTextureCoordsCreator::isValid()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCoords)
|
||||
{
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTextureCoordsCreator::createTextureCoords(
|
||||
cvf::Vec2fArray* quadTextureCoords,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const RivResultToTextureMapper* texMapper)
|
||||
cvf::Vec2fArray* quadTextureCoords,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const RivResultToTextureMapper* texMapper)
|
||||
{
|
||||
CVF_ASSERT(quadTextureCoords && quadMapper && resultAccessor && texMapper);
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class RivResultToTextureMapper;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
size_t gridIndex,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper);
|
||||
|
||||
bool isValid();
|
||||
bool isValid();
|
||||
|
||||
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
|
||||
|
||||
@@ -51,8 +51,8 @@ private:
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadMapper,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const RivResultToTextureMapper* texMapper);
|
||||
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
|
||||
cvf::ref<RigResultAccessor> m_resultAccessor;
|
||||
cvf::ref<RivResultToTextureMapper> m_texMapper;
|
||||
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
|
||||
cvf::ref<RigResultAccessor> m_resultAccessor;
|
||||
cvf::ref<RivResultToTextureMapper> m_texMapper;
|
||||
};
|
||||
|
||||
|
@@ -225,9 +225,9 @@ void RimCommandIssueFieldChanged::redo()
|
||||
{
|
||||
caf::PdmFieldHandle* fieldHandle = findFieldByKeyword(pdmObject, this->fieldName);
|
||||
|
||||
if (fieldHandle && fieldHandle->uiCapability())
|
||||
if (fieldHandle && fieldHandle->uiCapability())
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability();
|
||||
QVariant variantValue(this->fieldValueToApply);
|
||||
uiFieldHandle->setValueFromUi(variantValue);
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ public:
|
||||
RigCaseData* reservoirData();
|
||||
const RigCaseData* reservoirData() const;
|
||||
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
|
||||
RimEclipseView* createAndAddReservoirView();
|
||||
|
||||
|
@@ -248,14 +248,14 @@ cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString model
|
||||
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
|
||||
|
||||
RimMockModelSettings rimMockModelSettings;
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(&rimMockModelSettings);
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(&rimMockModelSettings);
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &rimMockModelSettings, "Customize Mock Model", "");
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &rimMockModelSettings, "Customize Mock Model", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(&rimMockModelSettings);
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(&rimMockModelSettings);
|
||||
|
||||
double startX = 0;
|
||||
double startY = 0;
|
||||
|
@@ -150,15 +150,15 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
|
||||
|
||||
// Build data access objects for source scalar results
|
||||
|
||||
cvf::Collection<RigResultAccessor> sourceDataAccessList;
|
||||
cvf::Collection<RigResultAccessor> sourceDataAccessList;
|
||||
for (size_t caseIdx = 0; caseIdx < m_sourceCases.size(); caseIdx++)
|
||||
{
|
||||
RimEclipseCase* sourceCase = m_sourceCases.at(caseIdx);
|
||||
|
||||
// Trigger loading of dataset
|
||||
sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
|
||||
// Trigger loading of dataset
|
||||
sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
sourceDataAccessList.push_back(resultAccessor.p());
|
||||
|
@@ -111,7 +111,7 @@ RimEclipseView::RimEclipseView()
|
||||
|
||||
this->cellResult()->setReservoirView(this);
|
||||
|
||||
this->cellEdgeResult()->setReservoirView(this);
|
||||
this->cellEdgeResult()->setReservoirView(this);
|
||||
this->cellEdgeResult()->legendConfig()->setReservoirView(this);
|
||||
this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE);
|
||||
|
||||
@@ -620,7 +620,7 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
{
|
||||
if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
}
|
||||
else if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
@@ -1465,14 +1465,14 @@ void RimEclipseView::updateFaultColors()
|
||||
|
||||
for (size_t i = 0; i < faultGeometriesToRecolor.size(); ++i)
|
||||
{
|
||||
if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultCellEdgeResultColor(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultColors, this->cellEdgeResult());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultColors(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultColors);
|
||||
}
|
||||
if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultCellEdgeResultColor(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultColors, this->cellEdgeResult());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultColors(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultColors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ void RimMockModelSettings::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
|
||||
{
|
||||
totalCellCount = cellCountX * cellCountY * cellCountZ;
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = totalCellCount.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = totalCellCount.uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
uiFieldHandle->updateConnectedEditors();
|
||||
|
@@ -43,5 +43,5 @@ public:
|
||||
|
||||
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
||||
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||
};
|
||||
|
@@ -295,12 +295,12 @@ void RimProject::initAfterRead()
|
||||
{
|
||||
casesObsolete.clear();
|
||||
}
|
||||
|
||||
if (casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0)
|
||||
{
|
||||
//printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from Project to analysisModels",
|
||||
// casesObsolete().size(), caseGroupsObsolete.size());
|
||||
}
|
||||
|
||||
if (casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0)
|
||||
{
|
||||
//printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from Project to analysisModels",
|
||||
// casesObsolete().size(), caseGroupsObsolete.size());
|
||||
}
|
||||
|
||||
// Set project pointer to each well path
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
||||
|
@@ -96,7 +96,7 @@ RimTernaryLegendConfig::RimTernaryLegendConfig()
|
||||
m_localAutoMin.resize(3, 0.0);
|
||||
m_localAutoMax.resize(3, 1.0);
|
||||
|
||||
m_scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
m_scalarMapper = new RivTernaryScalarMapper(cvf::Color3f::GRAY);
|
||||
|
||||
recreateLegend();
|
||||
updateLegend();
|
||||
@@ -168,7 +168,7 @@ void RimTernaryLegendConfig::updateLegend()
|
||||
double swatUpper = 1.0;
|
||||
|
||||
ternaryRanges(soilLower, soilUpper, sgasLower, sgasUpper, swatLower, swatUpper);
|
||||
m_scalarMapper->setTernaryRanges(soilLower, soilUpper, sgasLower, sgasUpper);
|
||||
m_scalarMapper->setTernaryRanges(soilLower, soilUpper, sgasLower, sgasUpper);
|
||||
|
||||
cvf::String soilRange;
|
||||
cvf::String sgasRange;
|
||||
@@ -449,6 +449,6 @@ void RimTernaryLegendConfig::updateLabelText()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper()
|
||||
{
|
||||
return m_scalarMapper.p();
|
||||
return m_scalarMapper.p();
|
||||
}
|
||||
|
||||
|
@@ -72,8 +72,8 @@ public:
|
||||
|
||||
void recreateLegend();
|
||||
|
||||
RivTernarySaturationOverlayItem* legend();
|
||||
RivTernaryScalarMapper* scalarMapper();
|
||||
RivTernarySaturationOverlayItem* legend();
|
||||
RivTernaryScalarMapper* scalarMapper();
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
@@ -109,5 +109,5 @@ private:
|
||||
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
cvf::ref<RivTernarySaturationOverlayItem> m_legend;
|
||||
cvf::ref<RivTernaryScalarMapper> m_scalarMapper;
|
||||
cvf::ref<RivTernaryScalarMapper> m_scalarMapper;
|
||||
};
|
||||
|
@@ -335,14 +335,14 @@ void RimView::setMeshOnlyDrawstyle()
|
||||
{
|
||||
if (isGridVisualizationMode())
|
||||
{
|
||||
meshMode.uiCapability()->setValueFromUi(FULL_MESH);
|
||||
meshMode.uiCapability()->setValueFromUi(FULL_MESH);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
}
|
||||
|
||||
surfaceMode.uiCapability()->setValueFromUi(NO_SURFACE);
|
||||
surfaceMode.uiCapability()->setValueFromUi(NO_SURFACE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -352,13 +352,13 @@ void RimView::setMeshSurfDrawstyle()
|
||||
{
|
||||
if (isGridVisualizationMode())
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
meshMode.uiCapability()->setValueFromUi(FULL_MESH);
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
meshMode.uiCapability()->setValueFromUi(FULL_MESH);
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,14 +374,14 @@ void RimView::setFaultMeshSurfDrawstyle()
|
||||
// Mesh SF SF SF
|
||||
if (this->isGridVisualizationMode())
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
}
|
||||
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -391,14 +391,14 @@ void RimView::setSurfOnlyDrawstyle()
|
||||
{
|
||||
if (isGridVisualizationMode())
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
}
|
||||
|
||||
meshMode.uiCapability()->setValueFromUi(NO_MESH);
|
||||
meshMode.uiCapability()->setValueFromUi(NO_MESH);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -409,13 +409,13 @@ void RimView::setShowFaultsOnly(bool showFaults)
|
||||
if (showFaults)
|
||||
{
|
||||
m_previousGridModeMeshLinesWasFaults = meshMode() == FAULTS_MESH;
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
if (meshMode() != NO_MESH) meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(FAULTS);
|
||||
if (meshMode() != NO_MESH) meshMode.uiCapability()->setValueFromUi(FAULTS_MESH);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
if (meshMode() != NO_MESH) meshMode.uiCapability()->setValueFromUi(m_previousGridModeMeshLinesWasFaults ? FAULTS_MESH : FULL_MESH);
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
if (meshMode() != NO_MESH) meshMode.uiCapability()->setValueFromUi(m_previousGridModeMeshLinesWasFaults ? FAULTS_MESH : FULL_MESH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ void RimView::setShowFaultsOnly(bool showFaults)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::setSurfaceDrawstyle()
|
||||
{
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode.uiCapability()->setValueFromUi(SURFACE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -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;
|
||||
|
@@ -33,12 +33,12 @@ class RigHistogramCalculator;
|
||||
class RigStatisticsCalculator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) = 0;
|
||||
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) = 0;
|
||||
|
||||
void meanCellScalarValue(double& meanValue);
|
||||
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount) = 0;
|
||||
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) = 0;
|
||||
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) = 0;
|
||||
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) = 0;
|
||||
|
||||
void meanCellScalarValue(double& meanValue);
|
||||
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount) = 0;
|
||||
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) = 0;
|
||||
|
||||
virtual size_t timeStepCount() = 0;
|
||||
};
|
||||
|
@@ -29,7 +29,7 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigStatisticsDataCache::RigStatisticsDataCache(RigStatisticsCalculator* statisticsCalculator)
|
||||
: m_statisticsCalculator(statisticsCalculator)
|
||||
: m_statisticsCalculator(statisticsCalculator)
|
||||
{
|
||||
clearAllStatistics();
|
||||
}
|
||||
@@ -60,27 +60,27 @@ void RigStatisticsDataCache::clearAllStatistics()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max)
|
||||
{
|
||||
if (!m_isMaxMinCalculated)
|
||||
{
|
||||
if (!m_isMaxMinCalculated)
|
||||
{
|
||||
min = HUGE_VAL;
|
||||
max = -HUGE_VAL;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < m_statisticsCalculator->timeStepCount(); i++)
|
||||
{
|
||||
for (i = 0; i < m_statisticsCalculator->timeStepCount(); i++)
|
||||
{
|
||||
double tsmin, tsmax;
|
||||
this->minMaxCellScalarValues(i, tsmin, tsmax);
|
||||
if (tsmin < min) min = tsmin;
|
||||
if (tsmax > max) max = tsmax;
|
||||
}
|
||||
this->minMaxCellScalarValues(i, tsmin, tsmax);
|
||||
if (tsmin < min) min = tsmin;
|
||||
if (tsmax > max) max = tsmax;
|
||||
}
|
||||
|
||||
m_minValue = min;
|
||||
m_maxValue = max;
|
||||
m_minValue = min;
|
||||
m_maxValue = max;
|
||||
m_isMaxMinCalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
min = m_minValue;
|
||||
max = m_maxValue;
|
||||
min = m_minValue;
|
||||
max = m_maxValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -88,9 +88,9 @@ void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
|
||||
{
|
||||
if (timeStepIndex >= m_maxMinValuesPrTs.size())
|
||||
{
|
||||
m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||
if (timeStepIndex >= m_maxMinValuesPrTs.size())
|
||||
{
|
||||
m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||
m_isMaxMinPrTsCalculated.resize(timeStepIndex + 1, false);
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double
|
||||
|
||||
m_statisticsCalculator->minMaxCellScalarValues(timeStepIndex, tsMin, tsMax);
|
||||
|
||||
m_maxMinValuesPrTs[timeStepIndex].first = tsMin;
|
||||
m_maxMinValuesPrTs[timeStepIndex].second = tsMax;
|
||||
m_maxMinValuesPrTs[timeStepIndex].first = tsMin;
|
||||
m_maxMinValuesPrTs[timeStepIndex].second = tsMax;
|
||||
|
||||
m_isMaxMinPrTsCalculated[timeStepIndex] = true;
|
||||
}
|
||||
|
||||
min = m_maxMinValuesPrTs[timeStepIndex].first;
|
||||
max = m_maxMinValuesPrTs[timeStepIndex].second;
|
||||
min = m_maxMinValuesPrTs[timeStepIndex].first;
|
||||
max = m_maxMinValuesPrTs[timeStepIndex].second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -116,27 +116,27 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg)
|
||||
{
|
||||
if (!m_isClosestToZeroCalculated)
|
||||
{
|
||||
if (!m_isClosestToZeroCalculated)
|
||||
{
|
||||
pos = HUGE_VAL;
|
||||
neg = -HUGE_VAL;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < m_statisticsCalculator->timeStepCount(); i++)
|
||||
{
|
||||
double tsNeg, tsPos;
|
||||
this->posNegClosestToZero(i, tsPos, tsNeg);
|
||||
if (tsNeg > neg && tsNeg < 0) neg = tsNeg;
|
||||
if (tsPos < pos && tsPos > 0) pos = tsPos;
|
||||
}
|
||||
{
|
||||
double tsNeg, tsPos;
|
||||
this->posNegClosestToZero(i, tsPos, tsNeg);
|
||||
if (tsNeg > neg && tsNeg < 0) neg = tsNeg;
|
||||
if (tsPos < pos && tsPos > 0) pos = tsPos;
|
||||
}
|
||||
|
||||
m_posClosestToZero = pos;
|
||||
m_negClosestToZero = neg;
|
||||
m_posClosestToZero = pos;
|
||||
m_negClosestToZero = neg;
|
||||
m_isClosestToZeroCalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
pos = m_posClosestToZero;
|
||||
neg = m_negClosestToZero;
|
||||
pos = m_posClosestToZero;
|
||||
neg = m_negClosestToZero;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -144,9 +144,9 @@ void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& posNearZero, double& negNearZero)
|
||||
{
|
||||
if (timeStepIndex >= m_posNegClosestToZeroPrTs.size())
|
||||
{
|
||||
m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||
if (timeStepIndex >= m_posNegClosestToZeroPrTs.size())
|
||||
{
|
||||
m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||
m_isClosestToZeroPrTsCalculated.resize(timeStepIndex + 1, false);
|
||||
}
|
||||
|
||||
@@ -158,14 +158,14 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
|
||||
|
||||
m_statisticsCalculator->posNegClosestToZero(timeStepIndex, pos, neg);
|
||||
|
||||
m_posNegClosestToZeroPrTs[timeStepIndex].first = pos;
|
||||
m_posNegClosestToZeroPrTs[timeStepIndex].second = neg;
|
||||
m_posNegClosestToZeroPrTs[timeStepIndex].first = pos;
|
||||
m_posNegClosestToZeroPrTs[timeStepIndex].second = neg;
|
||||
|
||||
m_isClosestToZeroPrTsCalculated[timeStepIndex] = true;
|
||||
}
|
||||
|
||||
posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first;
|
||||
negNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].second;
|
||||
posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first;
|
||||
negNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -173,22 +173,22 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
|
||||
{
|
||||
if (m_histogram.size() == 0)
|
||||
{
|
||||
double min;
|
||||
double max;
|
||||
size_t nBins = 100;
|
||||
this->minMaxCellScalarValues(min, max);
|
||||
if (m_histogram.size() == 0)
|
||||
{
|
||||
double min;
|
||||
double max;
|
||||
size_t nBins = 100;
|
||||
this->minMaxCellScalarValues(min, max);
|
||||
|
||||
RigHistogramCalculator histCalc(min, max, nBins, &m_histogram);
|
||||
RigHistogramCalculator histCalc(min, max, nBins, &m_histogram);
|
||||
|
||||
m_statisticsCalculator->addDataToHistogramCalculator(histCalc);
|
||||
m_statisticsCalculator->addDataToHistogramCalculator(histCalc);
|
||||
|
||||
m_p10 = histCalc.calculatePercentil(0.1);
|
||||
m_p90 = histCalc.calculatePercentil(0.9);
|
||||
}
|
||||
m_p10 = histCalc.calculatePercentil(0.1);
|
||||
m_p90 = histCalc.calculatePercentil(0.9);
|
||||
}
|
||||
|
||||
return m_histogram;
|
||||
return m_histogram;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -196,11 +196,11 @@ const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90)
|
||||
{
|
||||
// First make sure they are calculated
|
||||
const std::vector<size_t>& histogr = this->cellScalarValuesHistogram();
|
||||
// First make sure they are calculated
|
||||
const std::vector<size_t>& histogr = this->cellScalarValuesHistogram();
|
||||
|
||||
p10 = m_p10;
|
||||
p90 = m_p90;
|
||||
p10 = m_p10;
|
||||
p90 = m_p90;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -208,12 +208,12 @@ void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::meanCellScalarValues(double& meanValue)
|
||||
{
|
||||
if (!m_isMeanCalculated)
|
||||
{
|
||||
m_statisticsCalculator->meanCellScalarValue(m_meanValue);
|
||||
if (!m_isMeanCalculated)
|
||||
{
|
||||
m_statisticsCalculator->meanCellScalarValue(m_meanValue);
|
||||
m_isMeanCalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
meanValue = m_meanValue;
|
||||
meanValue = m_meanValue;
|
||||
}
|
||||
|
||||
|
@@ -47,26 +47,26 @@ public:
|
||||
const std::vector<size_t>& cellScalarValuesHistogram();
|
||||
|
||||
private:
|
||||
double m_minValue;
|
||||
double m_maxValue;
|
||||
double m_minValue;
|
||||
double m_maxValue;
|
||||
bool m_isMaxMinCalculated;
|
||||
|
||||
double m_posClosestToZero;
|
||||
double m_negClosestToZero;
|
||||
double m_posClosestToZero;
|
||||
double m_negClosestToZero;
|
||||
bool m_isClosestToZeroCalculated;
|
||||
|
||||
double m_p10;
|
||||
double m_p90;
|
||||
double m_p10;
|
||||
double m_p90;
|
||||
double m_meanValue;
|
||||
bool m_isMeanCalculated;
|
||||
|
||||
std::vector<size_t> m_histogram;
|
||||
std::vector<size_t> m_histogram;
|
||||
|
||||
std::vector<std::pair<double, double> > m_maxMinValuesPrTs; ///< Max min values for each time step
|
||||
std::vector<std::pair<double, double> > m_maxMinValuesPrTs; ///< Max min values for each time step
|
||||
std::vector<bool> m_isMaxMinPrTsCalculated;
|
||||
std::vector<std::pair<double, double> > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step
|
||||
std::vector<std::pair<double, double> > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step
|
||||
std::vector<bool> m_isClosestToZeroPrTsCalculated;
|
||||
|
||||
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
|
||||
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
|
||||
};
|
||||
|
||||
|
@@ -320,7 +320,7 @@ public:
|
||||
|
||||
for (size_t tsIdx = 0; tsIdx < timestepCount; tsIdx++)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(rimCase->reservoirData(), gridIdx, porosityModelEnum, requestedTimesteps[tsIdx], propertyName);
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(rimCase->reservoirData(), gridIdx, porosityModelEnum, requestedTimesteps[tsIdx], propertyName);
|
||||
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
|
@@ -37,15 +37,15 @@
|
||||
RiuCursors::RiuCursors()
|
||||
{
|
||||
m_cursors[FILTER_BOX] = cursorFromFile(":/Cursors/curFilterBox.bmp", 10, 10);
|
||||
m_cursors[NORMAL] = cursorFromFile(":/Cursors/curNormal.bmp", 10, 10);
|
||||
m_cursors[PAN] = cursorFromFile(":/Cursors/curPan.bmp");
|
||||
m_cursors[WALK] = cursorFromFile(":/Cursors/curWalk.bmp");
|
||||
m_cursors[ZOOM] = cursorFromFile(":/Cursors/curZoom.bmp");
|
||||
m_cursors[ROTATE] = cursorFromFile(":/Cursors/curRotate.bmp");
|
||||
m_cursors[NORMAL] = cursorFromFile(":/Cursors/curNormal.bmp", 10, 10);
|
||||
m_cursors[PAN] = cursorFromFile(":/Cursors/curPan.bmp");
|
||||
m_cursors[WALK] = cursorFromFile(":/Cursors/curWalk.bmp");
|
||||
m_cursors[ZOOM] = cursorFromFile(":/Cursors/curZoom.bmp");
|
||||
m_cursors[ROTATE] = cursorFromFile(":/Cursors/curRotate.bmp");
|
||||
|
||||
m_cursors[PICK] = cursorFromFile(":/Cursors/curPick.bmp", 10, 10);
|
||||
m_cursors[PICK_ROTPOINT]= cursorFromFile(":/Cursors/curPickRotPoint.bmp", 10, 10);
|
||||
m_cursors[PICK_GOTO] = cursorFromFile(":/Cursors/curPickGoto.bmp", 10, 10);
|
||||
m_cursors[PICK] = cursorFromFile(":/Cursors/curPick.bmp", 10, 10);
|
||||
m_cursors[PICK_ROTPOINT]= cursorFromFile(":/Cursors/curPickRotPoint.bmp", 10, 10);
|
||||
m_cursors[PICK_GOTO] = cursorFromFile(":/Cursors/curPickGoto.bmp", 10, 10);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ RiuCursors::RiuCursors()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QCursor RiuCursors::get(CursorIndex cursorIdx)
|
||||
{
|
||||
// Create our single instance in a local static variable
|
||||
static RiuCursors myStaticInstance;
|
||||
|
||||
// Create our single instance in a local static variable
|
||||
static RiuCursors myStaticInstance;
|
||||
|
||||
return myStaticInstance.m_cursors[cursorIdx];
|
||||
}
|
||||
|
||||
@@ -64,23 +64,23 @@ QCursor RiuCursors::get(CursorIndex cursorIdx)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QCursor RiuCursors::cursorFromFile(const QString& fileName, int hotspotX, int hotspotY)
|
||||
QCursor RiuCursors::cursorFromFile(const QString& fileName, int hotspotX, int hotspotY)
|
||||
{
|
||||
QImage image(fileName);
|
||||
if (image.width() == 0 || image.height() == 0)
|
||||
{
|
||||
return QCursor();
|
||||
}
|
||||
QImage image(fileName);
|
||||
if (image.width() == 0 || image.height() == 0)
|
||||
{
|
||||
return QCursor();
|
||||
}
|
||||
|
||||
QRgb maskClr = image.pixel(0, 0);
|
||||
//QImage imgMask = image.createMaskFromColor(maskClr, Qt::MaskInColor);
|
||||
QImage imgMask = image.createHeuristicMask(true);
|
||||
QRgb maskClr = image.pixel(0, 0);
|
||||
//QImage imgMask = image.createMaskFromColor(maskClr, Qt::MaskInColor);
|
||||
QImage imgMask = image.createHeuristicMask(true);
|
||||
|
||||
QBitmap bmMask = QBitmap::fromImage(imgMask, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
QBitmap bmMask = QBitmap::fromImage(imgMask, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
|
||||
QBitmap bitmap = QBitmap::fromImage(image, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
QBitmap bitmap = QBitmap::fromImage(image, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
|
||||
return QCursor(bitmap, bmMask, hotspotX, hotspotY);
|
||||
return QCursor(bitmap, bmMask, hotspotX, hotspotY);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -41,16 +41,16 @@ public:
|
||||
PICK,
|
||||
PICK_GOTO,
|
||||
PICK_ROTPOINT,
|
||||
NUM_CURSORS
|
||||
NUM_CURSORS
|
||||
};
|
||||
|
||||
public:
|
||||
static QCursor get(CursorIndex cursorIdx);
|
||||
static QCursor get(CursorIndex cursorIdx);
|
||||
|
||||
private:
|
||||
RiuCursors();
|
||||
static QCursor cursorFromFile(const QString& fileName, int hotspotX = -1, int hotspotY = -1);
|
||||
RiuCursors();
|
||||
static QCursor cursorFromFile(const QString& fileName, int hotspotX = -1, int hotspotY = -1);
|
||||
|
||||
private:
|
||||
QCursor m_cursors[NUM_CURSORS];
|
||||
QCursor m_cursors[NUM_CURSORS];
|
||||
};
|
||||
|
@@ -38,9 +38,9 @@ RiuFemResultTextBuilder::RiuFemResultTextBuilder(RimGeoMechView* reservoirView,
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
m_reservoirView = reservoirView;
|
||||
m_gridIndex = gridIndex;
|
||||
m_cellIndex = cellIndex;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
m_gridIndex = gridIndex;
|
||||
m_cellIndex = cellIndex;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
|
||||
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
|
||||
m_face = cvf::StructGridInterface::NO_FACE;
|
||||
@@ -79,7 +79,7 @@ QString RiuFemResultTextBuilder::mainResultText()
|
||||
|
||||
appendDetails(text, gridResultDetails());
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -135,21 +135,21 @@ QString RiuFemResultTextBuilder::topologyText(QString itemSeparator)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuFemResultTextBuilder::gridResultDetails()
|
||||
{
|
||||
QString text;
|
||||
QString text;
|
||||
|
||||
if (m_reservoirView->geoMechCase() && m_reservoirView->geoMechCase()->geoMechData())
|
||||
{
|
||||
RigGeoMechCaseData* eclipseCaseData = m_reservoirView->geoMechCase()->geoMechData();
|
||||
if (m_reservoirView->geoMechCase() && m_reservoirView->geoMechCase()->geoMechData())
|
||||
{
|
||||
RigGeoMechCaseData* eclipseCaseData = m_reservoirView->geoMechCase()->geoMechData();
|
||||
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
||||
|
||||
if (!text.isEmpty())
|
||||
{
|
||||
text.prepend("-- Element result details --\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,10 +158,10 @@ QString RiuFemResultTextBuilder::gridResultDetails()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuFemResultTextBuilder::appendTextFromResultColors(RigGeoMechCaseData* geomData, int gridIndex, int cellIndex, int timeStepIndex, RimGeoMechCellColors* resultColors, QString* resultInfoText)
|
||||
{
|
||||
if (!resultColors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!resultColors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
@@ -218,16 +218,16 @@ void RiuFemResultTextBuilder::appendDetails(QString& text, const QString& detail
|
||||
QString RiuFemResultTextBuilder::closestNodeResultText(RimGeoMechCellColors* resultColors)
|
||||
{
|
||||
QString text;
|
||||
if (!resultColors)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
if (!resultColors)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
if (! (m_reservoirView->geoMechCase() && m_reservoirView->geoMechCase()->geoMechData())) return text;
|
||||
|
||||
RigGeoMechCaseData* geomData = m_reservoirView->geoMechCase()->geoMechData();
|
||||
if (! (m_reservoirView->geoMechCase() && m_reservoirView->geoMechCase()->geoMechData())) return text;
|
||||
|
||||
RigGeoMechCaseData* geomData = m_reservoirView->geoMechCase()->geoMechData();
|
||||
|
||||
const std::vector<float>& scalarResults = geomData->femPartResults()->resultValues(resultColors->resultAddress(), m_gridIndex, m_timeStepIndex);
|
||||
if (scalarResults.size())
|
||||
|
@@ -30,7 +30,7 @@ class RigGeoMechCaseData;
|
||||
class RimGeoMechCellColors;
|
||||
|
||||
namespace cvf {
|
||||
class Part;
|
||||
class Part;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -40,14 +40,14 @@ namespace cvf {
|
||||
class RiuFemResultTextBuilder
|
||||
{
|
||||
public:
|
||||
RiuFemResultTextBuilder(RimGeoMechView* reservoirView, int gridIndex, int cellIndex, int timeStepIndex);
|
||||
RiuFemResultTextBuilder(RimGeoMechView* reservoirView, int gridIndex, int cellIndex, int timeStepIndex);
|
||||
void setFace(cvf::StructGridInterface::FaceType face);
|
||||
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
|
||||
|
||||
QString mainResultText();
|
||||
|
||||
QString topologyText(QString itemSeparator);
|
||||
|
||||
QString topologyText(QString itemSeparator);
|
||||
|
||||
private:
|
||||
void appendDetails(QString& text, const QString& details);
|
||||
|
||||
@@ -55,16 +55,16 @@ private:
|
||||
|
||||
QString closestNodeResultText(RimGeoMechCellColors* resultColors);
|
||||
|
||||
void appendTextFromResultColors(RigGeoMechCaseData* eclipseCase, int gridIndex, int cellIndex, int timeStepIndex, RimGeoMechCellColors* resultColors, QString* resultInfoText);
|
||||
void appendTextFromResultColors(RigGeoMechCaseData* eclipseCase, int gridIndex, int cellIndex, int timeStepIndex, RimGeoMechCellColors* resultColors, QString* resultInfoText);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
||||
|
||||
int m_gridIndex;
|
||||
int m_cellIndex;
|
||||
int m_timeStepIndex;
|
||||
int m_gridIndex;
|
||||
int m_cellIndex;
|
||||
int m_timeStepIndex;
|
||||
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
|
||||
cvf::Vec3d m_intersectionPoint;
|
||||
cvf::Vec3d m_intersectionPoint;
|
||||
};
|
||||
|
@@ -255,35 +255,35 @@ void RiuMainWindow::createActions()
|
||||
|
||||
m_exitAction = new QAction("E&xit", this);
|
||||
|
||||
connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject()));
|
||||
connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject()));
|
||||
connect(m_openLastUsedProjectAction, SIGNAL(triggered()), SLOT(slotOpenLastUsedProject()));
|
||||
|
||||
connect(m_importGeoMechCaseAction, SIGNAL(triggered()), SLOT(slotImportGeoMechModel()));
|
||||
|
||||
connect(m_mockModelAction, SIGNAL(triggered()), SLOT(slotMockModel()));
|
||||
connect(m_mockResultsModelAction, SIGNAL(triggered()), SLOT(slotMockResultsModel()));
|
||||
connect(m_mockLargeResultsModelAction, SIGNAL(triggered()), SLOT(slotMockLargeResultsModel()));
|
||||
connect(m_mockModelCustomizedAction, SIGNAL(triggered()), SLOT(slotMockModelCustomized()));
|
||||
connect(m_mockInputModelAction, SIGNAL(triggered()), SLOT(slotInputMockModel()));
|
||||
connect(m_mockModelAction, SIGNAL(triggered()), SLOT(slotMockModel()));
|
||||
connect(m_mockResultsModelAction, SIGNAL(triggered()), SLOT(slotMockResultsModel()));
|
||||
connect(m_mockLargeResultsModelAction, SIGNAL(triggered()), SLOT(slotMockLargeResultsModel()));
|
||||
connect(m_mockModelCustomizedAction, SIGNAL(triggered()), SLOT(slotMockModelCustomized()));
|
||||
connect(m_mockInputModelAction, SIGNAL(triggered()), SLOT(slotInputMockModel()));
|
||||
|
||||
connect(m_snapshotToFile, SIGNAL(triggered()), SLOT(slotSnapshotToFile()));
|
||||
connect(m_snapshotToClipboard, SIGNAL(triggered()), SLOT(slotSnapshotToClipboard()));
|
||||
connect(m_snapshotToFile, SIGNAL(triggered()), SLOT(slotSnapshotToFile()));
|
||||
connect(m_snapshotToClipboard, SIGNAL(triggered()), SLOT(slotSnapshotToClipboard()));
|
||||
connect(m_snapshotAllViewsToFile, SIGNAL(triggered()), SLOT(slotSnapshotAllViewsToFile()));
|
||||
|
||||
connect(m_createCommandObject, SIGNAL(triggered()), SLOT(slotCreateCommandObject()));
|
||||
connect(m_showRegressionTestDialog, SIGNAL(triggered()), SLOT(slotShowRegressionTestDialog()));
|
||||
connect(m_executePaintEventPerformanceTest, SIGNAL(triggered()), SLOT(slotExecutePaintEventPerformanceTest()));
|
||||
|
||||
connect(m_saveProjectAction, SIGNAL(triggered()), SLOT(slotSaveProject()));
|
||||
connect(m_saveProjectAsAction, SIGNAL(triggered()), SLOT(slotSaveProjectAs()));
|
||||
connect(m_saveProjectAction, SIGNAL(triggered()), SLOT(slotSaveProject()));
|
||||
connect(m_saveProjectAsAction, SIGNAL(triggered()), SLOT(slotSaveProjectAs()));
|
||||
|
||||
connect(m_closeProjectAction, SIGNAL(triggered()), SLOT(slotCloseProject()));
|
||||
connect(m_closeProjectAction, SIGNAL(triggered()), SLOT(slotCloseProject()));
|
||||
|
||||
connect(m_exitAction, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows()));
|
||||
|
||||
// Edit actions
|
||||
m_editPreferences = new QAction("&Preferences...", this);
|
||||
connect(m_editPreferences, SIGNAL(triggered()), SLOT(slotEditPreferences()));
|
||||
connect(m_editPreferences, SIGNAL(triggered()), SLOT(slotEditPreferences()));
|
||||
|
||||
// View actions
|
||||
m_viewFromNorth = new QAction(QIcon(":/SouthViewArrow.png"), "Look South", this);
|
||||
@@ -302,13 +302,13 @@ void RiuMainWindow::createActions()
|
||||
m_zoomAll = new QAction(QIcon(":/ZoomAll16x16.png"),"Zoom all", this);
|
||||
m_zoomAll->setToolTip("Zoom to view all");
|
||||
|
||||
connect(m_viewFromNorth, SIGNAL(triggered()), SLOT(slotViewFromNorth()));
|
||||
connect(m_viewFromSouth, SIGNAL(triggered()), SLOT(slotViewFromSouth()));
|
||||
connect(m_viewFromEast, SIGNAL(triggered()), SLOT(slotViewFromEast()));
|
||||
connect(m_viewFromWest, SIGNAL(triggered()), SLOT(slotViewFromWest()));
|
||||
connect(m_viewFromAbove, SIGNAL(triggered()), SLOT(slotViewFromAbove()));
|
||||
connect(m_viewFromBelow, SIGNAL(triggered()), SLOT(slotViewFromBelow()));
|
||||
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
||||
connect(m_viewFromNorth, SIGNAL(triggered()), SLOT(slotViewFromNorth()));
|
||||
connect(m_viewFromSouth, SIGNAL(triggered()), SLOT(slotViewFromSouth()));
|
||||
connect(m_viewFromEast, SIGNAL(triggered()), SLOT(slotViewFromEast()));
|
||||
connect(m_viewFromWest, SIGNAL(triggered()), SLOT(slotViewFromWest()));
|
||||
connect(m_viewFromAbove, SIGNAL(triggered()), SLOT(slotViewFromAbove()));
|
||||
connect(m_viewFromBelow, SIGNAL(triggered()), SLOT(slotViewFromBelow()));
|
||||
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
||||
|
||||
// Debug actions
|
||||
m_newPropertyView = new QAction("New Project and Property View", this);
|
||||
@@ -326,18 +326,18 @@ void RiuMainWindow::createActions()
|
||||
m_dsActionGroup = new QActionGroup(this);
|
||||
|
||||
m_drawStyleLinesAction = new QAction(QIcon(":/draw_style_lines_24x24.png"), "&Mesh Only", this);
|
||||
//connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines()));
|
||||
//connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines()));
|
||||
m_dsActionGroup->addAction(m_drawStyleLinesAction);
|
||||
|
||||
m_drawStyleLinesSolidAction = new QAction(QIcon(":/draw_style_meshlines_24x24.png"), "Mesh And Surfaces", this);
|
||||
//connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid()));
|
||||
//connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid()));
|
||||
m_dsActionGroup->addAction(m_drawStyleLinesSolidAction);
|
||||
|
||||
m_drawStyleFaultLinesSolidAction = new QAction(QIcon(":/draw_style_surface_w_fault_mesh_24x24.png"), "Fault Mesh And Surfaces", this);
|
||||
m_dsActionGroup->addAction(m_drawStyleFaultLinesSolidAction);
|
||||
|
||||
m_drawStyleSurfOnlyAction = new QAction(QIcon(":/draw_style_surface_24x24.png"), "&Surface Only", this);
|
||||
//connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly()));
|
||||
//connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly()));
|
||||
m_dsActionGroup->addAction(m_drawStyleSurfOnlyAction);
|
||||
|
||||
|
||||
@@ -345,21 +345,21 @@ void RiuMainWindow::createActions()
|
||||
|
||||
m_disableLightingAction = new QAction(QIcon(":/disable_lighting_24x24.png"), "&Disable Results Lighting", this);
|
||||
m_disableLightingAction->setCheckable(true);
|
||||
connect(m_disableLightingAction, SIGNAL(toggled(bool)), SLOT(slotDisableLightingAction(bool)));
|
||||
connect(m_disableLightingAction, SIGNAL(toggled(bool)), SLOT(slotDisableLightingAction(bool)));
|
||||
|
||||
|
||||
m_drawStyleToggleFaultsAction = new QAction( QIcon(":/draw_style_faults_24x24.png"), "&Show Faults Only", this);
|
||||
m_drawStyleToggleFaultsAction->setCheckable(true);
|
||||
connect(m_drawStyleToggleFaultsAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultsAction(bool)));
|
||||
connect(m_drawStyleToggleFaultsAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultsAction(bool)));
|
||||
|
||||
m_toggleFaultsLabelAction = new QAction( QIcon(":/draw_style_faults_label_24x24.png"), "&Show Fault Labels", this);
|
||||
m_toggleFaultsLabelAction->setCheckable(true);
|
||||
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
|
||||
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
|
||||
|
||||
m_addWellCellsToRangeFilterAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Add Well Cells To Range Filter", this);
|
||||
m_addWellCellsToRangeFilterAction->setCheckable(true);
|
||||
m_addWellCellsToRangeFilterAction->setToolTip("Add Well Cells To Range Filter based on the individual settings");
|
||||
connect(m_addWellCellsToRangeFilterAction, SIGNAL(toggled(bool)), SLOT(slotAddWellCellsToRangeFilterAction(bool)));
|
||||
connect(m_addWellCellsToRangeFilterAction, SIGNAL(toggled(bool)), SLOT(slotAddWellCellsToRangeFilterAction(bool)));
|
||||
|
||||
}
|
||||
|
||||
@@ -576,18 +576,18 @@ void RiuMainWindow::createToolBars()
|
||||
|
||||
void RiuMainWindow::createDockPanels()
|
||||
{
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Project Tree", this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Project Tree", this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||
|
||||
m_projectTreeView = new caf::PdmUiTreeView(this);
|
||||
m_projectTreeView = new caf::PdmUiTreeView(this);
|
||||
m_projectTreeView->enableSelectionManagerUpdating(true);
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
m_projectTreeView->enableAppendOfClassNameToUiItemText(app->preferences()->appendClassNameToUiText());
|
||||
|
||||
dockWidget->setWidget(m_projectTreeView);
|
||||
dockWidget->setWidget(m_projectTreeView);
|
||||
|
||||
m_projectTreeView->treeView()->setHeaderHidden(true);
|
||||
m_projectTreeView->treeView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
@@ -602,13 +602,13 @@ void RiuMainWindow::createDockPanels()
|
||||
RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter(this);
|
||||
m_projectTreeView->treeView()->installEventFilter(treeViewEventFilter);
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||
|
||||
connect(m_projectTreeView, SIGNAL(selectionChanged()), this, SLOT(selectedObjectsChanged()));
|
||||
connect(m_projectTreeView, SIGNAL(selectionChanged()), this, SLOT(selectedObjectsChanged()));
|
||||
m_projectTreeView->treeView()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_projectTreeView->treeView(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(customMenuRequested(const QPoint&)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Undo stack", this);
|
||||
@@ -676,7 +676,7 @@ void RiuMainWindow::createDockPanels()
|
||||
// }
|
||||
|
||||
|
||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
|
||||
}
|
||||
|
||||
@@ -1317,7 +1317,7 @@ void RiuMainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
|
||||
{
|
||||
m_pdmRoot = pdmRoot;
|
||||
|
||||
m_projectTreeView->setPdmItem(pdmRoot);
|
||||
m_projectTreeView->setPdmItem(pdmRoot);
|
||||
// For debug only : m_projectTreeView->treeView()->expandAll();
|
||||
m_projectTreeView->setDragDropInterface(m_dragDropInterface);
|
||||
|
||||
@@ -1559,18 +1559,18 @@ void RiuMainWindow::slotShowPerformanceInfo(bool enable)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotEditPreferences()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(this, app->preferences(), "Preferences", "");
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(this, app->preferences(), "Preferences", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
// Write preferences using QSettings and apply them to the application
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(app->preferences());
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(app->preferences());
|
||||
app->applyPreferences();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read back currently stored values using QSettings
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(app->preferences());
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(app->preferences());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,7 +1594,7 @@ void RiuMainWindow::slotFramerateChanged(double frameRate)
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView() != NULL)
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = RiaApplication::instance()->activeReservoirView()->maximumFrameRate.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = RiaApplication::instance()->activeReservoirView()->maximumFrameRate.uiCapability();
|
||||
uiFieldHandle->setValueFromUi(QVariant(frameRate));
|
||||
}
|
||||
}
|
||||
@@ -1871,7 +1871,7 @@ void RiuMainWindow::slotToggleFaultLabelsAction(bool showLabels)
|
||||
RimEclipseView* activeRiv = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
if (!activeRiv) return;
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = activeRiv->faultCollection->showFaultLabel.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = activeRiv->faultCollection->showFaultLabel.uiCapability();
|
||||
uiFieldHandle->setValueFromUi(showLabels);
|
||||
|
||||
refreshDrawStyleActions();
|
||||
@@ -1994,7 +1994,7 @@ void RiuMainWindow::slotScaleChanged(int scaleValue)
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView())
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = RiaApplication::instance()->activeReservoirView()->scaleZ.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = RiaApplication::instance()->activeReservoirView()->scaleZ.uiCapability();
|
||||
uiFieldHandle->setValueFromUi(scaleValue);
|
||||
}
|
||||
}
|
||||
@@ -2080,13 +2080,13 @@ void RiuMainWindow::slotShowRegressionTestDialog()
|
||||
RiaRegressionTest regTestConfig;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig);
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig);
|
||||
|
||||
caf::PdmUiPropertyViewDialog regressionTestDialog(this, ®TestConfig, "Regression Test", "");
|
||||
if (regressionTestDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
// Write preferences using QSettings and apply them to the application
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(®TestConfig);
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(®TestConfig);
|
||||
|
||||
QString currentApplicationPath = QDir::currentPath();
|
||||
|
||||
@@ -2143,7 +2143,7 @@ void RiuMainWindow::slotAddWellCellsToRangeFilterAction(bool doAdd)
|
||||
caf::AppEnum<RimEclipseWellCollection::WellCellsRangeFilterType> rangeAddType;
|
||||
rangeAddType = doAdd ? RimEclipseWellCollection::RANGE_ADD_INDIVIDUAL : RimEclipseWellCollection::RANGE_ADD_NONE;
|
||||
|
||||
caf::PdmUiFieldHandle* pdmUiFieldHandle = riv->wellCollection()->wellCellsToRangeFilterMode.uiCapability();
|
||||
caf::PdmUiFieldHandle* pdmUiFieldHandle = riv->wellCollection()->wellCellsToRangeFilterMode.uiCapability();
|
||||
if (pdmUiFieldHandle)
|
||||
{
|
||||
pdmUiFieldHandle->setValueFromUi(static_cast<unsigned int>(rangeAddType.index()));
|
||||
|
@@ -47,7 +47,7 @@ class RiuWellLogPlot;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmUiTreeView;
|
||||
class PdmUiTreeView;
|
||||
class AnimationToolBar;
|
||||
class FrameAnimationControl;
|
||||
class PdmObject;
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
RiuMainWindow();
|
||||
static RiuMainWindow* instance();
|
||||
|
||||
void initializeGuiNewProjectLoaded();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
void initializeGuiNewProjectLoaded();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void removeViewer( QWidget* viewer );
|
||||
void addViewer(QWidget* viewer, const std::vector<int>& windowsGeometry);
|
||||
@@ -93,8 +93,8 @@ public:
|
||||
RiuProcessMonitor* processMonitor();
|
||||
|
||||
void hideAllDockWindows();
|
||||
void loadWinGeoAndDockToolBarLayout();
|
||||
void showWindow();
|
||||
void loadWinGeoAndDockToolBarLayout();
|
||||
void showWindow();
|
||||
|
||||
void setCurrentObjectInTreeView(caf::PdmObject* object);
|
||||
|
||||
@@ -118,14 +118,14 @@ public:
|
||||
QMdiSubWindow* findMdiSubWindow(QWidget* viewer);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void createDockPanels();
|
||||
void saveWinGeoAndDockToolBarLayout();
|
||||
void saveWinGeoAndDockToolBarLayout();
|
||||
|
||||
bool checkForDocumentModifications();
|
||||
|
||||
@@ -137,17 +137,17 @@ private:
|
||||
private:
|
||||
static RiuMainWindow* sm_mainWindowInstance;
|
||||
|
||||
QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI
|
||||
QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI
|
||||
|
||||
private:
|
||||
// File actions
|
||||
QAction* m_importGeoMechCaseAction;
|
||||
QAction* m_openProjectAction;
|
||||
QAction* m_openLastUsedProjectAction;
|
||||
QAction* m_saveProjectAction;
|
||||
QAction* m_saveProjectAsAction;
|
||||
QAction* m_openProjectAction;
|
||||
QAction* m_openLastUsedProjectAction;
|
||||
QAction* m_saveProjectAction;
|
||||
QAction* m_saveProjectAsAction;
|
||||
QAction* m_closeProjectAction;
|
||||
QAction* m_exitAction;
|
||||
QAction* m_exitAction;
|
||||
|
||||
// Recent files
|
||||
enum { MaxRecentFiles = 5 };
|
||||
@@ -157,28 +157,28 @@ private:
|
||||
|
||||
|
||||
// Edit actions
|
||||
QAction* m_editPreferences;
|
||||
QAction* m_newPropertyView;
|
||||
QAction* m_editPreferences;
|
||||
QAction* m_newPropertyView;
|
||||
|
||||
// View actions
|
||||
QAction* m_viewFromNorth;
|
||||
QAction* m_viewFromSouth;
|
||||
QAction* m_viewFromEast;
|
||||
QAction* m_viewFromWest;
|
||||
QAction* m_viewFromAbove;
|
||||
QAction* m_viewFromBelow;
|
||||
QAction* m_zoomAll;
|
||||
QAction* m_viewFromNorth;
|
||||
QAction* m_viewFromSouth;
|
||||
QAction* m_viewFromEast;
|
||||
QAction* m_viewFromWest;
|
||||
QAction* m_viewFromAbove;
|
||||
QAction* m_viewFromBelow;
|
||||
QAction* m_zoomAll;
|
||||
|
||||
// Mock actions
|
||||
QAction* m_mockModelAction;
|
||||
QAction* m_mockResultsModelAction;
|
||||
QAction* m_mockLargeResultsModelAction;
|
||||
QAction* m_mockModelCustomizedAction;
|
||||
QAction* m_mockInputModelAction;
|
||||
QAction* m_mockModelAction;
|
||||
QAction* m_mockResultsModelAction;
|
||||
QAction* m_mockLargeResultsModelAction;
|
||||
QAction* m_mockModelCustomizedAction;
|
||||
QAction* m_mockInputModelAction;
|
||||
|
||||
QAction* m_snapshotToFile;
|
||||
QAction* m_snapshotToClipboard;
|
||||
QAction* m_snapshotAllViewsToFile;
|
||||
QAction* m_snapshotToFile;
|
||||
QAction* m_snapshotToClipboard;
|
||||
QAction* m_snapshotAllViewsToFile;
|
||||
|
||||
QAction* m_createCommandObject;
|
||||
QAction* m_showRegressionTestDialog;
|
||||
@@ -276,7 +276,7 @@ private slots:
|
||||
|
||||
void slotSubWindowActivated(QMdiSubWindow* subWindow);
|
||||
|
||||
void selectedObjectsChanged();
|
||||
void selectedObjectsChanged();
|
||||
void customMenuRequested(const QPoint& pos);
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ private slots:
|
||||
public:
|
||||
void setPdmRoot(caf::PdmObject* pdmRoot);
|
||||
private:
|
||||
caf::PdmUiTreeView* m_projectTreeView;
|
||||
caf::PdmUiTreeView* m_projectTreeView;
|
||||
|
||||
caf::PdmUiDragDropInterface* m_dragDropInterface;
|
||||
|
||||
|
@@ -60,25 +60,25 @@ RiuProjectAndPropertyView::RiuProjectAndPropertyView(QWidget* parent, Qt::Window
|
||||
|
||||
connect(m_projectTreeView, SIGNAL(selectedObjectChanged(caf::PdmObjectHandle*)), m_propertyView, SLOT(showProperties(caf::PdmObjectHandle*)));
|
||||
|
||||
QWidget* propertyEditorWithHeader = new QWidget;
|
||||
{
|
||||
QLabel* propertyHeader = new QLabel;
|
||||
propertyHeader->setText("Property Editor");
|
||||
propertyHeader->setStyleSheet("QLabel { background-color: #CCCCCC }");
|
||||
propertyHeader->setFixedHeight(20);
|
||||
QWidget* propertyEditorWithHeader = new QWidget;
|
||||
{
|
||||
QLabel* propertyHeader = new QLabel;
|
||||
propertyHeader->setText("Property Editor");
|
||||
propertyHeader->setStyleSheet("QLabel { background-color: #CCCCCC }");
|
||||
propertyHeader->setFixedHeight(20);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(propertyHeader);
|
||||
layout->addWidget(m_propertyView);
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(propertyHeader);
|
||||
layout->addWidget(m_propertyView);
|
||||
|
||||
propertyEditorWithHeader->setLayout(layout);
|
||||
propertyEditorWithHeader->setMinimumHeight(150);
|
||||
}
|
||||
propertyEditorWithHeader->setLayout(layout);
|
||||
propertyEditorWithHeader->setMinimumHeight(150);
|
||||
}
|
||||
|
||||
QSplitter* splitter = new QSplitter(Qt::Vertical);
|
||||
splitter->addWidget(m_projectTreeView);
|
||||
splitter->addWidget(propertyEditorWithHeader);
|
||||
splitter->addWidget(propertyEditorWithHeader);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
|
@@ -38,16 +38,16 @@
|
||||
RiuResultInfoPanel::RiuResultInfoPanel(QDockWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_textEdit = new QTextEdit(this);
|
||||
m_textEdit->setReadOnly(true);
|
||||
m_textEdit->setLineWrapMode(QTextEdit::NoWrap);
|
||||
m_textEdit = new QTextEdit(this);
|
||||
m_textEdit->setReadOnly(true);
|
||||
m_textEdit->setLineWrapMode(QTextEdit::NoWrap);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->addWidget(m_textEdit);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->addWidget(m_textEdit);
|
||||
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
setLayout(layout);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ void RiuResultInfoPanel::setInfo(const QString& info)
|
||||
{
|
||||
QString tmp(info);
|
||||
|
||||
convertStringToHTML(&tmp);
|
||||
convertStringToHTML(&tmp);
|
||||
|
||||
m_textEdit->setText(info);
|
||||
m_textEdit->setText(info);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ void RiuResultInfoPanel::setInfo(const QString& info)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuResultInfoPanel::convertStringToHTML(QString* str)
|
||||
{
|
||||
str->replace("\n", "<br>");
|
||||
str->replace(" ", " ");
|
||||
str->replace("\n", "<br>");
|
||||
str->replace(" ", " ");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -32,19 +32,19 @@ class QTextEdit;
|
||||
//==================================================================================================
|
||||
class RiuResultInfoPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuResultInfoPanel(QDockWidget* parent);
|
||||
RiuResultInfoPanel(QDockWidget* parent);
|
||||
|
||||
void setInfo(const QString& info);
|
||||
void setInfo(const QString& info);
|
||||
|
||||
virtual QSize sizeHint () const;
|
||||
virtual QSize sizeHint () const;
|
||||
|
||||
private:
|
||||
static void convertStringToHTML(QString* str);
|
||||
static void convertStringToHTML(QString* str);
|
||||
|
||||
private:
|
||||
QTextEdit* m_textEdit;
|
||||
QTextEdit* m_textEdit;
|
||||
};
|
||||
|
||||
|
@@ -42,9 +42,9 @@ RiuResultTextBuilder::RiuResultTextBuilder(RimEclipseView* reservoirView, size_t
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
m_reservoirView = reservoirView;
|
||||
m_gridIndex = gridIndex;
|
||||
m_cellIndex = cellIndex;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
m_gridIndex = gridIndex;
|
||||
m_cellIndex = cellIndex;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
|
||||
m_nncIndex = cvf::UNDEFINED_SIZE_T;
|
||||
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
|
||||
@@ -122,7 +122,7 @@ QString RiuResultTextBuilder::mainResultText()
|
||||
appendDetails(text, wellResultText());
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -176,22 +176,22 @@ QString RiuResultTextBuilder::topologyText(QString itemSeparator)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuResultTextBuilder::gridResultDetails()
|
||||
{
|
||||
QString text;
|
||||
QString text;
|
||||
|
||||
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||
{
|
||||
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||
{
|
||||
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
||||
|
||||
if (!text.isEmpty())
|
||||
{
|
||||
text.prepend("-- Grid cell result details --\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -199,33 +199,33 @@ QString RiuResultTextBuilder::gridResultDetails()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuResultTextBuilder::faultResultDetails()
|
||||
{
|
||||
QString text;
|
||||
QString text;
|
||||
|
||||
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||
{
|
||||
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||
RigMainGrid* mainGrid = grid->mainGrid();
|
||||
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||
{
|
||||
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||
RigMainGrid* mainGrid = grid->mainGrid();
|
||||
|
||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(m_cellIndex, m_face);
|
||||
if (fault)
|
||||
{
|
||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(m_cellIndex, m_face);
|
||||
if (fault)
|
||||
{
|
||||
text += "-- Fault result details --\n";
|
||||
|
||||
text += QString("Fault Name: %1\n").arg(fault->name());
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceHelper(m_face);
|
||||
text += "Fault Face : " + faceHelper.text() + "\n";
|
||||
cvf::StructGridInterface::FaceEnum faceHelper(m_face);
|
||||
text += "Fault Face : " + faceHelper.text() + "\n";
|
||||
|
||||
if (m_reservoirView->faultResultSettings()->hasValidCustomResult())
|
||||
{
|
||||
text += "Fault result data:\n";
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->currentFaultResultColors(), &text);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_reservoirView->faultResultSettings()->hasValidCustomResult())
|
||||
{
|
||||
text += "Fault result data:\n";
|
||||
this->appendTextFromResultColors(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->currentFaultResultColors(), &text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ QString RiuResultTextBuilder::gridResultText()
|
||||
{
|
||||
QString text = cellResultText(m_reservoirView->cellResult());
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ QString RiuResultTextBuilder::faultResultText()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuResultTextBuilder::nncResultText()
|
||||
{
|
||||
QString text;
|
||||
QString text;
|
||||
|
||||
if (m_nncIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ QString RiuResultTextBuilder::nncResultText()
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -316,143 +316,143 @@ QString RiuResultTextBuilder::nncResultText()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuResultTextBuilder::appendTextFromResultColors(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimEclipseCellColors* resultColors, QString* resultInfoText)
|
||||
{
|
||||
if (!resultColors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!resultColors)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel());
|
||||
if (resultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RimReservoirCellResultsStorage* gridCellResults = resultColors->currentGridCellResults();
|
||||
if (gridCellResults)
|
||||
{
|
||||
size_t soilScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel());
|
||||
if (resultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RimReservoirCellResultsStorage* gridCellResults = resultColors->currentGridCellResults();
|
||||
if (gridCellResults)
|
||||
{
|
||||
size_t soilScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, soilScalarSetIndex);
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, sgasScalarSetIndex);
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, swatScalarSetIndex);
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, soilScalarSetIndex);
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, sgasScalarSetIndex);
|
||||
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, swatScalarSetIndex);
|
||||
|
||||
double scalarValue = 0.0;
|
||||
double scalarValue = 0.0;
|
||||
|
||||
if (dataAccessObjectX.notNull()) scalarValue = dataAccessObjectX->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SOIL : %1\n").arg(scalarValue));
|
||||
if (dataAccessObjectX.notNull()) scalarValue = dataAccessObjectX->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SOIL : %1\n").arg(scalarValue));
|
||||
|
||||
if (dataAccessObjectY.notNull()) scalarValue = dataAccessObjectY->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SGAS : %1\n").arg(scalarValue));
|
||||
if (dataAccessObjectY.notNull()) scalarValue = dataAccessObjectY->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SGAS : %1\n").arg(scalarValue));
|
||||
|
||||
if (dataAccessObjectZ.notNull()) scalarValue = dataAccessObjectZ->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SWAT : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->hasResult())
|
||||
{
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor;
|
||||
if (dataAccessObjectZ.notNull()) scalarValue = dataAccessObjectZ->cellScalar(cellIndex);
|
||||
else scalarValue = 0.0;
|
||||
resultInfoText->append(QString("SWAT : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->hasResult())
|
||||
{
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor;
|
||||
|
||||
if (resultColors->hasStaticResult())
|
||||
{
|
||||
if (resultColors->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedTransmissibilityResultName());
|
||||
{
|
||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("Tran X : %1\n").arg(scalarValue));
|
||||
if (resultColors->hasStaticResult())
|
||||
{
|
||||
if (resultColors->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedTransmissibilityResultName());
|
||||
{
|
||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("Tran X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("Tran Y : %1\n").arg(scalarValue));
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("Tran Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("Tran Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> multResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedMultResultName());
|
||||
{
|
||||
double scalarValue = 0.0;
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("Tran Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> multResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedMultResultName());
|
||||
{
|
||||
double scalarValue = 0.0;
|
||||
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("MULTX : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_I);
|
||||
resultInfoText->append(QString("MULTX- : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("MULTX : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_I);
|
||||
resultInfoText->append(QString("MULTX- : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("MULTY : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_J);
|
||||
resultInfoText->append(QString("MULTY- : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("MULTY : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_J);
|
||||
resultInfoText->append(QString("MULTY- : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("MULTZ : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_K);
|
||||
resultInfoText->append(QString("MULTZ- : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiTranResultName());
|
||||
{
|
||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riTran X : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("MULTZ : %1\n").arg(scalarValue));
|
||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_K);
|
||||
resultInfoText->append(QString("MULTZ- : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiTranResultName());
|
||||
{
|
||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riTran X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riTran Y : %1\n").arg(scalarValue));
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riTran Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riTran Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiMultResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riMult X : %1\n").arg(scalarValue));
|
||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riTran Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiMultResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riMult X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riMult Y : %1\n").arg(scalarValue));
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riMult Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riMult Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiAreaNormTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiAreaNormTranResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riTransByArea X : %1\n").arg(scalarValue));
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riMult Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultColors->resultVariable().compare(RimDefines::combinedRiAreaNormTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiAreaNormTranResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riTransByArea X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riTransByArea Y : %1\n").arg(scalarValue));
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riTransByArea Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riTransByArea Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultColors->scalarResultIndex());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultColors->scalarResultIndex());
|
||||
}
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riTransByArea Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultColors->scalarResultIndex());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultColors->scalarResultIndex());
|
||||
}
|
||||
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
||||
resultInfoText->append("Cell result : ");
|
||||
resultInfoText->append(resultColors->resultVariable());
|
||||
resultInfoText->append(QString(" : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
resultInfoText->append(QString(" : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -460,32 +460,32 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigCaseData* eclipseCase,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuResultTextBuilder::cellEdgeResultDetails()
|
||||
{
|
||||
QString text;
|
||||
QString text;
|
||||
|
||||
if (m_reservoirView->cellEdgeResult()->hasResult())
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
QStringList resultNames;
|
||||
m_reservoirView->cellEdgeResult()->gridScalarIndices(resultIndices);
|
||||
m_reservoirView->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
||||
if (m_reservoirView->cellEdgeResult()->hasResult())
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
QStringList resultNames;
|
||||
m_reservoirView->cellEdgeResult()->gridScalarIndices(resultIndices);
|
||||
m_reservoirView->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
||||
|
||||
text += "-- Cell edge result data --\n";
|
||||
for (int idx = 0; idx < 6; idx++)
|
||||
{
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
text += "-- Cell edge result data --\n";
|
||||
for (int idx = 0; idx < 6; idx++)
|
||||
{
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
// Cell edge results are static, results are loaded for first time step only
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, 0, resultIndices[idx]);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
|
||||
text.append(QString("%1 : %2\n").arg(resultNames[idx]).arg(scalarValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cell edge results are static, results are loaded for first time step only
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, 0, resultIndices[idx]);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
|
||||
text.append(QString("%1 : %2\n").arg(resultNames[idx]).arg(scalarValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -30,7 +30,7 @@ class QString;
|
||||
class RigCaseData;
|
||||
|
||||
namespace cvf {
|
||||
class Part;
|
||||
class Part;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -40,15 +40,15 @@ namespace cvf {
|
||||
class RiuResultTextBuilder
|
||||
{
|
||||
public:
|
||||
RiuResultTextBuilder(RimEclipseView* reservoirView, size_t gridIndex, size_t cellIndex, size_t timeStepIndex);
|
||||
RiuResultTextBuilder(RimEclipseView* reservoirView, size_t gridIndex, size_t cellIndex, size_t timeStepIndex);
|
||||
void setFace(cvf::StructGridInterface::FaceType face);
|
||||
void setNncIndex(size_t nncIndex);
|
||||
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
|
||||
|
||||
QString mainResultText();
|
||||
|
||||
QString topologyText(QString itemSeparator);
|
||||
|
||||
QString topologyText(QString itemSeparator);
|
||||
|
||||
private:
|
||||
void appendDetails(QString& text, const QString& details);
|
||||
|
||||
@@ -64,18 +64,18 @@ private:
|
||||
|
||||
QString cellResultText(RimEclipseCellColors* resultColors);
|
||||
|
||||
void appendTextFromResultColors(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimEclipseCellColors* resultColors, QString* resultInfoText);
|
||||
void appendTextFromResultColors(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimEclipseCellColors* resultColors, QString* resultInfoText);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
size_t m_timeStepIndex;
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
size_t m_timeStepIndex;
|
||||
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
|
||||
size_t m_nncIndex;
|
||||
|
||||
cvf::Vec3d m_intersectionPoint;
|
||||
cvf::Vec3d m_intersectionPoint;
|
||||
};
|
||||
|
@@ -344,7 +344,7 @@ void RiuViewerCommands::slotHideFault()
|
||||
RimFault* rimFault = eclipseView->faultCollection()->findFaultByName(faultName);
|
||||
if (rimFault)
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = rimFault->showFault.uiCapability();
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = rimFault->showFault.uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
uiFieldHandle->setValueFromUi(!rimFault->showFault);
|
||||
|
@@ -875,7 +875,7 @@ void WellSelectionPage::buildWellTreeView()
|
||||
caf::PdmObjectCollection* fieldGroup = new caf::PdmObjectCollection;
|
||||
fieldGroup->objects.uiCapability()->setUiHidden(true);
|
||||
|
||||
fieldGroup->setUiName(oilField->userDescriptionField()->uiCapability()->uiValue().toString());
|
||||
fieldGroup->setUiName(oilField->userDescriptionField()->uiCapability()->uiValue().toString());
|
||||
|
||||
regGroup->objects.push_back(fieldGroup);
|
||||
|
||||
|
Reference in New Issue
Block a user