diff --git a/src/base/fileparser.h b/src/base/fileparser.h
index 09b3c47e1..e9b06cbb6 100644
--- a/src/base/fileparser.h
+++ b/src/base/fileparser.h
@@ -91,6 +91,12 @@ class FileParser
variable = parser_.line();
return (result == 0);
}
+ // Read next delimited argument from file
+ bool readArg(QString& variable)
+ {
+ if (!parser_.getNextArg(Parser::Defaults, variable)) return false;
+ return true;
+ }
// Read next line from file into the variable supplied, and parse it as well
bool readAndParseLine(QString& variable)
{
diff --git a/src/gui/qcustomplot/plotdata.cpp b/src/gui/qcustomplot/plotdata.cpp
index e5fc34b42..51fac2492 100644
--- a/src/gui/qcustomplot/plotdata.cpp
+++ b/src/gui/qcustomplot/plotdata.cpp
@@ -38,6 +38,8 @@ PlotData& PlotData::operator=(const PlotData& source)
title_ = source.title_;
x_ = source.x_;
y_ = source.y_;
+
+ return (*this) ;
}
// Set titles for data and axes
diff --git a/src/gui/qcustomplot/tplotwidget_funcs.cpp b/src/gui/qcustomplot/tplotwidget_funcs.cpp
index 38aa2dfbd..76f0f353d 100644
--- a/src/gui/qcustomplot/tplotwidget_funcs.cpp
+++ b/src/gui/qcustomplot/tplotwidget_funcs.cpp
@@ -98,6 +98,8 @@ QCPGraph* TPlotWidget::addData(PlotData& source, PlotDataStyle::DataStyle style)
graph->setBrush(brush);
plot_->replot();
+
+ return graph;
}
// Add the specified data source as a bar chart to the QCustomPlot
@@ -124,6 +126,8 @@ QCPBars* TPlotWidget::addBarsData(PlotData& source, bool group, PlotDataStyle::D
}
plot_->replot();
+
+ return graph;
}
/*
diff --git a/src/plugins/io_cube/CMakeLists.txt b/src/plugins/io_cube/CMakeLists.txt
index e8f0c5b78..3a68b3376 100644
--- a/src/plugins/io_cube/CMakeLists.txt
+++ b/src/plugins/io_cube/CMakeLists.txt
@@ -1,3 +1,26 @@
+### Cube Model
+
+# Meta-Objects
+set(cubemodel_MOC_HDRS
+ cubemodel.hui
+)
+QT5_WRAP_CPP(cubemodel_MOC_SRCS ${cubemodel_MOC_HDRS} OPTIONS -I${PROJECT_SOURCE_DIR}/src)
+
+add_library(cubemodel MODULE
+ cubemodel_funcs.cpp
+ ${cube_MOC_SRCS}
+)
+target_link_libraries(cubemodel
+ ${PLUGIN_LINK_LIBS}
+)
+set_target_properties(cubemodel PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY ${Aten_BINARY_DIR}/data/plugins
+ COMPILE_DEFINITIONS "QT_PLUGIN"
+ PREFIX ""
+)
+
+#### Cube
+
# Meta-Objects
set(cube_MOC_HDRS
cube.hui
@@ -17,6 +40,9 @@ set_target_properties(cube PROPERTIES
PREFIX ""
)
+# Install Targets
+
+# Install Targets
if(UNIX AND NOT APPLE)
install(TARGETS cube
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/aten/plugins COMPONENT RuntimePlugins
diff --git a/src/plugins/io_cube/Makefile.am b/src/plugins/io_cube/Makefile.am
index d1ddbf852..88c36e116 100644
--- a/src/plugins/io_cube/Makefile.am
+++ b/src/plugins/io_cube/Makefile.am
@@ -1,6 +1,6 @@
# Set plugin installation dir and define plugin targets
pluginexecdir = @ATEN_PLUGINLIBDIR@
-pluginexec_LTLIBRARIES = cube.la
+pluginexec_LTLIBRARIES = cube.la cubemodel.la
# Rules
.ui.lo:
@@ -18,8 +18,12 @@ pluginexec_LTLIBRARIES = cube.la
clean-local:
-rm -f cube.cpp
-# AKF Model plugin
+# Cube Model plugin
cube_la_SOURCES = cube_funcs.cpp cube.hui
cube_la_LDFLAGS = -module -shared -avoid-version
+# Cube Model plugin
+cubemodel_la_SOURCES = cubemodel_funcs.cpp cubemodel.hui
+cubemodel_la_LDFLAGS = -module -shared -avoid-version
+
AM_CPPFLAGS = -I${top_srcdir}/src @ATEN_INCLUDES@ @ATEN_CFLAGS@
diff --git a/src/plugins/io_cube/cube.hui b/src/plugins/io_cube/cube.hui
index 2502a7621..10aa1d54d 100644
--- a/src/plugins/io_cube/cube.hui
+++ b/src/plugins/io_cube/cube.hui
@@ -1,5 +1,5 @@
/*
- *** CUBE Model File Plugin
+ *** Cube Grid File Plugin
*** src/plugins/io_cube/cube.hui
Copyright T. Youngs 2016-2018
@@ -19,8 +19,8 @@
along with Aten. If not, see .
*/
-#ifndef ATEN_CUBEMODELPLUGIN_H
-#define ATEN_CUBEMODELPLUGIN_H
+#ifndef ATEN_CUBEGRIDPLUGIN_H
+#define ATEN_CUBEGRIDPLUGIN_H
#include "plugins/interfaces/fileplugin.h"
@@ -29,8 +29,8 @@ ATEN_BEGIN_NAMESPACE
// Forward Declarations
/* none */
-// CUBE Model Plugin
-class CUBEModelPlugin : public QObject, public FilePluginInterface
+// Cube Grid Plugin
+class CubeGridPlugin : public QObject, public FilePluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.projectaten.Aten.FilePluginInterface.v1")
@@ -39,9 +39,9 @@ class CUBEModelPlugin : public QObject, public FilePluginInterface
public:
// Constructor
- CUBEModelPlugin();
+ CubeGridPlugin();
// Destructor
- ~CUBEModelPlugin();
+ ~CubeGridPlugin();
/*
diff --git a/src/plugins/io_cube/cube_funcs.cpp b/src/plugins/io_cube/cube_funcs.cpp
index f8d526c56..a5b92ca1d 100644
--- a/src/plugins/io_cube/cube_funcs.cpp
+++ b/src/plugins/io_cube/cube_funcs.cpp
@@ -1,5 +1,5 @@
/*
- *** CUBE Model Plugin Functions
+ *** Cube Plugin Functions
*** src/plugins/io_cube/cube_funcs.cpp
Copyright T. Youngs 2016-2018
@@ -23,12 +23,12 @@
#include "model/model.h"
// Constructor
-CUBEModelPlugin::CUBEModelPlugin()
+CubeGridPlugin::CubeGridPlugin()
{
}
// Destructor
-CUBEModelPlugin::~CUBEModelPlugin()
+CubeGridPlugin::~CubeGridPlugin()
{
}
@@ -37,9 +37,9 @@ CUBEModelPlugin::~CUBEModelPlugin()
*/
// Return a copy of the plugin object
-BasePluginInterface* CUBEModelPlugin::makeCopy() const
+BasePluginInterface* CubeGridPlugin::makeCopy() const
{
- return new CUBEModelPlugin;
+ return new CubeGridPlugin;
}
/*
@@ -47,49 +47,49 @@ BasePluginInterface* CUBEModelPlugin::makeCopy() const
*/
// Return type of plugin
-PluginTypes::PluginType CUBEModelPlugin::type() const
+PluginTypes::PluginType CubeGridPlugin::type() const
{
return PluginTypes::FilePlugin;
}
// Return category of plugin
-int CUBEModelPlugin::category() const
+int CubeGridPlugin::category() const
{
return PluginTypes::ModelFilePlugin;
}
// Name of plugin
-QString CUBEModelPlugin::name() const
+QString CubeGridPlugin::name() const
{
- return QString("CUBE (dlputils) 3D probability density");
+ return QString("Cube (dlputils) 3D probability density");
}
// Nickname of plugin
-QString CUBEModelPlugin::nickname() const
+QString CubeGridPlugin::nickname() const
{
return QString("cube");
}
// Return whether the plugin is enabled
-bool CUBEModelPlugin::enabled() const
+bool CubeGridPlugin::enabled() const
{
return true;
}
// Description (long name) of plugin
-QString CUBEModelPlugin::description() const
+QString CubeGridPlugin::description() const
{
- return QString("Import/export for dlputils CUBE files");
+ return QString("Import/export for cube files");
}
// Related file extensions
-QStringList CUBEModelPlugin::extensions() const
+QStringList CubeGridPlugin::extensions() const
{
return QStringList() << "cube";
}
// Exact names
-QStringList CUBEModelPlugin::exactNames() const
+QStringList CubeGridPlugin::exactNames() const
{
return QStringList();
}
@@ -99,15 +99,15 @@ QStringList CUBEModelPlugin::exactNames() const
*/
// Return whether this plugin can import data
-bool CUBEModelPlugin::canImport() const
+bool CubeGridPlugin::canImport() const
{
return true;
}
// Import data from the specified file
-bool CUBEModelPlugin::importData()
+bool CubeGridPlugin::importData()
{
-//filter(type="importmodel", name="Gaussian CUBE", nickname="cube", extension="cube", glob="*.cube", zmap="numeric")
+//filter(type="importmodel", name="Gaussian Cube", nickname="cube", extension="cube", glob="*.cube", zmap="numeric")
//{
// # Variable declaration
// string e,title;
@@ -163,7 +163,7 @@ bool CUBEModelPlugin::importData()
// finaliseGrid();
//}
//
-//filter(type="importgrid", name="Gaussian CUBE", nickname="cube", extension="cube", glob="*.cube", zmap="numeric", id=1)
+//filter(type="importgrid", name="Gaussian Cube", nickname="cube", extension="cube", glob="*.cube", zmap="numeric", id=1)
//{
// # Variable declaration
// string e,title;
@@ -213,25 +213,25 @@ bool CUBEModelPlugin::importData()
}
// Return whether this plugin can export data
-bool CUBEModelPlugin::canExport() const
+bool CubeGridPlugin::canExport() const
{
return false;
}
// Export data to the specified file
-bool CUBEModelPlugin::exportData()
+bool CubeGridPlugin::exportData()
{
return false;
}
// Import next partial data chunk
-bool CUBEModelPlugin::importNextPart()
+bool CubeGridPlugin::importNextPart()
{
return false;
}
// Skip next partial data chunk
-bool CUBEModelPlugin::skipNextPart()
+bool CubeGridPlugin::skipNextPart()
{
return false;
}
@@ -241,25 +241,25 @@ bool CUBEModelPlugin::skipNextPart()
*/
// Return whether the plugin has import options
-bool CUBEModelPlugin::hasImportOptions() const
+bool CubeGridPlugin::hasImportOptions() const
{
return false;
}
// Show import options dialog
-bool CUBEModelPlugin::showImportOptionsDialog(KVMap& targetOptions) const
+bool CubeGridPlugin::showImportOptionsDialog(KVMap& targetOptions) const
{
return false;
}
// Return whether the plugin has export options
-bool CUBEModelPlugin::hasExportOptions() const
+bool CubeGridPlugin::hasExportOptions() const
{
return false;
}
// Show export options dialog
-bool CUBEModelPlugin::showExportOptionsDialog(KVMap& targetOptions) const
+bool CubeGridPlugin::showExportOptionsDialog(KVMap& targetOptions) const
{
return false;
}
diff --git a/src/plugins/io_cube/cubemodel.hui b/src/plugins/io_cube/cubemodel.hui
new file mode 100644
index 000000000..a841b9640
--- /dev/null
+++ b/src/plugins/io_cube/cubemodel.hui
@@ -0,0 +1,111 @@
+/*
+ *** Cube Model File Plugin
+ *** src/plugins/io_cube/cubemodel.hui
+ Copyright T. Youngs 2016-2018
+
+ This file is part of Aten.
+
+ Aten 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.
+
+ Aten 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Aten. If not, see .
+*/
+
+#ifndef ATEN_CUBEMODELPLUGIN_H
+#define ATEN_CUBEMODELPLUGIN_H
+
+#include "plugins/interfaces/fileplugin.h"
+
+ATEN_BEGIN_NAMESPACE
+
+// Forward Declarations
+/* none */
+
+// Cube Model Plugin
+class CubeModelPlugin : public QObject, public FilePluginInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "com.projectaten.Aten.FilePluginInterface.v1")
+ Q_INTERFACES(AtenSpace::FilePluginInterface)
+
+
+ public:
+ // Constructor
+ CubeModelPlugin();
+ // Destructor
+ ~CubeModelPlugin();
+
+
+ /*
+ * Instance Handling
+ */
+ private:
+ // Return a copy of the plugin object
+ BasePluginInterface* makeCopy() const;
+
+
+ /*
+ * Definition
+ */
+ public:
+ // Return type of plugin
+ PluginTypes::PluginType type() const;
+ // Return category of plugin
+ int category() const;
+ // Return name of plugin
+ QString name() const;
+ // Return nickname of plugin
+ QString nickname() const;
+ // Return whether plugin is enabled
+ bool enabled() const;
+ // Return description (long name) of plugin
+ QString description() const;
+ // Return related file extensions
+ QStringList extensions() const;
+ // Return exact names
+ QStringList exactNames() const;
+
+
+ /*
+ * Input / Output
+ */
+ public:
+ // Return whether this plugin can import data
+ bool canImport() const;
+ // Import data via the supplied parser
+ bool importData();
+ // Return whether this plugin can export data
+ bool canExport() const;
+ // Export data via the supplied parser
+ bool exportData();
+ // Import next partial data chunk
+ bool importNextPart();
+ // Skip next partial data chunk
+ bool skipNextPart();
+
+
+ /*
+ * Options
+ */
+ public:
+ // Return whether the plugin has import options
+ bool hasImportOptions() const;
+ // Show import options dialog
+ bool showImportOptionsDialog(KVMap& targetOptions) const;
+ // Return whether the plugin has export options
+ bool hasExportOptions() const;
+ // Show export options dialog
+ bool showExportOptionsDialog(KVMap& targetOptions) const;
+};
+
+ATEN_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/io_cube/cubemodel_funcs.cpp b/src/plugins/io_cube/cubemodel_funcs.cpp
new file mode 100644
index 000000000..cd29fb3e6
--- /dev/null
+++ b/src/plugins/io_cube/cubemodel_funcs.cpp
@@ -0,0 +1,242 @@
+/*
+ *** Cube Model Plugin Functions
+ *** src/plugins/io_cube/cubemodel_funcs.cpp
+ Copyright T. Youngs 2016-2018
+
+ This file is part of Aten.
+
+ Aten 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.
+
+ Aten 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Aten. If not, see .
+*/
+
+#include "plugins/io_cube/cubemodel.hui"
+#include "model/model.h"
+
+// Constructor
+CubeModelPlugin::CubeModelPlugin()
+{
+}
+
+// Destructor
+CubeModelPlugin::~CubeModelPlugin()
+{
+}
+
+/*
+ * Instance Handling
+ */
+
+// Return a copy of the plugin object
+BasePluginInterface* CubeModelPlugin::makeCopy() const
+{
+ return new CubeModelPlugin;
+}
+
+/*
+ * Definition
+ */
+
+// Return type of plugin
+PluginTypes::PluginType CubeModelPlugin::type() const
+{
+ return PluginTypes::FilePlugin;
+}
+
+// Return category of plugin
+int CubeModelPlugin::category() const
+{
+ return PluginTypes::ModelFilePlugin;
+}
+
+// Name of plugin
+QString CubeModelPlugin::name() const
+{
+ return QString("Cube (dlputils) 3D probability density");
+}
+
+// Nickname of plugin
+QString CubeModelPlugin::nickname() const
+{
+ return QString("cube");
+}
+
+// Return whether the plugin is enabled
+bool CubeModelPlugin::enabled() const
+{
+ return true;
+}
+
+// Description (long name) of plugin
+QString CubeModelPlugin::description() const
+{
+ return QString("Import/export for dlputils Cube files");
+}
+
+// Related file extensions
+QStringList CubeModelPlugin::extensions() const
+{
+ return QStringList() << "cube";
+}
+
+// Exact names
+QStringList CubeModelPlugin::exactNames() const
+{
+ return QStringList();
+}
+
+/*
+ * Input / Output
+ */
+
+// Return whether this plugin can import data
+bool CubeModelPlugin::canImport() const
+{
+ return true;
+}
+
+// Import data from the specified file
+bool CubeModelPlugin::importData()
+{
+ // Lines 1-2: Comments (use first as title)
+ QString name;
+ if (!fileParser_.readLine(name)) return false;
+ fileParser_.skipLines(1);
+
+ // Line 3: Number of atoms and coordinate origin of surface
+ if (!fileParser_.parseLine()) return false;
+ int nAtoms = fileParser_.argi(0);
+ Vec3 origin = fileParser_.arg3d(1);
+
+ // Lines 4-6: Number of voxels and axis vector
+ Vec3 nXYZ;
+ if (!fileParser_.parseLine()) return false;
+ nXYZ.x = fileParser_.argi(0);
+ double xFactor = nXYZ.x < 0 ? 1.0 : ANGBOHR;
+ Vec3 xAxis = fileParser_.arg3d(1);
+ nXYZ.y = fileParser_.argi(0);
+ double yFactor = nXYZ.y < 0 ? 1.0 : ANGBOHR;
+ Vec3 yAxis = fileParser_.arg3d(1);
+ nXYZ.z = fileParser_.argi(0);
+ double zFactor = nXYZ.z < 0 ? 1.0 : ANGBOHR;
+ Vec3 zAxis = fileParser_.arg3d(1);
+
+ // Create a new model and set its name
+ Model* targetModel = createModel();
+ targetModel->setName(name);
+
+ // Lines 7-(7+natoms) Molecule Definition
+ Vec3 r;
+ for (int n=0; ncalculateBonding(true);
+
+ // Create new grid in the target model
+ Grid* grid = createGrid(targetModel);
+ grid->setName(fileParser_.filename());
+
+ grid->initialise(Grid::RegularXYZData, nXYZ);
+ Messenger::print("Grid size (points) is : {%i,%i,%i}\n", nXYZ.x, nXYZ.y, nXYZ.z);
+ Messenger::print("Grid origin is : {%f,%f,%f}\n", origin.x, origin.y, origin.z);
+
+ grid->setOrigin(origin);
+ Matrix axes;
+ axes.setColumn(0, xAxis * xFactor, 0.0);
+ axes.setColumn(1, yAxis * yFactor, 0.0);
+ axes.setColumn(2, zAxis * zFactor, 0.0);
+ grid->setAxes(axes);
+
+ // Read in volumetric data
+ QString arg;
+ for (int i=0; isetNextData(arg.toDouble());
+ }
+ }
+ }
+
+ return true;
+}
+
+// Return whether this plugin can export data
+bool CubeModelPlugin::canExport() const
+{
+ return false;
+}
+
+// Export data to the specified file
+bool CubeModelPlugin::exportData()
+{
+ return false;
+}
+
+// Import next partial data chunk
+bool CubeModelPlugin::importNextPart()
+{
+ return false;
+}
+
+// Skip next partial data chunk
+bool CubeModelPlugin::skipNextPart()
+{
+ return false;
+}
+
+/*
+ * Options
+ */
+
+// Return whether the plugin has import options
+bool CubeModelPlugin::hasImportOptions() const
+{
+ return false;
+}
+
+// Show import options dialog
+bool CubeModelPlugin::showImportOptionsDialog(KVMap& targetOptions) const
+{
+ return false;
+}
+
+// Return whether the plugin has export options
+bool CubeModelPlugin::hasExportOptions() const
+{
+ return false;
+}
+
+// Show export options dialog
+bool CubeModelPlugin::showExportOptionsDialog(KVMap& targetOptions) const
+{
+ return false;
+}
+
diff --git a/src/plugins/tool_test/testtool_funcs.cpp b/src/plugins/tool_test/testtool_funcs.cpp
index 5771da319..75fe78e84 100644
--- a/src/plugins/tool_test/testtool_funcs.cpp
+++ b/src/plugins/tool_test/testtool_funcs.cpp
@@ -144,6 +144,8 @@ bool TestToolPlugin::showDialog()
}
testToolDialog->applyPluginOptions();
testToolDialog->exec();
+
+ return true;
}
// Run the tool with the current settings
@@ -199,4 +201,4 @@ bool TestToolPlugin::runTool()
QObject* TestToolPlugin::object()
{
return this;
-}
\ No newline at end of file
+}