mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Removed the obsolete code from odb reader etc.
This commit is contained in:
parent
406379e544
commit
b99b334fc8
@ -54,11 +54,8 @@ public:
|
|||||||
virtual std::map<std::string, std::vector<std::string> > scalarElementNodeFieldAndComponentNames() = 0;
|
virtual std::map<std::string, std::vector<std::string> > scalarElementNodeFieldAndComponentNames() = 0;
|
||||||
virtual std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldAndComponentNames() = 0;
|
virtual std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldAndComponentNames() = 0;
|
||||||
|
|
||||||
virtual void readScalarNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues) = 0;
|
|
||||||
virtual void readScalarElementNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues) = 0;
|
|
||||||
virtual void readScalarIntegrationPointField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues) = 0;
|
|
||||||
virtual void readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements) = 0;
|
virtual void readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements) = 0;
|
||||||
|
|
||||||
virtual void readNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
virtual void readNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
||||||
virtual void readElementNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
virtual void readElementNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
||||||
virtual void readIntegrationPointField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
virtual void readIntegrationPointField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues) = 0;
|
||||||
|
@ -607,48 +607,6 @@ odb_Instance* RifOdbReader::instance(int instanceIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
const odb_SequenceFieldBulkData& RifOdbReader::fieldBulkData(const std::string& fieldName, ResultPosition position, odb_Instance* instance, const odb_Frame& frame)
|
|
||||||
{
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
const odb_FieldOutput& fieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*instance);
|
|
||||||
CVF_ASSERT(false); // This stuff must be fixed for linux
|
|
||||||
#if 0
|
|
||||||
=======
|
|
||||||
const odb_FieldOutput& mainFieldOutput = frame.fieldOutputs()[fieldName.c_str()].getSubset(*instance);
|
|
||||||
|
|
||||||
>>>>>>> Results are now loaded pr field, and not pr component
|
|
||||||
switch (position)
|
|
||||||
{
|
|
||||||
case NODAL:
|
|
||||||
return mainFieldOutput.getSubset(odb_Enum::NODAL).bulkDataBlocks();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ELEMENT_NODAL:
|
|
||||||
return mainFieldOutput.getSubset(odb_Enum::ELEMENT_NODAL).bulkDataBlocks();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INTEGRATION_POINT:
|
|
||||||
return mainFieldOutput.getSubset(odb_Enum::INTEGRATION_POINT).bulkDataBlocks();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
CVF_ASSERT(false);
|
|
||||||
return mainFieldOutput.getSubset(odb_Enum::NODAL).bulkDataBlocks();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
<<<<<<< HEAD
|
|
||||||
#endif
|
|
||||||
return fieldOutput.bulkDataBlocks();
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> Results are now loaded pr field, and not pr component
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Get the number of result items (== #nodes or #elements)
|
/// Get the number of result items (== #nodes or #elements)
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -749,180 +707,6 @@ std::map<std::string, std::vector<std::string> > RifOdbReader::fieldAndComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RifOdbReader::readScalarNodeField(const std::string& fieldName, const std::string& componentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(resultValues);
|
|
||||||
|
|
||||||
odb_Instance* partInstance = instance(partIndex);
|
|
||||||
CVF_ASSERT(partInstance != NULL);
|
|
||||||
|
|
||||||
std::map<int, int>& nodeIdToIdxMap = m_nodeIdToIdxMaps[partIndex];
|
|
||||||
size_t dataSize = nodeIdToIdxMap.size();
|
|
||||||
CVF_ASSERT(dataSize > 0);
|
|
||||||
|
|
||||||
int compIndex = componentIndex(RifOdbResultKey(NODAL, fieldName), componentName);
|
|
||||||
|
|
||||||
if (compIndex < 0) return;
|
|
||||||
|
|
||||||
resultValues->resize(dataSize);
|
|
||||||
resultValues->assign(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_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::NODAL);
|
|
||||||
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];
|
|
||||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
|
||||||
|
|
||||||
int numNodes = bulkData.length();
|
|
||||||
int numComp = bulkData.width();
|
|
||||||
int* nodeLabels = bulkData.nodeLabels();
|
|
||||||
float* data = bulkDataGetter.data();
|
|
||||||
|
|
||||||
for (int i = 0; i < numNodes; i++)
|
|
||||||
{
|
|
||||||
(*resultValues)[nodeIdToIdxMap[nodeLabels[i]]] = data[i*numComp + compIndex];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RifOdbReader::readScalarElementNodeField(const std::string& fieldName, const std::string& componentName,
|
|
||||||
int partIndex, int stepIndex, int frameIndex,
|
|
||||||
std::vector<float>* resultValues)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(resultValues);
|
|
||||||
|
|
||||||
odb_Instance* partInstance = instance(partIndex);
|
|
||||||
CVF_ASSERT(partInstance != NULL);
|
|
||||||
|
|
||||||
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
|
|
||||||
CVF_ASSERT(elementIdToIdxMap.size() > 0);
|
|
||||||
|
|
||||||
int compIndex = componentIndex(RifOdbResultKey(ELEMENT_NODAL, fieldName), componentName);
|
|
||||||
if (compIndex < 0) return;
|
|
||||||
|
|
||||||
size_t dataSize = resultItemCount(fieldName, partIndex, stepIndex, frameIndex);
|
|
||||||
if (dataSize > 0)
|
|
||||||
{
|
|
||||||
resultValues->resize(dataSize);
|
|
||||||
resultValues->assign(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_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::ELEMENT_NODAL);
|
|
||||||
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];
|
|
||||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
|
||||||
|
|
||||||
int numValues = bulkData.length();
|
|
||||||
int numComp = bulkData.width();
|
|
||||||
int elemCount = bulkData.numberOfElements();
|
|
||||||
int elemNodeCount = numValues/elemCount;
|
|
||||||
int* elementLabels = bulkData.elementLabels();
|
|
||||||
float* data = bulkDataGetter.data();
|
|
||||||
|
|
||||||
for (int elem = 0; elem < elemCount; elem++)
|
|
||||||
{
|
|
||||||
int elementIdx = elementIdToIdxMap[elementLabels[elem*elemNodeCount]];
|
|
||||||
int elementResultStartDestIdx = elementIdx*elemNodeCount; // Ikke generellt riktig !
|
|
||||||
int elementResultStartSourceIdx = elem*elemNodeCount*numComp;
|
|
||||||
|
|
||||||
for (int elemNode = 0; elemNode < elemNodeCount; elemNode++)
|
|
||||||
{
|
|
||||||
int destIdx = elementResultStartDestIdx + elemNode;
|
|
||||||
int srcIdx = elementResultStartSourceIdx + elemNode*numComp + compIndex;
|
|
||||||
(*resultValues)[destIdx] = data[srcIdx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RifOdbReader::readScalarIntegrationPointField( const std::string& fieldName, const std::string& componentName,
|
|
||||||
int partIndex, int stepIndex, int frameIndex,
|
|
||||||
std::vector<float>* resultValues)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(resultValues);
|
|
||||||
|
|
||||||
odb_Instance* partInstance = instance(partIndex);
|
|
||||||
CVF_ASSERT(partInstance != NULL);
|
|
||||||
|
|
||||||
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
|
|
||||||
CVF_ASSERT(elementIdToIdxMap.size() > 0);
|
|
||||||
|
|
||||||
int compIndex = componentIndex(RifOdbResultKey(INTEGRATION_POINT, fieldName), componentName);
|
|
||||||
if (compIndex < 0) return;
|
|
||||||
|
|
||||||
size_t dataSize = resultItemCount(fieldName, partIndex, stepIndex, frameIndex);
|
|
||||||
if (dataSize > 0)
|
|
||||||
{
|
|
||||||
resultValues->resize(dataSize);
|
|
||||||
resultValues->assign(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_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::INTEGRATION_POINT);
|
|
||||||
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];
|
|
||||||
RifOdbBulkDataGetter bulkDataGetter(bulkData);
|
|
||||||
|
|
||||||
int numValues = bulkData.length();
|
|
||||||
int numComp = bulkData.width();
|
|
||||||
int elemCount = bulkData.numberOfElements();
|
|
||||||
int ipCount = numValues/elemCount;
|
|
||||||
int* elementLabels = bulkData.elementLabels();
|
|
||||||
float* data = bulkDataGetter.data();
|
|
||||||
|
|
||||||
RigElementType eType = toRigElementType(bulkData.baseElementType());
|
|
||||||
const int* elmNodeToIpResultMapping = localElmNodeToIntegrationPointMapping(eType);
|
|
||||||
if (!elmNodeToIpResultMapping) continue;
|
|
||||||
|
|
||||||
for (int elem = 0; elem < elemCount; elem++)
|
|
||||||
{
|
|
||||||
int elementIdx = elementIdToIdxMap[elementLabels[elem*ipCount]];
|
|
||||||
int elementResultStartDestIdx = elementIdx*ipCount; // Ikke generellt riktig !
|
|
||||||
int elementResultStartSourceIdx = elem*ipCount*numComp;
|
|
||||||
|
|
||||||
for (int ipIdx = 0; ipIdx < ipCount; ipIdx++)
|
|
||||||
{
|
|
||||||
int resultIpIdx = elmNodeToIpResultMapping[ipIdx];
|
|
||||||
int destIdx = elementResultStartDestIdx + ipIdx;
|
|
||||||
int srcIdx = elementResultStartSourceIdx + resultIpIdx*numComp + compIndex;
|
|
||||||
|
|
||||||
(*resultValues)[destIdx] = data[srcIdx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -53,10 +53,7 @@ public:
|
|||||||
virtual std::map<std::string, std::vector<std::string> > scalarNodeFieldAndComponentNames();
|
virtual std::map<std::string, std::vector<std::string> > scalarNodeFieldAndComponentNames();
|
||||||
virtual std::map<std::string, std::vector<std::string> > scalarElementNodeFieldAndComponentNames();
|
virtual std::map<std::string, std::vector<std::string> > scalarElementNodeFieldAndComponentNames();
|
||||||
virtual std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldAndComponentNames();
|
virtual std::map<std::string, std::vector<std::string> > scalarIntegrationPointFieldAndComponentNames();
|
||||||
|
|
||||||
virtual void readScalarNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
|
||||||
virtual void readScalarElementNodeField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
|
||||||
virtual void readScalarIntegrationPointField(const std::string& fieldName, const std::string& componmentName, int partIndex, int stepIndex, int frameIndex, std::vector<float>* resultValues);
|
|
||||||
virtual void readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements);
|
virtual void readDisplacements(int partIndex, int stepIndex, int frameIndex, std::vector<cvf::Vec3f>* displacements);
|
||||||
|
|
||||||
virtual void readNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues);
|
virtual void readNodeField(const std::string& fieldName, int partIndex, int stepIndex, int frameIndex, std::vector<std::vector<float>*>* resultValues);
|
||||||
@ -97,7 +94,7 @@ private:
|
|||||||
size_t componentsCount(const std::string& fieldName, ResultPosition position);
|
size_t componentsCount(const std::string& fieldName, ResultPosition position);
|
||||||
const odb_Frame& stepFrame(int stepIndex, int frameIndex) const;
|
const odb_Frame& stepFrame(int stepIndex, int frameIndex) const;
|
||||||
odb_Instance* instance(int instanceIndex);
|
odb_Instance* instance(int instanceIndex);
|
||||||
const odb_SequenceFieldBulkData& fieldBulkData(const std::string& fieldName, ResultPosition position, odb_Instance*, const odb_Frame& frame);
|
|
||||||
int componentIndex(const RifOdbResultKey& result, const std::string& componentName);
|
int componentIndex(const RifOdbResultKey& result, const std::string& componentName);
|
||||||
std::vector<std::string> componentNames(const RifOdbResultKey& result);
|
std::vector<std::string> componentNames(const RifOdbResultKey& result);
|
||||||
std::map< std::string, std::vector<std::string> > fieldAndComponentNames(ResultPosition position);
|
std::map< std::string, std::vector<std::string> > fieldAndComponentNames(ResultPosition position);
|
||||||
@ -105,9 +102,11 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
odb_Odb* m_odb;
|
odb_Odb* m_odb;
|
||||||
|
|
||||||
std::map< RifOdbResultKey, std::vector<std::string> > m_resultsMetaData;
|
std::map< RifOdbResultKey, std::vector<std::string> > m_resultsMetaData;
|
||||||
std::map< int, std::vector<std::string> > m_partElementSetNames;
|
std::map< int, std::vector<std::string> > m_partElementSetNames;
|
||||||
std::vector< std::map<int, int> > m_nodeIdToIdxMaps;
|
std::vector< std::map<int, int> > m_nodeIdToIdxMaps;
|
||||||
std::vector< std::map<int, int> > m_elementIdToIdxMaps;
|
std::vector< std::map<int, int> > m_elementIdToIdxMaps;
|
||||||
static size_t sm_instanceCount;
|
|
||||||
|
static size_t sm_instanceCount;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user