Changes in / [f761c4:ec149d]


Ignore:
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    rf761c4 rec149d  
    77doc:
    88        cd doc && make doxygen-docs
    9        
    10 unity:
    11         cd src && make unity
  • src/Actions/CmdAction/FastParsingAction.cpp

    rf761c4 rec149d  
    7878
    7979Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){
    80   return performUndo(_state);
     80  performUndo(_state);
    8181}
    8282
  • src/Actions/CmdAction/VerboseAction.cpp

    rf761c4 rec149d  
    7676
    7777Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){
    78   return performUndo(_state);
     78  performUndo(_state);
    7979}
    8080
  • src/Actions/FragmentationAction/SubgraphDissectionAction.hpp

    rf761c4 rec149d  
    77
    88#ifndef SUBGRAPHDISSECTIONACTION_HPP_
    9 #define SUBGRAPHDISSECTIONACTION_HPP_
     9#define SUBGRAPHDISSECTIONACTION_HPP_f
    1010
    1111#include "Actions/Action.hpp"
  • src/Actions/Makefile.am

    rf761c4 rec149d  
    168168  WorldAction/SetOutputFormatsAction.hpp               
    169169
    170 unity.cpp:
    171         echo "" >  unity.cpp; \
    172         list='$(ACTIONSSOURCE)'; for file in $$list; do \
    173           echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
    174         done;
    175        
    176 MOSTLYCLEANFILES = unity.cpp
  • src/Actions/SelectionAction/NotAllAtomsAction.cpp

    rf761c4 rec149d  
    2828// memento to remember the state when undoing
    2929
    30 class SelectionNotAllAtomsState : public ActionState {
     30class SelectionAllAtomsState : public ActionState {
    3131public:
    32   SelectionNotAllAtomsState(std::vector<atom*> _selectedAtoms) :
     32  SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
    3333    selectedAtoms(_selectedAtoms)
    3434  {}
     
    6161  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms." << endl);
    6262  World::getInstance().clearAtomSelection();
    63   return Action::state_ptr(new SelectionNotAllAtomsState(selectedAtoms));
     63  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
    6464}
    6565
    6666Action::state_ptr SelectionNotAllAtomsAction::performUndo(Action::state_ptr _state) {
    67   SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
     67  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
    6868
    6969  World::getInstance().clearAtomSelection();
     
    7171    World::getInstance().selectAtom(*iter);
    7272
    73   return Action::state_ptr(new SelectionNotAllAtomsState(state->selectedAtoms));
     73  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
    7474}
    7575
    7676Action::state_ptr SelectionNotAllAtomsAction::performRedo(Action::state_ptr _state){
    77   SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
     77  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
    7878
    7979  World::getInstance().clearAtomSelection();
    8080
    81   return Action::state_ptr(new SelectionNotAllAtomsState(state->selectedAtoms));
     81  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
    8282}
    8383
  • src/Actions/WorldAction/SetDefaultNameAction.cpp

    rf761c4 rec149d  
    7979
    8080Action::state_ptr WorldSetDefaultNameAction::performRedo(Action::state_ptr _state){
    81   return performUndo(_state);
     81  performUndo(_state);
    8282}
    8383
  • src/Actions/WorldAction/SetGaussianBasisAction.cpp

    rf761c4 rec149d  
    7979
    8080Action::state_ptr WorldSetGaussianBasisAction::performRedo(Action::state_ptr _state){
    81   return performUndo(_state);
     81  performUndo(_state);
    8282}
    8383
  • src/Formula.cpp

    rf761c4 rec149d  
    5555
    5656void Formula::fromString(const std::string &formula) throw(ParseError){
    57   // make this transactional, in case an error is thrown
    58   Formula res;
    59   string::const_iterator begin = formula.begin();
    60   string::const_iterator end = formula.end();
    61   res.parseFromString(begin,end,static_cast<char>(0));
    62   (*this)=res;
    63 }
    64 
    65 int Formula::parseMaybeNumber(string::const_iterator &it,string::const_iterator &end) throw(ParseError){
    66   static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
    67   int count = 0;
    68   while(it!=end && Numbers.isInRange(*it))
    69     count = (count*10) + ((*it++)-Numbers.first);
    70   // one is implicit
    71   count = (count!=0)?count:1;
    72   return count;
    73 }
    74 
    75 void Formula::parseFromString(string::const_iterator &it,string::const_iterator &end,char delimiter) throw(ParseError){
    7657  // some constants needed for parsing... Assumes ASCII, change if other encodings are used
    7758  static const range<char> CapitalLetters = makeRange('A',static_cast<char>('Z'+1));
    7859  static const range<char> SmallLetters = makeRange('a',static_cast<char>('z'+1));
    79   map<char,char> delimiters;
    80   delimiters['('] = ')';
    81   delimiters['['] = ']';
     60  static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
    8261  // clean the formula
    8362  clear();
    84   for(/*send from above*/;it!=end && *it!=delimiter;/*updated in loop*/){
    85     // we might have a sub formula
    86     if(delimiters.count(*it)){
    87       Formula sub;
    88       char nextdelim=delimiters[*it];
    89       sub.parseFromString(++it,end,nextdelim);
    90       if(!sub.getElementCount()){
    91         throw(ParseError(__FILE__,__LINE__));
    92       }
    93       int count = parseMaybeNumber(++it,end);
    94       addFormula(sub,count);
    95       continue;
    96     }
     63  string::const_iterator end = formula.end(); // will be used frequently
     64  for(string::const_iterator it=formula.begin();it!=end;){
    9765    string shorthand;
    9866    // Atom names start with a capital letter
     
    10371    while(it!=end && SmallLetters.isInRange(*it))
    10472      shorthand+=(*it++);
    105     int count = parseMaybeNumber(it,end);
     73    // now we can count the occurences
     74    int count = 0;
     75    while(it!=end && Numbers.isInRange(*it))
     76      count = (count*10) + ((*it++)-Numbers.first);
     77    // one is implicit
     78    count = (count!=0)?count:1;
    10679    // test if the shorthand exists
    10780    if(!World::getInstance().getPeriode()->FindElement(shorthand))
     
    11083    addElements(shorthand,count);
    11184  }
    112   if(it==end && delimiter!=0){
    113     throw(ParseError(__FILE__,__LINE__));
    114   }
    11585}
    11686
     
    12393    *output << "#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol" << endl;
    12494    for(const_iterator iter=begin(); iter!=end();++iter){
     95      (*iter).first->No = No;
    12596      result = result && (*iter).first->Checkout(output, No++, (*iter).second);
    12697    }
     
    224195}
    225196
    226 void Formula::addFormula(const Formula &formula,unsigned int n){
    227   for(Formula::const_iterator iter=formula.begin();iter!=formula.end();++iter){
    228     this->addElements(iter->first,iter->second*n);
    229   }
    230 }
    231 
    232 enumeration<Formula::key_type> Formula::enumerateElements() const{
    233   enumeration<key_type> res(1);
    234   for(Formula::const_iterator iter=begin();iter!=end();++iter){
    235     res.add(iter->first);
    236   }
    237   return res;
    238 }
    239 
    240197const unsigned int Formula::operator[](const element *element) const{
    241198  ASSERT(element,"Invalid pointer in access of Formula");
  • src/Formula.hpp

    rf761c4 rec149d  
    1616
    1717#include "types.hpp"
    18 #include "helpers.hpp"
    1918
    2019class element;
     
    2322{
    2423public:
    25   typedef const element*                                key_type;
     24  typedef element*                                      key_type;
    2625  typedef unsigned int                                  mapped_type;
    2726  typedef std::pair<key_type, mapped_type>              value_type;
     
    6665
    6766  unsigned int getElementCount() const;
    68   bool hasElement(key_type)             const;
     67  bool hasElement(const element*)       const;
    6968  bool hasElement(atomicNumber_t)       const;
    7069  bool hasElement(const std::string&)   const;
    7170
    72   void operator+=(key_type);
     71  void operator+=(const element*);
    7372  void operator+=(atomicNumber_t);
    7473  void operator+=(const std::string&);
    7574
    76   void operator-=(key_type);
     75  void operator-=(const element*);
    7776  void operator-=(atomicNumber_t);
    7877  void operator-=(const std::string&);
    7978
    80   void addElements(key_type,unsigned int);
     79  void addElements(const element*,unsigned int);
    8180  void addElements(atomicNumber_t,unsigned int);
    8281  void addElements(const std::string&,unsigned int);
    8382
    84   void addFormula(const Formula&,unsigned int);
    85 
    86   enumeration<key_type> enumerateElements() const;
    87 
    8883  // only const versions, because someone might try to increment a previously
    8984  // not set element
    90   const unsigned int operator[](key_type) const;
     85  const unsigned int operator[](const element*) const;
    9186  const unsigned int operator[](atomicNumber_t) const;
    9287  const unsigned int operator[](std::string)    const;
     
    10398
    10499private:
    105   void parseFromString(std::string::const_iterator&,std::string::const_iterator&,char) throw(ParseError);
    106   int parseMaybeNumber(std::string::const_iterator &it,std::string::const_iterator &end) throw(ParseError);
    107100  // this contains all counts of elements in the formula
    108101  // the size of the actual structure might be used in comparisons
  • src/Helpers/Assert.cpp

    rf761c4 rec149d  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Helpers/Assert.hpp"
     
    4446}
    4547
     48using namespace Assert;
     49
    4650#ifndef NDEBUG
    4751
    48 #ifdef __GNUC__
    49 #include <cstdlib>
    50 #include <execinfo.h>
    51 #include <cxxabi.h>
    52 #endif
     52Action _my_assert::defaultAction = Ask;
     53std::vector<Assert::hook_t> _my_assert::hooks;
    5354
    54 Assert::Action Assert::_my_assert::defaultAction = Ask;
    55 std::vector<Assert::hook_t> Assert::_my_assert::hooks;
     55std::map<std::string,bool> _wrapper::ignores;
     56const char* _wrapper::message_ptr = "source pointer did not point to object of desired type";
     57const char* _wrapper::message_ref = "source reference did not contain object of desired type";
    5658
    57 std::map<std::string,bool> Assert::_wrapper::ignores;
    58 const char* Assert::_wrapper::message_ptr = "source pointer did not point to object of desired type";
    59 const char* Assert::_wrapper::message_ref = "source reference did not contain object of desired type";
    6059
    61 bool Assert::_my_assert::check(const char* condition,
    62                                const char* message,
    63                                const char* filename,
    64                                const int line,
    65                                bool& ignore)
     60bool _my_assert::check(const bool res,
     61                       const char* condition,
     62                       const char* message,
     63                       const char* filename,
     64                       const int line,
     65                       bool& ignore)
    6666{
    67   cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl;
    68   cout << "Assertion Message: " << message << std::endl;
    69   while(true){
    70     char choice;
    71     if(defaultAction==Assert::Ask) {
    72 #ifdef __GNUC__
    73       cout << "Please choose: (a)bort, (t)hrow execption, show (b)actrace, (i)gnore, al(w)ays ignore" << endl;
    74 #else
    75       cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl;
    76 #endif /* __GNUC__ */
    77       cin >> choice;
    78     }
    79     else{
    80       choice = ActionKeys[defaultAction];
    81     }
    82     switch(choice){
    83       case 'a':
    84         return true;
    85         break;
    86       case 't':
    87         throw AssertionFailure(condition,filename,line,message);
    88         break;
    89 #ifdef __GNUC__
    90       case 'b':
    91         Assert::_my_assert::backtrace(filename,line);
    92        break;
    93 #endif /* __GNUC__ */
    94       case 'w':
    95         ignore = true;
    96         // fallthrough
    97       case 'i':
    98         return false;
    99         break;
     67  if(!res){
     68    cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl;
     69    cout << "Assertion Message: " << message << std::endl;
     70    while(true){
     71      char choice;
     72      if(defaultAction==Ask) {
     73        cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl;
     74        cin >> choice;
     75      }
     76      else{
     77        choice = ActionKeys[defaultAction];
     78      }
     79      switch(choice){
     80        case 'a':
     81          return true;
     82          break;
     83        case 't':
     84          throw AssertionFailure(condition,filename,line,message);
     85          break;
     86        case 'w':
     87          ignore = true;
     88          // fallthrough
     89        case 'i':
     90          return false;
     91          break;
     92      }
    10093    }
    10194  }
     
    10396}
    10497
    105 #ifdef __GNUC__
    106 void Assert::_my_assert::backtrace(const char *file, int line){
    107   const size_t max_depth = 100;
    108   void* stack_addrs[max_depth];
    109   size_t stack_depth;
    110   char **stack_strings=0;
    111   const char *func_name=0;
    112   size_t sz = 64;
    113 
    114   // get the backtrace
    115   stack_depth   = ::backtrace(stack_addrs,max_depth);
    116   stack_strings = backtrace_symbols(stack_addrs, stack_depth);
    117   // used later for demangling
    118   // reserved here, so we can free it unconditionally
    119   char *dm_function = static_cast<char*>(malloc(sz));
    120   if(!dm_function){
    121     // malloc failed... we are out of luck
    122     cout << "cannot provide stack trace due to exhausted memory" << endl;
    123     return;
    124   }
    125 
    126   cout << "Backtrace from  " << file << "@" << line << ":" << endl;
    127 
    128   // i=2 because we don't want this function, nor the assertion handler
    129   for(unsigned int i=2;i<stack_depth-2;++i){
    130     // find the mangled function name
    131     char *begin = stack_strings[i];
    132     // function name starts with a (
    133     while(*begin && *begin!='(') ++begin;
    134     char *end=begin;
    135     while(*end && *end!='+') ++end;
    136 
    137     // see if we found our function name
    138     if(*begin && *end){
    139       *begin++ = 0;
    140       *end = 0;
    141       // use the C++ demangler
    142 
    143       int status;
    144       char *func_ret = abi::__cxa_demangle(begin, dm_function, &sz, &status);
    145       if(func_ret){
    146         // abi might have realloced...
    147         dm_function = func_ret;
    148         func_name = dm_function;
    149       }
    150       else{
    151         // demangling failed... get the function name without demangling
    152         func_name = begin;
    153       }
    154     }
    155     else{
    156       // function name not found... get the whole line
    157       func_name = stack_strings[i];
    158     }
    159     cout << func_name << endl;
    160   }
    161   free(dm_function);
    162   free(stack_strings); // malloc()ed by backtrace_symbols
    163 }
    164 #endif /* __GNUC__ */
    165 
    166 void Assert::_my_assert::doHooks(){
     98void _my_assert::doHooks(){
    16799  for(vector<hook_t>::reverse_iterator iter = hooks.rbegin(); iter!=hooks.rend(); ++iter ){
    168100    (*iter)();
     
    170102}
    171103
    172 void Assert::_my_assert::addHook(hook_t hook){
     104void _my_assert::addHook(hook_t hook){
    173105  hooks.push_back(hook);
    174106}
    175107
    176 void Assert::_my_assert::removeHook(Assert::hook_t hook){
     108void _my_assert::removeHook(Assert::hook_t hook){
    177109  for(vector<hook_t>::iterator iter = hooks.begin(); iter!=hooks.end();){
    178110    if((*iter)==hook){
     
    185117}
    186118
    187 void Assert::_my_assert::setDefault(Assert::Action action){
     119void _my_assert::setDefault(Assert::Action action){
    188120  defaultAction = action;
    189121}
    190 Assert::Action Assert::_my_assert::getDefault(){
     122Assert::Action _my_assert::getDefault(){
    191123  return defaultAction;
    192124}
    193 std::string Assert::_my_assert::printDefault(){
     125std::string _my_assert::printDefault(){
    194126  return ActionNames[defaultAction];
    195127}
  • src/Helpers/Assert.hpp

    rf761c4 rec149d  
    234234      static bool ignore = false;\
    235235      if(!ignore){\
    236         if(!(condition) && Assert::_my_assert::check(STRINGIFY(condition),(message),\
    237                                                      __FILE__,__LINE__,ignore)){\
     236        if(Assert::_my_assert::check((condition),STRINGIFY(condition),(message),\
     237                                     __FILE__,__LINE__,ignore)){\
    238238          Assert::_my_assert::doHooks();\
    239239          DEBUG_BREAK;\
     
    247247                  static bool ignore = false; \
    248248                  if(!ignore){\
    249                           if(Assert::_my_assert::check("Exception caught",(message),__FILE__,__LINE__,ignore)){\
     249                          if(Assert::_my_assert::check(false,"Exception caught",(message),__FILE__,__LINE__,ignore)){\
    250250                            Assert::_my_assert::doHooks();\
    251                             DEBUG_BREAK;\
     251          DEBUG_BREAK;\
    252252                          }\
    253253                  }\
     
    299299    class _my_assert{
    300300    public:
    301       static bool check(const char* condition,
     301      static bool check(const bool res,
     302                        const char* condition,
    302303                        const char* message,
    303304                        const char* filename,
    304305                        const int line,
    305306                        bool& ignore);
    306 #ifdef __GNUC__
    307       static void backtrace(const char *file, int line);
    308 #endif /* __GNUC__ */
    309307      static void addHook(Assert::hook_t hook);
    310308      static void removeHook(Assert::hook_t hook);
     
    334332
    335333      if(!ignore){
    336         bool res = dynamic_cast<target>(src)==static_cast<target>(src);
    337         if(!res && _my_assert::check("type-safe typecast",message_ptr,file,line,ignore)){
     334        if(_my_assert::check(dynamic_cast<target>(src)==static_cast<target>(src),"type-safe typecast",
     335                                       message_ptr,file,line,ignore)){
    338336          _my_assert::doHooks();
    339337          DEBUG_BREAK;
     
    356354      catch(...){
    357355        if(!ignore){
    358           if(_my_assert::check("type-safe typecast",message_ref,file,line,ignore)){
     356          if(_my_assert::check(0,"type-safe typecast",message_ref,file,line,ignore)){
    359357            _my_assert::doHooks();
    360358            DEBUG_BREAK;
  • src/Helpers/MemDebug.cpp

    rf761c4 rec149d  
    7272  // all allocated memory blocks
    7373  struct entry_t {
    74     typedef unsigned int checksum_t;
    7574    // we seperate the tracking info from the rest
    7675    // A checksum will be calculated for this part of
     
    9190    } info;
    9291    bool isIgnored;
    93     checksum_t checksum;
     92    char checksum;
    9493    entry_t *prev;
    9594    entry_t *next;
     
    118117  // calculates a simple checksum for the info block
    119118  // the checksum is used to find memory corruptions
    120   inline entry_t::checksum_t calcChecksum(entry_t::info_t *info){
     119  inline char calcChecksum(entry_t::info_t *info){
    121120    char *buffer = (char*)info;
    122     entry_t::checksum_t checksum =0;
     121    char checksum =0;
    123122    for(size_t i=0;i<sizeof(entry_t::info_t);i++){
    124123      checksum+=buffer[i];
     
    155154      cout << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;
    156155#endif
    157     }
    158   }
    159 
    160   void dumpMemory(std::ostream &ost){
    161     ost << "Maximum allocated Memory: " << max << " bytes" << endl;
    162     ost << "Maximum allocated Memory: " << max << " bytes" << endl;
    163     ost << "Currently allocated Memory: " << state <<" bytes" << endl;
    164     ost << allocs << " allocated chunks total" << endl;
    165     bool corrupted=false;
    166     for(entry_t *pos=begin;pos;pos=pos->next){
    167       ost << "\nChunk of " << pos->info.nbytes << " bytes" << " still available" << endl;
    168 #     ifdef __GNUC__
    169         ost << "Chunk reserved at: " << pos->info.function
    170              << " (" << pos->info.file << ":" << pos->info.line  << ")" << endl;
    171 #     else
    172         ost << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;
    173 #     endif
    174         ost << "Chunk address: " << pos->info.location << endl;
    175         entry_t::checksum_t checksum = calcChecksum(&pos->info);
    176         ost << "Checksum of chunk: " << checksum << endl;
    177         ost << "Checksum at allocation time: " << pos->checksum << endl;
    178         if(checksum!=pos->checksum){
    179           ost << "!!!Chunk was corrupted!!!" << endl;
    180           corrupted=true;
    181         }
    182     }
    183     if(corrupted){
    184       ost << "\n!!!Memory corruption detected!!!" << endl;
    185156    }
    186157  }
  • src/Helpers/MemDebug.hpp

    rf761c4 rec149d  
    6161   */
    6262  void getState();
    63   void dumpMemory(std::ostream&);
    6463
    6564  void _ignore(void*);
     
    106105  inline void getState(){}
    107106
    108   inline void dumpMemory(std::ostream&){};
    109 
    110107  template <typename T>
    111108  inline T *ignore(T* ptr){
  • src/Makefile.am

    rf761c4 rec149d  
    88  Helpers/Assert.cpp \
    99  Helpers/MemDebug.cpp
    10  
    11 BASESOURCE = \
    12   ${HELPERSOURCE} \
    13   Space.cpp \
    14   vector.cpp
    15  
    16 BASEHEADER = \
    17   ${HELPERHEADER} \
    18   Space.hpp \
    19   vector.hpp
    2010                       
    2111ATOMSOURCE = \
     
    4131
    4232LINALGSOURCE = \
     33  ${HELPERSOURCE} \
    4334  gslmatrix.cpp \
    4435  gslvector.cpp \
    45   linearsystemofequations.cpp
     36  linearsystemofequations.cpp \
     37  Space.cpp \
     38  vector.cpp
    4639                           
    4740LINALGHEADER = \
    4841  gslmatrix.hpp \
    4942  gslvector.hpp \
    50   linearsystemofequations.hpp
     43  linearsystemofequations.hpp \
     44  Space.hpp \
     45  vector.hpp
    5146                           
    5247ANALYSISSOURCE = \
     
    137132  Shapes/Shape.hpp \
    138133  Shapes/ShapeOps.hpp
    139 
    140134 
     135
     136QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \
     137        UIElements/QT4/QTMainWindow.hpp \
     138        UIElements/Menu/QT4/QTMenu.hpp \
     139        UIElements/Views/QT4/QTWorldView.hpp \
     140        UIElements/Views/QT4/GLMoleculeView.hpp \
     141        UIElements/Views/QT4/QTMoleculeView.hpp \
     142        UIElements/Views/QT4/QTStatusBar.hpp
     143 
     144QTUIMOC_TARGETS = QTMainWindow.moc.cpp \
     145        QTMenu.moc.cpp\
     146        QTDialog.moc.cpp \
     147        QTWorldView.moc.cpp \
     148        GLMoleculeView.moc.cpp \
     149        QTMoleculeView.moc.cpp \
     150        QTStatusBar.moc.cpp
     151
    141152DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
    142153  Descriptors/AtomIdDescriptor.cpp \
     
    161172  Descriptors/MoleculePtrDescriptor.hpp \
    162173  Descriptors/MoleculeSelectionDescriptor.cpp
    163 
    164 
    165 QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \
    166         UIElements/QT4/QTMainWindow.hpp \
    167         UIElements/Menu/QT4/QTMenu.hpp \
    168         UIElements/Views/QT4/QTWorldView.hpp \
    169         UIElements/Views/QT4/GLMoleculeView.hpp \
    170         UIElements/Views/QT4/QTMoleculeView.hpp \
    171         UIElements/Views/QT4/QTStatusBar.hpp
    172174                                 
    173 QTUISOURCE = allmocs.moc.cpp \
     175QTUISOURCE = ${QTUIMOC_TARGETS} \
    174176        UIElements/QT4/QTMainWindow.cpp \
    175177        UIElements/QT4/QTDialog.cpp \
     
    194196  ${SHAPESOURCE} \
    195197  ${DESCRIPTORSOURCE} \
     198  ${HELPERSOURCE} \
    196199  bond.cpp \
    197200  bondgraph.cpp \
     
    225228  periodentafel.cpp \
    226229  Plane.cpp \
     230  Space.cpp \
    227231  tesselation.cpp \
    228232  tesselationhelpers.cpp \
     
    230234  triangleintersectionlist.cpp \
    231235  UIElements/UIFactory.cpp \
     236  vector.cpp \
    232237  vector_ops.cpp \
    233238  verbose.cpp \
     
    291296INCLUDES = -I$(top_srcdir)/src/unittests -I$(top_srcdir)/src/Actions -I$(top_srcdir)/src/UIElements
    292297
    293 noinst_LIBRARIES = libmolecuilderbase.a libmolecuilder.a libgslwrapper.a libmenu.a libparser.a
     298noinst_LIBRARIES = libmolecuilder.a libgslwrapper.a libmenu.a libparser.a
    294299bin_PROGRAMS = molecuilder molecuildergui joiner analyzer
    295 EXTRA_PROGRAMS = unity
    296300
    297301molecuilderdir = ${bindir}
    298302
    299 libmolecuilderbase_a_SOURCES = ${BASESOURCE} ${BASEHEADER}
    300303libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
     304
    301305libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER}
    302306libparser_a_SOURCES = ${PARSERSOURCE} ${PARSERHEADER}
     
    310314molecuilder_SOURCES = ${LEGACYSOURCE} builder.cpp
    311315molecuilder_SOURCES += $(srcdir)/version.c
    312 molecuilder_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilderbase.a libmolecuilder.a libparser.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
     316molecuilder_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilder.a libparser.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    313317
    314318#Stuff for building the GUI using QT
     
    317321molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT
    318322molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS}
    319 molecuildergui_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilderbase.a libmolecuilder.a libparser.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}  ${GUI_LIBS}
     323molecuildergui_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilder.a libparser.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}  ${GUI_LIBS}
    320324
    321325joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    322 joiner_LDADD = libmolecuilder.a libmolecuilderbase.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
     326joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    323327
    324328analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp
    325 analyzer_LDADD = libmolecuilder.a libmolecuilderbase.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    326 
    327 unity_SOURCES = unity.cpp $(srcdir)/version.c
    328 unity_LDADD = $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
     329analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    329330
    330331#Rules needed for QT4
     
    332333# Therfore `%'-rules do not seem to work
    333334#Quick fix to get it done otherwise
    334 allmocs.moc.cpp: ${QTUIMOC_HEADER}
    335         echo "" > allmocs.moc.cpp;\
     335${QTUIMOC_TARGETS}: ${QTUIMOC_HEADER}
    336336        list='$(QTUIMOC_HEADER)'; for header in $$list; do \
    337337        echo "Making mocfile for $$header"; \
     
    339339        $(MOC) $(srcdir)/$$header -o $$target \
    340340        || eval $$failcom; \
    341         echo "#include \"$$target\"" >> allmocs.moc.cpp; \
    342341        done;
    343342
    344 unity.cpp: ${LINALGSOURCE} ${LINALGHEADER} ${SOURCE} ${HEADER}
    345         echo "" >  unity.cpp; \
    346         list='$(BASESOURCE)'; for file in $$list; do \
    347           echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
    348         done; \
    349         list='$(LINALGSOURCE)'; for file in $$list; do \
    350           echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
    351         done; \
    352         list='$(SOURCE)'; for file in $$list; do \
    353           echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
    354         done; \
    355         subdirs='$(SUBDIRS)';for directory in $$subdirs; do\
    356                 olddir=$$PWD;\
    357                 cd $$directory && make unity.cpp;\
    358                 cd $$olddir;\
    359                 echo "#include \"$$directory/unity.cpp\"" >> unity.cpp;\
    360         done;\
    361         echo "#include \"$(srcdir)/builder.cpp\"" >> unity.cpp;
    362 
    363 MOSTLYCLEANFILES = allmocs.moc.cpp unity.cpp
     343MOSTLYCLEANFILES = ${QTUIMOC_TARGETS}
    364344       
    365345#EXTRA_DIST = ${molecuilder_DATA}
  • src/Parser/TremoloParser.cpp

    rf761c4 rec149d  
    2121
    2222using namespace std;
     23using namespace boost;
    2324
    2425/**
  • src/UIElements/Makefile.am

    rf761c4 rec149d  
    8080  CommandLineUI/CommandLineWindow.hpp
    8181
    82 unity.cpp:
    83         echo "" >  unity.cpp; \
    84         list='$(UISOURCE)'; for file in $$list; do \
    85           echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
    86         done;
    87        
    88 MOSTLYCLEANFILES = unity.cpp
     82
  • src/UIElements/TextUI/TextDialog.cpp

    rf761c4 rec149d  
    523523    }
    524524  }
    525   return true;
    526525}
    527526
  • src/UIElements/TextUI/TextWindow.cpp

    rf761c4 rec149d  
    2525#include "Views/StreamStringView.hpp"
    2626#include "Views/MethodStringView.hpp"
     27#include "Helpers/MemDebug.hpp"
    2728
    2829#include "defs.hpp"
  • src/World.cpp

    rf761c4 rec149d  
    3232
    3333using namespace std;
    34 
    35 const unsigned int MAX_POOL_FRAGMENTATION=20;
    36 const unsigned int MAX_FRAGMENTATION_SKIPS=100;
    3734
    3835/******************************* getter and setter ************************/
     
    721718  delete cell_size;
    722719  delete molecules_deprecated;
     720  delete periode;
     721  delete configuration;
     722  delete Thermostats;
    723723  MoleculeSet::iterator molIter;
    724724  for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
     
    731731  }
    732732  atoms.clear();
    733   delete periode;
    734   delete configuration;
    735   delete Thermostats;
    736733}
    737734
  • src/atom.cpp

    rf761c4 rec149d  
    1919
    2020#include <iomanip>
    21 #include <iostream>
    2221
    2322/************************************* Functions for class atom *************************************/
     
    110109};
    111110
    112 bool atom::isFather(const atom *ptr){
    113   return ptr==father;
    114 }
    115 
    116111/** Checks whether atom is within the given box.
    117112 * \param offset offset to box origin
     
    166161  * \return true - \a *out present, false - \a *out is NULL
    167162 */
    168 bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
     163bool atom::OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment) const
    169164{
    170165  AtomNo[type->Z]++;  // increment number
    171166  if (out != NULL) {
    172     cout << "Looking for atom with element " << *type << endl;
    173     ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    174     *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     167    *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    175168    *out << x[0] << "\t" << x[1] << "\t" << x[2];
    176169    *out << "\t" << FixedIon;
  • src/atom.hpp

    rf761c4 rec149d  
    5252
    5353  bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const;
    54   bool OutputArrayIndexed(ostream * const out,const enumeration<const element*>&, int *AtomNo, const char *comment = NULL) const;
     54  bool OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const;
    5555  bool OutputXYZLine(ofstream *out) const;
    5656  bool OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const;
     
    6161
    6262  void EqualsFather ( const atom *ptr, const atom **res ) const;
    63   bool isFather(const atom *ptr);
    6463  void CorrectFather();
    6564  atom *GetTrueFather();
  • src/builder.cpp

    rf761c4 rec149d  
    110110}
    111111
    112 void dumpMemory(){
    113   ofstream ost("molecuilder.memdump");
    114   Memory::dumpMemory(ost);
    115 }
    116 
    117112int main(int argc, char **argv)
    118113{
    119114  // while we are non interactive, we want to abort from asserts
    120   ASSERT_DO(Assert::Abort);
    121   ASSERT_HOOK(dumpMemory);
     115  //ASSERT_DO(Assert::Abort);
    122116  string line;
    123117  char **Arguments = NULL;
     
    133127  // need to init the history before any action is created
    134128  ActionHistory::init();
     129
     130  // In the interactive mode, we can leave the user the choice in case of error
     131  ASSERT_DO(Assert::Ask);
    135132
    136133  // from this moment on, we need to be sure to deeinitialize in the correct order
     
    158155      UIFactory::makeUserInterface("CommandLine");
    159156    } else {
    160       // In the interactive mode, we can leave the user the choice in case of error
    161       ASSERT_DO(Assert::Ask);
    162157      #ifdef USE_GUI_QT
    163158        DoLog(0) && (Log() << Verbose(0) << "Setting UI to QT4." << endl);
  • src/defs.hpp

    rf761c4 rec149d  
    8484#define MOLECUILDER_NAME "Molecuilder"
    8585
    86 const extern unsigned int MAX_POOL_FRAGMENTATION;
    87 const extern unsigned int MAX_FRAGMENTATION_SKIPS;
     86const unsigned int MAX_POOL_FRAGMENTATION=20;
     87const unsigned int MAX_FRAGMENTATION_SKIPS=100;
    8888
    8989#endif /*DEFS_HPP_*/
  • src/element.cpp

    rf761c4 rec149d  
    2626        next(NULL),
    2727        sort(NULL),
     28        No(-1),
    2829        Valence(0),
    2930        NoValenceOrbitals(0)
     
    6970  return string(symbol);
    7071}
    71 
    72 std::string element::getName() const{
    73   return string(name);
    74 }
    75 
    76 std::ostream &operator<<(std::ostream &ost,const element &elem){
    77   ost << elem.getName() << "(" << elem.getNumber() << ")";
    78   return ost;
    79 }
  • src/element.hpp

    rf761c4 rec149d  
    4141    element *next;  //!< next element in list
    4242    int *sort;      //!< sorc criteria
     43    int No;         //!< number of element set on periodentafel::Output()
    4344    double Valence;   //!< number of valence electrons for this element
    4445    int NoValenceOrbitals;  //!< number of valence orbitals, used for determining bond degree in molecule::CreateConnectmatrix()
     
    5253  atomicNumber_t getNumber() const;
    5354  std::string getSymbol() const;
    54   std::string getName() const;
    5555
    5656  //> print element entries to screen
     
    6161};
    6262
    63 std::ostream &operator<<(std::ostream&,const element&);
    6463
    6564#endif /* ELEMENT_HPP_ */
  • src/helpers.hpp

    rf761c4 rec149d  
    194194};
    195195
    196 /************ struct to contain simple enumerations ***************/
    197 template <class C>
    198 struct enumeration{
    199   enumeration() : max(0) {}
    200   enumeration(unsigned int i) : max(i) {}
    201   enumeration(const enumeration &src) :
    202     there(src.there),
    203     back(src.back),
    204     max(src.max)
    205   {}
    206   enumeration &operator=(const enumeration &src){
    207     /* no self-assignment check needed */
    208     there = src.there;
    209     back = src.back;
    210     max = src.max;
    211     return *this;
    212   }
    213   void add(const C &value){
    214     if(!there.count(value)){
    215       there[value]=max;
    216       back[max++]=value;
    217     }
    218   }
    219   unsigned int getMax() const{
    220     return max;
    221   }
    222 
    223   map<C,unsigned int> there;
    224   map<unsigned int,C> back;
    225 private:
    226   unsigned int max;
    227 };
    228 
    229 /***** A counter to generate sequential numbers *******************/
    230 struct counter{
    231   inline counter() : count(0){};
    232   inline counter(int i) : count(i){};
    233   inline unsigned int operator()(){
    234     return count++;
    235   }
    236 private:
    237   unsigned int count;
    238 };
    239 
    240 template <class C,class ForwardIterator>
    241 enumeration<C> enumerate(ForwardIterator first,ForwardIterator last){
    242   enumeration<C> res;
    243   for_each(first,last,bind1st(mem_fun(&enumeration<C>::add),&res));
    244   return res;
    245 }
    246 
    247196#endif /*HELPERS_HPP_*/
  • src/linearsystemofequations.hpp

    rf761c4 rec149d  
    66 */
    77
    8 #ifndef LINEARSYSTEMSOFEQUATIONS_HPP
    9 #define LINEARSYSTEMSOFEQUATIONS_HPP
     8using namespace std;
    109
    1110/*********************************************** includes ***********************************/
     
    5655  bool IsSymmetric;
    5756};
    58 
    59 #endif /* LINEARSYSTEMSOFEQUATIONS_HPP */
  • src/log.hpp

    rf761c4 rec149d  
    1212#include "logger.hpp"
    1313
    14 class logger & Log();
    15 class errorLogger & eLog();
     14class logger * Log();
     15class errorLogger * eLog();
    1616void setVerbosity(int verbosityLevel);
    1717bool DoLog(int verbose);
  • src/molecule.cpp

    rf761c4 rec149d  
    151151molecule::const_iterator molecule::erase( const_iterator loc )
    152152{
    153   OBSERVE;
    154153  molecule::const_iterator iter = loc;
    155154  iter--;
     
    157156  atomIds.erase( atom->getId() );
    158157  atoms.remove( atom );
    159   formula-=atom->type;
    160158  atom->removeFromMolecule();
    161159  return iter;
     
    164162molecule::const_iterator molecule::erase( atom * key )
    165163{
    166   OBSERVE;
    167164  molecule::const_iterator iter = find(key);
    168165  if (iter != end()){
    169166    atomIds.erase( key->getId() );
    170167    atoms.remove( key );
    171     formula-=key->type;
    172168    key->removeFromMolecule();
    173169  }
     
    187183pair<molecule::iterator,bool> molecule::insert ( atom * const key )
    188184{
    189   OBSERVE;
    190185  pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
    191186  if (res.second) { // push atom if went well
    192187    atoms.push_back(key);
    193     formula+=key->type;
    194188    return pair<iterator,bool>(molecule::iterator(--end()),res.second);
    195189  } else {
     
    239233  if (pointer != NULL) {
    240234    atom *walker = pointer->clone();
    241     formula += walker->type;
    242235    walker->setName(pointer->getName());
    243236    walker->nr = last_atom++;  // increase number within molecule
     
    626619{
    627620  molecule *copy = World::getInstance().createMolecule();
     621  atom *LeftAtom = NULL, *RightAtom = NULL;
    628622
    629623  // copy all atoms
    630   for_each(atoms.begin(),atoms.end(),bind1st(mem_fun(&molecule::AddCopyAtom),copy));
     624  ActOnCopyWithEachAtom ( &molecule::AddCopyAtom, copy );
    631625
    632626  // copy all bonds
     627  bond *Binder = NULL;
     628  bond *NewBond = NULL;
    633629  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    634630    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
    635631      if ((*BondRunner)->leftatom == *AtomRunner) {
    636         bond *Binder = (*BondRunner);
     632        Binder = (*BondRunner);
    637633
    638634        // get the pendant atoms of current bond in the copy molecule
    639         atomSet::iterator leftiter=find_if(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->leftatom));
    640         atomSet::iterator rightiter=find_if(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->rightatom));
    641         ASSERT(leftiter!=atoms.end(),"No original left atom for bondcopy found");
    642         ASSERT(leftiter!=atoms.end(),"No original right atom for bondcopy found");
    643         atom *LeftAtom = *leftiter;
    644         atom *RightAtom = *rightiter;
    645 
    646         bond *NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
     635        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->leftatom, (const atom **)&LeftAtom );
     636        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->rightatom, (const atom **)&RightAtom );
     637
     638        NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
    647639        NewBond->Cyclic = Binder->Cyclic;
    648640        if (Binder->Cyclic)
     
    651643      }
    652644  // correct fathers
    653   for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather));
     645  ActOnAllAtoms( &atom::CorrectFather );
    654646
    655647  // copy values
     
    860852 * \param *out output stream
    861853 */
    862 bool molecule::Output(ostream * const output)
    863 {
     854bool molecule::Output(ofstream * const output)
     855{
     856  int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS];
     857
     858  for (int i=0;i<MAX_ELEMENTS;++i) {
     859    AtomNo[i] = 0;
     860    ElementNo[i] = 0;
     861  }
    864862  if (output == NULL) {
    865863    return false;
    866864  } else {
    867     int AtomNo[MAX_ELEMENTS];
    868     memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));
    869     enumeration<const element*> elementLookup = formula.enumerateElements();
    870     for(map<const element*,unsigned int>::iterator iter=elementLookup.there.begin();
    871         iter!=elementLookup.there.end();++iter){
    872       cout << "Enumerated element " << *iter->first << " with number " << iter->second << endl;
    873     }
    874865    *output << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
    875     for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0));
     866    SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1);
     867    int current=1;
     868    for (int i=0;i<MAX_ELEMENTS;++i) {
     869      if (ElementNo[i] == 1)
     870        ElementNo[i] = current++;
     871    }
     872    ActOnAllAtoms( &atom::OutputArrayIndexed, (ostream * const) output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
    876873    return true;
    877874  }
     
    916913{
    917914  DoLog(2) && (Log() << Verbose(2) << endl << "From Contents of ListOfBonds, all non-hydrogen atoms:" << endl);
    918   for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputBondOfAtom));
     915  ActOnAllAtoms (&atom::OutputBondOfAtom );
    919916  DoLog(0) && (Log() << Verbose(0) << endl);
    920917};
     
    939936    for (int step=0;step<MDSteps;step++) {
    940937      *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now);
    941       for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step));
     938      ActOnAllAtoms( &atom::OutputTrajectoryXYZ, output, step );
    942939    }
    943940    return true;
     
    956953    now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
    957954    *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now);
    958     for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputXYZLine),output));
     955    ActOnAllAtoms( &atom::OutputXYZLine, output );
    959956    return true;
    960957  } else
  • src/molecule.hpp

    rf761c4 rec149d  
    341341
    342342  // Output routines.
    343   bool Output(std::ostream * const output);
     343  bool Output(ofstream * const output);
    344344  bool OutputTrajectories(ofstream * const output);
    345345  void OutputListOfBonds() const;
  • src/unittests/FormulaUnittest.cpp

    rf761c4 rec149d  
    185185  }
    186186  {
    187     Formula formula("CH2(COOH)2");
    188     CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)4);
    189     CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)4);
    190     CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)3);
    191     CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
    192     CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
    193   }
    194   {
    195     Formula formula("K4[Fe(CN)6]");
    196     CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);
    197     CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);
    198     CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)6);
    199     CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
    200     CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
    201     CPPUNIT_ASSERT_EQUAL(formula["K"],(unsigned int)4);
    202     CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);
    203     CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)6);
    204   }
    205   {
    206     Formula formula("[CrCl3(H2O)3]");
    207     CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)6);
    208     CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)3);
    209     CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)0);
    210     CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
    211     CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
    212     CPPUNIT_ASSERT_EQUAL(formula["Cr"],(unsigned int)1);
    213     CPPUNIT_ASSERT_EQUAL(formula["Cl"],(unsigned int)3);
    214   }
    215   {
    216     Formula formula("Mg3[Fe(CN)6]2");
    217     CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);
    218     CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);
    219     CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)12);
    220     CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
    221     CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
    222     CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)3);
    223     CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)2);
    224     CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)12);
    225   }
    226   {
    227     Formula formula("Na[Fe((HO2CCH2)2NCH2CH2N(CH2CO2H)2)]");
    228     CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)16);
    229     CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)8);
    230     CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)10);
    231     CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)1);
    232     CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
    233     CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)0);
    234     CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);
    235     CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)2);
    236   }
    237   {
    238187    CPPUNIT_ASSERT_THROW(Formula formula("74107"),ParseError);
    239188    CPPUNIT_ASSERT_THROW(Formula formula("  "),ParseError);
     
    243192    CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),ParseError);
    244193    CPPUNIT_ASSERT_THROW(Formula formula("Mag"),ParseError);
    245     CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),ParseError);
    246     CPPUNIT_ASSERT_THROW(Formula formula("(Na"),ParseError);
    247     CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),ParseError);
    248     CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),ParseError);
    249     CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),ParseError);
    250     CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),ParseError);
    251     CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),ParseError);
    252     CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),ParseError);
    253     CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),ParseError);
    254     CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),ParseError);
    255194  }
    256195
  • src/unittests/Makefile.am

    rf761c4 rec149d  
    4949noinst_PROGRAMS = $(TESTS) TestRunner
    5050
    51 GSLLIBS = ../libgslwrapper.a ../libmolecuilderbase.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
     51GSLLIBS = ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    5252ALLLIBS = ../libmolecuilder.a ${GSLLIBS}
    5353PARSERLIBS = ../libparser.a ${ALLLIBS}
    54 UILIBS = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions.a ${ALLLIBS} ${BOOST_PROGRAM_OPTIONS_LIB}
    5554
    5655TESTSOURCES = \
     
    130129
    131130ActionSequenceTest_SOURCES = UnitTestMain.cpp ActionSequenceTest.cpp ActionSequenceTest.hpp $(srcdir)/../version.c
    132 ActionSequenceTest_LDADD = ${UILIBS}
     131ActionSequenceTest_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions.a ../libmolecuilder.a ../libparser.a ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    133132
    134133ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
     
    196195
    197196manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp $(srcdir)/../version.c
    198 manipulateAtomsTest_LDADD = ${UILIBS}
     197manipulateAtomsTest_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions.a ../libmolecuilder.a ../libparser.a ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    199198
    200199MatrixUnittest_SOURCES = UnitTestMain.cpp MatrixUnittest.cpp MatrixUnittest.hpp
     
    235234
    236235TestRunner_SOURCES = TestRunnerMain.cpp $(srcdir)/../version.c $(TESTSOURCES) $(TESTHEADERS)
    237 TestRunner_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions.a ../libmolecuilder.a ../libparser.a ../libgslwrapper.a ../libmolecuilderbase.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
     236TestRunner_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions.a ../libmolecuilder.a ../libparser.a ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    238237
    239238VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp
Note: See TracChangeset for help on using the changeset viewer.