Changes in / [12872d:f941b1]


Ignore:
Files:
108 added
2 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r12872d rf941b1  
    2828# Boost libraries
    2929AX_BOOST_BASE([1.33.1])
    30 #AX_BOOST_PROGRAM_OPTIONS
     30AX_BOOST_PROGRAM_OPTIONS
    3131#AX_BOOST_FOREACH
    3232#AX_BOOST_FILESYSTEM
  • src/Actions/ActionRegistry.cpp

    r12872d rf941b1  
    4343}
    4444
     45void ActionRegistry::unregisterAction(Action* action){
     46  actionMap.erase(action->getName());
     47}
     48
     49std::map<const std::string,Action*>::iterator ActionRegistry::getBeginIter()
     50{
     51  return actionMap.begin();
     52}
     53
     54std::map<const std::string,Action*>::iterator ActionRegistry::getEndIter()
     55{
     56  return actionMap.end();
     57}
     58
    4559CONSTRUCT_SINGLETON(ActionRegistry)
  • src/Actions/ActionRegistry.hpp

    r12872d rf941b1  
    2222  Action* getActionByName(const std::string);
    2323  void registerAction(Action*);
     24  void unregisterAction(Action*);
     25
     26  std::map<const std::string,Action*>::iterator getBeginIter();
     27  std::map<const std::string,Action*>::iterator getEndIter();
    2428
    2529private:
  • src/Legacy/oldmenu.cpp

    r12872d rf941b1  
    3535#include "Menu/DisplayMenuItem.hpp"
    3636#include "Menu/SubMenuItem.hpp"
     37#include "Actions/MapOfActions.hpp"
    3738#include "Actions/MethodAction.hpp"
    3839#include "Actions/ErrorAction.hpp"
     
    908909  molecule *srcmol = NULL, *destmol = NULL;
    909910  Dialog *dialog = UIFactory::getInstance().makeDialog();
    910   dialog->queryMolecule("Enter index of destination molecule: ",&destmol, molecules);
    911   dialog->queryMolecule("Enter index of source molecule to add from: ",&srcmol, molecules);
     911  dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     912  dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    912913  if(dialog->display()) {
    913914    molecules->SimpleAdd(srcmol, destmol);
     
    922923  molecule *srcmol = NULL, *destmol = NULL;
    923924  Dialog *dialog = UIFactory::getInstance().makeDialog();
    924   dialog->queryMolecule("Enter index of matrix molecule (the variable one): ",&srcmol,molecules);
    925   dialog->queryMolecule("Enter index of molecule to merge into (the fixed one): ",&destmol,molecules);
     925  dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     926  dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    926927  if(dialog->display()) {
    927928    molecules->EmbedMerge(destmol, srcmol);
  • src/Makefile.am

    r12872d rf941b1  
     1# PLEASE adhere to the alphabetical ordering in this Makefile!
     2# Also indentation by a single tab
     3
    14# this includes source files that need to be present at multiple points
    2 HELPERSOURCE =  Helpers/Assert.cpp \
    3                                 Helpers/MemDebug.cpp
     5HELPERSOURCE =  \
     6  Helpers/Assert.cpp \
     7  Helpers/MemDebug.cpp
    48                       
    5 ATOMSOURCE = atom.cpp atom_atominfo.cpp atom_bondedparticle.cpp atom_bondedparticleinfo.cpp atom_graphnode.cpp atom_graphnodeinfo.cpp atom_particleinfo.cpp atom_trajectoryparticle.cpp atom_trajectoryparticleinfo.cpp
    6 ATOMHEADER = atom.hpp atom_atominfo.hpp atom_bondedparticle.hpp atom_bondedparticleinfo.hpp atom_graphnode.hpp atom_graphnodeinfo.hpp atom_particleinfo.hpp atom_trajectoryparticle.hpp atom_trajectoryparticleinfo.hpp
    7 
    8 LINALGSOURCE = ${HELPERSOURCE} \
    9                gslmatrix.cpp \
    10                            gslvector.cpp \
    11                            linearsystemofequations.cpp \
    12                            Space.cpp \
    13                            vector.cpp
     9ATOMSOURCE = \
     10  atom.cpp \
     11  atom_atominfo.cpp \
     12  atom_bondedparticle.cpp \
     13  atom_bondedparticleinfo.cpp \
     14  atom_graphnode.cpp \
     15  atom_graphnodeinfo.cpp \
     16  atom_particleinfo.cpp \
     17  atom_trajectoryparticle.cpp \
     18  atom_trajectoryparticleinfo.cpp
     19ATOMHEADER = \
     20  atom.hpp \
     21  atom_atominfo.hpp \
     22  atom_bondedparticle.hpp \
     23  atom_bondedparticleinfo.hpp \
     24  atom_graphnode.hpp \
     25  atom_graphnodeinfo.hpp \
     26  atom_particleinfo.hpp \
     27  atom_trajectoryparticle.hpp \
     28  atom_trajectoryparticleinfo.hpp
     29
     30LINALGSOURCE = \
     31  ${HELPERSOURCE} \
     32  gslmatrix.cpp \
     33  gslvector.cpp \
     34  linearsystemofequations.cpp \
     35  Space.cpp \
     36  vector.cpp
    1437                           
    1538LINALGHEADER = gslmatrix.hpp \
    16                            gslvector.hpp \
    17                            linearsystemofequations.hpp \
    18                            Space.hpp \
    19                            vector.hpp
     39  gslvector.hpp \
     40  linearsystemofequations.hpp \
     41  Space.hpp \
     42  vector.hpp
    2043                           
    21 
    22 ANALYSISSOURCE = analysis_bonds.cpp analysis_correlation.cpp
    23 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp
     44ANALYSISSOURCE = \
     45  analysis_bonds.cpp \
     46  analysis_correlation.cpp
     47ANALYSISHEADER = \
     48  analysis_bonds.hpp \
     49  analysis_correlation.hpp
    2450
    2551ACTIONSSOURCE = Actions/Action.cpp \
    26                                 Actions/ActionHistory.cpp \
    27                                 Actions/ActionRegistry.cpp \
    28                                 Actions/ActionSequence.cpp \
    29                                 Actions/ErrorAction.cpp \
    30                                 Actions/MakroAction.cpp \
    31                                 Actions/ManipulateAtomsProcess.cpp \
    32                                 Actions/MethodAction.cpp \
    33                 Actions/Process.cpp \
    34                 Actions/small_actions.cpp
    35                
     52  ${ANALYSISACTIONSOURCE} \
     53  ${ATOMACTIONSOURCE} \
     54  ${CMDACTIONSOURCE} \
     55  ${FRAGMENTATIONACTIONSOURCE} \
     56  ${MOLECULEACTIONSOURCE} \
     57  ${PARSERACTIONSOURCE} \
     58  ${TESSELATIONACTIONSOURCE} \
     59  ${WORLDACTIONSOURCE} \
     60  Actions/ActionHistory.cpp \
     61  Actions/ActionRegistry.cpp \
     62  Actions/ActionSequence.cpp \
     63  Actions/ErrorAction.cpp \
     64  Actions/MakroAction.cpp \
     65  Actions/ManipulateAtomsProcess.cpp \
     66  Actions/MapOfActions.cpp \
     67  Actions/MethodAction.cpp \
     68  Actions/Process.cpp
     69
     70ACTIONSHEADER = Actions/Action.hpp \
     71  ${ANALYSISACTIONHEADER} \
     72  ${ATOMACTIONHEADER} \
     73  ${CMDACTIONHEADER} \
     74  ${FRAGMENTATIONACTIONHEADER} \
     75  ${MOLECULEACTIONHEADER} \
     76  ${PARSERACTIONHEADER} \
     77  ${TESSELATIONACTIONHEADER} \
     78  ${WORLDACTIONHEADER} \
     79  Actions/ActionHistory.hpp \
     80  Actions/ActionRegistry.hpp \
     81  Actions/ActionSequence.hpp \
     82  Actions/Calculation.hpp \
     83  Actions/Calculation_impl.hpp \
     84  Actions/ErrorAction.hpp \
     85  Actions/MakroAction.hpp \
     86  Actions/ManipulateAtomsProcess.hpp \
     87  Actions/MapOfActions.hpp \
     88  Actions/MethodAction.hpp \
     89  Actions/Process.hpp
     90 
     91ANALYSISACTIONSOURCE = \
     92  Actions/AnalysisAction/MolecularVolumeAction.cpp \
     93  Actions/AnalysisAction/PairCorrelationAction.cpp \
     94  Actions/AnalysisAction/PairCorrelationToPointAction.cpp \
     95  Actions/AnalysisAction/PairCorrelationToSurfaceAction.cpp \
     96  Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
     97ANALYSISACTIONHEADER = \
     98  Actions/AnalysisAction/MolecularVolumeAction.hpp \
     99  Actions/AnalysisAction/PairCorrelationAction.hpp \
     100  Actions/AnalysisAction/PairCorrelationToPointAction.hpp \
     101  Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp \
     102  Actions/AnalysisAction/PrincipalAxisSystemAction.hpp
     103
     104ATOMACTIONSOURCE = \
     105  Actions/AtomAction/AddAction.cpp \
     106  Actions/AtomAction/ChangeElementAction.cpp \
     107  Actions/AtomAction/RemoveAction.cpp
     108ATOMACTIONHEADER = \
     109  Actions/AtomAction/AddAction.hpp \
     110  Actions/AtomAction/ChangeElementAction.hpp \
     111  Actions/AtomAction/RemoveAction.cpp
     112
     113CMDACTIONSOURCE = \
     114  Actions/CmdAction/BondLengthTableAction.cpp \
     115  Actions/CmdAction/ElementDbAction.cpp \
     116  Actions/CmdAction/FastParsingAction.cpp \
     117  Actions/CmdAction/HelpAction.cpp \
     118  Actions/CmdAction/VerboseAction.cpp \
     119  Actions/CmdAction/VersionAction.cpp
     120CMDACTIONHEADER = \
     121  Actions/CmdAction/BondLengthTableAction.hpp \
     122  Actions/CmdAction/ElementDbAction.hpp \
     123  Actions/CmdAction/FastParsingAction.hpp \
     124  Actions/CmdAction/HelpAction.hpp \
     125  Actions/CmdAction/VerboseAction.hpp \
     126  Actions/CmdAction/VersionAction.hpp
     127
     128FRAGMENTATIONACTIONSOURCE = \
     129  Actions/FragmentationAction/DepthFirstSearchAction.cpp \
     130  Actions/FragmentationAction/FragmentationAction.cpp \
     131  Actions/FragmentationAction/SubgraphDissectionAction.cpp               
     132FRAGMENTATIONACTIONHEADER = \
     133  Actions/FragmentationAction/DepthFirstSearchAction.hpp \
     134  Actions/FragmentationAction/FragmentationAction.hpp \
     135  Actions/FragmentationAction/SubgraphDissectionAction.hpp
     136
     137MOLECULEACTIONSOURCE = \
     138  Actions/MoleculeAction/BondFileAction.cpp \
     139  Actions/MoleculeAction/ChangeNameAction.cpp \
     140  Actions/MoleculeAction/FillWithMoleculeAction.cpp \
     141  Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \
     142  Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp \
     143  Actions/MoleculeAction/SaveAdjacencyAction.cpp \
     144  Actions/MoleculeAction/SaveBondsAction.cpp \
     145  Actions/MoleculeAction/SaveTemperatureAction.cpp \
     146  Actions/MoleculeAction/SuspendInWaterAction.cpp \
     147  Actions/MoleculeAction/TranslateAction.cpp \
     148  Actions/MoleculeAction/VerletIntegrationAction.cpp
     149MOLECULEACTIONHEADER = \
     150  Actions/MoleculeAction/BondFileAction.hpp \
     151  Actions/MoleculeAction/ChangeNameAction.hpp \
     152  Actions/MoleculeAction/FillWithMoleculeAction.hpp \
     153  Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \
     154  Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp \
     155  Actions/MoleculeAction/SaveAdjacencyAction.hpp \
     156  Actions/MoleculeAction/SaveBondsAction.hpp \
     157  Actions/MoleculeAction/SaveTemperatureAction.hpp \
     158  Actions/MoleculeAction/SuspendInWaterAction.hpp \
     159  Actions/MoleculeAction/TranslateAction.hpp \
     160  Actions/MoleculeAction/VerletIntegrationAction.hpp
    36161                 
    37 ACTIONSHEADER = Actions/Action.hpp \
    38                                 Actions/ActionHistory.hpp \
    39                                 Actions/ActionRegistry.hpp \
    40                                 Actions/ActionSequence.hpp \
    41                             Actions/Calculation.hpp \
    42                             Actions/Calculation_impl.hpp \
    43                             Actions/ErrorAction.hpp \
    44                             Actions/MakroAction.hpp \
    45                             Actions/ManipulateAtomsProcess.hpp \
    46                             Actions/MethodAction.hpp \
    47                             Actions/Process.hpp \
    48                             Actions/small_actions.hpp
    49                            
    50                            
    51 
    52 PATTERNSOURCE = Patterns/Observer.cpp
    53 PATTERNHEADER = Patterns/Cacheable.hpp \
    54                                 Patterns/Observer.hpp \
    55                 Patterns/Singleton.hpp
    56 
    57 VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp
    58 VIEWHEADER = Views/View.hpp Views/StringView.hpp Views/MethodStringView.hpp Views/StreamStringView.hpp
    59 
    60 MENUSOURCE = Menu/Menu.cpp Menu/TextMenu.cpp Menu/MenuItem.cpp Menu/SubMenuItem.cpp Menu/ActionMenuItem.cpp Menu/SeperatorItem.cpp Menu/DisplayMenuItem.cpp
    61 MENUHEADER = Menu/Menu.hpp Menu/TextMenu.hpp Menu/MenuItem.hpp Menu/SubMenuItem.hpp Menu/ActionMenuItem.hpp Menu/SeperatorItem.hpp Menu/DisplayMenuItem.hpp
    62 
    63 UISOURCE = ${ACTIONSSOURCE} ${VIEWSOURCE} ${MENUSOURCE} UIElements/UIFactory.cpp UIElements/TextUIFactory.cpp UIElements/MainWindow.cpp UIElements/TextWindow.cpp UIElements/TextStatusIndicator.cpp UIElements/Dialog.cpp UIElements/TextDialog.cpp
    64 UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/UIFactory.hpp UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/TextStatusIndicator.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp
     162PARSERACTIONSOURCE = \
     163  Actions/ParserAction/LoadXyzAction.cpp \
     164  Actions/ParserAction/SaveXyzAction.cpp       
     165PARSERACTIONHEADER = \
     166  Actions/ParserAction/LoadXyzAction.hpp \
     167  Actions/ParserAction/SaveXyzAction.hpp
     168
     169TESSELATIONACTIONSOURCE = \
     170  Actions/TesselationAction/ConvexEnvelopeAction.cpp \
     171  Actions/TesselationAction/NonConvexEnvelopeAction.cpp               
     172TESSELATIONACTIONHEADER = \
     173  Actions/TesselationAction/ConvexEnvelopeAction.hpp \
     174  Actions/TesselationAction/NonConvexEnvelopeAction.hpp
     175
     176WORLDACTIONSOURCE = \
     177  Actions/WorldAction/AddEmptyBoundaryAction.cpp \
     178  Actions/WorldAction/BoundInBoxAction.cpp \
     179  Actions/WorldAction/CenterInBoxAction.cpp \
     180  Actions/WorldAction/CenterOnEdgeAction.cpp \
     181  Actions/WorldAction/ChangeBoxAction.cpp \
     182  Actions/WorldAction/RemoveSphereOfAtomsAction.cpp \
     183  Actions/WorldAction/RepeatBoxAction.cpp \
     184  Actions/WorldAction/ScaleBoxAction.cpp \
     185  Actions/WorldAction/SetDefaultNameAction.cpp \
     186  Actions/WorldAction/SetGaussianBasisAction.cpp               
     187WORLDACTIONHEADER = \
     188  Actions/WorldAction/AddEmptyBoundaryAction.hpp \
     189  Actions/WorldAction/BoundInBoxAction.hpp \
     190  Actions/WorldAction/CenterInBoxAction.hpp \
     191  Actions/WorldAction/CenterOnEdgeAction.hpp \
     192  Actions/WorldAction/ChangeBoxAction.hpp \
     193  Actions/WorldAction/RemoveSphereOfAtomsAction.hpp \
     194  Actions/WorldAction/RepeatBoxAction.hpp \
     195  Actions/WorldAction/ScaleBoxAction.hpp \
     196  Actions/WorldAction/SetDefaultNameAction.hpp \
     197  Actions/WorldAction/SetGaussianBasisAction.hpp
     198
     199
     200
     201PARSERSOURCE = \
     202  Parser/ChangeTracker.cpp \
     203  Parser/FormatParser.cpp \
     204  Parser/TremoloParser.cpp \
     205  Parser/XyzParser.cpp
     206PARSERHEADER = \
     207  Parser/ChangeTracker.hpp \
     208  Parser/FormatParser.hpp \
     209  Parser/TremoloParser.hpp \
     210  Parser/XyzParser.hpp
     211
     212PATTERNSOURCE = \
     213  Patterns/Observer.cpp
     214PATTERNHEADER = \
     215  Patterns/Cacheable.hpp \
     216  Patterns/Observer.hpp \
     217  Patterns/Singleton.hpp
     218
     219# Below is all for the User Interface
     220
     221VIEWSOURCE = \
     222  Views/View.cpp \
     223  Views/StringView.cpp \
     224  Views/MethodStringView.cpp \
     225  Views/StreamStringView.cpp
     226VIEWHEADER = \
     227  Views/View.hpp \
     228  Views/StringView.hpp \
     229  Views/MethodStringView.hpp \
     230  Views/StreamStringView.hpp
     231
     232MENUSOURCE = \
     233  Menu/Menu.cpp \
     234  Menu/TextMenu.cpp \
     235  Menu/MenuItem.cpp \
     236  Menu/SubMenuItem.cpp \
     237  Menu/ActionMenuItem.cpp \
     238  Menu/SeperatorItem.cpp \
     239  Menu/DisplayMenuItem.cpp
     240 
     241MENUHEADER = \
     242  Menu/Menu.hpp \
     243  Menu/TextMenu.hpp \
     244  Menu/MenuItem.hpp \
     245  Menu/SubMenuItem.hpp \
     246  Menu/ActionMenuItem.hpp \
     247  Menu/SeperatorItem.hpp \
     248  Menu/DisplayMenuItem.hpp
     249
     250UISOURCE = \
     251  ${ACTIONSSOURCE} \
     252  ${COMMANDLINEUISOURCE} \
     253  ${MENUSOURCE} \
     254  ${TEXTUISOURCE} \
     255  ${VIEWSOURCE} \
     256  UIElements/Dialog.cpp \
     257  UIElements/MainWindow.cpp \
     258  UIElements/UIFactory.cpp
     259 
     260UIHEADER = \
     261  ${ACTIONSHEADER} \
     262  ${COMMANDLINEUIHEADER} \
     263  ${MENUHEADER} \
     264  ${TEXTUIHEADER} \
     265  ${VIEWHEADER} \
     266  UIElements/Dialog.hpp \
     267  UIElements/MainWindow.hpp \
     268  UIElements/UIFactory.hpp
     269
     270TEXTUISOURCE = \
     271  UIElements/TextDialog.cpp \
     272  UIElements/TextStatusIndicator.cpp \
     273  UIElements/TextUIFactory.cpp \
     274  UIElements/TextWindow.cpp
     275TEXTUIHEADER = \
     276  UIElements/TextDialog.hpp \
     277  UIElements/TextStatusIndicator.hpp \
     278  UIElements/TextUIFactory.hpp \
     279  UIElements/TextWindow.hpp
     280
     281COMMANDLINEUISOURCE = \
     282  UIElements/CommandLineDialog.cpp \
     283  UIElements/CommandLineStatusIndicator.cpp \
     284  UIElements/CommandLineUIFactory.cpp \
     285  UIElements/CommandLineWindow.cpp
     286COMMANDLINEUIHEADER = \
     287  UIElements/CommandLineDialog.hpp \
     288  UIElements/CommandLineStatusIndicator.hpp \
     289  UIElements/CommandLineUIFactory.hpp \
     290  UIElements/CommandLineWindow.hpp
    65291
    66292# all these files are only used for legacy reasons while the transition is in progress
     
    71297
    72298DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
    73                                    Descriptors/AtomIdDescriptor.cpp \
    74                                    Descriptors/AtomTypeDescriptor.cpp \
    75                                    Descriptors/MoleculeDescriptor.cpp \
    76                                    Descriptors/MoleculeIdDescriptor.cpp
     299  Descriptors/AtomIdDescriptor.cpp \
     300  Descriptors/AtomTypeDescriptor.cpp \
     301  Descriptors/MoleculeDescriptor.cpp \
     302  Descriptors/MoleculeIdDescriptor.cpp
    77303                                   
    78304                                   
    79305DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \
    80                                    Descriptors/AtomIdDescriptor.hpp \
    81                                    Descriptors/AtomTypeDescriptor.hpp \
    82                                    Descriptors/MoleculeDescriptor.hpp \
    83                                    Descriptors/MoleculeIdDescriptor.hpp
     306  Descriptors/AtomIdDescriptor.hpp \
     307  Descriptors/AtomTypeDescriptor.hpp \
     308  Descriptors/MoleculeDescriptor.hpp \
     309  Descriptors/MoleculeIdDescriptor.hpp
    84310                                   
    85 
    86 
    87311EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
    88                                   Exceptions/LinearDependenceException.cpp \
    89                                   Exceptions/MathException.cpp \
    90                                   Exceptions/ZeroVectorException.cpp
     312  Exceptions/LinearDependenceException.cpp \
     313  Exceptions/MathException.cpp \
     314  Exceptions/ZeroVectorException.cpp
    91315                                 
    92316EXCEPTIONHEADER = Exceptions/CustomException.hpp \
    93                                   Exceptions/LinearDependenceException.hpp \
    94                                   Exceptions/MathException.hpp \
    95                                   Exceptions/ZeroVectorException.hpp
    96 
    97 SOURCE = ${ANALYSISSOURCE} \
    98                  ${ATOMSOURCE} \
    99                  ${PATTERNSOURCE} \
    100                  ${UISOURCE} \
    101                  ${DESCRIPTORSOURCE} \
    102                  ${HELPERSOURCE} \
    103                  ${LEGACYSOURCE} \
    104                  ${EXCEPTIONSOURCE} \
    105                  bond.cpp \
    106                  bondgraph.cpp \
    107                  boundary.cpp \
    108                  config.cpp \
    109                  element.cpp \
    110                  ellipsoid.cpp \
    111                  errorlogger.cpp \
    112                  graph.cpp \
    113                  helpers.cpp \
    114                  info.cpp \
    115                  leastsquaremin.cpp \
    116                  Line.cpp \
    117                  linkedcell.cpp \
    118                  lists.cpp \
    119                  log.cpp \
    120                  logger.cpp \
    121                  memoryusageobserver.cpp \
    122                  moleculelist.cpp \
    123                  molecule.cpp \
    124                  molecule_dynamics.cpp \
    125                  molecule_fragmentation.cpp \
    126                  molecule_geometry.cpp \
    127                  molecule_graph.cpp \
    128                  molecule_pointcloud.cpp \
    129                  parser.cpp \
    130                  periodentafel.cpp \
    131                  Plane.cpp \
    132                  tesselation.cpp \
    133                  tesselationhelpers.cpp \
    134                  triangleintersectionlist.cpp \
    135                  verbose.cpp \
    136                  vector_ops.cpp \
    137                  World.cpp
     317  Exceptions/LinearDependenceException.hpp \
     318  Exceptions/MathException.hpp \
     319  Exceptions/ZeroVectorException.hpp
     320
     321SOURCE = \
     322  ${ANALYSISSOURCE} \
     323  ${ATOMSOURCE} \
     324  ${PATTERNSOURCE} \
     325  ${PARSERSOURCE} \
     326  ${UISOURCE} \
     327  ${DESCRIPTORSOURCE} \
     328  ${HELPERSOURCE} \
     329  ${LEGACYSOURCE} \
     330  ${EXCEPTIONSOURCE} \
     331  bond.cpp \
     332  bondgraph.cpp \
     333  boundary.cpp \
     334  CommandLineParser.cpp \
     335  config.cpp \
     336  element.cpp \
     337  ellipsoid.cpp \
     338  errorlogger.cpp \
     339  graph.cpp \
     340  helpers.cpp \
     341  info.cpp \
     342  leastsquaremin.cpp \
     343  Line.cpp \
     344  linkedcell.cpp \
     345  lists.cpp \
     346  log.cpp \
     347  logger.cpp \
     348  memoryusageobserver.cpp \
     349  moleculelist.cpp \
     350  molecule.cpp \
     351  molecule_dynamics.cpp \
     352  molecule_fragmentation.cpp \
     353  molecule_geometry.cpp \
     354  molecule_graph.cpp \
     355  molecule_pointcloud.cpp \
     356  parser.cpp \
     357  periodentafel.cpp \
     358  Plane.cpp \
     359  tesselation.cpp \
     360  tesselationhelpers.cpp \
     361  triangleintersectionlist.cpp \
     362  verbose.cpp \
     363  vector_ops.cpp \
     364  World.cpp
    138365
    139366HEADER = \
    140           ${ANALYSISHEADER} \
    141           ${ATOMHEADER} \
    142           ${PATTERNHEADER} \
    143           ${UIHEADER} \
    144           ${DESCRIPTORHEADER} \
    145           ${EXCEPTIONHEADER} \
    146           ${LEGACYHEADER} \
    147           bond.hpp \
    148           bondgraph.hpp \
    149           boundary.hpp \
    150           config.hpp \
    151           defs.hpp \
    152           element.hpp \
    153           ellipsoid.hpp \
    154           errorlogger.hpp \
    155           graph.hpp \
    156           helpers.hpp \
    157           info.hpp \
    158           leastsquaremin.hpp \
    159           Line.hpp \
    160           linkedcell.hpp \
    161           lists.hpp \
    162           log.hpp \
    163           logger.hpp \
    164           memoryallocator.hpp \
    165           memoryusageobserver.hpp \
    166           molecule.hpp \
    167           molecule_template.hpp \
    168           parser.hpp \
    169           periodentafel.hpp \
    170           Plane.hpp \
    171           stackclass.hpp \
    172           tesselation.hpp \
    173           tesselationhelpers.hpp \
    174           triangleintersectionlist.hpp \
    175           verbose.hpp \
    176           vector_ops.hpp \
    177           World.hpp
     367  ${ANALYSISHEADER} \
     368  ${ATOMHEADER} \
     369  ${PARSERHEADER} \
     370  ${PATTERNHEADER} \
     371  ${UIHEADER} \
     372  ${DESCRIPTORHEADER} \
     373  ${EXCEPTIONHEADER} \
     374  ${LEGACYHEADER} \
     375  bond.hpp \
     376  bondgraph.hpp \
     377  boundary.hpp \
     378  CommandLineParser.hpp \
     379  config.hpp \
     380  defs.hpp \
     381  element.hpp \
     382  ellipsoid.hpp \
     383  errorlogger.hpp \
     384  graph.hpp \
     385  helpers.hpp \
     386  info.hpp \
     387  leastsquaremin.hpp \
     388  Line.hpp \
     389  linkedcell.hpp \
     390  lists.hpp \
     391  log.hpp \
     392  logger.hpp \
     393  memoryallocator.hpp \
     394  memoryusageobserver.hpp \
     395  molecule.hpp \
     396  molecule_template.hpp \
     397  parser.hpp \
     398  periodentafel.hpp \
     399  Plane.hpp \
     400  stackclass.hpp \
     401  tesselation.hpp \
     402  tesselationhelpers.hpp \
     403  triangleintersectionlist.hpp \
     404  verbose.hpp \
     405  vector_ops.hpp \
     406  World.hpp
    178407
    179408BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
     
    188417molecuilder_LDFLAGS = $(BOOST_LDFLAGS)
    189418molecuilder_SOURCES = builder.cpp
    190 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
     419molecuilder_LDADD = libmolecuilder.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    191420joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    192421joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    193422analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp
    194423analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    195 
    196 #EXTRA_DIST = ${molecuilder_DATA}
    197424
    198425FORCE:
  • src/UIElements/Dialog.cpp

    r12872d rf941b1  
    1010#include "UIElements/Dialog.hpp"
    1111
     12#include "atom.hpp"
     13#include "element.hpp"
     14#include "molecule.hpp"
    1215#include "vector.hpp"
    1316
     
    5154
    5255// Base class
    53 Dialog::Query::Query(string _title) :
    54     title(_title)
     56Dialog::Query::Query(string _title, string _description) :
     57    title(_title),
     58    description(_description)
    5559{}
    5660
     
    6165}
    6266
     67const std::string Dialog::Query::getDescription() const{
     68  return description;
     69}
     70// empty Queries
     71
     72Dialog::EmptyQuery::EmptyQuery(string title, std::string description) :
     73    Query(title, description)
     74{}
     75
     76Dialog::EmptyQuery::~EmptyQuery() {}
     77
     78void Dialog::EmptyQuery::setResult() {
     79}
     80
    6381// Int Queries
    6482
    65 Dialog::IntQuery::IntQuery(string title,int *_target) :
    66     Query(title), target(_target)
     83Dialog::IntQuery::IntQuery(string title,int *_target, std::string description) :
     84    Query(title, description), target(_target)
    6785{}
    6886
     
    7391}
    7492
     93// Int Queries
     94
     95Dialog::BooleanQuery::BooleanQuery(string title,bool *_target, std::string description) :
     96    Query(title, description), target(_target)
     97{}
     98
     99Dialog::BooleanQuery::~BooleanQuery() {}
     100
     101void Dialog::BooleanQuery::setResult() {
     102  *target = tmp;
     103}
     104
    75105// String Queries
    76106
    77 Dialog::StringQuery::StringQuery(string title,string *_target) :
    78     Query(title), target(_target)
     107Dialog::StringQuery::StringQuery(string title,string *_target, std::string _description) :
     108    Query(title, _description), target(_target)
    79109{}
    80110
     
    87117// Double Queries
    88118
    89 Dialog::DoubleQuery::DoubleQuery(string title,double *_target) :
    90     Query(title), target(_target)
     119Dialog::DoubleQuery::DoubleQuery(string title,double *_target, std::string _description) :
     120    Query(title, _description), target(_target)
    91121{}
    92122
     
    98128
    99129
     130// Atom Queries
     131
     132Dialog::AtomQuery::AtomQuery(string title, atom **_target, std::string _description) :
     133    Query(title, _description),
     134    tmp(0),
     135    target(_target)
     136
     137{}
     138
     139Dialog::AtomQuery::~AtomQuery() {}
     140
     141void Dialog::AtomQuery::setResult() {
     142  *target = tmp;
     143}
     144
    100145// Molecule Queries
    101146
    102 Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, MoleculeListClass *_molecules) :
    103     Query(title),
     147Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, std::string _description) :
     148    Query(title, _description),
    104149    tmp(0),
    105     molecules(_molecules),
    106150    target(_target)
    107151
     
    116160// Vector Queries
    117161
    118 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check) :
    119   Query(title),
     162Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description) :
     163  Query(title, _description),
    120164  cellSize(_cellSize),
    121165  check(_check),
     
    134178}
    135179
     180// Box Queries
     181
     182Dialog::BoxQuery::BoxQuery(std::string title, double ** const _cellSize, std::string _description) :
     183  Query(title, _description),
     184  target(_cellSize)
     185{
     186    tmp = new double[6];
     187}
     188
     189Dialog::BoxQuery::~BoxQuery()
     190{
     191  delete[] tmp;
     192}
     193
     194void Dialog::BoxQuery::setResult() {
     195  for (int i=0;i<6;i++)
     196    *target[i] = tmp[i];
     197}
     198
    136199// Element Queries
    137 Dialog::ElementQuery::ElementQuery(std::string title, const element **_target) :
    138   Query(title),
     200Dialog::ElementQuery::ElementQuery(std::string title, const element **_target, std::string _description) :
     201  Query(title, _description),
    139202  tmp(0),
    140203  target(_target)
  • src/UIElements/Dialog.hpp

    r12872d rf941b1  
    1212#include<list>
    1313
    14 class MoleculeListClass;
     14class atom;
     15class element;
    1516class molecule;
    1617class Vector;
    17 class element;
    1818
    1919class Dialog
     
    2323  virtual ~Dialog();
    2424
    25   virtual void queryInt(const char *, int *)=0;
    26   virtual void queryDouble(const char*,double *)=0;
    27   virtual void queryString(const char*, std::string *)=0;
    28   virtual void queryMolecule(const char*,molecule**,MoleculeListClass*)=0;
    29   virtual void queryVector(const char*,Vector *,const double *const,bool)=0;
    30   virtual void queryElement(const char*,const element **)=0;
     25  virtual void queryEmpty(const char *, std::string = "")=0;
     26  virtual void queryBoolean(const char *, bool *, std::string = "")=0;
     27  virtual void queryInt(const char *, int *, std::string = "")=0;
     28  virtual void queryDouble(const char*,double *, std::string = "")=0;
     29  virtual void queryString(const char*, std::string *, std::string = "")=0;
     30  virtual void queryAtom(const char*,atom**,std::string = "")=0;
     31  virtual void queryMolecule(const char*,molecule**, std::string = "")=0;
     32  virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0;
     33  virtual void queryBox(const char*,double ** const, std::string = "")=0;
     34  virtual void queryElement(const char*,const element **, std::string = "")=0;
    3135
    3236  virtual bool display();
     
    4650  class Query {
    4751  public:
    48     Query(std::string _title);
     52    Query(std::string _title, std::string _description = "");
    4953    virtual ~Query();
    5054    virtual bool handle()=0;
     
    5256  protected:
    5357    const std::string getTitle() const;
     58    const std::string getDescription() const;
    5459  private:
    55     std::string title;
     60    std::string title;  //!< short title of the query
     61    std::string description; //!< longer description for tooltips or for help
     62  };
     63
     64  // Empty Query is just meant for showing text, such as version, help, initial message or alike
     65  class EmptyQuery : public Query {
     66  public:
     67    EmptyQuery(std::string title, std::string _description = "");
     68    virtual ~EmptyQuery();
     69    virtual bool handle()=0;
     70    virtual void setResult();
    5671  };
    5772
    5873  //Specialized classes for certain types. GUI-Types are not specialized at this time
     74  class BooleanQuery : public Query {
     75  public:
     76    BooleanQuery(std::string title,bool *_target, std::string _description = "");
     77    virtual ~BooleanQuery();
     78    virtual bool handle()=0;
     79    virtual void setResult();
     80  protected:
     81    bool tmp;
     82  private:
     83    bool *target;
     84  };
     85
    5986  class IntQuery : public Query {
    6087  public:
    61     IntQuery(std::string title,int *_target);
     88    IntQuery(std::string title,int *_target, std::string _description = "");
    6289    virtual ~IntQuery();
    6390    virtual bool handle()=0;
     
    7198  class DoubleQuery : public Query {
    7299  public:
    73     DoubleQuery(std::string title,double *_target);
     100    DoubleQuery(std::string title,double *_target, std::string _description = "");
    74101    virtual ~DoubleQuery();
    75102    virtual bool handle()=0;
     
    83110  class StringQuery : public Query {
    84111  public:
    85     StringQuery(std::string title,std::string *_target);
     112    StringQuery(std::string title,std::string *_target, std::string _description = "");
    86113    virtual ~StringQuery();
    87114    virtual bool handle()=0;
     
    93120  };
    94121
    95 
    96122  class MoleculeQuery : public Query {
    97123  public:
    98     MoleculeQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);
     124    MoleculeQuery(std::string title, molecule **_target, std::string _description = "");
    99125    virtual ~MoleculeQuery();
    100126    virtual bool handle()=0;
     
    102128  protected:
    103129    molecule *tmp;
    104     MoleculeListClass *molecules;
    105130  private:
    106131    molecule **target;
    107132  };
    108133
     134  class AtomQuery : public Query {
     135  public:
     136    AtomQuery(std::string title, atom **_target, std::string _description = "");
     137    virtual ~AtomQuery();
     138    virtual bool handle()=0;
     139    virtual void setResult();
     140  protected:
     141    atom *tmp;
     142  private:
     143    atom **target;
     144  };
     145
    109146  class VectorQuery : public Query {
    110147  public:
    111       VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);
     148      VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
    112149      virtual ~VectorQuery();
    113150      virtual bool handle()=0;
     
    121158  };
    122159
     160  class BoxQuery : public Query {
     161  public:
     162      BoxQuery(std::string title,double ** const _cellSize, std::string _description = "");
     163      virtual ~BoxQuery();
     164      virtual bool handle()=0;
     165      virtual void setResult();
     166    protected:
     167      double *tmp;
     168    private:
     169      double **target;
     170  };
     171
    123172  class ElementQuery : public Query {
    124173  public:
    125     ElementQuery(std::string title, const element**_target);
     174    ElementQuery(std::string title, const element**_target, std::string _description = "");
    126175    virtual ~ElementQuery();
    127176    virtual bool handle()=0;
     
    140189};
    141190
     191
    142192#endif /* DIALOG_HPP_ */
  • src/UIElements/MainWindow.hpp

    r12872d rf941b1  
    2525};
    2626
    27 /**
    28  * The type of menuPopulators
    29  */
    30 typedef void (*MenuMaker)(Menu*,MoleculeListClass*, config*, periodentafel*);
    31 
    32 /**
    33  * This contains all Functions that are used to create the menus.
    34  * Needs a specific funtion for each menu. All populators will be called
    35  * by the UIFactory upon creation of the main menu. Thus the actuall construction
    36  * of the Menus can be kept independent of the concrete type of UI that is being
    37  * built.
    38  */
    39 struct menuPopulaters{
    40   MenuMaker MakeEditMoleculesMenu;
    41 };
    4227
    4328#endif /* MAINWINDOW_HPP_ */
  • src/UIElements/TextDialog.cpp

    r12872d rf941b1  
    88#include <iostream>
    99
     10#include <Descriptors/AtomDescriptor.hpp>
     11#include <Descriptors/AtomIdDescriptor.hpp>
     12#include <Descriptors/MoleculeDescriptor.hpp>
     13#include <Descriptors/MoleculeIdDescriptor.hpp>
    1014#include "UIElements/TextDialog.hpp"
    1115
    1216#include "World.hpp"
    1317#include "periodentafel.hpp"
    14 #include "atom.hpp"
    15 #include "molecule.hpp"
    1618#include "log.hpp"
    1719#include "verbose.hpp"
    1820
     21#include "atom.hpp"
     22#include "element.hpp"
     23#include "molecule.hpp"
     24#include "vector.hpp"
     25
    1926using namespace std;
    2027
     
    2936
    3037
    31 void TextDialog::queryInt(const char* title, int* target){
    32   registerQuery(new IntTextQuery(title,target));
    33 }
    34 
    35 void TextDialog::queryDouble(const char* title, double* target){
    36   registerQuery(new DoubleTextQuery(title,target));
    37 }
    38 
    39 void TextDialog::queryString(const char* title, string* target){
    40   registerQuery(new StringTextQuery(title,target));
    41 }
    42 
    43 void TextDialog::queryMolecule(const char* title, molecule **target, MoleculeListClass *molecules) {
    44   registerQuery(new MoleculeTextQuery(title,target,molecules));
    45 }
    46 
    47 void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check) {
    48   registerQuery(new VectorTextQuery(title,target,cellSize,check));
    49 }
    50 
    51 void TextDialog::queryElement(const char* title, const element **target){
    52   registerQuery(new ElementTextQuery(title,target));
     38void TextDialog::queryEmpty(const char* title, string description){
     39  registerQuery(new EmptyTextQuery(title,description));
     40}
     41
     42void TextDialog::queryBoolean(const char* title, bool* target, string description){
     43  registerQuery(new BooleanTextQuery(title,target,description));
     44}
     45
     46void TextDialog::queryInt(const char* title, int* target, string description){
     47  registerQuery(new IntTextQuery(title,target,description));
     48}
     49
     50void TextDialog::queryDouble(const char* title, double* target, string description){
     51  registerQuery(new DoubleTextQuery(title,target,description));
     52}
     53
     54void TextDialog::queryString(const char* title, string* target, string description){
     55  registerQuery(new StringTextQuery(title,target,description));
     56}
     57
     58void TextDialog::queryAtom(const char* title, atom **target, string description) {
     59  registerQuery(new AtomTextQuery(title,target,description));
     60}
     61
     62void TextDialog::queryMolecule(const char* title, molecule **target, string description) {
     63  registerQuery(new MoleculeTextQuery(title,target,description));
     64}
     65
     66void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string description) {
     67  registerQuery(new VectorTextQuery(title,target,cellSize,check,description));
     68}
     69
     70void TextDialog::queryBox(const char* title,double ** const cellSize, string description) {
     71  registerQuery(new BoxTextQuery(title,cellSize,description));
     72}
     73
     74void TextDialog::queryElement(const char* title, const element **target, string description){
     75  registerQuery(new ElementTextQuery(title,target,description));
    5376}
    5477
    5578/************************** Query Infrastructure ************************/
    5679
    57 TextDialog::IntTextQuery::IntTextQuery(string title,int *_target) :
    58     Dialog::IntQuery(title,_target)
     80TextDialog::EmptyTextQuery::EmptyTextQuery(string title, std::string _description) :
     81    Dialog::EmptyQuery(title,_description)
     82{}
     83
     84TextDialog::EmptyTextQuery::~EmptyTextQuery() {}
     85
     86bool TextDialog::EmptyTextQuery::handle() {
     87  cout << "Message of " << getTitle() << ":\n" << getDescription() << "\n";
     88  return true;
     89}
     90
     91TextDialog::IntTextQuery::IntTextQuery(string title, int * _target, std::string _description) :
     92    Dialog::IntQuery(title,_target,_description)
    5993{}
    6094
     
    79113}
    80114
    81 TextDialog::StringTextQuery::StringTextQuery(string title,string *_target) :
    82     Dialog::StringQuery(title,_target)
     115TextDialog::BooleanTextQuery::BooleanTextQuery(string title, bool * _target, std::string _description) :
     116    Dialog::BooleanQuery(title,_target,_description)
     117{}
     118
     119TextDialog::BooleanTextQuery::~BooleanTextQuery() {}
     120
     121bool TextDialog::BooleanTextQuery::handle() {
     122  bool badInput = false;
     123  char input = ' ';
     124  do{
     125    badInput = false;
     126    Log() << Verbose(0) << getTitle();
     127    cin >> input;
     128    if ((input == 'y' ) || (input == 'Y')) {
     129      tmp = true;
     130    } else if ((input == 'n' ) || (input == 'N')) {
     131      tmp = false;
     132    } else {
     133      badInput=true;
     134      cin.clear();
     135      cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
     136      Log() << Verbose(0) << "Input was not of [yYnN]!" << endl;
     137    }
     138  } while(badInput);
     139  // clear the input buffer of anything still in the line
     140  cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
     141  return true;
     142}
     143
     144TextDialog::StringTextQuery::StringTextQuery(string title,string *_target, std::string _description) :
     145    Dialog::StringQuery(title,_target,_description)
    83146{}
    84147
     
    91154}
    92155
    93 TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target) :
    94     Dialog::DoubleQuery(title,_target)
     156TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target, std::string _description) :
     157    Dialog::DoubleQuery(title,_target,_description)
    95158{}
    96159
     
    114177}
    115178
    116 TextDialog::MoleculeTextQuery::MoleculeTextQuery(string title, molecule **_target, MoleculeListClass *_molecules) :
    117     Dialog::MoleculeQuery(title,_target,_molecules)
     179TextDialog::AtomTextQuery::AtomTextQuery(string title, atom **_target, std::string _description) :
     180    Dialog::AtomQuery(title,_target,_description)
     181{}
     182
     183TextDialog::AtomTextQuery::~AtomTextQuery() {}
     184
     185bool TextDialog::AtomTextQuery::handle() {
     186  int idxOfAtom=0;
     187  bool badInput = false;
     188  do{
     189    badInput = false;
     190    Log() << Verbose(0) << getTitle();
     191    cin >> idxOfAtom;
     192    if(cin.fail()){
     193      badInput = true;
     194      cin.clear();
     195      cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
     196      Log() << Verbose(0) << "Input was not a number!" << endl;
     197      continue;
     198    }
     199
     200    tmp = World::getInstance().getAtom(AtomById(idxOfAtom));
     201    if(!tmp && idxOfAtom!=-1){
     202      Log() << Verbose(0) << "Invalid Atom Index" << endl;
     203      badInput = true;
     204    }
     205
     206  } while(badInput);
     207  cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
     208  return (idxOfAtom!=-1);
     209}
     210
     211TextDialog::MoleculeTextQuery::MoleculeTextQuery(string title, molecule **_target, std::string _description) :
     212    Dialog::MoleculeQuery(title,_target,_description)
    118213{}
    119214
     
    135230    }
    136231
    137     tmp = molecules->ReturnIndex(idxOfMol);
     232    tmp = World::getInstance().getMolecule(MoleculeById(idxOfMol));
    138233    if(!tmp && idxOfMol!=-1){
    139234      Log() << Verbose(0) << "Invalid Molecule Index" << endl;
     
    146241}
    147242
    148 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check) :
    149     Dialog::VectorQuery(title,_target,_cellSize,_check)
     243TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) :
     244    Dialog::VectorQuery(title,_target,_cellSize,_check,_description)
    150245{}
    151246
     
    168263}
    169264
    170 
    171 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target) :
    172     Dialog::ElementQuery(title,target)
     265TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const _cellSize, std::string _description) :
     266    Dialog::BoxQuery(title,_cellSize,_description)
     267{}
     268
     269TextDialog::BoxTextQuery::~BoxTextQuery()
     270{}
     271
     272bool TextDialog::BoxTextQuery::handle() {
     273  Log() << Verbose(0) << getTitle();
     274
     275  std::string coords[6] = {"xx","xy","xz", "yy", "yz", "zz"};
     276  for (int i=0;i<6;i++) {
     277    Log() << Verbose(0) << coords[i] << ": ";
     278    cin >> tmp[i];
     279  }
     280  return true;
     281}
     282
     283TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target, std::string _description) :
     284    Dialog::ElementQuery(title,target,_description)
    173285{}
    174286
  • src/UIElements/TextDialog.hpp

    r12872d rf941b1  
    1313#include "UIElements/Dialog.hpp"
    1414
     15class atom;
     16class element;
     17class molecule;
     18class Vector;
     19
    1520class TextDialog : public Dialog
    1621{
     
    1924  virtual ~TextDialog();
    2025
    21   virtual void queryInt(const char *, int *);
    22   virtual void queryString(const char*, std::string *);
    23   virtual void queryDouble(const char*, double*);
    24   virtual void queryMolecule(const char*,molecule**,MoleculeListClass*);
    25   virtual void queryVector(const char*,Vector *,const double * const,bool);
    26   virtual void queryElement(const char*,const element **);
     26  virtual void queryEmpty(const char *, std::string = "");
     27  virtual void queryBoolean(const char *, bool *, std::string = "");
     28  virtual void queryInt(const char *, int *, std::string = "");
     29  virtual void queryString(const char*, std::string *, std::string = "");
     30  virtual void queryDouble(const char*, double*, std::string = "");
     31  virtual void queryAtom(const char*,atom**,std::string = "");
     32  virtual void queryMolecule(const char*,molecule**,std::string = "");
     33  virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = "");
     34  virtual void queryBox(const char*,double ** const, std::string = "");
     35  virtual void queryElement(const char*,const element **, std::string = "");
    2736
    2837protected:
    2938  // specialized stuff for text queries
     39  class EmptyTextQuery : public Dialog::EmptyQuery {
     40  public:
     41    EmptyTextQuery(std::string title, std::string _description = NULL);
     42    virtual ~EmptyTextQuery();
     43    virtual bool handle();
     44  };
     45
     46  class BooleanTextQuery : public Dialog::BooleanQuery {
     47  public:
     48    BooleanTextQuery(std::string title, bool *_target, std::string _description = NULL);
     49    virtual ~BooleanTextQuery();
     50    virtual bool handle();
     51  };
     52
    3053  class IntTextQuery : public Dialog::IntQuery {
    3154  public:
    32     IntTextQuery(std::string title, int *_target);
     55    IntTextQuery(std::string title, int *_target, std::string _description = NULL);
    3356    virtual ~IntTextQuery();
    3457    virtual bool handle();
     
    3760  class DoubleTextQuery : public Dialog::DoubleQuery {
    3861  public:
    39     DoubleTextQuery(std::string title, double *_target);
     62    DoubleTextQuery(std::string title, double *_target, std::string _description = NULL);
    4063    virtual ~DoubleTextQuery();
    4164    virtual bool handle();
     
    4467  class StringTextQuery : public Dialog::StringQuery {
    4568  public:
    46     StringTextQuery(std::string title, std::string *_target);
     69    StringTextQuery(std::string title, std::string *_target, std::string _description = NULL);
    4770    virtual ~StringTextQuery();
     71    virtual bool handle();
     72  };
     73
     74  class AtomTextQuery : public Dialog::AtomQuery {
     75  public:
     76    AtomTextQuery(std::string title, atom **_target, std::string _description = NULL);
     77    virtual ~AtomTextQuery();
    4878    virtual bool handle();
    4979  };
     
    5181  class MoleculeTextQuery : public Dialog::MoleculeQuery {
    5282  public:
    53     MoleculeTextQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);
     83    MoleculeTextQuery(std::string title, molecule **_target, std::string _description = NULL);
    5484    virtual ~MoleculeTextQuery();
    5585    virtual bool handle();
     
    5888  class VectorTextQuery : public Dialog::VectorQuery {
    5989  public:
    60     VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);
     90    VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = NULL);
    6191    virtual ~VectorTextQuery();
     92    virtual bool handle();
     93  };
     94
     95  class BoxTextQuery : public Dialog::BoxQuery {
     96  public:
     97    BoxTextQuery(std::string title,double ** const _cellSize, std::string _description = NULL);
     98    virtual ~BoxTextQuery();
    6299    virtual bool handle();
    63100  };
     
    65102  class ElementTextQuery : public Dialog::ElementQuery {
    66103  public:
    67     ElementTextQuery(std::string title, const element **_target);
     104    ElementTextQuery(std::string title, const element **_target, std::string _description = NULL);
    68105    virtual ~ElementTextQuery();
    69106    virtual bool handle();
  • src/UIElements/TextUIFactory.cpp

    r12872d rf941b1  
    2727}
    2828
    29 MainWindow* TextUIFactory::makeMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) {
    30   return new TextWindow(populaters,molecules,configuration,periode,ConfigFileName);
     29MainWindow* TextUIFactory::makeMainWindow() {
     30  return new TextWindow();
    3131}
    3232
  • src/UIElements/TextUIFactory.hpp

    r12872d rf941b1  
    1919
    2020  virtual Dialog* makeDialog();
    21   virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
     21  virtual MainWindow* makeMainWindow();
    2222
    2323protected:
  • src/UIElements/TextWindow.cpp

    r12872d rf941b1  
    2727#include "molecule.hpp"
    2828#include "periodentafel.hpp"
     29#include "World.hpp"
    2930
    3031#include "Legacy/oldmenu.hpp"
     
    3839#include "UIElements/TextStatusIndicator.hpp"
    3940#include "Actions/MethodAction.hpp"
     41#include "Actions/MoleculeAction/ChangeNameAction.hpp"
    4042#include "Actions/ErrorAction.hpp"
    4143#include "Actions/ActionRegistry.hpp"
     
    4850
    4951// TODO: see what code can be moved to a base class for Graphic and Text Windows
    50 TextWindow::TextWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName)
     52TextWindow::TextWindow()
    5153{
     54  MoleculeListClass *molecules = World::getInstance().getMolecules();
     55  config *configuration = World::getInstance().getConfig();
     56  periodentafel *periode = World::getInstance().getPeriode();
     57  char *ConfigFileName = NULL;
    5258  old_menu = new oldmenu;
    5359
     
    101107  // call all functions used to build the submenus
    102108
    103   populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode);
     109  populateEditMoleculesMenu(editMoleculesMenu);
    104110
    105111  Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu);
     
    125131  main_menu->display();
    126132}
     133
     134void TextWindow::populateEditMoleculesMenu(Menu* editMoleculesMenu)
     135{
     136  MoleculeListClass *molecules = World::getInstance().getMolecules();
     137  periodentafel *periode = World::getInstance().getPeriode();
     138
     139  // build the EditMoleculesMenu
     140  Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
     141  new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
     142
     143  Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
     144  new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
     145
     146  Action *changeFilenameAction = new MoleculeChangeNameAction();
     147  new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
     148
     149  Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
     150  new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
     151
     152  Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
     153  new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
     154
     155  Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
     156  new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
     157
     158}
  • src/UIElements/TextWindow.hpp

    r12872d rf941b1  
    1717class TextStatusIndicator;
    1818
     19
    1920class TextWindow : public MainWindow
    2021{
    2122public:
    22   TextWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
     23  TextWindow();
    2324  virtual ~TextWindow();
    2425
    2526  virtual void display();
    2627private:
     28  // populaters
     29  void populateEditMoleculesMenu(Menu* editMoleculesMenu);
     30
    2731  TextMenu *main_menu;
    2832
  • src/UIElements/UIFactory.cpp

    r12872d rf941b1  
    1313// all factories that can be used:
    1414#include "UIElements/TextUIFactory.hpp"
     15#include "UIElements/CommandLineUIFactory.hpp"
    1516
    1617UIFactory::UIFactory()
     
    3031      setInstance(new TextUIFactory());
    3132      break;
     33    case CommandLine:
     34      setInstance(new CommandLineUIFactory());
     35      break;
    3236
    3337    default:
  • src/UIElements/UIFactory.hpp

    r12872d rf941b1  
    1111class MainWindow;
    1212class Dialog;
    13 
    14 class MoleculeListClass;
    15 class config;
    16 class periodentafel;
    17 
    18 struct menuPopulaters;
     13class DialogDescription;
    1914
    2015#include "Patterns/Singleton.hpp"
     
    3126
    3227public:
    33   enum InterfaceTypes {Text};
     28  enum InterfaceTypes {Text, CommandLine};
    3429  virtual ~UIFactory();
    3530
     
    3732   * Produce some kind of main window, of whichever type was chosen when the factory was created
    3833   */
    39   virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *)=0;
     34  virtual MainWindow* makeMainWindow()=0;
    4035
    4136  /**
  • src/World.cpp

    r12872d rf941b1  
    99
    1010#include "atom.hpp"
     11#include "config.hpp"
    1112#include "molecule.hpp"
    1213#include "periodentafel.hpp"
     
    2728}
    2829
     30config *&World::getConfig(){
     31  return configuration;
     32}
     33
    2934// Atoms
    3035
     
    5358std::vector<molecule*> World::getAllMolecules(MoleculeDescriptor descriptor){
    5459  return descriptor.findAll();
     60}
     61
     62std::vector<molecule*> World::getAllMolecules(){
     63  return getAllMolecules(AllMolecules());
    5564}
    5665
     
    267276World::World() :
    268277    periode(new periodentafel),
     278    configuration(new config),
    269279    atoms(),
    270280    currAtomId(0),
     
    292302  delete molecules_deprecated;
    293303  delete periode;
     304  delete configuration;
    294305  MoleculeSet::iterator molIter;
    295306  for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
  • src/World.hpp

    r12872d rf941b1  
    3030
    3131// forward declarations
     32class config;
    3233class periodentafel;
    3334class MoleculeListClass;
     
    7576
    7677  /**
     78   * returns the configuration for the world.
     79   */
     80  config *&getConfig();
     81
     82  /**
    7783   * returns the first atom that matches a given descriptor.
    7884   * Do not rely on ordering for descriptors that match more than one atom.
     
    109115   */
    110116  std::vector<molecule*> getAllMolecules(MoleculeDescriptor descriptor);
     117  std::vector<molecule*> getAllMolecules();
    111118
    112119  /**
     
    234241
    235242  periodentafel *periode;
     243  config *configuration;
    236244  static double *cell_size;
    237245  static char *defaultName;
  • src/atom_bondedparticle.cpp

    r12872d rf941b1  
    7474      *BondFile << nr << "\t" << (*Runner)->GetOtherAtom(this)->nr << "\n";
    7575};
     76
     77/**
     78 * Adds a bond between this bonded particle and another. Does nothing if this
     79 * bond already exists.
     80 *
     81 * \param bonding partner
     82 */
     83void BondedParticle::addBond(BondedParticle* Partner) {
     84  if (IsBondedTo(Partner)) {
     85    return;
     86  }
     87
     88  bond* newBond = new bond((atom*) this, (atom*) Partner, 1, 0);
     89  RegisterBond(newBond);
     90  Partner->RegisterBond(newBond);
     91}
    7692
    7793/** Puts a given bond into atom::ListOfBonds.
  • src/atom_bondedparticle.hpp

    r12872d rf941b1  
    3737  virtual ~BondedParticle();
    3838
     39  void addBond(BondedParticle* Partner);
    3940  bool RegisterBond(bond *Binder);
    4041  bool UnregisterBond(bond *Binder);
  • src/atom_particleinfo.cpp

    r12872d rf941b1  
    1616    nr(pointer->nr),
    1717    Name(pointer->Name)
    18     {}
     18    {
     19      if (Name == NULL)
     20        Name = " ";
     21    }
    1922
    2023
  • src/bond.cpp

    r12872d rf941b1  
    1515/** Empty Constructor for class bond.
    1616 */
    17 bond::bond() : leftatom(NULL), rightatom(NULL), previous(NULL), next(NULL), HydrogenBond(0), BondDegree(0), nr(-1), Cyclic(false), Type(Undetermined), Used(white)
     17bond::bond()
     18  : leftatom(NULL), rightatom(NULL), previous(NULL), next(NULL), HydrogenBond(0),
     19    BondDegree(0), nr(-1), Cyclic(false), Type(Undetermined), Used(white)
    1820{
    1921};
     
    2527 * \param number increasing index
    2628 */
    27 bond::bond(atom *left, atom *right, const int degree, const int number) : leftatom(left), rightatom(right), previous(NULL), next(NULL), HydrogenBond(0), BondDegree(degree), nr(number), Cyclic(false), Type(Undetermined), Used(white)
     29bond::bond(atom *left, atom *right, const int degree, const int number)
     30  : leftatom(left), rightatom(right), previous(NULL), next(NULL), HydrogenBond(0),
     31    BondDegree(degree), nr(number), Cyclic(false), Type(Undetermined), Used(white)
    2832{
    2933  if ((left != NULL) && (right != NULL)) {
  • src/bondgraph.hpp

    r12872d rf941b1  
    2727
    2828class molecule;
    29 class periodentafel;
     29class BondedParticle;
    3030class MatrixContainer;
    3131
  • src/builder.cpp

    r12872d rf941b1  
    6060#include "bondgraph.hpp"
    6161#include "boundary.hpp"
     62#include "CommandLineParser.hpp"
    6263#include "config.hpp"
    6364#include "element.hpp"
     
    7677#include "Actions/ActionRegistry.hpp"
    7778#include "Actions/ActionHistory.hpp"
     79#include "Actions/MapOfActions.hpp"
    7880#include "Actions/MethodAction.hpp"
    79 #include "Actions/small_actions.hpp"
     81#include "Actions/MoleculeAction/ChangeNameAction.hpp"
    8082#include "World.hpp"
    8183#include "version.h"
     
    14791481
    14801482/** Parses the command line options.
     1483 * Note that this function is from now on transitional. All commands that are not passed
     1484 * here are handled by CommandLineParser and the actions of CommandLineUIFactory.
    14811485 * \param argc argument count
    14821486 * \param **argv arguments array
     
    14861490 * \param *ConfigFileName pointer to config file name in **argv
    14871491 * \param *PathToDatabases pointer to db's path in **argv
     1492 * \param &ArgcList list of arguments that we do not parse here
    14881493 * \return exit code (0 - successful, all else - something's wrong)
    14891494 */
    1490 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,\
    1491                                    config& configuration, char *&ConfigFileName)
     1495static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,
     1496                                   config& configuration, char *&ConfigFileName, list<int> &ArgcList)
    14921497{
    14931498  Vector x,y,z,n;  // coordinates for absolute point in cell volume
     
    15071512  molecule *mol = NULL;
    15081513  string BondGraphFileName("\n");
    1509   int verbosity = 0;
    15101514  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    15111515
     
    15211525          case 'H':
    15221526          case '?':
    1523             DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl);
    1524             DoLog(0) && (Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl);
    1525             DoLog(0) && (Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl);
    1526             DoLog(0) && (Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl);
    1527             DoLog(0) && (Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl);
    1528             DoLog(0) && (Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl);
    1529             DoLog(0) && (Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl);
    1530             DoLog(0) && (Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl);
    1531             DoLog(0) && (Log() << Verbose(0) << "\t-C <type> [params] <output> <bin output> <BinWidth> <BinStart> <BinEnd>\tPair Correlation analysis." << endl);
    1532             DoLog(0) && (Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl);
    1533             DoLog(0) && (Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl);
    1534             DoLog(0) && (Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl);
    1535             DoLog(0) && (Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl);
    1536             DoLog(0) && (Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl);
    1537             DoLog(0) && (Log() << Verbose(0) << "\t-F <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl);
    1538             DoLog(0) && (Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl);
    1539             DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl);
    1540             DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl);
    1541             DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl);
    1542             DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl);
    1543             DoLog(0) && (Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl);
    1544             DoLog(0) && (Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl);
    1545             DoLog(0) && (Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl);
    1546             DoLog(0) && (Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl);
    1547             DoLog(0) && (Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl);
    1548             DoLog(0) && (Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl);
    1549             DoLog(0) && (Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl);
    1550             DoLog(0) && (Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl);
    1551             DoLog(0) && (Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl);
    1552             DoLog(0) && (Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl);
    1553             DoLog(0) && (Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl);
    1554             DoLog(0) && (Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl);
    1555             DoLog(0) && (Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl);
    1556             DoLog(0) && (Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl);
    1557             DoLog(0) && (Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl);
    1558             DoLog(0) && (Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl);
    1559             DoLog(0) && (Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl);
    1560             DoLog(0) && (Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl);
    1561             DoLog(0) && (Log() << Verbose(0) << "\t-V\t\tGives version information." << endl);
    1562             DoLog(0) && (Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl);
    1563             DoLog(0) && (Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl);
    1564             return (1);
     1527            ArgcList.push_back(argptr-1);
     1528            return(1);
    15651529            break;
    15661530          case 'v':
    1567             while (argv[argptr-1][verbosity+1] == 'v') {
    1568               verbosity++;
    1569             }
    1570             setVerbosity(verbosity);
    1571             DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
     1531            ArgcList.push_back(argptr-1);
     1532            return(1);
    15721533            break;
    15731534          case 'V':
    1574             DoLog(0) && (Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl);
    1575             DoLog(0) && (Log() << Verbose(0) << "Build your own molecule position set." << endl);
    1576             return (1);
     1535            ArgcList.push_back(argptr-1);
     1536            ArgcList.push_back(argptr);
     1537            argptr++;
    15771538            break;
    15781539          case 'B':
     
    25112472};
    25122473
    2513 /***************************************** Functions used to build all menus **********************/
    2514 
    2515 void populateEditMoleculesMenu(Menu* editMoleculesMenu,MoleculeListClass *molecules, config *configuration, periodentafel *periode){
    2516   // build the EditMoleculesMenu
    2517   Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
    2518   new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
    2519 
    2520   Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
    2521   new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
    2522 
    2523   Action *changeFilenameAction = new ChangeMoleculeNameAction(molecules);
    2524   new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
    2525 
    2526   Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
    2527   new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
    2528 
    2529   Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
    2530   new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
    2531 
    2532   Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
    2533   new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
    2534 
    2535 }
    2536 
    2537 
    25382474/********************************************** Main routine **************************************/
    25392475
    2540 void cleanUp(config *configuration){
    2541   UIFactory::purgeInstance();
     2476void cleanUp(){
    25422477  World::purgeInstance();
    2543   delete(configuration);
    25442478  Log() << Verbose(0) <<  "Maximum of allocated memory: "
    25452479    << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     
    25492483  logger::purgeInstance();
    25502484  errorLogger::purgeInstance();
     2485  UIFactory::purgeInstance();
     2486  MapOfActions::purgeInstance();
     2487  CommandLineParser::purgeInstance();
    25512488  ActionRegistry::purgeInstance();
    25522489  ActionHistory::purgeInstance();
     
    25552492int main(int argc, char **argv)
    25562493{
    2557     molecule *mol = NULL;
    2558     config *configuration = new config;
     2494    config *configuration = World::getInstance().getConfig();
    25592495    Vector x, y, z, n;
    25602496    ifstream test;
    25612497    ofstream output;
    25622498    string line;
    2563     char *ConfigFileName = NULL;
    2564     int j;
     2499    char **Arguments = NULL;
     2500    int ArgcSize = 0;
     2501    bool ArgumentsCopied = false;
    25652502
    25662503    cout << ESPACKVersion << endl;
     
    25692506    // need to init the history before any action is created
    25702507    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;
     2508
     2509    // Parse command line options and if present create respective UI
     2510    {
     2511      list<int> ArgcList;
     2512      ArgcList.push_back(0); // push back program!
     2513      ArgcList.push_back(1); // push back config file name
     2514      char ConfigFileName[MAXSTRINGSIZE];
     2515      // handle arguments by ParseCommandLineOptions()
     2516      ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
     2517      // copy all remaining arguments to a new argv
     2518      Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments");
     2519      cout << "The following arguments are handled by CommandLineParser: ";
     2520      for (list<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
     2521        Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]");
     2522        strcpy(Arguments[ArgcSize], argv[*ArgcRunner]);
     2523        cout << " " << argv[*ArgcRunner];
     2524        ArgcSize++;
     2525      }
     2526      cout << endl;
     2527      ArgumentsCopied = true;
     2528      // handle remaining arguments by CommandLineParser
     2529      MapOfActions::getInstance().AddOptionsToParser();
     2530      CommandLineParser::getInstance().Run(ArgcSize,Arguments);
     2531      if (!CommandLineParser::getInstance().isEmpty()) {
     2532        DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
     2533        UIFactory::makeUserInterface(UIFactory::CommandLine);
     2534      } else {
     2535        DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
     2536        UIFactory::makeUserInterface(UIFactory::Text);
     2537      }
    25812538    }
    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     }
    25952539
    25962540    {
    2597       cout << ESPACKVersion << endl;
    2598 
    2599       setVerbosity(0);
    2600 
    2601       menuPopulaters populaters;
    2602       populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu;
    2603 
    2604       UIFactory::makeUserInterface(UIFactory::Text);
    2605       MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName);
     2541      MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow();
    26062542      mainWindow->display();
    26072543      delete mainWindow;
     
    26142550        Log() << Verbose(0) << "Saving of elements.db failed." << endl;
    26152551
    2616   cleanUp(configuration);
    2617 
     2552  // free the new argv
     2553  if (ArgumentsCopied) {
     2554    for (int i=0; i<ArgcSize;i++)
     2555      Free(&Arguments[i]);
     2556    Free(&Arguments);
     2557  }
     2558
     2559  cleanUp();
    26182560  Memory::getState();
    26192561  return (0);
  • src/molecule.hpp

    r12872d rf941b1  
    3535#include "Patterns/Observer.hpp"
    3636#include "Patterns/Cacheable.hpp"
     37
     38#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3739
    3840/****************************************** forward declarations *****************************/
  • src/unittests/Makefile.am

    r12872d rf941b1  
     1# PLEASE adhere to the alphabetical ordering in this Makefile!
     2# Also indentation by a single tab
     3
    14INCLUDES = -I$(top_srcdir)/src
    25
     
    3235  PlaneUnittest \
    3336  ObserverTest \
     37  ParserUnitTest \
    3438  SingletonTest \
    3539  StackClassUnitTest \
     
    7377  PlaneUnittest.cpp \
    7478  ObserverTest.cpp \
     79  ParserUnitTest.cpp \
    7580  SingletonTest.cpp \
    7681  stackclassunittest.cpp \
     
    114119 
    115120
     121ActionSequenceTest_SOURCES = UnitTestMain.cpp ../../../TestRunnerClient.hpp ActionSequenceTest.cpp ActionSequenceTest.hpp
     122ActionSequenceTest_LDADD = ${ALLLIBS}
     123
    116124ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
    117125ActOnAllUnitTest_LDADD = ${ALLLIBS}
     
    132140atomsCalculationTest_LDADD = ${ALLLIBS}
    133141
     142AtomDescriptorTest_SOURCES = UnitTestMain.cpp AtomDescriptorTest.cpp AtomDescriptorTest.hpp
     143AtomDescriptorTest_LDADD = ${ALLLIBS}
     144
    134145BondGraphUnitTest_SOURCES = UnitTestMain.cpp bondgraphunittest.cpp bondgraphunittest.hpp
    135146BondGraphUnitTest_LDADD = ${ALLLIBS}
    136147
     148CacheableTest_SOURCES = UnitTestMain.cpp CacheableTest.cpp CacheableTest.hpp
     149CacheableTest_LDADD = ${ALLLIBS}
     150
    137151CountBondsUnitTest_SOURCES = UnitTestMain.cpp CountBondsUnitTest.cpp CountBondsUnitTest.hpp
    138152CountBondsUnitTest_LDADD = ${ALLLIBS}
     
    162176LogUnitTest_LDADD = ${ALLLIBS}
    163177
     178manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
     179manipulateAtomsTest_LDADD = ${ALLLIBS}
     180
    164181MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp
    165182MemoryAllocatorUnitTest_LDADD = ${ALLLIBS}
     
    171188MoleculeDescriptorTest_LDADD = ${ALLLIBS}
    172189
     190ObserverTest_SOURCES = UnitTestMain.cpp ObserverTest.cpp ObserverTest.hpp
     191ObserverTest_LDADD = ${ALLLIBS}
     192
     193ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
     194ParserUnitTest_LDADD = ${ALLLIBS}
     195
    173196PlaneUnittest_SOURCES = UnitTestMain.cpp PlaneUnittest.cpp PlaneUnittest.hpp
    174197PlaneUnittest_LDADD = ${ALLLIBS}
     
    189212Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}
    190213
     214TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS)
     215TestRunner_LDADD = ${ALLLIBS}
     216
    191217VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp
    192218VectorUnitTest_LDADD = ${ALLLIBS}
    193219
    194 ActionSequenceTest_SOURCES = UnitTestMain.cpp ../../../TestRunnerClient.hpp ActionSequenceTest.cpp ActionSequenceTest.hpp
    195 ActionSequenceTest_LDADD = ${ALLLIBS}
    196 
    197 ObserverTest_SOURCES = UnitTestMain.cpp ObserverTest.cpp ObserverTest.hpp
    198 ObserverTest_LDADD = ${ALLLIBS}
    199 
    200 CacheableTest_SOURCES = UnitTestMain.cpp CacheableTest.cpp CacheableTest.hpp
    201 CacheableTest_LDADD = ${ALLLIBS}
    202 
    203 AtomDescriptorTest_SOURCES = UnitTestMain.cpp AtomDescriptorTest.cpp AtomDescriptorTest.hpp
    204 AtomDescriptorTest_LDADD = ${ALLLIBS}
    205 
    206 manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
    207 manipulateAtomsTest_LDADD = ${ALLLIBS}
    208 
    209 TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS)
    210 TestRunner_LDADD = ${ALLLIBS}
    211 
    212220#AUTOMAKE_OPTIONS = parallel-tests
    213 
  • src/unittests/SingletonTest.cpp

    r12872d rf941b1  
    5252    count1++;
    5353  }
    54   // explicit copy constructor to catch if thsi is ever called
     54  // explicit copy constructor to catch if this is ever called
    5555  SingletonStub2(const SingletonStub2&){
    5656    CPPUNIT_FAIL    ( "Copy constructor of Singleton called" );
  • src/unittests/TestRunnerMain.cpp

    r12872d rf941b1  
    66 */
    77
     8// include config.h
     9#ifdef HAVE_CONFIG_H
     10#include <config.h>
     11#endif
     12
     13#ifdef HAVE_ECUT
    814// give the main function its correct name
    915#define CPPUNIT_MAIN main
    10 
    1116// include the TestRunnerClient file containing the main class
    1217#include "../../../TestRunnerClient.h"
    1318#include "../../../TestRunnerClient.cpp"
     19#else
     20#include "UnitTestMain.cpp"
     21#endif
     22
Note: See TracChangeset for help on using the changeset viewer.