-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresinsight.patch
More file actions
331 lines (301 loc) · 12.4 KB
/
resinsight.patch
File metadata and controls
331 lines (301 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
diff --git a/ApplicationExeCode/RiaMainTools.cpp b/ApplicationExeCode/RiaMainTools.cpp
index c110b1c17..37f7b3cb5 100644
--- a/ApplicationExeCode/RiaMainTools.cpp
+++ b/ApplicationExeCode/RiaMainTools.cpp
@@ -31,28 +31,46 @@
#include <QDir>
-#include <stacktrace>
+#include <sstream>
+
+#if __has_include(<stacktrace>)
+ #include <stacktrace>
+ #define HAVE_STD_STACKTRACE 1
+#else
+ #define HAVE_STD_STACKTRACE 0
+#endif
namespace internal
{
// Custom formatter for stacktrace
-std::string formatStacktrace( const std::stacktrace& st )
+std::string formatStacktrace(
+#if HAVE_STD_STACKTRACE
+ const std::stacktrace& st
+#else
+ const void* /*unused*/
+#endif
+)
{
std::stringstream ss;
+#if HAVE_STD_STACKTRACE
int frame = 0;
for ( const auto& entry : st )
{
ss << " [" << frame++ << "] " << entry.description() << " at " << entry.source_file() << ":"
<< entry.source_line() << "\n";
}
+#else
+ ss << "std::stacktrace is not supported on this compiler\n";
+#endif
return ss.str();
}
+
} // namespace internal
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void manageSegFailure( int signalCode )
+void manageSegFailure(int signalCode)
{
// Executing function here is not safe, but works as expected on Windows. Behavior on Linux is undefined, but will
// work in some cases.
@@ -70,10 +88,14 @@ void manageSegFailure( int signalCode )
fileLogger->error( str.toStdString().data() );
+#if HAVE_STD_STACKTRACE
auto st = std::stacktrace::current();
std::string message = "Stack trace:\n" + internal::formatStacktrace( st );
- logger->error( message.data() );
+#else
+ std::string message = "Stack trace:\nstd::stacktrace is not supported on this compiler\n";
+#endif
+ logger->error(message.data());
fileLogger->flush();
}
}
diff --git a/ApplicationLibCode/FileInterface/RifArrowTools.cpp b/ApplicationLibCode/FileInterface/RifArrowTools.cpp
index b9661c829..f3233a003 100644
--- a/ApplicationLibCode/FileInterface/RifArrowTools.cpp
+++ b/ApplicationLibCode/FileInterface/RifArrowTools.cpp
@@ -34,7 +34,7 @@ QString RifArrowTools::readFirstRowsOfTable( const QByteArray& contents )
// Open Parquet file reader
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
- if ( !parquet::arrow::OpenFile( input, pool, &arrow_reader ).ok() )
+ if ( !parquet::arrow::OpenFile( input, pool ).ok() )
{
return {};
}
diff --git a/ApplicationLibCode/FileInterface/RifOsduWellLogReader.cpp b/ApplicationLibCode/FileInterface/RifOsduWellLogReader.cpp
index 31c98527b..350c4a464 100644
--- a/ApplicationLibCode/FileInterface/RifOsduWellLogReader.cpp
+++ b/ApplicationLibCode/FileInterface/RifOsduWellLogReader.cpp
@@ -46,7 +46,7 @@ std::pair<cvf::ref<RigOsduWellLogData>, QString> RifOsduWellLogReader::readWellL
// Open Parquet file reader
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
- if ( !parquet::arrow::OpenFile( input, pool, &arrow_reader ).ok() )
+ if ( !parquet::arrow::OpenFile( input, pool ).ok() )
{
return { nullptr, "Unable to read parquet data." };
}
diff --git a/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp b/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp
index df8ec4e98..c84760c2d 100644
--- a/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp
+++ b/ApplicationLibCode/FileInterface/RifOsduWellPathReader.cpp
@@ -117,7 +117,7 @@ std::pair<cvf::ref<RigWellPath>, QString> RifOsduWellPathReader::readWellPathDat
// Open Parquet file reader
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
- if ( !parquet::arrow::OpenFile( input, pool, &arrow_reader ).ok() )
+ if ( !parquet::arrow::OpenFile( input, pool ).ok() )
{
return { nullptr, "Unable to read parquet data." };
}
diff --git a/ApplicationLibCode/FileInterface/RifVtkImportUtil.cpp b/ApplicationLibCode/FileInterface/RifVtkImportUtil.cpp
index e16c113d5..39c80ea04 100644
--- a/ApplicationLibCode/FileInterface/RifVtkImportUtil.cpp
+++ b/ApplicationLibCode/FileInterface/RifVtkImportUtil.cpp
@@ -21,7 +21,6 @@
#include "RiaStdStringTools.h"
#include <filesystem>
-#include <spanstream>
#include <sstream>
#include <string>
#include <vector>
@@ -178,46 +177,106 @@ std::vector<RifVtkImportUtil::PvdDataset> RifVtkImportUtil::parsePvdDatasets( co
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-std::vector<cvf::Vec3d> RifVtkImportUtil::parseVec3ds( std::string_view text )
+std::vector<cvf::Vec3d> RifVtkImportUtil::parseVec3ds(std::string_view text)
{
- std::ispanstream iss( text );
-
std::vector<cvf::Vec3d> vecs;
- std::string xStr, yStr, zStr;
- while ( iss >> xStr >> yStr >> zStr )
+ while (!text.empty())
{
+ // Trim leading whitespace
+ while (!text.empty() && std::isspace(static_cast<unsigned char>(text.front())))
+ text.remove_prefix(1);
+
+ // Extract three tokens
+ auto read_token = [&](std::string_view& sv) -> std::string_view {
+ size_t i = 0;
+ while (i < sv.size() && !std::isspace(static_cast<unsigned char>(sv[i])))
+ ++i;
+ std::string_view tok = sv.substr(0, i);
+ sv.remove_prefix(i);
+ return tok;
+ };
+
+ if (text.empty())
+ break;
+
+ auto xs = read_token(text);
+ auto ys = read_token(text);
+ auto zs = read_token(text);
+
double x, y, z;
- if ( !RiaStdStringTools::toDouble( xStr, x ) || !RiaStdStringTools::toDouble( yStr, y ) || !RiaStdStringTools::toDouble( zStr, z ) )
+ if (!RiaStdStringTools::toDouble(xs, x) ||
+ !RiaStdStringTools::toDouble(ys, y) ||
+ !RiaStdStringTools::toDouble(zs, z))
{
return {};
}
- vecs.emplace_back( x, y, z );
+ vecs.emplace_back(x, y, z);
}
return vecs;
}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-std::vector<cvf::Vec3f> RifVtkImportUtil::parseVec3fs( std::string_view text )
+std::vector<cvf::Vec3f> RifVtkImportUtil::parseVec3fs(std::string_view text)
{
- std::ispanstream iss( text );
-
std::vector<cvf::Vec3f> vecs;
- std::string xStr, yStr, zStr;
- while ( iss >> xStr >> yStr >> zStr )
+ auto trim_left = [](std::string_view& sv) {
+ while (!sv.empty() &&
+ std::isspace(static_cast<unsigned char>(sv.front())))
+ {
+ sv.remove_prefix(1);
+ }
+ };
+
+ auto read_token = [&](std::string_view& sv) -> std::string_view {
+ trim_left(sv);
+ if (sv.empty())
+ return {};
+
+ size_t i = 0;
+ while (i < sv.size() &&
+ !std::isspace(static_cast<unsigned char>(sv[i])))
+ {
+ ++i;
+ }
+
+ std::string_view tok = sv.substr(0, i);
+ sv.remove_prefix(i);
+ return tok;
+ };
+
+ while (true)
{
+ trim_left(text);
+ if (text.empty())
+ break;
+
+ std::string_view xs = read_token(text);
+ std::string_view ys = read_token(text);
+ std::string_view zs = read_token(text);
+
+ if (xs.empty() || ys.empty() || zs.empty())
+ break;
+
double x, y, z;
- if ( !RiaStdStringTools::toDouble( xStr, x ) || !RiaStdStringTools::toDouble( yStr, y ) || !RiaStdStringTools::toDouble( zStr, z ) )
+ if (!RiaStdStringTools::toDouble(xs, x) ||
+ !RiaStdStringTools::toDouble(ys, y) ||
+ !RiaStdStringTools::toDouble(zs, z))
{
return {};
}
- vecs.emplace_back( static_cast<float>( x ), static_cast<float>( y ), static_cast<float>( z ) );
+ vecs.emplace_back(
+ static_cast<float>(x),
+ static_cast<float>(y),
+ static_cast<float>(z)
+ );
}
return vecs;
diff --git a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp
index c42126034..9f55b86bc 100644
--- a/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Summary/Sumo/RimSummaryEnsembleSumo.cpp
@@ -161,7 +161,7 @@ std::shared_ptr<arrow::Table> RimSummaryEnsembleSumo::readParquetTable( const QB
std::shared_ptr<arrow::Table> table;
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
- if ( auto openResult = parquet::arrow::OpenFile( input, pool, &arrow_reader ); openResult.ok() )
+ if ( auto openResult = parquet::arrow::OpenFile( input, pool ); openResult.ok() )
{
if ( auto readResult = arrow_reader->ReadTable( &table ); readResult.ok() )
{
@@ -176,7 +176,7 @@ std::shared_ptr<arrow::Table> RimSummaryEnsembleSumo::readParquetTable( const QB
else
{
RiaLogging::warning(
- QString( "Parquet: Not able to open data stream. Message: %1" ).arg( QString::fromStdString( openResult.ToString() ) ) );
+ QString( "Parquet: Not able to open data stream." ));
}
return table;
diff --git a/ApplicationLibCode/UnitTests/RifParquetReader-Test.cpp b/ApplicationLibCode/UnitTests/RifParquetReader-Test.cpp
index 0a88dee51..4e83f5f05 100644
--- a/ApplicationLibCode/UnitTests/RifParquetReader-Test.cpp
+++ b/ApplicationLibCode/UnitTests/RifParquetReader-Test.cpp
@@ -32,7 +32,7 @@ TEST( RifParquetReaderTest, ReadValidFile )
// Open Parquet file reader
std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
- EXPECT_TRUE( parquet::arrow::OpenFile( input, pool, &arrow_reader ).ok() );
+ EXPECT_TRUE( parquet::arrow::OpenFile( input, pool ).ok() );
// Read entire file as a single Arrow table
std::shared_ptr<arrow::Table> table;
diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp
index af2a1579c..f3dca7e0e 100644
--- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp
+++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp
@@ -147,6 +147,9 @@ RiuMainWindow::RiuMainWindow()
createMenus();
createToolBars();
createDockPanels();
+ // Pre-populate the Windows menu so it is not empty on creation. On macOS, the native menu bar
+ // hides empty menus, preventing the aboutToShow signal from ever firing.
+ slotBuildWindowActions();
setAcceptDrops( true );
diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp
index f5b26a49f..52904a825 100644
--- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp
+++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp
@@ -132,6 +132,9 @@ RiuPlotMainWindow::RiuPlotMainWindow()
createMenus();
createToolBars();
createDockPanels();
+ // Pre-populate the Windows menu so it is not empty on creation. On macOS, the native menu bar
+ // hides empty menus, preventing the aboutToShow signal from ever firing.
+ slotBuildWindowActions();
setAcceptDrops( true );
diff --git a/ThirdParty/NRLib/CMakeLists.txt b/ThirdParty/NRLib/CMakeLists.txt
index 858365e8a..f9c700e3e 100644
--- a/ThirdParty/NRLib/CMakeLists.txt
+++ b/ThirdParty/NRLib/CMakeLists.txt
@@ -37,7 +37,7 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/nrlib/well
)
-find_package(Boost REQUIRED filesystem system)
+find_package(Boost REQUIRED filesystem)
target_link_libraries(${PROJECT_NAME}
Boost::filesystem
diff --git a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt
index c9f65024e..ba6829571 100644
--- a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt
+++ b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt
@@ -30,7 +30,7 @@ add_library(custom-opm-flowdiag-app
${project_source_files_complete_path1}
)
-find_package(Boost REQUIRED filesystem system)
+find_package(Boost REQUIRED filesystem)
target_link_libraries(custom-opm-flowdiag-app
resdata