/usr/include/gromacs/analysisdata/modules/plot.h is in libgromacs-dev 5.1.2-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 332 333 334 335 336 337 338 | /*
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* GROMACS 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
/*! \file
* \brief
* Declares gmx::AnalysisDataPlotModule for plotting data (into a file).
*
* \inpublicapi
* \ingroup module_analysisdata
* \author Teemu Murtola <teemu.murtola@gmail.com>
*/
#ifndef GMX_ANALYSISDATA_MODULES_PLOT_H
#define GMX_ANALYSISDATA_MODULES_PLOT_H
#include <string>
#include <boost/shared_ptr.hpp>
#include "gromacs/analysisdata/datamodule.h"
#include "gromacs/options/timeunitmanager.h"
#include "gromacs/utility/classhelpers.h"
namespace gmx
{
class AnalysisDataValue;
class Options;
class SelectionCollection;
/*! \brief
* Common settings for data plots.
*
* \inpublicapi
* \ingroup module_analysisdata
*/
class AnalysisDataPlotSettings
{
public:
//! Constructs default analysis plot settings.
AnalysisDataPlotSettings();
//! Returns the selection collection set with setSelectionCollection().
const SelectionCollection *selectionCollection() const
{
return selections_;
}
//! Returns the time unit set with setTimeUnit().
TimeUnit timeUnit() const { return timeUnit_; }
/*! \brief
* Returns the plot format.
*
* \todo Use a proper enum.
*/
int plotFormat() const { return plotFormat_; }
/*! \brief
* Set selection collection to print as comments into the output.
*
* Formatted selection text from all selections in \p selections is
* printed as comments in the output file.
* If this method is not called, no selection information is written
* to the output.
*/
void setSelectionCollection(const SelectionCollection *selections);
/*! \brief
* Sets the time unit for the plot.
*
* The value is used only if AbstractPlotModule::setXAxisIsTime() is
* called, in which case it is used to print the appropriate axis label
* and to scale the values.
* If not called, the default time unit is ps.
*/
void setTimeUnit(TimeUnit timeUnit) { timeUnit_ = timeUnit; }
/*! \brief
* Adds common options for setting plot options.
*
* \param[in,out] options Options object to which options are added.
*/
void addOptions(Options *options);
private:
const SelectionCollection *selections_;
TimeUnit timeUnit_;
int plotFormat_;
};
/*! \brief
* Abstract data module for writing data into a file.
*
* Implements features common to all plotting modules. Subclasses implement
* features specific to certain applications (AnalysisDataPlotModule implements
* straightforward plotting).
*
* By default, the data is written into an xvgr file, according to the
* options read from the AnalysisDataPlotSettings object given to the
* constructor.
* For non-xvgr data, it's possible to skip all headers by calling
* setPlainOutput().
*
* A single output line corresponds to a single frame. In most cases with
* multipoint data, setPlainOutput() should be called since the output does not
* make sense as an xvgr file, but this is not enforced.
*
* Multipoint data and multiple data sets are both supported, in which case all
* the points are written to the output, in the order in which they are added
* to the data.
*
* \ingroup module_analysisdata
*/
class AbstractPlotModule : public AnalysisDataModuleSerial
{
public:
virtual ~AbstractPlotModule();
/*! \brief
* Set common settings for the plotting.
*/
void setSettings(const AnalysisDataPlotSettings &settings);
/*! \brief
* Set the output file name.
*
* If no file name is set (or if \p filename is empty), no output occurs.
*/
void setFileName(const std::string &filename);
/*! \brief
* Set plain output.
*
* If \p bPlain is true, no xvgr headers are written to the file.
* In this case, only setOmitX(), setXFormat(), and setYFormat()
* methods have any effect on the output.
*/
void setPlainOutput(bool bPlain);
/*! \brief
* Plot errors as a separate output column after each value column.
*/
void setErrorsAsSeparateColumn(bool bSeparate);
/*! \brief
* Omit the X coordinates from the output.
*
* This method only makes sense when combined with setPlainOutput().
*/
void setOmitX(bool bOmitX);
/*! \brief
* Set plot title.
*/
void setTitle(const char *title);
//! \copydoc setTitle(const char *)
void setTitle(const std::string &title);
/*! \brief
* Set plot subtitle.
*/
void setSubtitle(const char *subtitle);
//! \copydoc setSubtitle(const char *)
void setSubtitle(const std::string &subtitle);
/*! \brief
* Set X axis label.
*/
void setXLabel(const char *label);
/*! \brief
* Treat X axis as time.
*
* Sets the label for the axis accordingly and also scales output to
* take into account the correct time unit.
*/
void setXAxisIsTime();
/*! \brief
* Set Y axis label.
*/
void setYLabel(const char *label);
/*! \brief
* Add legend from an array of strings.
*
* Multiple calls to setLegend() and/or appendLegend() are added
* together.
*/
void setLegend(int nsets, const char * const *setname);
/*! \brief
* Add a legend string for the next data set.
*
* Multiple calls to setLegend() and/or appendLegend() are added
* together.
*/
void appendLegend(const char *setname);
//! \copydoc appendLegend(const char *)
void appendLegend(const std::string &setname);
/*! \brief
* Set field width and precision for X value output.
*/
void setXFormat(int width, int precision, char format = 'f');
/*! \brief
* Set field width and precision for Y value output.
*/
void setYFormat(int width, int precision, char format = 'f');
virtual int flags() const;
virtual void dataStarted(AbstractAnalysisData *data);
virtual void frameStarted(const AnalysisDataFrameHeader &header);
virtual void pointsAdded(const AnalysisDataPointSetRef &points) = 0;
virtual void frameFinished(const AnalysisDataFrameHeader &header);
virtual void dataFinished();
protected:
/*! \cond libapi */
AbstractPlotModule();
//! Creates AbstractPlotModule and assign common settings.
explicit AbstractPlotModule(const AnalysisDataPlotSettings &settings);
//! Whether an output file has been opened.
bool isFileOpen() const;
/*! \brief
* Appends a single value to the current output line.
*
* \param[in] value Value to append.
*
* Should be used from pointsAdded() implementations in derived classes
* to write out individual y values to the output.
*
* Must not be called if isFileOpen() returns false.
*/
void writeValue(const AnalysisDataValue &value) const;
//! \endcond
private:
class Impl;
PrivateImplPointer<Impl> impl_;
};
/*! \brief
* Plotting module for straightforward plotting of data.
*
* See AbstractPlotModule for common plotting options.
*
* \inpublicapi
* \ingroup module_analysisdata
*/
class AnalysisDataPlotModule : public AbstractPlotModule
{
public:
AnalysisDataPlotModule();
//! Creates AnalysisDataPlotModule and assign common settings.
explicit AnalysisDataPlotModule(const AnalysisDataPlotSettings &settings);
virtual void pointsAdded(const AnalysisDataPointSetRef &points);
// Copy and assign disallowed by base.
};
/*! \brief
* Plotting module specifically for data consisting of vectors.
*
* See AbstractPlotModule for common plotting options.
*
* \inpublicapi
* \ingroup module_analysisdata
*/
class AnalysisDataVectorPlotModule : public AbstractPlotModule
{
public:
AnalysisDataVectorPlotModule();
//! Creates AnalysisDataVectorPlotModule and assign common settings.
explicit AnalysisDataVectorPlotModule(const AnalysisDataPlotSettings &settings);
/*! \brief
* Set whether to write X component.
*/
void setWriteX(bool bWrite);
/*! \brief
* Set whether to write Y component.
*/
void setWriteY(bool bWrite);
/*! \brief
* Set whether to write Z component.
*/
void setWriteZ(bool bWrite);
/*! \brief
* Set whether to write norm of the vector.
*/
void setWriteNorm(bool bWrite);
/*! \brief
* Set mask for what to write.
*/
void setWriteMask(bool bWrite[4]);
virtual void pointsAdded(const AnalysisDataPointSetRef &points);
private:
bool bWrite_[4];
// Copy and assign disallowed by base.
};
//! Smart pointer to manage an AnalysisDataPlotModule object.
typedef boost::shared_ptr<AnalysisDataPlotModule>
AnalysisDataPlotModulePointer;
//! Smart pointer to manage an AnalysisDataVectorPlotModule object.
typedef boost::shared_ptr<AnalysisDataVectorPlotModule>
AnalysisDataVectorPlotModulePointer;
} // namespace gmx
#endif
|