Skip to content
Snippets Groups Projects
Commit 072d9fc4 authored by Max Piletski's avatar Max Piletski
Browse files

Added support to count coordinates using Bin Grid

 - New Env variable to count polygon outline coordinates using bin grid
 - Small interface changes
parent 71155dca
No related branches found
No related tags found
2 merge requests!344Merge slb-master feature branch with master branch,!298Added support to calculate coordinates using Bin Grid
Pipeline #206144 failed
......@@ -18,6 +18,7 @@ limitations under the License.
#include "../ComputePolygonPlugin/ComputePolygonInterface.h"
#include "../SegyIndex/SegyIndex.h"
#include "../Utilities/BinGrid.h"
#include <openzgy/api.h>
#include "../segysdk_details/DLL_EXPORT.h"
......@@ -26,6 +27,7 @@ limitations under the License.
using namespace segysdk::compute_polygon;
using namespace segysdk::segyindex;
using namespace segysdk::utilities;
using namespace OpenZGY;
/**
......@@ -43,7 +45,7 @@ extern "C" {
* @return a pointer to the just created and initialized ComputePolygonInteraface object instance on success, NULL otherwise
*
**/
SEGYSDK_DLL_PUBLIC ComputePolygonInterface* ComputePolygonSegy(SegyIndex* index);
SEGYSDK_DLL_PUBLIC ComputePolygonInterface* ComputePolygonSegy(SegyIndex* index, BinGrid* grid);
/**
* @brief Creates instance of ComputePolygonInterface and computes Polygons for ZGY file using ZGY reader object.
......
......@@ -36,10 +36,10 @@ ComputePolygonPlugin::~ComputePolygonPlugin()
}
Json::Value
ComputePolygonPlugin::computeForSegy(std::shared_ptr<segysdk::segyindex::SegyIndex> index, bool& isMultiple)
ComputePolygonPlugin::computeForSegy(std::shared_ptr<segysdk::segyindex::SegyIndex> index, std::shared_ptr<segysdk::utilities::BinGrid> grid, bool& isMultiple)
{
SEGYLOG_INFO("Start of Polygon Computation");
auto pInterface = ComputePolySegyFn_(index.get());
auto pInterface = ComputePolySegyFn_(index.get(), grid.get());
if (pInterface == nullptr) {
// @TODO: better to update for more error messages from library
throw ComputePolygonPluginException("Could not initialize Compute Polygon instance");
......
......@@ -19,6 +19,7 @@ limitations under the License.
#include "../ComputePolygonPlugin/ComputePolygonInterface.h"
#include "../LibraryLoader/DynamicLibraryLoader.h"
#include "../SegyIndex/SegyIndex.h"
#include "../Utilities/BinGrid.h"
#include <openzgy/api.h>
#include "../segysdk_details/DLL_EXPORT.h"
......@@ -36,7 +37,7 @@ public:
~ComputePolygonPlugin();
Json::Value computeForSegy(std::shared_ptr<segysdk::segyindex::SegyIndex> index, bool& isMultiple);
Json::Value computeForSegy(std::shared_ptr<segysdk::segyindex::SegyIndex> index, std::shared_ptr<segysdk::utilities::BinGrid> grid, bool& isMultiple);
Json::Value computeForZgy(std::shared_ptr<OpenZGY::IZgyReader> reader, bool& isMultiple);
......@@ -44,7 +45,7 @@ private:
bool InitFunctionPointers();
private:
typedef ComputePolygonInterface* (*ComputePolygonSegy_t)(segysdk::segyindex::SegyIndex* index);
typedef ComputePolygonInterface* (*ComputePolygonSegy_t)(segysdk::segyindex::SegyIndex* index, segysdk::utilities::BinGrid* grid);
typedef ComputePolygonInterface* (*ComputePolygonZgy_t)(OpenZGY::IZgyReader* reader);
typedef void (*DestroyPolygon_t) (ComputePolygonInterface*);
......
......@@ -307,6 +307,12 @@ Environment::overwritePolygonOutline() const
return getIntEnv(EnvironmentVariableStringConsts::OVERWRITE_POLYGON_OUTLINE, 0) > 0;
}
bool
Environment::useBinGridForComputePolygonOutline() const
{
return getIntEnv(EnvironmentVariableStringConsts::USE_BIN_GRID_FOR_COMPUTE_POLYGON_OUTLINE, 0) > 0;
}
std::string
Environment::outputPathRaw1() const
{
......
......@@ -89,6 +89,7 @@ public:
bool computePolygonOutline() const;
bool overwritePolygonOutline() const;
bool useBinGridForComputePolygonOutline() const;
private:
static std::shared_ptr<Environment> instance_;
......
......@@ -67,6 +67,7 @@ public:
inline static const std::string COMPUTE_POLYGON_OUTLINE = "COMPUTE_POLYGON_OUTLINE";
inline static const std::string OVERWRITE_POLYGON_OUTLINE = "OVERWRITE_POLYGON_OUTLINE";
inline static const std::string USE_BIN_GRID_FOR_COMPUTE_POLYGON_OUTLINE = "USE_BIN_GRID_FOR_COMPUTE_POLYGON_OUTLINE";
// Variables to control OpenZGY iocontext/Memory requirements
inline static const std::string SEGYTOZGY_IOCONTXT_BUFFER_SIZE = "SEGYTOZGY_IOCONTXT_BUFFER_SIZE";
......
......@@ -628,7 +628,7 @@ segy_dummy_reference_keeping_function(SegySession* session, segy_api_error* erro
auto loader = std::make_unique<segysdk::library_loader::DynamicLibraryLoader>("");
segysdk::compute_polygon::ComputePolygonPlugin p(std::move(loader));
bool isMultiple = false;
p.computeForSegy(boo1, isMultiple);
p.computeForSegy(boo1, nullptr, isMultiple);
}
{
......
......@@ -21,6 +21,7 @@ limitations under the License.
#include "../Logger/Logger.h"
#include "../Utilities/Authorization.h"
#include "../Utilities/Environment.h"
#include "../Utilities/JsonBinGrid.h"
#include "../Utilities/osdu/OsduObject.h"
#include "../Utilities/osdu/OsduSeismicTraceData100.h"
#include "../Utilities/osdu/OsduWorkProduct100.h"
......@@ -61,10 +62,21 @@ SeismicTraceDataUtilities::savePolygonOutlineToSeismicTraceData(const std::share
SEGYLOG_DEBUG("Seismic Trace Data has already LivePolygons computed. No overwrite specified");
return;
}
std::shared_ptr<segysdk::utilities::BinGrid> grid = nullptr;
if (segysdk::utilities::Environment::instance().useBinGridForComputePolygonOutline()) {
auto binGridId = seismicTraceData.binGridId();
if (binGridId.empty()) {
std::string errorMsg = "Bin Grid could not be empty";
SEGYLOG_ERROR(errorMsg);
return;
}
const auto binGridContent = storageSvcClient_.getRecord(binGridId);
grid = std::make_shared<segysdk::utilities::BinGrid>(segysdk::utilities::JsonBinGrid::loadBinGridFromContent(binGridContent));
}
auto libraryLoader = std::make_unique<segysdk::library_loader::DynamicLibraryLoader>(pluginPath_);
segysdk::compute_polygon::ComputePolygonPlugin polygonPlugin(std::move(libraryLoader));
bool isMultiple = false;
auto jsonPolys = polygonPlugin.computeForSegy(index, isMultiple);
auto jsonPolys = polygonPlugin.computeForSegy(index, grid, isMultiple);
seismicTraceData.addLiveTraceOutline(jsonPolys, isMultiple);
storageSvcClient_.storeRecord(seismicTraceData.content());
......
......@@ -202,7 +202,8 @@ createPolygonOutlines(const std::shared_ptr<segysdk::segyindex::SegyIndex>& inde
auto libraryLoader = std::make_unique<segysdk::library_loader::DynamicLibraryLoader>(pluginPath.string());
segysdk::compute_polygon::ComputePolygonPlugin polygonPlugin(std::move(libraryLoader));
bool isMultiple = false;
auto jsonPolys = polygonPlugin.computeForSegy(index, isMultiple);
auto binGrid = std::make_shared<segysdk::utilities::BinGrid>(options->binGrid());
auto jsonPolys = polygonPlugin.computeForSegy(index, binGrid, isMultiple);
SEGYLOG_INFO("Computed Polygons:");
SEGYLOG_INFO(jsonPolys.toStyledString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment