This was unnecessary, and this simplifies the module dependency graph.
With some simple changes, oenv only needs to use
utility/programcontext.h.
Change-Id: I794b15cee88bf49379fd8c783672df5f57628c97
message(FATAL_ERROR "Could not find init_mtop in the GROMACS library, take look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. This most likely means that your GROMACS version is too old, we need at least GROMACS 4.0.7.")
endif(NOT FOUND_GROMACS_INIT_MTOP)
set(GROMACS_VERSION 40000)
- check_library_exists("${GROMACS_LIBRARY};${GROMACS_DEP_LIBRARIES}" output_env_init "" FOUND_GROMACS_OUTPUT_ENV_INIT)
- if(FOUND_GROMACS_OUTPUT_ENV_INIT)
+ check_library_exists("${GROMACS_LIBRARY};${GROMACS_DEP_LIBRARIES}" output_env_done "" FOUND_GROMACS_OUTPUT_ENV_DONE)
+ if(FOUND_GROMACS_OUTPUT_ENV_DONE)
set(GROMACS_VERSION 40500)
- endif(FOUND_GROMACS_OUTPUT_ENV_INIT)
+ endif(FOUND_GROMACS_OUTPUT_ENV_DONE)
check_library_exists("${GROMACS_LIBRARY};${GROMACS_DEP_LIBRARIES}" gmx_nonbonded_setup "" FOUND_GROMACS_GMX_NONBONDED_SETUP)
if(FOUND_GROMACS_GMX_NONBONDED_SETUP)
set(GROMACS_VERSION 40600)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
+ * 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.
#include <boost/shared_ptr.hpp>
-#include "gromacs/fileio/gmxfio.h"
#include "gromacs/legacyheaders/oenv.h"
#include "gromacs/legacyheaders/vec.h"
#include "gromacs/legacyheaders/xvgr.h"
#include "gromacs/analysisdata/dataframe.h"
+#include "gromacs/fileio/gmxfio.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/options.h"
#include "gromacs/options/timeunitmanager.h"
#include "gromacs/selection/selectioncollection.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/stringutil.h"
namespace
? static_cast<xvg_format_t>(impl_->settings_.plotFormat())
: exvgNONE);
output_env_t oenv;
- output_env_init(&oenv, 0, NULL, time_unit, FALSE, xvg_format, 0, 0);
+ output_env_init(&oenv, getProgramContext(), time_unit, FALSE, xvg_format, 0, 0);
boost::shared_ptr<output_env> oenvGuard(oenv, &output_env_done);
impl_->fp_ = xvgropen(impl_->filename_.c_str(), impl_->title_.c_str(),
impl_->xlabel_.c_str(), impl_->ylabel_.c_str(),
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/stringutil.h"
/* The source code in this file should be thread-safe.
get_pargs(argc, argv, npall, all_pa);
/* set program name, command line, and default values for output options */
- output_env_init(oenv, *argc, argv, (time_unit_t)nenum(time_units), bView,
+ output_env_init(oenv, gmx::getProgramContext(), (time_unit_t)nenum(time_units), bView,
(xvg_format_t)nenum(xvg_format), 0, debug_level);
/* Parse the file args */
#include "smalloc.h"
-#include "gromacs/commandline/cmdlineprogramcontext.h"
+#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/exceptions.h"
struct output_env
{
- output_env()
- {
- setDefaults();
- }
- output_env(int argc, const char *const argv[])
- : programContext(argc, argv)
- {
- setDefaults();
- }
-
- void setDefaults()
+ explicit output_env(const gmx::ProgramContextInterface &context)
+ : programContext(context)
{
time_unit = time_ps;
view = FALSE;
debug_level = 0;
}
- gmx::CommandLineProgramContext programContext;
+ const gmx::ProgramContextInterface &programContext;
/* the time unit, enum defined in oenv.h */
- time_unit_t time_unit;
+ time_unit_t time_unit;
/* view of file requested */
- gmx_bool view;
+ gmx_bool view;
/* xvg output format, enum defined in oenv.h */
- xvg_format_t xvg_format;
+ xvg_format_t xvg_format;
/* The level of verbosity for this program */
- int verbosity;
+ int verbosity;
/* the debug level */
- int debug_level;
+ int debug_level;
};
/* The source code in this file should be thread-safe.
/***** OUTPUT_ENV MEMBER FUNCTIONS ******/
-void output_env_init(output_env_t *oenvp, int argc, char *argv[],
+void output_env_init(output_env_t *oenvp,
+ const gmx::ProgramContextInterface &context,
time_unit_t tmu, gmx_bool view, xvg_format_t xvg_format,
int verbosity, int debug_level)
{
try
{
- output_env_t oenv = new output_env(argc, argv);
+ output_env_t oenv = new output_env(context);
*oenvp = oenv;
oenv->time_unit = tmu;
oenv->view = view;
{
try
{
- output_env_t oenv = new output_env();
+ output_env_t oenv = new output_env(gmx::getProgramContext());
*oenvp = oenv;
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
/* the xvg output formattings */
-void output_env_init(output_env_t *oenvp, int argc, char *argv[],
- time_unit_t tmu, gmx_bool view, xvg_format_t xvg_format,
- int verbosity, int debug_level);
-/* initialize an output_env structure, setting the command line,
- the default time value a gmx_boolean view that is set to TRUE when the
- user requests direct viewing of graphs,
- the graph formatting type, the verbosity, and debug level */
-
void output_env_init_default(output_env_t *oenvp);
/* initialize an output_env structure, with reasonable default settings.
(the time unit is set to time_ps, which means no conversion). */
#ifdef __cplusplus
}
+
+namespace gmx
+{
+class ProgramContextInterface;
+} // namespace gmx
+
+void output_env_init(output_env_t *oenvp,
+ const gmx::ProgramContextInterface &context,
+ time_unit_t tmu, gmx_bool view, xvg_format_t xvg_format,
+ int verbosity, int debug_level);
+/* initialize an output_env structure, setting the command line,
+ the default time value a gmx_boolean view that is set to TRUE when the
+ user requests direct viewing of graphs,
+ the graph formatting type, the verbosity, and debug level */
#endif
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
+ * 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.
#include "gromacs/trajectoryanalysis/analysissettings.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/stringutil.h"
#include "analysissettings-impl.h"
}
time_unit_t time_unit
= static_cast<time_unit_t>(impl_->settings_.timeUnit() + 1);
- output_env_init(&impl_->oenv_, 0, NULL, time_unit, FALSE, exvgNONE, 0, 0);
+ output_env_init(&impl_->oenv_, getProgramContext(), time_unit, FALSE, exvgNONE, 0, 0);
int frflags = impl_->settings_.frflags();
frflags |= TRX_NEED_X;