Changeset c6efc1 for src


Ignore:
Timestamp:
May 8, 2010, 7:14:29 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
ecb799
Parents:
18eecf
git-author:
Frederik Heber <heber@…> (05/08/10 18:40:49)
git-committer:
Frederik Heber <heber@…> (05/08/10 19:14:29)
Message:

Begin of Refactoring of ParseCommandLineOptions().

  • new singleton class CommandLineParser which wraps boost's program_options
  • main() uses the new CommandLineParser and calls UIFactory with CommandLine specizliation if commands detected.
  • files added toe Makefile.am
  • BOOST_PROGRAM_OPTIONS added to configure.ac
  • BOOST_PROGRAM_OPTIONS_LIB added to molecuilder/src/Makefile.am

Signed-off-by: Frederik Heber <heber@…>

Location:
src
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r18eecf rc6efc1  
    241241  bondgraph.cpp \
    242242  boundary.cpp \
     243  CommandLineParser.cpp \
    243244  config.cpp \
    244245  element.cpp \
     
    284285  bondgraph.hpp \
    285286  boundary.hpp \
     287  CommandLineParser.hpp \
    286288  config.hpp \
    287289  defs.hpp \
     
    324326molecuilder_LDFLAGS = $(BOOST_LDFLAGS)
    325327molecuilder_SOURCES = builder.cpp
    326 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
     328molecuilder_LDADD = libmolecuilder.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    327329joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    328330joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
  • src/builder.cpp

    r18eecf rc6efc1  
    6060#include "bondgraph.hpp"
    6161#include "boundary.hpp"
     62#include "CommandLineParser.hpp"
    6263#include "config.hpp"
    6364#include "element.hpp"
     
    25492550  logger::purgeInstance();
    25502551  errorLogger::purgeInstance();
     2552  CommandLineParser::purgeInstance();
    25512553  ActionRegistry::purgeInstance();
    25522554  ActionHistory::purgeInstance();
     
    25552557int main(int argc, char **argv)
    25562558{
    2557     molecule *mol = NULL;
    25582559    config *configuration = new config;
    25592560    Vector x, y, z, n;
     
    25622563    string line;
    25632564    char *ConfigFileName = NULL;
    2564     int j;
    25652565
    25662566    cout << ESPACKVersion << endl;
     
    25692569    // need to init the history before any action is created
    25702570    ActionHistory::init();
    2571     /* structure of ParseCommandLineOptions will be refactored later */
    2572     j = ParseCommandLineOptions(argc, argv,  World::getInstance().getMolecules(), World::getInstance().getPeriode(), *configuration, ConfigFileName);
    2573     switch (j){
    2574         case 255:
    2575         case 2:
    2576         case 1:
    2577             cleanUp(configuration);
    2578             return (j == 1 ? 0 : j);
    2579         default:
    2580             break;
     2571
     2572    {
     2573      // Parse command line options and if present create respective UI
     2574      CommandLineParser::getInstance().generic.add_options()
     2575          ("help,h", "produce help message")
     2576          ("parse-xyz,p", po::value< vector<string> >(), "parse xyz file into World")
     2577          ;
     2578      CommandLineParser::getInstance().Run(argc,argv);
     2579      if (!CommandLineParser::getInstance().isEmpty())
     2580        UIFactory::makeUserInterface(UIFactory::CommandLine);
     2581      else
     2582        UIFactory::makeUserInterface(UIFactory::Text);
    25812583    }
    2582     if(World::getInstance().numMolecules() == 0){
    2583         mol = World::getInstance().createMolecule();
    2584         World::getInstance().getMolecules()->insert(mol);
    2585         cout << "Molecule created" << endl;
    2586         if(World::getInstance().getDomain()[0] == 0.){
    2587             Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
    2588             for(int i = 0;i < 6;i++){
    2589                 Log() << Verbose(1) << "Cell size" << i << ": ";
    2590                 cin >> World::getInstance().getDomain()[i];
    2591             }
    2592         }
    2593         mol->ActiveFlag = true;
    2594     }
    25952584
    25962585    {
    2597       cout << ESPACKVersion << endl;
    2598 
    2599       setVerbosity(0);
    2600 
    26012586      menuPopulaters populaters;
    26022587      populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu;
    26032588
    2604       UIFactory::makeUserInterface(UIFactory::Text);
    26052589      MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName);
    26062590      mainWindow->display();
Note: See TracChangeset for help on using the changeset viewer.