Skip to content

Commit 2c6560a

Browse files
authored
Merge pull request #38841 from mantidproject/revert-38818-ewm9174-scrap-nappy-ornl-next
Revert "Remove napi from NexusClasses - ornl-next"
2 parents 4906536 + b9db08f commit 2c6560a

File tree

17 files changed

+594
-495
lines changed

17 files changed

+594
-495
lines changed

Framework/API/src/FrameworkManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void FrameworkManagerImpl::setGlobalNumericLocaleToC() {
340340
}
341341

342342
/// Silence NeXus output
343-
void FrameworkManagerImpl::disableNexusOutput() { ::NeXus::setError(nullptr, NexusErrorFunction); }
343+
void FrameworkManagerImpl::disableNexusOutput() { NXMSetError(nullptr, NexusErrorFunction); }
344344

345345
/// Starts asynchronous tasks that are done as part of Start-up.
346346
void FrameworkManagerImpl::asynchronousStartupTasks() {

Framework/DataHandling/src/LoadEventNexus.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ using namespace DataObjects;
6060
using Types::Core::DateAndTime;
6161

6262
namespace {
63+
// detnotes the end of iteration for NeXus::getNextEntry
64+
const std::string NULL_STR("NULL");
65+
6366
const std::vector<std::string> binningModeNames{"Default", "Linear", "Logarithmic"};
6467
enum class BinningMode { DEFAULT, LINEAR, LOGARITHMIC, enum_count };
6568
typedef Mantid::Kernel::EnumeratedString<BinningMode, &binningModeNames> BINMODE;
@@ -345,7 +348,7 @@ void LoadEventNexus::setTopEntryName() {
345348
m_top_entry_name = entry.first;
346349
break;
347350
}
348-
} else if (entry == ::NeXus::EOD_ENTRY) {
351+
} else if (entry.first == NULL_STR && entry.second == NULL_STR) {
349352
g_log.error() << "Unable to determine name of top level NXentry - assuming "
350353
"\"entry\".\n";
351354
m_top_entry_name = "entry";

Framework/DataHandling/src/LoadHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ void LoadHelper::fillMovingWorkspace(const API::MatrixWorkspace_sptr &ws, const
497497
const auto useCustomSpectraMap = customDetectorIDs.size() != 0;
498498
const auto useAcceptedDetectorIDs = acceptedDetectorIDs.size() != 0;
499499

500-
std::array<int, 3U> dims = {data.dim0(), data.dim1(), data.dim2()};
500+
std::array dims = {data.dim0(), data.dim1(), data.dim2()};
501501
const auto nTubes = dims[std::get<0>(axisOrder)];
502502
const auto nPixels = dims[std::get<1>(axisOrder)];
503503
const auto nScans = dims[std::get<2>(axisOrder)];

Framework/DataHandling/src/LoadNexus.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ using namespace Kernel;
3737
using namespace API;
3838
using namespace DataObjects;
3939

40+
namespace {
41+
const std::string NULL_STR("NULL");
42+
}
43+
4044
/// Empty default constructor
4145
LoadNexus::LoadNexus() : Algorithm(), m_filename() {}
4246

@@ -293,7 +297,7 @@ int LoadNexus::getNexusEntryTypes(const std::string &fileName, std::vector<std::
293297
std::pair<std::string, std::string> entry;
294298
while (true) {
295299
entry = fileH->getNextEntry();
296-
if (entry == ::NeXus::EOD_ENTRY)
300+
if (entry.first == NULL_STR && entry.second == NULL_STR)
297301
break;
298302

299303
if (entry.second == "NXentry")
@@ -308,7 +312,7 @@ int LoadNexus::getNexusEntryTypes(const std::string &fileName, std::vector<std::
308312
// loop through field names in this entry
309313
while (true) {
310314
entry = fileH->getNextEntry();
311-
if (entry == ::NeXus::EOD_ENTRY)
315+
if (entry.first == NULL_STR && entry.second == NULL_STR)
312316
break;
313317
// if a data field
314318
if (entry.second == "SDS") {

Framework/DataHandling/src/LoadNexusProcessed.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,10 @@ API::Workspace_sptr LoadNexusProcessed::loadTableEntry(const NXEntry &entry) {
845845
std::string columnTitle = data.attributes("name");
846846
if (!columnTitle.empty()) {
847847
workspace->addColumn("str", columnTitle);
848-
NeXus::DimSize nRows = info.dims[0];
848+
int nRows = info.dims[0];
849849
workspace->setRowCount(nRows);
850850

851-
NeXus::DimSize const maxStr = info.dims[1];
851+
const int maxStr = info.dims[1];
852852
data.load();
853853
for (int iR = 0; iR < nRows; ++iR) {
854854
auto &cellContents = workspace->cell<std::string>(iR, columnNumber - 1);
@@ -1173,7 +1173,7 @@ API::Workspace_sptr LoadNexusProcessed::loadLeanElasticPeaksEntry(const NXEntry
11731173
NXInfo info = nx_tw.getDataSetInfo(str);
11741174
NXChar data = nx_tw.openNXChar(str);
11751175

1176-
const int maxShapeJSONLength = static_cast<int>(info.dims[1]);
1176+
const int maxShapeJSONLength = info.dims[1];
11771177
data.load();
11781178
for (int i = 0; i < numberPeaks; ++i) {
11791179

@@ -1465,7 +1465,7 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(const NXEntry &entry) {
14651465
NXInfo info = nx_tw.getDataSetInfo(str);
14661466
NXChar data = nx_tw.openNXChar(str);
14671467

1468-
NeXus::DimSize const maxShapeJSONLength = info.dims[1];
1468+
const int maxShapeJSONLength = info.dims[1];
14691469
data.load();
14701470
for (int i = 0; i < numberPeaks; ++i) {
14711471

Framework/DataHandling/src/LoadTOFRawNexus.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, const std::s
187187

188188
// Count how many pixels in the bank
189189
file.openData("pixel_id");
190-
std::vector<int64_t> const dims = file.getInfo().dims;
190+
std::vector<int64_t> dims = file.getInfo().dims;
191191
file.closeData();
192192

193193
if (!dims.empty()) {
@@ -200,11 +200,11 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, const std::s
200200

201201
// Get the number of pixels from the offsets arrays
202202
file.openData("x_pixel_offset");
203-
std::vector<int64_t> const xdim = file.getInfo().dims;
203+
std::vector<int64_t> xdim = file.getInfo().dims;
204204
file.closeData();
205205

206206
file.openData("y_pixel_offset");
207-
std::vector<int64_t> const ydim = file.getInfo().dims;
207+
std::vector<int64_t> ydim = file.getInfo().dims;
208208
file.closeData();
209209

210210
if (!xdim.empty() && !ydim.empty()) {
@@ -215,7 +215,7 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, const std::s
215215
if (bankEntries.find(m_axisField) != bankEntries.end()) {
216216
// Get the size of the X vector
217217
file.openData(m_axisField);
218-
std::vector<int64_t> const dims = file.getInfo().dims;
218+
std::vector<int64_t> dims = file.getInfo().dims;
219219
// Find the units, if available
220220
if (file.hasAttr("units"))
221221
file.getAttr("units", m_xUnits);

Framework/DataHandling/src/NexusTester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void NexusTester::exec() {
146146
if (!LoadFilename.empty()) {
147147
::NeXus::File file(LoadFilename, NXACC_READ);
148148
int HDFCacheSize = getProperty("HDFCacheSize");
149-
::NeXus::setCache(HDFCacheSize);
149+
NXsetcache(HDFCacheSize);
150150
file.openGroup("FakeDataGroup", "NXdata");
151151
Progress prog(this, 0.0, 1.0, NumChunks);
152152
CPUTimer tim;

Framework/DataHandling/src/SaveNexusProcessed.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void SaveNexusProcessed::doExec(const Workspace_sptr &inputWorkspace,
205205
std::shared_ptr<Mantid::NeXus::NexusFileIO> &nexusFile, const bool keepFile,
206206
optional_size_t entryNumber) {
207207
// TODO: Remove?
208-
::NeXus::EnableErrorReporting();
208+
NXMEnableErrorReporting();
209209

210210
// Retrieve the filename from the properties
211211
const std::string filename = getPropertyValue("Filename");

0 commit comments

Comments
 (0)