mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 15:41:00 -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
@@ -1,6 +1,10 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaKeyValueStore.h)
|
||||
set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaKeyValueStore.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaKeyValueStoreUtil.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES)
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaKeyValueStoreUtil.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "RiaKeyValueStoreUtil.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<float> RiaKeyValueStoreUtil::convertToFloatVector( const std::optional<std::vector<char>>& inputVector )
|
||||
{
|
||||
if ( !inputVector || inputVector->empty() ) return {};
|
||||
|
||||
// Ensure the byte vector size is a multiple of sizeof(float)
|
||||
if ( inputVector->size() % sizeof( float ) != 0 ) return {};
|
||||
|
||||
// Calculate how many floats we'll have
|
||||
size_t numFloats = inputVector->size() / sizeof( float );
|
||||
|
||||
// Create a vector of floats with the appropriate size
|
||||
std::vector<float> floatVector( numFloats );
|
||||
|
||||
// Copy the binary data from the byte vector to the float vector
|
||||
std::memcpy( floatVector.data(), inputVector->data(), inputVector->size() );
|
||||
|
||||
return floatVector;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaKeyValueStoreUtil
|
||||
{
|
||||
public:
|
||||
static std::vector<float> convertToFloatVector( const std::optional<std::vector<char>>& input );
|
||||
};
|
||||
Reference in new issue
Block a user