mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
#12459 Add regular surface domain object.
This commit is contained in:
1 parent
b9ac1bc0c5
commit
1a55fa11c3
23 files changed
+1143
-31
No files matched your search
@@ -19,6 +19,7 @@
|
||||
#include "RimcProject.h"
|
||||
|
||||
#include "Ensemble/RiaEnsembleImportTools.h"
|
||||
#include "KeyValueStore/RiaKeyValueStoreUtil.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
@@ -271,34 +272,9 @@ std::expected<caf::PdmObjectHandle*, QString> RimProject_createGridFromKeyValues
|
||||
|
||||
auto keyValueStore = RiaApplication::instance()->keyValueStore();
|
||||
|
||||
auto convertToFloatVector = []( const std::optional<std::vector<char>>& input ) -> std::vector<float>
|
||||
{
|
||||
if ( input && !input->empty() )
|
||||
{
|
||||
// Ensure the byte vector size is a multiple of sizeof(float)
|
||||
if ( input->size() % sizeof( float ) != 0 )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// Calculate how many floats we'll have
|
||||
size_t float_count = input->size() / sizeof( float );
|
||||
|
||||
// Create a vector of floats with the appropriate size
|
||||
std::vector<float> float_vec( float_count );
|
||||
|
||||
// Copy the binary data from the byte vector to the float vector
|
||||
std::memcpy( float_vec.data(), input->data(), input->size() );
|
||||
|
||||
return float_vec;
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
std::vector<float> coord = convertToFloatVector( keyValueStore->get( m_coordKey().toStdString() ) );
|
||||
std::vector<float> zcorn = convertToFloatVector( keyValueStore->get( m_zcornKey().toStdString() ) );
|
||||
std::vector<float> actnum = convertToFloatVector( keyValueStore->get( m_actnumKey().toStdString() ) );
|
||||
std::vector<float> coord = RiaKeyValueStoreUtil::convertToFloatVector( keyValueStore->get( m_coordKey().toStdString() ) );
|
||||
std::vector<float> zcorn = RiaKeyValueStoreUtil::convertToFloatVector( keyValueStore->get( m_zcornKey().toStdString() ) );
|
||||
std::vector<float> actnum = RiaKeyValueStoreUtil::convertToFloatVector( keyValueStore->get( m_actnumKey().toStdString() ) );
|
||||
if ( coord.empty() || zcorn.empty() || actnum.empty() )
|
||||
{
|
||||
return std::unexpected( "Found unexcepted empty coord, zcorn or actnum array." );
|
||||
|
||||
Reference in new issue
Block a user