source: ThirdParty/vmg/src/base/command.hpp@ 33a694

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since 33a694 was 7faa5c, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit 'de061d9d851257a04e924d4472df4523d33bb08b' as 'ThirdParty/vmg'

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * vmg - a versatile multigrid solver
3 * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
4 *
5 * vmg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * vmg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * @file command.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Tue Apr 5 19:21:37 2011
23 *
24 * @brief Base class for commands that can be added to several
25 * command lists. Commands in the lists COMMANDLIST_INIT,
26 * COMMAND_LIST_LOOP and COMMANDLIST_FINALIZE will be
27 * executed automatically. However the user may create
28 * other command lists and execute them manually.
29 *
30 */
31
32#ifndef COMMAND_HPP_
33#define COMMAND_HPP_
34
35#include <string>
36#include <vector>
37
38#include "base/defs.hpp"
39#include "base/proxy.hpp"
40#include "comm/comm.hpp"
41#include "mg.hpp"
42
43#ifdef HAVE_MPE
44#include <mpe_log.h>
45#define MPE_EVENT_BEGIN() static int eventID_begin;\
46 static int eventID_end;\
47 if (eventID_begin == 0 && eventID_end == 0) {\
48 MPE_Log_get_state_eventIDs(&eventID_begin, &eventID_end);\
49 if (MG::GetComm()->GlobalRank() == 0)\
50 MPE_Describe_state(eventID_begin, eventID_end, Name(), "pink"); \
51 }\
52 MPE_Log_event(eventID_begin, 0, NULL);
53#define MPE_EVENT_END() MPE_Log_event(eventID_end, 0, NULL);
54#else
55#define MPE_EVENT_BEGIN()
56#define MPE_EVENT_END()
57#endif /* HAVE_MPE */
58
59#define CREATE_INITIALIZER(a) void Initialize##a() { \
60 VMG::MG::GetCommands().Register(new VMG::CommandProxy<a>); \
61 }
62
63namespace VMG
64{
65
66class Command
67{
68public:
69 typedef std::vector<std::string> argument_vector; ///< Holds arguments for execution
70
71 virtual ~Command() {}
72
73 /**
74 * This function will be executed when command flow in a certain command
75 * list reaches this command.
76 *
77 * @param arguments Holds arguments for execution as strings. When using multiple arguments,
78 * ':' serves as the separator.
79 *
80 * @return Certain commands may want to change the following command flow of the command list
81 * (e.g. stopping criteria). This can be achieved by returning either "StopNow", which
82 * stops execution right after this command or by returning "StopLater", which will stop
83 * execution of a loop after the remaining commands have also been executed.
84 */
85 virtual Request Run(Command::argument_vector arguments) = 0;
86};
87
88}
89
90#endif /* COMMAND_HPP_ */
Note: See TracBrowser for help on using the repository browser.