Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ set(BASIC_LINK_LIBS
moduleregistry
io
export
import
neta
analyser
generator
Expand Down
1 change: 0 additions & 1 deletion src/classes/dataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "base/serialiser.h"
#include "io/fileAndFormat.h"
#include "io/import/data2D.h"
#include "items/list.h"
#include "math/data1D.h"
#include "math/data2D.h"
Expand Down
1 change: 0 additions & 1 deletion src/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ target_link_libraries(io PRIVATE base)

# Subdirectories
add_subdirectory(export)
add_subdirectory(import)
11 changes: 0 additions & 11 deletions src/io/import/CMakeLists.txt

This file was deleted.

72 changes: 0 additions & 72 deletions src/io/import/data2D.cpp

This file was deleted.

65 changes: 0 additions & 65 deletions src/io/import/data2D.h

This file was deleted.

62 changes: 0 additions & 62 deletions src/io/import/data2D_cartesian.cpp

This file was deleted.

1 change: 1 addition & 0 deletions src/nodes/dAngle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void DAngleNode::clearData() {}
// Temporary accessors to data for testing
const Data1D &DAngleNode::rdfBC() const { return rdfBC_; }
const Data1D &DAngleNode::angle() const { return angle_; }
const Histogram2D &DAngleNode::distanceAngleMap() const { return *distanceAngleMap_; }
const Data2D &DAngleNode::dAngle() const { return dAngle_; }

/*
Expand Down
1 change: 1 addition & 0 deletions src/nodes/dAngle.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class DAngleNode : public Node
// Temporary accessors to data for testing
const Data1D &rdfBC() const;
const Data1D &angle() const;
const Histogram2D &distanceAngleMap() const;
const Data2D &dAngle() const;

/*
Expand Down
88 changes: 88 additions & 0 deletions src/nodes/importDLPUtilsSurface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 Team Dissolve and contributors

#include "nodes/importDLPUtilsSurface.h"
#include "base/lineParser.h"

ImportDLPUtilsSurfaceNode::ImportDLPUtilsSurfaceNode(Graph *parentGraph) : Node(parentGraph)
{
// Options
addOption<std::string>("FilePath", "File path", filePath_);

// Outputs
addOutput<std::optional<Data2D>>("Data", "Imported data", data_);
}

std::string_view ImportDLPUtilsSurfaceNode::type() const { return "ImportDLPUtilsSurface"; }

std::string_view ImportDLPUtilsSurfaceNode::summary() const { return "Import DLPUtils 2D surface data (.surf)"; }

NodeConstants::ProcessResult ImportDLPUtilsSurfaceNode::process()
{
// Create the data
data_.emplace();

if (!read(*data_, filePath_))
return error("Failed to read DLPUtils Surface data from file '{}'.\n", filePath_);

return NodeConstants::ProcessResult::Success;
}

// Read data specified
bool ImportDLPUtilsSurfaceNode::read(Data2D &data, std::string filePath)
{
data.clear();

// Open file and check that we're OK to proceed importing from it
LineParser parser;
if ((!parser.openInput(filePath)) || (!parser.isFileGoodForReading()))
return false;

// Data is in blocks of common Y value, three-columns: x y f(x,y)
std::vector<double> xAxis, yAxis, values;
auto firstLineOfBlock = true;
while (!parser.eofOrBlank())
{
if (parser.getArgsDelim(LineParser::KeepBlanks) != LineParser::Success)
return false;

// Is this a blank line inbetween blocks?
if (parser.nArgs() == 0)
{
firstLineOfBlock = true;
continue;
}

// If this is the first line of the block, re-start x-axis storage and push next y value
if (firstLineOfBlock)
{
xAxis.clear();
yAxis.push_back(parser.argd(1));
firstLineOfBlock = false;
}

// Store the x-axis value
xAxis.push_back(parser.argd(0));

// Store the value
values.push_back(parser.argd(2));
}

parser.closeFiles();

// Validity check on number of points in loaded file
if (xAxis.size() * yAxis.size() != values.size())
return false;

// Initialise the array and poke values back in the correct order

data.initialise(xAxis.size(), yAxis.size(), false);
data.xAxis() = xAxis;
data.yAxis() = yAxis;
auto index = 0;
for (auto y = 0; y < yAxis.size(); ++y)
for (auto x = 0; x < xAxis.size(); ++x)
data.values()[{x, y}] = values[index++];

return true;
}
41 changes: 41 additions & 0 deletions src/nodes/importDLPUtilsSurface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 Team Dissolve and contributors

#pragma once

#include "math/data2D.h"
#include "nodes/node.h"

class ImportDLPUtilsSurfaceNode : public Node
{
public:
ImportDLPUtilsSurfaceNode(Graph *parentGraph);
~ImportDLPUtilsSurfaceNode() override = default;

/*
* Definition
*/
public:
std::string_view type() const override;
std::string_view summary() const override;

/*
* Data
*/
private:
// File path
std::string filePath_;
// Imported data
std::optional<Data2D> data_;

/*
* Processing
*/
private:
// Run main processing
NodeConstants::ProcessResult process() override;

public:
// Read data specified
static bool read(Data2D &data, std::string filePath);
};
2 changes: 2 additions & 0 deletions src/nodes/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "nodes/importDLPOLYStructure.h"
#include "nodes/importDLPOLYTrajectory.h"
#include "nodes/importDLPUtilsPDens.h"
#include "nodes/importDLPUtilsSurface.h"
#include "nodes/importEPSRAtoStructure.h"
#include "nodes/importMoscitoStructure.h"
#include "nodes/importXYData.h"
Expand Down Expand Up @@ -101,6 +102,7 @@ void NodeRegistry::instantiateNodeProducers()
{"ImportDLPOLYStructure", makeDerivedNode<ImportDLPOLYStructureNode>()},
{"ImportDLPOLYTrajectory", makeDerivedNode<ImportDLPOLYTrajectoryNode>()},
{"ImportDLPUtilsPDens", makeDerivedNode<ImportDLPUtilsPDensNode>()},
{"ImportDLPUtilsSurface", makeDerivedNode<ImportDLPUtilsSurfaceNode>()},
{"ImportEPSRAtoStructure", makeDerivedNode<ImportEPSRAtoStructureNode>()},
{"ImportMoscitoStructure", makeDerivedNode<ImportMoscitoStructureNode>()},
{"ImportXYData", makeDerivedNode<ImportXYDataNode>()},
Expand Down
Loading
Loading