Changes in / [1b2d30:55240c4]


Ignore:
Files:
7 added
193 edited

Legend:

Unmodified
Added
Removed
  • doc/Doxyfile

    r1b2d30 r55240c4  
    258258# Configuration::additions related to the search engine   
    259259#---------------------------------------------------------------------------
    260 SEARCHENGINE           = NO
     260SEARCHENGINE           = YES
  • src/Actions/Action.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <string>
     
    1517using namespace std;
    1618
     19Action::state_ptr getEmptyState() {
     20  return Action::state_ptr(Memory::ignore(new ActionState()));
     21}
     22
    1723// An empty state to indicate success
    18 Action::state_ptr Action::success = Action::state_ptr(Memory::ignore(new ActionState()));
    19 Action::state_ptr Action::failure = Action::state_ptr(Memory::ignore(new ActionState()));
     24Action::state_ptr Action::success = getEmptyState();
     25Action::state_ptr Action::failure = getEmptyState();
    2026
    2127Action::Action(std::string _name,bool _doRegister) :
  • src/Actions/ActionHistory.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "ActionHistory.hpp"
  • src/Actions/ActionRegistry.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/ActionRegistry.hpp"
  • src/Actions/ActionSequence.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/ActionSequence.hpp"
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
  • src/Actions/AtomAction/AddAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AtomAction/AddAction.hpp"
  • src/Actions/AtomAction/ChangeElementAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AtomAction/ChangeElementAction.hpp"
  • src/Actions/AtomAction/RemoveAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/AtomAction/RemoveAction.hpp"
  • src/Actions/CmdAction/BondLengthTableAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/BondLengthTableAction.hpp"
  • src/Actions/CmdAction/ElementDbAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/ElementDbAction.hpp"
  • src/Actions/CmdAction/FastParsingAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/FastParsingAction.hpp"
  • src/Actions/CmdAction/HelpAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/HelpAction.hpp"
  • src/Actions/CmdAction/VerboseAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/VerboseAction.hpp"
  • src/Actions/CmdAction/VersionAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/CmdAction/VersionAction.hpp"
  • src/Actions/ErrorAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/FragmentationAction/FragmentationAction.hpp"
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
  • src/Actions/MakroAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <string>
  • src/Actions/ManipulateAtomsProcess.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "ManipulateAtomsProcess.hpp"
  • src/Actions/MapOfActions.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810using namespace std;
  • src/Actions/MethodAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/Actions/MoleculeAction/BondFileAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/BondFileAction.hpp"
  • src/Actions/MoleculeAction/ChangeNameAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/ChangeNameAction.hpp"
  • src/Actions/MoleculeAction/FillWithMoleculeAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
  • src/Actions/MoleculeAction/SaveAdjacencyAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
  • src/Actions/MoleculeAction/SaveBondsAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/SaveBondsAction.hpp"
  • src/Actions/MoleculeAction/SaveTemperatureAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
  • src/Actions/MoleculeAction/SuspendInWaterAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
  • src/Actions/MoleculeAction/TranslateAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/TranslateAction.hpp"
  • src/Actions/MoleculeAction/VerletIntegrationAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
  • src/Actions/ParserAction/LoadXyzAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/ParserAction/LoadXyzAction.hpp"
  • src/Actions/ParserAction/SaveXyzAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/ParserAction/SaveXyzAction.hpp"
  • src/Actions/Process.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "Process.hpp"
    911
     
    1214Process::Process(int _maxSteps, std::string _name, bool _doRegister) :
    1315  Action(_name,_doRegister),
     16  Observable("Process"),
    1417  maxSteps(_maxSteps),
    1518  active(false),
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
  • src/Actions/WorldAction/BoundInBoxAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/BoundInBoxAction.hpp"
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/CenterInBoxAction.hpp"
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
  • src/Actions/WorldAction/ChangeBoxAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/ChangeBoxAction.hpp"
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/RepeatBoxAction.hpp"
     
    7880        for (n[2] = 0; n[2] < Repeater[2]; n[2]++) {
    7981          y[2] = n[2];
    80           if (n[0] == n[1] == n[2] == 0)
     82          if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0))
    8183            continue;
    8284          for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/ScaleBoxAction.hpp"
  • src/Actions/WorldAction/SetDefaultNameAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/SetDefaultNameAction.hpp"
  • src/Actions/WorldAction/SetGaussianBasisAction.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
  • src/CommandLineParser.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <boost/program_options.hpp>
  • src/Descriptors/AtomDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Descriptors/AtomDescriptor.hpp"
  • src/Descriptors/AtomIdDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "AtomIdDescriptor.hpp"
  • src/Descriptors/AtomTypeDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Descriptors/AtomTypeDescriptor.hpp"
  • src/Descriptors/MoleculeDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Descriptors/MoleculeDescriptor.hpp"
  • src/Descriptors/MoleculeIdDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MoleculeIdDescriptor.hpp"
  • src/Descriptors/MoleculePtrDescriptor.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MoleculePtrDescriptor.hpp"
  • src/Exceptions/CustomException.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "CustomException.hpp"
  • src/Exceptions/LinearDependenceException.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "LinearDependenceException.hpp"
  • src/Exceptions/MathException.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MathException.hpp"
  • src/Exceptions/ZeroVectorException.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "ZeroVectorException.hpp"
  • src/Hbondangle.db

    r1b2d30 r55240c4  
     1# atomicnumber angles for single, double and triple bond (-1 no angle)
    121       180     -1      -1
    235       180     131.0   109.2
  • src/Hbonddistance.db

    r1b2d30 r55240c4  
     1#atomic number bond distances for single, double and triple bond (-1 no bond)
    121       0.74    -1      -1
    232       0.77429209      -1      -1
  • src/Helpers/Assert.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Helpers/Assert.hpp"
     
    4547
    4648using namespace Assert;
     49
     50#ifndef NDEBUG
    4751
    4852Action _my_assert::defaultAction = Ask;
     
    122126  return ActionNames[defaultAction];
    123127}
     128
     129#endif
     130
  • src/Helpers/MemDebug.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#ifndef NDBEGUG
     9#ifndef NO_MEMDEBUG
     10
    811#include <iostream>
    912#include <cstdlib>
     
    1114#include <boost/thread.hpp>
    1215
     16#ifdef __GNUC__
     17#include <execinfo.h>
     18#include <cxxabi.h>
     19#endif
     20
    1321using namespace std;
    1422
    15 #ifndef NDBEGUG
    16 #ifndef NO_MEMDEBUG
     23// we need our own low level mutexex, since we cannot assure the time of construction and destruction
     24// otherwise
     25#if defined(unix) || defined(__unix)
     26
     27#include <pthread.h>
     28#include <cassert>
     29#define mutex_t    pthread_mutex_t
     30#define mutex_init PTHREAD_MUTEX_INITIALIZER
     31#define mutex_lock(mtx) \
     32  do{\
     33    int res = pthread_mutex_lock(&(mtx));\
     34    assert(!res && "Could not lock mutex!");\
     35  }while(0)
     36
     37#define mutex_unlock(mtx) \
     38  do{\
     39    int res = pthread_mutex_unlock(&(mtx));\
     40    assert(!res && "Could not unlock mutex!");\
     41  }while(0)
     42
     43#else
     44# error "No thread structure defined for this plattform..."
     45#endif
    1746
    1847namespace Memory {
     
    3463      char file[length+1];
    3564      int line;
     65#ifdef __GNUC__  // function tracking only works with GCC
     66      // function names can get looooong
     67      enum {length2 = 256};
     68      char function[length2+1];
     69#endif
    3670      size_t nbytes;
    3771      bool isUsed;
     
    4478  };
    4579
    46   boost::mutex memorylock;
     80
     81  mutex_t memorylock = mutex_init;
    4782
    4883  // start and end of the doubly-linked list
     
    96131    for(entry_t *pos=begin;pos;pos=pos->next){
    97132      cout << "\nChunk of " << pos->info.nbytes << " bytes" << " still available" << endl;
     133#ifdef __GNUC__
     134      cout << "Chunk reserved at: " << pos->info.function
     135           << " (" << pos->info.file << ":" << pos->info.line  << ")" << endl;
     136#else
    98137      cout << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;
    99     }
     138#endif
     139    }
     140  }
     141
     142  // Adds an entry to the linked list
     143  void addEntry(entry_t *entry){
     144    // check if the entry is already in the list
     145    if(!entry->isIgnored)
     146      return;
     147
     148    mutex_lock(Memory::memorylock);
     149
     150    entry->next=0;            // the created block is last in the list
     151    entry->prev=Memory::end;  // the created block is last in the list
     152    if(!Memory::begin){
     153      // the list was empty... start a new one
     154      Memory::begin=entry;
     155    }
     156    else {
     157      // other blocks present... we can add to the last one
     158      Memory::end->next=entry;
     159    }
     160    Memory::end=entry;
     161
     162    // update some global info
     163    Memory::state  += entry->info.nbytes;
     164    if(Memory::state>Memory::max){
     165        Memory::max = Memory::state;
     166    }
     167    ++Memory::allocs;
     168    // done with the list... it is safe to unlock now
     169    mutex_unlock(Memory::memorylock);
     170    entry->isIgnored = false;
    100171  }
    101172
     
    105176      return;
    106177
     178    mutex_lock(memorylock);
    107179    if(entry->prev){
    108180      entry->prev->next = entry->next;
     
    120192      end = entry->prev;
    121193    }
     194    Memory::state  -= entry->info.nbytes;
     195    mutex_unlock(memorylock);
    122196    entry->isIgnored = true;
    123     Memory::state  -= entry->info.nbytes;
     197
    124198  }
    125199
     
    130204    deleteEntry(entry);
    131205  }
    132 }
    133 
    134 void *operator new(size_t nbytes,const char* file, int line) throw(std::bad_alloc) {
    135 
    136   // we need to lock, so that no one changes the linked list while we are here
    137   boost::mutex::scoped_lock guard(Memory::memorylock);
     206
     207#ifdef __GNUC__
     208  // this function let's us find the caller's name
     209  char* getCaller(){
     210    // stack looks like this:
     211    // getCaller();
     212    // operator new();
     213    // function_we_are_looking_for(); <-
     214    const size_t max_depth = 3;
     215    void* stack_addrs[max_depth];
     216    size_t stack_depth;
     217    char **stack_strings=0;
     218    const char *func_name=0;
     219    const char *toplevel = "Global scope";
     220    char *retval=0;
     221
     222    // get the backtrace, depth three
     223    stack_depth   = backtrace(stack_addrs,max_depth);
     224    stack_strings = backtrace_symbols(stack_addrs, stack_depth);
     225    // used later for demangling
     226    // reserved here, so we can free it unconditionally
     227    char *dm_function = static_cast<char*>(malloc(entry_t::info_t::length2));
     228    if(!dm_function){
     229      // malloc failed... we are out of luck
     230      throw std::bad_alloc();
     231    }
     232
     233    // see if we found our function name
     234    if(stack_depth==max_depth){
     235      // find the mangled function name
     236      char *begin = stack_strings[max_depth-1];
     237      // function name starts with a (
     238      while(*begin && *begin!='(') ++begin;
     239      char *end=begin;
     240      while(*end && *end!='+') ++end;
     241
     242      // see if we found our function name
     243      if(*begin && *end){
     244        *begin++ = 0;
     245        *end = 0;
     246        // use the C++ demangler
     247
     248        size_t sz = entry_t::info_t::length2;
     249        int status;
     250        char *func_ret = abi::__cxa_demangle(begin, dm_function, &sz, &status);
     251        if(func_ret){
     252          // abi might have realloced...
     253          dm_function = func_ret;
     254          func_name = dm_function;
     255        }
     256        else{
     257          // demangling failed... get the function name without demangling
     258          func_name = begin;
     259        }
     260      }
     261      else{
     262        // function name not found... get the whole line
     263        func_name = stack_strings[max_depth-1];
     264      }
     265
     266    }
     267    else{
     268      func_name = toplevel;
     269    }
     270
     271    // now we copy the desired function name
     272    if((retval = static_cast<char*>(malloc(strlen(func_name)+1)))){
     273      // we know that the string will fit, so strcpy is safe here
     274      strcpy(retval,func_name);
     275    }
     276    else{
     277      free(stack_strings); // malloc()ed by backtrace_symbols
     278      free(dm_function);
     279      // uh-uh ... seems we are out of luck for allocations now
     280      throw std::bad_alloc();
     281    }
     282    free(dm_function);
     283    free(stack_strings); // malloc()ed by backtrace_symbols
     284    return retval;
     285  }
     286#endif
     287}
     288
     289#ifdef __GNUC__
     290
     291void *operator new(size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc) {
    138292
    139293  // to avoid allocations of 0 bytes if someone screws up
     
    153307  }
    154308
    155   // we got the space, so update the global info
    156   Memory::state += nbytes;
    157   if(Memory::state>Memory::max){
    158     Memory::max = Memory::state;
    159   }
    160   Memory::allocs++;
     309  // build the entry in front of the space
     310  Memory::entry_t *entry = (Memory::entry_t*) res;
     311  memset(res,0,entrySpace);
     312  entry->info.nbytes = nbytes;
     313  entry->info.isUsed = true;
     314  strncpy(entry->info.file,file,Memory::entry_t::info_t::length);
     315  entry->info.file[Memory::entry_t::info_t::length] = '\0';
     316  entry->info.line=line;
     317  strncpy(entry->info.function,func,Memory::entry_t::info_t::length2);
     318  entry->info.function[Memory::entry_t::info_t::length2] = '\0';
     319  // the space starts behind the info
     320  entry->info.location = (char*)res + entrySpace;
     321
     322  // mark the block as not in the list (will be changed by addEntry)
     323  entry->isIgnored = true;
     324  Memory::addEntry(entry);
     325
     326  // get the checksum...
     327  entry->checksum = Memory::calcChecksum(&entry->info);
     328
     329  // ok, space is prepared... the user can have it.
     330  // the rest (constructor, deleting when something is thrown etc)
     331  // is handled automatically
     332  return entry->info.location;
     333}
     334
     335#else
     336
     337void *operator new(size_t nbytes,const char* file, int line) throw(std::bad_alloc) {
     338
     339  // to avoid allocations of 0 bytes if someone screws up
     340  // allocation with 0 byte size are undefined behavior, so we are
     341  // free to handle it this way
     342  if(!nbytes) {
     343    nbytes = 1;
     344  }
     345
     346  // get the size of the entry, including alignment
     347  static const size_t entrySpace = Memory::doAlign(sizeof(Memory::entry_t));
     348
     349  void *res;
     350  if(!(res=malloc(entrySpace + nbytes))){
     351    // new must throw, when space is low
     352    throw std::bad_alloc();
     353  }
    161354
    162355  // build the entry in front of the space
     
    171364  entry->info.location = (char*)res + entrySpace;
    172365
    173   // add the entry at the end of the list
    174   entry->next=0;            // the created block is last in the list
    175   entry->prev=Memory::end;  // the created block is last in the list
    176   if(!Memory::begin){
    177     // the list was empty... start a new one
    178     Memory::begin=entry;
    179   }
    180   else {
    181     // other blocks present... we can add to the last one
    182     Memory::end->next=entry;
    183   }
    184   Memory::end=entry;
     366  // mark the block as not in the list (will be changed by addEntry)
     367  entry->isIgnored = true;
     368  Memory::addEntry(entry);
    185369
    186370  // get the checksum...
     
    196380}
    197381
     382#endif
     383
    198384void *operator new(size_t nbytes) throw(std::bad_alloc) {
    199385  // Just forward to the other operator, when we do not know from
    200386  // where the allocation came
     387#ifdef __GNUC__
     388  // this might throw bad_alloc
     389  char *caller = Memory::getCaller();
     390  void* retval = 0;
     391
     392  // if this throws, we have to clean up the caller anyway
     393  try{
     394    retval = operator new(nbytes,"Unknown",0,caller);
     395  }
     396  catch(...)
     397  {
     398    free(caller); // malloc()ed by Memory::getCaller();
     399    throw;
     400  }
     401  free(caller); // malloc()ed by Memory::getCaller();
     402  return retval;
     403#else
    201404  return operator new(nbytes,"Unknown",0);
    202 }
     405#endif
     406}
     407
     408#ifdef __GNUC__
     409
     410void *operator new[] (size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc) {
     411  // The difference between new and new[] is just for compiler bookkeeping.
     412  return operator new(nbytes,file,line,func);
     413}
     414
     415#else
    203416
    204417void *operator new[] (size_t nbytes,const char* file, int line) throw(std::bad_alloc) {
     
    207420}
    208421
     422#endif
     423
    209424void *operator new[] (size_t nbytes) throw(std::bad_alloc) {
    210425  // Forward again
     426#ifdef __GNUC__
     427  // this might throw bad_alloc
     428    char *caller = Memory::getCaller();
     429    void *retval=0;
     430
     431    // if this throws, we have to clean up the caller anyway
     432    try{
     433      retval = operator new[] (nbytes,"Unknown",0,caller);
     434    }
     435    catch(...)
     436    {
     437      free(caller); // malloc()ed by Memory::getCaller();
     438      throw;
     439    }
     440    free(caller); // malloc()ed by Memory::getCaller();
     441    return retval;
     442#else
    211443  return operator new[] (nbytes,"Unknown",0);
     444#endif
    212445}
    213446
     
    217450    return;
    218451  }
    219 
    220   // we need to lock, so the linked list does not changed while we are in here
    221   boost::mutex::scoped_lock guard(Memory::memorylock);
    222452
    223453  // get the size for the entry, including alignment
  • src/Helpers/MemDebug.hpp

    r1b2d30 r55240c4  
    2828#endif
    2929
     30#include <new>
     31
     32// some light header files, that do weird new stuff and therefore need
     33// to be loaded before the define
     34#include <string>
     35#include <boost/optional.hpp>
     36#include <boost/shared_ptr.hpp>
     37#include <boost/function.hpp>
     38#include <boost/program_options.hpp>
     39
     40
    3041namespace Memory {
    3142
     
    5061  }
    5162}
    52 
     63#ifdef __GNUC__
     64void *operator new   (size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc);
     65void *operator new[] (size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc);
     66#else
    5367void *operator new   (size_t nbytes,const char* file, int line) throw(std::bad_alloc);
    5468void *operator new[] (size_t nbytes,const char* file, int line) throw(std::bad_alloc);
     69#endif
    5570void operator delete   (void *ptr,const char*, int) throw();
    5671void operator delete[] (void *ptr,const char*, int) throw();
     72
     73
    5774
    5875/**
     
    6077 * version that allows tracking.
    6178 */
     79#ifdef __GNUC__
     80#define new new(__FILE__,__LINE__,__PRETTY_FUNCTION__)
     81#else
    6282#define new new(__FILE__,__LINE__)
     83#endif
    6384
    6485#endif
    6586#endif
    6687
     88
     89#ifdef NDEBUG
     90#undef MEMDEBUG
     91#endif
    6792
    6893#ifndef MEMDEBUG
  • src/Legacy/oldmenu.cpp

    r1b2d30 r55240c4  
    66 *
    77 */
     8
     9#include "Helpers/MemDebug.hpp"
    810
    911#include "Legacy/oldmenu.hpp"
     
    2628#include "vector_ops.hpp"
    2729#include "Plane.hpp"
     30#include "Line.hpp"
    2831
    2932#include "UIElements/UIFactory.hpp"
     
    191194          // rotate vector around first angle
    192195          first->x = x;
    193           first->x = RotateVector(first->x,z,b - M_PI);
     196          first->x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);
    194197          Log() << Verbose(0) << "Rotated vector: " << first->x << endl,
    195198          // remove the projection onto the rotation plane of the second angle
     
    207210          // rotate another vector around second angle
    208211          n = y;
    209           n = RotateVector(n,x,c - M_PI);
     212          n = Line(zeroVec,x).rotateVector(n,c - M_PI);
    210213          Log() << Verbose(0) << "2nd Rotated vector: " << n << endl;
    211214
  • src/Line.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "Line.hpp"
    911
     
    1113
    1214#include "vector.hpp"
    13 
    14 Line::Line(Vector &_origin, Vector &_direction) :
    15   origin(new Vector(_origin)),
     15#include "log.hpp"
     16#include "verbose.hpp"
     17#include "gslmatrix.hpp"
     18#include "info.hpp"
     19#include "Exceptions/LinearDependenceException.hpp"
     20#include "Exceptions/SkewException.hpp"
     21#include "Plane.hpp"
     22
     23using namespace std;
     24
     25Line::Line(const Vector &_origin, const Vector &_direction) :
    1626  direction(new Vector(_direction))
    1727{
    1828  direction->Normalize();
    19 }
     29  origin.reset(new Vector(_origin.partition(*direction).second));
     30}
     31
     32Line::Line(const Line &src) :
     33  origin(new Vector(*src.origin)),
     34  direction(new Vector(*src.direction))
     35{}
    2036
    2137Line::~Line()
     
    2440
    2541double Line::distance(const Vector &point) const{
    26   return fabs(point.ScalarProduct(*direction) - origin->ScalarProduct(*direction));
     42  // get any vector from line to point
     43  Vector helper = point - *origin;
     44  // partition this vector along direction
     45  // the residue points from the line to the point
     46  return helper.partition(*direction).second.Norm();
    2747}
    2848
    2949Vector Line::getClosestPoint(const Vector &point) const{
    30   double factor = point.ScalarProduct(*direction) - origin->ScalarProduct(*direction);
    31   return (point - (factor * (*direction)));
    32 }
     50  // get any vector from line to point
     51  Vector helper = point - *origin;
     52  // partition this vector along direction
     53  // add only the part along the direction
     54  return *origin + helper.partition(*direction).first;
     55}
     56
     57Vector Line::getDirection() const{
     58  return *direction;
     59}
     60
     61Vector Line::getOrigin() const{
     62  return *origin;
     63}
     64
     65vector<Vector> Line::getPointsOnLine() const{
     66  vector<Vector> res;
     67  res.reserve(2);
     68  res.push_back(*origin);
     69  res.push_back(*origin+*direction);
     70  return res;
     71}
     72
     73/** Calculates the intersection of the two lines that are both on the same plane.
     74 * This is taken from Weisstein, Eric W. "Line-Line Intersection." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html
     75 * \param *out output stream for debugging
     76 * \param *Line1a first vector of first line
     77 * \param *Line1b second vector of first line
     78 * \param *Line2a first vector of second line
     79 * \param *Line2b second vector of second line
     80 * \return true - \a this will contain the intersection on return, false - lines are parallel
     81 */
     82Vector Line::getIntersection(const Line& otherLine) const{
     83  Info FunctionInfo(__func__);
     84
     85  pointset line1Points = getPointsOnLine();
     86
     87  Vector Line1a = line1Points[0];
     88  Vector Line1b = line1Points[1];
     89
     90  pointset line2Points = otherLine.getPointsOnLine();
     91
     92  Vector Line2a = line2Points[0];
     93  Vector Line2b = line2Points[1];
     94
     95  Vector res;
     96
     97  auto_ptr<GSLMatrix> M = auto_ptr<GSLMatrix>(new GSLMatrix(4,4));
     98
     99  M->SetAll(1.);
     100  for (int i=0;i<3;i++) {
     101    M->Set(0, i, Line1a[i]);
     102    M->Set(1, i, Line1b[i]);
     103    M->Set(2, i, Line2a[i]);
     104    M->Set(3, i, Line2b[i]);
     105  }
     106
     107  //Log() << Verbose(1) << "Coefficent matrix is:" << endl;
     108  //for (int i=0;i<4;i++) {
     109  //  for (int j=0;j<4;j++)
     110  //    cout << "\t" << M->Get(i,j);
     111  //  cout << endl;
     112  //}
     113  if (fabs(M->Determinant()) > MYEPSILON) {
     114    Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
     115    throw SkewException(__FILE__,__LINE__);
     116  }
     117
     118  Log() << Verbose(1) << "INFO: Line1a = " << Line1a << ", Line1b = " << Line1b << ", Line2a = " << Line2a << ", Line2b = " << Line2b << "." << endl;
     119
     120
     121  // constuct a,b,c
     122  Vector a = Line1b - Line1a;
     123  Vector b = Line2b - Line2a;
     124  Vector c = Line2a - Line1a;
     125  Vector d = Line2b - Line1b;
     126  Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl;
     127  if ((a.NormSquared() < MYEPSILON) || (b.NormSquared() < MYEPSILON)) {
     128   res.Zero();
     129   Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl;
     130   throw LinearDependenceException(__FILE__,__LINE__);
     131  }
     132
     133  // check for parallelity
     134  Vector parallel;
     135  double factor = 0.;
     136  if (fabs(a.ScalarProduct(b)*a.ScalarProduct(b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) {
     137    parallel = Line1a - Line2a;
     138    factor = parallel.ScalarProduct(a)/a.Norm();
     139    if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
     140      res = Line2a;
     141      Log() << Verbose(1) << "Lines conincide." << endl;
     142      return res;
     143    } else {
     144      parallel = Line1a - Line2b;
     145      factor = parallel.ScalarProduct(a)/a.Norm();
     146      if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
     147        res = Line2b;
     148        Log() << Verbose(1) << "Lines conincide." << endl;
     149        return res;
     150      }
     151    }
     152    Log() << Verbose(1) << "Lines are parallel." << endl;
     153    res.Zero();
     154    throw LinearDependenceException(__FILE__,__LINE__);
     155  }
     156
     157  // obtain s
     158  double s;
     159  Vector temp1, temp2;
     160  temp1 = c;
     161  temp1.VectorProduct(b);
     162  temp2 = a;
     163  temp2.VectorProduct(b);
     164  Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl;
     165  if (fabs(temp2.NormSquared()) > MYEPSILON)
     166    s = temp1.ScalarProduct(temp2)/temp2.NormSquared();
     167  else
     168    s = 0.;
     169  Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;
     170
     171  // construct intersection
     172  res = a;
     173  res.Scale(s);
     174  res += Line1a;
     175  Log() << Verbose(1) << "Intersection is at " << res << "." << endl;
     176
     177  return res;
     178}
     179
     180/** Rotates the vector by an angle of \a alpha around this line.
     181 * \param rhs Vector to rotate
     182 * \param alpha rotation angle in radian
     183 */
     184Vector Line::rotateVector(const Vector &rhs, double alpha) const{
     185  Vector helper = rhs;
     186
     187  // translate the coordinate system so that the line goes through (0,0,0)
     188  helper -= *origin;
     189
     190  // partition the vector into a part that gets rotated and a part that lies along the line
     191  pair<Vector,Vector> parts = helper.partition(*direction);
     192
     193  // we just keep anything that is along the axis
     194  Vector res = parts.first;
     195
     196  // the rest has to be rotated
     197  Vector a = parts.second;
     198  // we only have to do the rest, if we actually could partition the vector
     199  if(!a.IsZero()){
     200    // construct a vector that is orthogonal to a and direction and has length |a|
     201    Vector y = a;
     202    // direction is normalized, so the result has length |a|
     203    y.VectorProduct(*direction);
     204
     205    res += cos(alpha) * a + sin(alpha) * y;
     206  }
     207
     208  // translate the coordinate system back
     209  res += *origin;
     210  return res;
     211}
     212
     213Plane Line::getOrthogonalPlane(const Vector &origin) const{
     214  return Plane(getDirection(),origin);
     215}
     216
     217Line makeLineThrough(const Vector &x1, const Vector &x2){
     218  if(x1==x2){
     219    throw LinearDependenceException(__FILE__,__LINE__);
     220  }
     221  return Line(x1,x1-x2);
     222}
  • src/Line.hpp

    r1b2d30 r55240c4  
    1212
    1313#include <memory>
     14#include <vector>
    1415
    1516class Vector;
     17class Plane;
    1618
    1719class Line : public Space
    1820{
    1921public:
    20   Line(Vector &_origin, Vector &_direction);
     22  Line(const Vector &_origin, const Vector &_direction);
     23  Line(const Line& _src);
    2124  virtual ~Line();
    2225
    23   virtual double distance(const Vector &point) const=0;
    24   virtual Vector getClosestPoint(const Vector &point) const=0;
     26  virtual double distance(const Vector &point) const;
     27  virtual Vector getClosestPoint(const Vector &point) const;
     28
     29  Vector getDirection() const;
     30  Vector getOrigin() const;
     31
     32  std::vector<Vector> getPointsOnLine() const;
     33
     34  Vector getIntersection(const Line& otherLine) const;
     35
     36  Vector rotateVector(const Vector &rhs, double alpha) const;
     37
     38  Plane getOrthogonalPlane(const Vector &origin) const;
    2539
    2640private:
     
    2943};
    3044
     45/**
     46 * Named constructor to make a line through two points
     47 */
     48Line makeLineThrough(const Vector &x1, const Vector &x2);
     49
    3150#endif /* LINE_HPP_ */
  • src/Makefile.am

    r1b2d30 r55240c4  
    118118  Descriptors/AtomTypeDescriptor.cpp \
    119119  Descriptors/MoleculeDescriptor.cpp \
    120   Descriptors/MoleculeIdDescriptor.cpp \ 
     120  Descriptors/MoleculeIdDescriptor.cpp \
    121121  Descriptors/MoleculeNameDescriptor.cpp \
    122   Descriptors/MoleculePtrDescriptor.cpp
     122  Descriptors/MoleculePtrDescriptor.cpp 
    123123                                   
    124124
     
    132132                                   
    133133EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
    134   Exceptions/LinearDependenceException.cpp \
    135   Exceptions/MathException.cpp \
    136   Exceptions/ZeroVectorException.cpp
     134                                  Exceptions/LinearDependenceException.cpp \
     135                                  Exceptions/MathException.cpp \
     136                                  Exceptions/SkewException.cpp \
     137                                  Exceptions/ZeroVectorException.cpp
    137138                                 
    138139EXCEPTIONHEADER = Exceptions/CustomException.hpp \
    139   Exceptions/LinearDependenceException.hpp \
    140   Exceptions/MathException.hpp \
    141   Exceptions/ZeroVectorException.hpp
     140                                  Exceptions/LinearDependenceException.hpp \
     141                                  Exceptions/MathException.hpp \
     142                                  Exceptions/SkewException.hpp \
     143                                  Exceptions/ZeroVectorException.hpp
    142144
    143145SOURCE = \
  • src/Parser/ChangeTracker.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "ChangeTracker.hpp"
     
    1315 * Constructor. Signs on as an observer for the World.
    1416 */
    15 ChangeTracker::ChangeTracker() {
     17ChangeTracker::ChangeTracker() :
     18  Observable("ChangeTracker")
     19{
    1620  isConsistent = true;
    1721  World::getInstance().signOn(this);
  • src/Parser/FormatParser.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "FormatParser.hpp"
     
    1416 * Constructor.
    1517 */
    16 FormatParser::FormatParser() {
     18FormatParser::FormatParser() :
     19  Observer("FormatParser")
     20{
    1721  ChangeTracker::get()->signOn(this);
    1822  saveStream = NULL;
  • src/Parser/TremoloParser.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Helpers/Assert.hpp"
  • src/Parser/XyzParser.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "XyzParser.hpp"
  • src/Patterns/Cacheable.hpp

    r1b2d30 r55240c4  
    3535        return busy;
    3636      }
     37    virtual std::string getName()=0;
    3738    protected:
    3839      bool busy;
     
    6465        // nothing to do when entering this
    6566      }
     67
     68      virtual std::string getName(){
     69        return "invalid";
     70      }
    6671    };
    6772
     
    9095        State::busy = false;
    9196      }
     97
     98      virtual std::string getName(){
     99        return "valid";
     100      }
    92101    private:
    93102      T content;
     
    118127        // nothing to do when entering this state
    119128      }
     129
     130      virtual std::string getName(){
     131        return "destroyed";
     132      }
    120133    };
    121134
     
    124137
    125138  public:
    126     Cacheable(Observable *_owner, boost::function<T()> _recalcMethod);
     139    Cacheable(Observable *_owner, boost::function<T()> _recalcMethod, std::string name);
    127140    virtual ~Cacheable();
    128141
     
    151164
    152165  template<typename T>
    153   Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod) :
     166  Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod, std::string name) :
     167    Observer(name + "(Cached)"),
    154168    owner(_owner),
    155169    recalcMethod(_recalcMethod)
     
    206220  void Cacheable<T>::switchState(state_ptr newState){
    207221    ASSERT(!state->isBusy(),"LOOP DETECTED: Cacheable state switched while recalculating.\nDid the recalculation trigger the Observable?");
     222#ifdef LOG_OBSERVER
     223    observerLog().addMessage() << "## Cacheable " << observerLog().getName(this) << " changed state (" << state->getName()
     224                               << "->" << newState->getName() << ")" << std::endl;
     225#endif
    208226    state = newState;
    209227    state->enter();
     
    215233  {
    216234  public:
    217     Cacheable(Observable *_owner, boost::function<T()> _recalcMethod);
     235    Cacheable(Observable *_owner, boost::function<T()> _recalcMethod,std::string name);
    218236    virtual ~Cacheable();
    219237
    220238    const bool isValid() const;
    221     const T& operator*() const;
     239    const T operator*() const;
    222240
    223241    // methods implemented for base-class Observer
     
    230248
    231249  template<typename T>
    232   Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod) :
     250  Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod, std::string name) :
     251    Observer(name),
    233252    recalcMethod(_recalcMethod)
    234253  {}
    235254
    236255  template<typename T>
    237   const T& Cacheable<T>::operator*() const{
     256  const T Cacheable<T>::operator*() const{
    238257    return recalcMethod();
    239258  }
  • src/Patterns/ObservedIterator.hpp

    r1b2d30 r55240c4  
    8484  {
    8585    --iter;
     86    return *this;
    8687  }
    8788
  • src/Patterns/Observer.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "Observer.hpp"
    911
     
    1214
    1315#include "Helpers/Assert.hpp"
     16#include "Helpers/MemDebug.hpp"
    1417
    1518using namespace std;
     
    4346  // if no entry for this observable is found, an new one is created
    4447  // by the STL and initialized to 0 (see STL documentation)
     48#ifdef LOG_OBSERVER
     49  observerLog().addMessage(depth[publisher]) << ">> Locking " << observerLog().getName(publisher) << endl;
     50#endif
    4551  depth[publisher]++;
    4652}
     
    6066  // if zero is reached all observed blocks are done and we can
    6167  // start to notify our observers
    62   if(--(depth[publisher])){}
     68  --depth[publisher];
     69#ifdef LOG_OBSERVER
     70  observerLog().addMessage(depth[publisher]) << "<< Unlocking " << observerLog().getName(publisher) << endl;
     71#endif
     72  if(depth[publisher]){}
    6373  else{
    6474    publisher->notifyAll();
     
    123133      callees_t::iterator iter;
    124134      for(iter=callees.begin();iter!=callees.end();++iter){
     135#ifdef LOG_OBSERVER
     136        observerLog().addMessage() << "-> Sending update from " << observerLog().getName(this)
     137                                   << " to " << observerLog().getName((*iter).second)
     138                                   << " (priority=" << (*iter).first << ")"<< endl;
     139#endif
    125140        (*iter).second->update(this);
    126141      }
     
    165180    // we do not need to publish all the changes at each time we are called
    166181    if(depth.find(this)==depth.end()) {
     182#ifdef LOG_OBSERVER
     183      observerLog().addMessage() << "-* Update from " << observerLog().getName(publisher)
     184                                 << " propagated by " << observerLog().getName(this) << endl;
     185#endif
    167186      notifyAll();
     187    }
     188    else{
     189#ifdef LOG_OBSERVER
     190      observerLog().addMessage() << "-| Update from " <<  observerLog().getName(publisher)
     191                                 << " not propagated by " << observerLog().getName(this) << endl;
     192#endif
    168193    }
    169194  }
     
    177202void Observable::signOn(Observer *target,int priority) {
    178203  ASSERT(priority>=-20 && priority<=+20, "Priority out of range [-20:+20] when signing on Observer");
     204#ifdef LOG_OBSERVER
     205  observerLog().addMessage() << "@@ Signing on " << observerLog().getName(target) << " to " << observerLog().getName(this) << endl;
     206#endif
    179207  bool res = false;
    180208  callees_t &callees = callTable[this];
     
    194222void Observable::signOff(Observer *target) {
    195223  ASSERT(callTable.count(this),"SignOff called for an Observable without Observers.");
     224#ifdef LOG_OBSERVER
     225  observerLog().addMessage() << "** Signing off " << observerLog().getName(target) << " from " << observerLog().getName(this) << endl;
     226#endif
    196227  callees_t &callees = callTable[this];
    197228
     
    238269/** Constructor for class Observable.
    239270 */
    240 Observable::Observable()
    241 {}
     271Observable::Observable(string name) :
     272  Observer(Observer::BaseConstructor())
     273{
     274#ifdef LOG_OBSERVER
     275  observerLog().addName(this,name);
     276  observerLog().addMessage() << "++ Creating Observable " << observerLog().getName(this) << endl;
     277#endif
     278}
    242279
    243280/** Destructor for class Observable.
     
    246283Observable::~Observable()
    247284{
     285#ifdef LOG_OBSERVER
     286  observerLog().addMessage() << "-- Destroying Observable " << observerLog().getName(this) << endl;
     287#endif
    248288  if(callTable.count(this)) {
    249289    // delete all entries for this observable
     
    259299/** Constructor for class Observer.
    260300 */
    261 Observer::Observer()
    262 {}
     301Observer::Observer(string name)
     302{
     303#ifdef LOG_OBSERVER
     304  observerLog().addName(this,name);
     305  observerLog().addMessage() << "++ Creating Observer " << observerLog().getName(this) << endl;
     306#endif
     307}
     308
     309/**
     310 * Base Constructor for class Observer
     311 *
     312 * only called from Observable Constructor
     313 */
     314Observer::Observer(Observer::BaseConstructor){
     315#ifdef LOG_OBSERVER
     316  observerLog().addObservable(this);
     317#endif
     318}
    263319
    264320/** Destructor for class Observer.
    265321 */
    266322Observer::~Observer()
    267 {}
     323{
     324#ifdef LOG_OBSERVER
     325  if(!observerLog().isObservable(this)){
     326    observerLog().addMessage() << "-- Destroying Observer " << observerLog().getName(this) << endl;
     327  }
     328#endif
     329}
    268330
    269331/**
     
    296358  }
    297359}
     360
     361#ifdef LOG_OBSERVER
     362
     363/************************* Methods to do logging of the Observer Mechanism *********/
     364
     365// The log needs to exist fairly early, so we make it construct on first use,
     366// and never destroy it
     367ObserverLog &observerLog(){
     368  // yes, this memory is never freed... we need it around for the whole programm,
     369  // so no freeing is possible
     370  static ObserverLog *theLog = Memory::ignore(new ObserverLog());
     371  return *theLog;
     372}
     373
     374
     375ObserverLog::ObserverLog() :
     376  count (0)
     377{}
     378
     379ObserverLog::~ObserverLog(){}
     380
     381string ObserverLog::getLog(){return log.str();}
     382
     383std::string ObserverLog::getName(void* obj){
     384  return names[obj];
     385}
     386
     387bool ObserverLog::isObservable(void* obj){
     388  return observables.count(obj);
     389}
     390
     391void ObserverLog::addName(void* obj , string name){
     392  stringstream sstr;
     393  sstr << name << "_" << count++;
     394  names[obj] = sstr.str();
     395}
     396
     397void ObserverLog::addObservable(void* obj){
     398  observables.insert(obj);
     399}
     400
     401void ObserverLog::deleteName(void* obj){
     402  names.erase(obj);
     403}
     404
     405void ObserverLog::deleteObservable(void* obj){
     406  observables.erase(obj);
     407}
     408
     409stringstream &ObserverLog::addMessage(int depth){
     410  for(int i=depth;i--;)
     411    log << "  ";
     412  return log;
     413}
     414
     415#endif
  • src/Patterns/Observer.hpp

    r1b2d30 r55240c4  
    1111#include <map>
    1212#include <set>
     13#include <string>
     14#include <sstream>
    1315
    1416/**
     
    2830 */
    2931
     32// Deactivate any logging when we are not in debug mode
     33#ifdef NDEBUG
     34#undef LOG_OBSERVER
     35#endif
     36
    3037class Observable;
    3138class Notification;
     
    5865  template<class> friend class ObservedIterator;
    5966
    60 public:
    61   Observer();
     67  // indicates the constructor called from Observables
     68  struct BaseConstructor{};
     69
     70public:
     71  Observer(BaseConstructor);
     72  Observer(std::string);
    6273  virtual ~Observer();
    6374
     
    91102class Observable : public Observer {
    92103public:
    93   Observable();
     104  Observable(std::string _name);
    94105  virtual ~Observable();
    95106
     
    192203};
    193204
     205#ifdef LOG_OBSERVER
     206
     207/**
     208 * This class is used to log the working of the observer mechanism
     209 *
     210 * TODO: make this conditional dependent on compiler Flag.
     211 */
     212class ObserverLog{
     213  friend class Observable;
     214  friend class Observer;
     215  template <typename> friend class Cacheable;
     216public:
     217  ObserverLog();
     218  ~ObserverLog();
     219  std::string getLog();                        // get everything that has been logged
     220  std::string getName(void*);                  // get the name of an actor
     221  bool isObservable(void*);
     222private:
     223  int count;                                   // number to reference each actor in this framework
     224  std::map<void*,std::string> names;           // List of names assigned to actors
     225  std::set<void*> observables;                 // List of pointers to Observables. Needed to distinguish Observers and Observables
     226  void addName(void*, std::string);            // Assign a name to an Actor
     227  void addObservable(void*);
     228  void deleteName(void*);                      // delete the name of an Actor
     229  void deleteObservable(void*);
     230  std::stringstream &addMessage(int depth=0);  // Add a Message to the logging
     231  std::stringstream log;                       // The internal log object
     232};
     233
     234ObserverLog &observerLog();
     235
     236#endif
     237
    194238// extra macro is necessary to work with __LINE__
    195239#define PASTE(a,b) PASTE_HELPER(a,b)
  • src/Plane.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Plane.hpp"
     
    1416#include "Helpers/Assert.hpp"
    1517#include <cmath>
     18#include "Line.hpp"
     19#include "Exceptions/MultipleSolutionsException.hpp"
    1620
    1721/**
     
    4246/**
    4347 * Constructs a plane from two direction vectors and a offset.
    44  * If no offset is given a plane through origin is assumed
    4548 */
    4649Plane::Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException) :
     
    113116}
    114117
    115 Vector Plane::getOffsetVector() {
     118Vector Plane::getOffsetVector() const {
    116119  return getOffset()*getNormal();
    117120}
    118121
    119 vector<Vector> Plane::getPointsOnPlane(){
     122vector<Vector> Plane::getPointsOnPlane() const{
    120123  std::vector<Vector> res;
    121124  res.reserve(3);
     
    147150 * \return true -  \a this contains intersection point on return, false - line is parallel to plane (even if in-plane)
    148151 */
    149 Vector Plane::GetIntersection(const Vector &Origin, const Vector &LineVector)
     152Vector Plane::GetIntersection(const Line& line) const
    150153{
    151154  Info FunctionInfo(__func__);
    152155  Vector res;
    153156
    154   // find intersection of a line defined by Offset and Direction with a  plane defined by triangle
    155   Vector Direction = LineVector - Origin;
    156   Direction.Normalize();
    157   Log() << Verbose(1) << "INFO: Direction is " << Direction << "." << endl;
    158   //Log() << Verbose(1) << "INFO: PlaneNormal is " << *PlaneNormal << " and PlaneOffset is " << *PlaneOffset << "." << endl;
    159   double factor1 = Direction.ScalarProduct(*normalVector.get());
    160   if (fabs(factor1) < MYEPSILON) { // Uniqueness: line parallel to plane?
    161     Log() << Verbose(1) << "BAD: Line is parallel to plane, no intersection." << endl;
    162     throw LinearDependenceException(__FILE__,__LINE__);
    163   }
    164 
    165   double factor2 = Origin.ScalarProduct(*normalVector.get());
    166   if (fabs(factor2-offset) < MYEPSILON) { // Origin is in-plane
    167     Log() << Verbose(1) << "GOOD: Origin of line is in-plane." << endl;
    168     res = Origin;
    169     return res;
    170   }
    171 
     157  double factor1 = getNormal().ScalarProduct(line.getDirection());
     158  if(fabs(factor1)<MYEPSILON){
     159    // the plane is parallel... under all circumstances this is bad luck
     160    // we no have either no or infinite solutions
     161    if(isContained(line.getOrigin())){
     162      throw MultipleSolutionsException<Vector>(__FILE__,__LINE__,line.getOrigin());
     163    }
     164    else{
     165      throw LinearDependenceException(__FILE__,__LINE__);
     166    }
     167  }
     168
     169  double factor2 = getNormal().ScalarProduct(line.getOrigin());
    172170  double scaleFactor = (offset-factor2)/factor1;
    173171
    174   //factor = Origin->ScalarProduct(PlaneNormal)*(-PlaneOffset->ScalarProduct(PlaneNormal))/(Direction.ScalarProduct(PlaneNormal));
    175   Direction.Scale(scaleFactor);
    176   res = Origin + Direction;
    177   Log() << Verbose(1) << "INFO: Scaled direction is " << Direction << "." << endl;
    178 
    179   // test whether resulting vector really is on plane
    180   ASSERT(fabs(res.ScalarProduct(*normalVector) - offset) < MYEPSILON,
    181          "Calculated line-Plane intersection does not lie on plane.");
     172  res = line.getOrigin() + scaleFactor * line.getDirection();
     173
     174  // tests to make sure the resulting vector really is on plane and line
     175  ASSERT(isContained(res),"Calculated line-Plane intersection does not lie on plane.");
     176  ASSERT(line.isContained(res),"Calculated line-Plane intersection does not lie on line.");
    182177  return res;
    183178};
     179
     180Vector Plane::mirrorVector(const Vector &rhs) const {
     181  Vector helper = getVectorToPoint(rhs);
     182  // substract twice the Vector to the plane
     183  return rhs+2*helper;
     184}
     185
     186Line Plane::getOrthogonalLine(const Vector &origin) const{
     187  return Line(origin,getNormal());
     188}
    184189
    185190/************ Methods inherited from Space ****************/
  • src/Plane.hpp

    r1b2d30 r55240c4  
    1717
    1818class Vector;
     19class Line;
    1920
    2021class Plane : public Space
     
    4243   * Same as getOffset()*getNormal();
    4344   */
    44   Vector getOffsetVector();
     45  Vector getOffsetVector() const;
    4546
    4647  /**
    4748   * returns three seperate points on this plane
    4849   */
    49   std::vector<Vector> getPointsOnPlane();
     50  std::vector<Vector> getPointsOnPlane() const;
    5051
    5152  // some calculations
    52   Vector GetIntersection(const Vector &Origin, const Vector &LineVector);
     53  Vector GetIntersection(const Line &Line) const;
     54
     55  Vector mirrorVector(const Vector &rhs) const;
     56
     57  /**
     58   * get a Line that is orthogonal to this plane, going through a chosen
     59   * point.
     60   *
     61   * The point does not have to lie on the plane itself.
     62   */
     63  Line getOrthogonalLine(const Vector &origin) const;
    5364
    5465  /****** Methods inherited from Space ***********/
  • src/Space.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Space.hpp"
     
    1921}
    2022
     23Vector Space::getVectorToPoint(const Vector &origin) const{
     24  Vector support = getClosestPoint(origin);
     25  return support-origin;
     26}
     27
    2128bool Space::isContained(const Vector &point) const{
    2229  return (distance(point)) < MYEPSILON;
  • src/Space.hpp

    r1b2d30 r55240c4  
    1717  virtual ~Space();
    1818
     19  /**
     20   * Calculates the distance between a Space and a Vector.
     21   */
    1922  virtual double distance(const Vector &point) const=0;
     23
     24  /**
     25   * get the closest point inside the space to another point
     26   */
    2027  virtual Vector getClosestPoint(const Vector &point) const=0;
     28
     29  /**
     30   * get the shortest Vector from a point to a Space.
     31   *
     32   * The Vector always points from the given Vector to the point in space
     33   * returned by Plane::getClosestPoint().
     34   */
     35  virtual Vector getVectorToPoint(const Vector &point) const;
     36
     37  /**
     38   * Test wether a point is contained in the space.
     39   *
     40   * returns true, when the point lies inside and false
     41   * otherwise.
     42   */
    2143  virtual bool isContained(const Vector &point) const;
     44
     45  /**
     46   * Tests if this space contains the center of the coordinate system.
     47   */
    2248  virtual bool hasZero() const;
    2349
  • src/UIElements/CommandLineUI/CommandLineDialog.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
    89
    910#include <iostream>
  • src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
    89
    910#include "CommandLineUI/CommandLineStatusIndicator.hpp"
     
    1516using namespace std;
    1617
    17 CommandLineStatusIndicator::CommandLineStatusIndicator()
     18CommandLineStatusIndicator::CommandLineStatusIndicator() :
     19    Observer("CommandLineStatusIndicator")
    1820{
    1921  Process::AddObserver(this);
  • src/UIElements/CommandLineUI/CommandLineUIFactory.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
    89
    910#include "CommandLineUI/CommandLineUIFactory.hpp"
     
    3132  return new CommandLineWindow();
    3233}
     34
     35CommandLineUIFactory::description::description() :
     36    UIFactory::factoryDescription("CommandLine")
     37{}
     38
     39CommandLineUIFactory::description::~description()
     40{}
     41
     42UIFactory* CommandLineUIFactory::description::makeFactory(){
     43  return new CommandLineUIFactory();
     44}
  • src/UIElements/CommandLineUI/CommandLineUIFactory.hpp

    r1b2d30 r55240c4  
    2121  virtual MainWindow* makeMainWindow();
    2222
     23  struct description : public UIFactory::factoryDescription {
     24    description();
     25    virtual ~description();
     26
     27    virtual UIFactory* makeFactory();
     28  };
     29
    2330protected:
    2431  CommandLineUIFactory();
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <boost/bind.hpp>
  • src/UIElements/Dialog.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <cassert>
  • src/UIElements/MainWindow.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MainWindow.hpp"
  • src/UIElements/Menu/ActionMenuItem.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/UIElements/Menu/DisplayMenuItem.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <sstream>
  • src/UIElements/Menu/Menu.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Menu.hpp"
  • src/UIElements/Menu/MenuItem.cpp

    r1b2d30 r55240c4  
    66 */
    77
    8 
     8#include "Helpers/MemDebug.hpp"
    99
    1010#include "Menu/MenuItem.hpp"
  • src/UIElements/Menu/SeperatorItem.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
     9
    710#include <string>
    811#include <sstream>
  • src/UIElements/Menu/SubMenuItem.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "SubMenuItem.hpp"
  • src/UIElements/Menu/TextMenu.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <boost/bind.hpp>
  • src/UIElements/TextUI/TextDialog.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/UIElements/TextUI/TextStatusIndicator.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "TextUI/TextStatusIndicator.hpp"
     
    1416using namespace std;
    1517
    16 TextStatusIndicator::TextStatusIndicator()
     18TextStatusIndicator::TextStatusIndicator() :
     19  Observer("TextStatusIndicator")
    1720{
    1821  Process::AddObserver(this);
  • src/UIElements/TextUI/TextUIFactory.cpp

    r1b2d30 r55240c4  
    66 */
    77
    8 #include "TextUI/TextUIFactory.hpp"
    9 #include "TextUI/TextWindow.hpp"
    10 #include "TextUI/TextDialog.hpp"
     8#include "UIElements/TextUI/TextUIFactory.hpp"
     9#include "UIElements/TextUI/TextWindow.hpp"
     10#include "UIElements/TextUI/TextDialog.hpp"
    1111
    1212
    1313TextUIFactory::TextUIFactory()
    14 {
    15   // TODO Auto-generated constructor stub
    16 
    17 }
     14{}
    1815
    1916TextUIFactory::~TextUIFactory()
    20 {
    21   // TODO Auto-generated destructor stub
    22 }
     17{}
    2318
    2419
     
    3126}
    3227
     28TextUIFactory::description::description() :
     29    UIFactory::factoryDescription("Text")
     30{}
     31
     32TextUIFactory::description::~description()
     33{}
     34
     35UIFactory* TextUIFactory::description::makeFactory(){
     36  return new TextUIFactory();
     37}
     38
  • src/UIElements/TextUI/TextUIFactory.hpp

    r1b2d30 r55240c4  
    2121  virtual MainWindow* makeMainWindow();
    2222
     23  struct description : public UIFactory::factoryDescription {
     24    description();
     25    virtual ~description();
     26
     27    virtual UIFactory* makeFactory();
     28  };
     29
    2330protected:
    2431  TextUIFactory();
  • src/UIElements/TextUI/TextWindow.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "TextUI/TextWindow.hpp"
  • src/UIElements/UIFactory.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
    89
    9 #include <cassert>
     10#include <utility>
    1011#include "Patterns/Singleton_impl.hpp"
    11 #include "UIFactory.hpp"
     12#include "UIElements/UIFactory.hpp"
     13#include "Helpers/Assert.hpp"
    1214
    13 // all factories that can be used:
    14 #include "TextUI/TextUIFactory.hpp"
    15 #include "CommandLineUI/CommandLineUIFactory.hpp"
     15using namespace std;
     16
     17std::map<std::string,boost::shared_ptr<UIFactory::factoryDescription> > UIFactory::factories;
    1618
    1719UIFactory::UIFactory()
    18 {
    19   // TODO Auto-generated constructor stub
     20{}
    2021
     22UIFactory::~UIFactory()
     23{}
     24
     25void UIFactory::makeUserInterface(std::string type) {
     26  ASSERT(factories.count(type),"Selected factory was not registered before creation.");
     27  // call the factory factory
     28  setInstance(factories[type]->makeFactory());
    2129}
    2230
    23 UIFactory::~UIFactory()
    24 {
    25   // TODO Auto-generated destructor stub
    26 }
    27 
    28 void UIFactory::makeUserInterface(InterfaceTypes type) {
    29   switch(type) {
    30     case Text :
    31       setInstance(new TextUIFactory());
    32       break;
    33     case CommandLine:
    34       setInstance(new CommandLineUIFactory());
    35       break;
    36 
    37     default:
    38       assert(0 && "No such Factory in stock");
    39       break;
    40   }
     31void UIFactory::registerFactory(factoryDescription *factoryDesc) {
     32  ASSERT(!factories.count(factoryDesc->name),"Trying to re-register an already registered factory.");
     33  factories.insert(make_pair(factoryDesc->name,
     34                             boost::shared_ptr<factoryDescription>(factoryDesc)));
    4135}
    4236
    4337CONSTRUCT_SINGLETON(UIFactory)
     38
     39UIFactory::factoryDescription::factoryDescription(string _name) :
     40  name(_name)
     41{}
     42
     43UIFactory::factoryDescription::~factoryDescription()
     44{}
  • src/UIElements/UIFactory.hpp

    r1b2d30 r55240c4  
    1515#include "Patterns/Singleton.hpp"
    1616
     17#include <string>
     18#include <map>
     19#include <boost/smart_ptr.hpp>
     20
    1721/**
    1822 * Abstract Factory to create any kind of User interface object needed by the programm.
     
    2428class UIFactory : public Singleton<UIFactory,false>
    2529{
    26 
     30  friend class Singleton<UIFactory,false>;
    2731public:
    28   enum InterfaceTypes {Text, CommandLine};
    29   virtual ~UIFactory();
    30 
    3132  /**
    3233   * Produce some kind of main window, of whichever type was chosen when the factory was created
     
    4243protected:
    4344  UIFactory();
     45  virtual ~UIFactory();
    4446
    4547public:
     48  struct factoryDescription {
     49    factoryDescription(std::string _name);
     50    virtual ~factoryDescription();
     51
     52    const std::string name;
     53    // yes this method really is a factory factory, to allow insertion of
     54    // arbitrary factories
     55    virtual UIFactory* makeFactory()=0;
     56  };
    4657  /**
    4758   * create a Factory of a certain type. From that moment on only those UIElements can be produced by the factory
    4859   */
    49   static void makeUserInterface(InterfaceTypes type);
    50 
     60  static void makeUserInterface(std::string type);
     61  static void registerFactory(factoryDescription *factoryDesc);
     62protected:
     63private:
     64  static std::map<std::string,boost::shared_ptr<factoryDescription> > factories;
    5165};
    5266
  • src/UIElements/Views/MethodStringView.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MethodStringView.hpp"
  • src/UIElements/Views/StreamStringView.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <sstream>
  • src/UIElements/Views/StringView.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "StringView.hpp"
  • src/UIElements/Views/View.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "View.hpp"
  • src/World.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "World.hpp"
     
    283285
    284286World::World() :
     287    Observable("World"),
    285288    periode(new periodentafel),
    286289    configuration(new config),
  • src/analysis_bonds.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "analysis_bonds.hpp"
  • src/analysis_correlation.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/analyzer.cpp

    r1b2d30 r55240c4  
    77
    88//============================ INCLUDES ===========================
     9
     10#include "Helpers/MemDebug.hpp"
    911
    1012#include <cstring>
  • src/atom.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include "atom.hpp"
     
    1416#include "vector.hpp"
    1517#include "World.hpp"
     18#include "molecule.hpp"
    1619
    1720/************************************* Functions for class atom *************************************/
     
    2124 */
    2225atom::atom() :
    23   previous(NULL), next(NULL), father(this), sort(&nr)
     26  father(this), sort(&nr), mol(0)
    2427{
    2528  node = &x;  // TesselPoint::x can only be referenced from here
     
    2932 */
    3033atom::atom(atom *pointer) :
    31     ParticleInfo(pointer),
    32     previous(NULL), next(NULL), father(pointer), sort(&nr)
     34    ParticleInfo(pointer),father(pointer), sort(&nr)
    3335{
    3436  type = pointer->type;  // copy element of atom
     
    3739  FixedIon = pointer->FixedIon;
    3840  node = &x;
     41  mol = 0;
    3942};
    4043
    4144atom *atom::clone(){
    4245  atom *res = new atom(this);
    43   res->previous=0;
    44   res->next=0;
    4546  res->father = this;
    4647  res->sort = &res->nr;
     
    5051  res->FixedIon = FixedIon;
    5152  res->node = &x;
     53  res->mol = 0;
    5254  World::getInstance().registerAtom(res);
    5355  return res;
     
    5961atom::~atom()
    6062{
     63  removeFromMolecule();
     64  for(BondList::iterator iter=ListOfBonds.begin(); iter!=ListOfBonds.end();){
     65    // deleting the bond will invalidate the iterator !!!
     66    bond *bond =*(iter++);
     67    delete(bond);
     68  }
    6169};
    6270
     
    6775atom *atom::GetTrueFather()
    6876{
    69   atom *walker = this;
    70   do {
    71     if (walker == walker->father) // top most father is the one that points on itself
    72       break;
    73     walker = walker->father;
    74   } while (walker != NULL);
    75   return walker;
     77  if(father == this){ // top most father is the one that points on itself
     78    return this;
     79  }
     80  else if(!father) {
     81    return 0;
     82  }
     83  else {
     84    return father->GetTrueFather();
     85  }
    7686};
    7787
     
    305315}
    306316
    307 atomId_t atom::getId() {
     317atomId_t atom::getId() const {
    308318  return id;
    309319}
     320
     321void atom::setMolecule(molecule *_mol){
     322  // take this atom from the old molecule
     323  removeFromMolecule();
     324  mol = _mol;
     325  if(!mol->containsAtom(this)){
     326    mol->AddAtom(this);
     327  }
     328}
     329
     330void atom::removeFromMolecule(){
     331  if(mol){
     332    if(mol->containsAtom(this)){
     333      mol->erase(this);
     334    }
     335    mol=0;
     336  }
     337}
     338
    310339
    311340atom* NewAtom(atomId_t _id){
  • src/atom.hpp

    r1b2d30 r55240c4  
    3434class Vector;
    3535class World;
     36class molecule;
    3637
    3738/********************************************** declarations *******************************/
     
    4445  friend void  DeleteAtom(atom*);
    4546  public:
    46     atom *previous; //!< previous atom in molecule list
    47     atom *next;     //!< next atom in molecule list
    4847    atom *father;   //!< In many-body bond order fragmentations points to originating atom
    4948    int *sort;      //!< sort criteria
     
    8079  void setWorld(World*);
    8180
    82   virtual atomId_t getId();
     81  virtual atomId_t getId() const;
    8382  virtual bool changeId(atomId_t newId);
    8483
     
    8988   virtual void setId(atomId_t);
    9089
     90   void setMolecule(molecule*);
     91   void removeFromMolecule();
     92
    9193  protected:
     94
    9295    /**
    9396     * Protected constructor to ensure construction of atoms through the world.
     
    108111    virtual ~atom();
    109112  private:
     113    molecule *mol; // !< the molecule this atom belongs to
    110114    World* world;
    111115    atomId_t id;
  • src/atom_atominfo.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "periodentafel.hpp"
  • src/atom_bondedparticle.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom.hpp"
  • src/atom_bondedparticleinfo.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom_bondedparticleinfo.hpp"
  • src/atom_graphnode.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom_graphnode.hpp"
  • src/atom_graphnodeinfo.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom_graphnodeinfo.hpp"
  • src/atom_particleinfo.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom_particleinfo.hpp"
  • src/atom_trajectoryparticle.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom.hpp"
  • src/atom_trajectoryparticleinfo.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom_trajectoryparticleinfo.hpp"
  • src/atom_trajectoryparticleinfo.hpp

    r1b2d30 r55240c4  
    2121
    2222#include "vector.hpp"
     23#include "VectorSet.hpp"
    2324
    2425/********************************************** declarations *******************************/
     
    2829  struct
    2930  {
    30     vector<Vector> R;  //!< position vector
    31     vector<Vector> U;  //!< velocity vector
    32     vector<Vector> F;  //!< last force vector
     31    VectorSet<vector<Vector> > R;  //!< position vector
     32    VectorSet<vector<Vector> > U;  //!< velocity vector
     33    VectorSet<vector<Vector> > F;  //!< last force vector
    3334  } Trajectory;
    3435  int FixedIon;   //!< config variable that states whether forces act on the ion or not
  • src/bond.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include "atom.hpp"
  • src/bondgraph.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/boundary.cpp

    r1b2d30 r55240c4  
    33 * Implementations and super-function for envelopes
    44 */
     5
     6#include "Helpers/MemDebug.hpp"
    57
    68#include "World.hpp"
  • src/builder.cpp

    r1b2d30 r55240c4  
    4747 */
    4848
     49#include "Helpers/MemDebug.hpp"
    4950
    5051#include <boost/bind.hpp>
     
    7374#include "periodentafel.hpp"
    7475#include "UIElements/UIFactory.hpp"
     76#include "UIElements/TextUI/TextUIFactory.hpp"
     77#include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
    7578#include "UIElements/MainWindow.hpp"
    7679#include "UIElements/Dialog.hpp"
     
    8487#include "version.h"
    8588#include "World.hpp"
    86 #include "Helpers/MemDebug.hpp"
     89
    8790
    8891/********************************************* Subsubmenu routine ************************************/
     
    13551358};
    13561359
    1357 #endif
    13581360
    13591361/** Tries given filename or standard on saving the config file.
     
    14811483};
    14821484
     1485#endif
     1486
    14831487/** Parses the command line options.
    14841488 * Note that this function is from now on transitional. All commands that are not passed
     
    14981502{
    14991503  Vector x,y,z,n;  // coordinates for absolute point in cell volume
    1500   double *factor; // unit factor if desired
    15011504  ifstream test;
    15021505  ofstream output;
    15031506  string line;
    1504   atom *first;
    15051507  bool SaveFlag = false;
    15061508  int ExitFlag = 0;
     
    15081510  double volume = 0.;
    15091511  enum ConfigStatus configPresent = absent;
    1510   clock_t start,end;
    1511   double MaxDistance = -1;
    15121512  int argptr;
    15131513  molecule *mol = NULL;
    15141514  string BondGraphFileName("\n");
    1515   bool DatabasePathGiven = false;
    15161515
    15171516  if (argc > 1) { // config file specified as option
     
    21902189  ActionRegistry::purgeInstance();
    21912190  ActionHistory::purgeInstance();
     2191#ifdef LOG_OBSERVER
     2192  cout << observerLog().getLog();
     2193#endif
    21922194  Memory::getState();
    21932195}
     
    21952197int main(int argc, char **argv)
    21962198{
    2197     config *configuration = World::getInstance().getConfig();
    21982199    // while we are non interactive, we want to abort from asserts
    21992200    //ASSERT_DO(Assert::Abort);
    2200     molecule *mol = NULL;
    22012201    Vector x, y, z, n;
    22022202    ifstream test;
     
    22552255      if (!CommandLineParser::getInstance().isEmpty()) {
    22562256        DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
    2257         UIFactory::makeUserInterface(UIFactory::CommandLine);
     2257        UIFactory::registerFactory(new CommandLineUIFactory::description());
     2258        UIFactory::makeUserInterface("CommandLine");
    22582259      } else {
    22592260        DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
    2260         UIFactory::makeUserInterface(UIFactory::Text);
     2261        UIFactory::registerFactory(new TextUIFactory::description());
     2262        UIFactory::makeUserInterface("Text");
    22612263      }
    22622264    }
  • src/config.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include <stdio.h>
     
    15211523  char filename[MAXSTRINGSIZE];
    15221524  ofstream output;
    1523   molecule *mol = World::getInstance().createMolecule();
    1524   mol->SetNameFromFilename(ConfigFileName);
     1525  molecule *mol = NULL;
    15251526
    15261527  if (!strcmp(configpath, GetDefaultPath())) {
     
    15531554  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
    15541555  int N = molecules->ListOfMolecules.size();
    1555   int *src = new int[N];
    1556   N=0;
    1557   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    1558     src[N++] = (*ListRunner)->IndexNr;
    1559     (*ListRunner)->Translate(&(*ListRunner)->Center);
    1560   }
    1561   molecules->SimpleMultiAdd(mol, src, N);
    1562   delete[](src);
    1563 
    1564   // ... and translate back
    1565   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    1566     (*ListRunner)->Center.Scale(-1.);
    1567     (*ListRunner)->Translate(&(*ListRunner)->Center);
    1568     (*ListRunner)->Center.Scale(-1.);
     1556  if (N != 1) { // don't do anything in case of only one molecule (shifts mol ids otherwise)
     1557    int *src = new int[N];
     1558    N=0;
     1559    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     1560      src[N++] = (*ListRunner)->IndexNr;
     1561      (*ListRunner)->Translate(&(*ListRunner)->Center);
     1562    }
     1563    mol = World::getInstance().createMolecule();
     1564    mol->SetNameFromFilename(ConfigFileName);
     1565    molecules->SimpleMultiMerge(mol, src, N);
     1566    mol->doCountAtoms();
     1567    mol->CountElements();
     1568    mol->CalculateOrbitals(*this);
     1569    delete[](src);
     1570  } else {
     1571    if (!molecules->ListOfMolecules.empty()) {
     1572      mol = *(molecules->ListOfMolecules.begin());
     1573      mol->doCountAtoms();
     1574      mol->CalculateOrbitals(*this);
     1575    } else {
     1576      DoeLog(1) && (eLog() << Verbose(1) << "There are no molecules to save!" << endl);
     1577    }
    15691578  }
    15701579
    15711580  Log() << Verbose(0) << "Storing configuration ... " << endl;
    15721581  // get correct valence orbitals
    1573   mol->CalculateOrbitals(*this);
    1574   InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble;
    15751582  if (ConfigFileName != NULL) { // test the file name
    15761583    strcpy(filename, ConfigFileName);
     
    16321639  }
    16331640
    1634   World::getInstance().destroyMolecule(mol);
     1641  // don't destroy molecule as it contains all our atoms
     1642  //World::getInstance().destroyMolecule(mol);
    16351643};
    16361644
  • src/datacreator.cpp

    r1b2d30 r55240c4  
    66
    77//============================ INCLUDES ===========================
     8
     9#include "Helpers/MemDebug.hpp"
    810
    911#include "datacreator.hpp"
  • src/element.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include <iomanip>
  • src/elements_db.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810const char *elementsDB =\
  • src/ellipsoid.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <gsl/gsl_multimin.h>
  • src/errorlogger.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <fstream>
  • src/graph.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79using namespace std;
  • src/gslmatrix.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810using namespace std;
  • src/gslvector.cpp

    r1b2d30 r55240c4  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include <cassert>
    911#include <cmath>
     
    1113#include "gslvector.hpp"
    1214#include "defs.hpp"
     15#include "vector.hpp"
    1316
    1417/** Constructor of class GSLVector.
     
    5962  gsl_vector_memcpy (vector, &m.vector);
    6063};
     64
     65/**
     66 * This function sets the GSLvector from an ordinary vector.
     67 *
     68 * Takes access to the internal gsl_vector and copies it
     69 */
     70void GSLVector::SetFromVector(Vector &v){
     71  gsl_vector_memcpy (vector, v.get());
     72}
    6173
    6274/** This function returns the i-th element of a vector.
  • src/gslvector.hpp

    r1b2d30 r55240c4  
    2424
    2525class GSLVector;
     26class Vector;
    2627
    2728/********************************************** declarations *******************************/
     
    3839  // Accessing
    3940  void SetFromDoubleArray(double *x);
     41  void SetFromVector(Vector &v);
    4042  double Get(size_t m) const;
    4143  void Set(size_t m, double x);
  • src/helpers.cpp

    r1b2d30 r55240c4  
    44 */
    55
     6#include "Helpers/MemDebug.hpp"
    67
    78#include "helpers.hpp"
  • src/info.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "info.hpp"
  • src/joiner.cpp

    r1b2d30 r55240c4  
    77
    88//============================ INCLUDES ===========================
     9
     10#include "Helpers/MemDebug.hpp"
    911
    1012#include <cstring>
  • src/leastsquaremin.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/linearsystemofequations.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "defs.hpp"
     
    5456{
    5557  assert ( columns == NDIM && "Vector class is always three-dimensional, unlike this LEqS!");
    56   b->SetFromDoubleArray(x->get());
     58  b->SetFromVector(*x);
    5759};
    5860
  • src/linkedcell.cpp

    r1b2d30 r55240c4  
    55 */
    66
     7#include "Helpers/MemDebug.hpp"
    78
    89#include "atom.hpp"
  • src/log.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "logger.hpp"
  • src/logger.cpp

    r1b2d30 r55240c4  
    55 *      Author: metzler
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <fstream>
  • src/memoryallocator.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810using namespace std;
  • src/memoryusageobserver.cpp

    r1b2d30 r55240c4  
    44 * This class represents a Singleton for observing memory usage.
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include <cstdlib>
  • src/molecule.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include <cstring>
     
    3537 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero.
    3638 */
    37 molecule::molecule(const periodentafel * const teil) : elemente(teil),
    38   MDSteps(0),
    39   BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.),
    40   ActiveFlag(false), IndexNr(-1),
    41   formula(this,boost::bind(&molecule::calcFormula,this)),
    42   AtomCount(this,boost::bind(&molecule::doCountAtoms,this)), last_atom(0),  InternalPointer(begin())
     39molecule::molecule(const periodentafel * const teil) :
     40  Observable("molecule"),
     41  elemente(teil),  MDSteps(0),  BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0),
     42  NoCyclicBonds(0), BondDistance(0.),  ActiveFlag(false), IndexNr(-1),
     43  formula(this,boost::bind(&molecule::calcFormula,this),"formula"),
     44  AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0),  InternalPointer(atoms.begin())
    4345{
    4446
     
    143145  molecule::const_iterator iter = loc;
    144146  iter--;
    145   atoms.erase( loc );
     147  atom* atom = *loc;
     148  atomIds.erase( atom->getId() );
     149  atoms.remove( atom );
     150  atom->removeFromMolecule();
    146151  return iter;
    147152}
    148153
    149 molecule::const_iterator molecule::erase( atom *& key )
     154molecule::const_iterator molecule::erase( atom * key )
    150155{
    151156  cout << "trying to erase atom" << endl;
    152157  molecule::const_iterator iter = find(key);
    153158  if (iter != end()){
    154     // remove this position and step forward (post-increment)
    155     atoms.erase( iter++ );
     159    atomIds.erase( key->getId() );
     160    atoms.remove( key );
     161    key->removeFromMolecule();
    156162  }
    157163  return iter;
    158164}
    159165
    160 molecule::const_iterator molecule::find ( atom *& key ) const
    161 {
    162   return atoms.find( key );
     166molecule::const_iterator molecule::find ( atom * key ) const
     167{
     168  molecule::const_iterator iter;
     169  for (molecule::const_iterator Runner = begin(); Runner != end(); ++Runner) {
     170    if (*Runner == key)
     171      return molecule::const_iterator(Runner);
     172  }
     173  return molecule::const_iterator(atoms.end());
    163174}
    164175
    165176pair<molecule::iterator,bool> molecule::insert ( atom * const key )
    166177{
    167   pair<atomSet::iterator,bool> res = atoms.insert(key);
    168   return pair<iterator,bool>(iterator(res.first,this),res.second);
     178  pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
     179  if (res.second) { // push atom if went well
     180    atoms.push_back(key);
     181    return pair<iterator,bool>(molecule::iterator(--end()),res.second);
     182  } else {
     183    return pair<iterator,bool>(molecule::iterator(end()),res.second);
     184  }
     185}
     186
     187bool molecule::containsAtom(atom* key){
     188  return (find(key) != end());
    169189}
    170190
     
    192212    }
    193213    insert(pointer);
     214    pointer->setMolecule(this);
    194215  }
    195216  return true;
     
    657678bond * molecule::AddBond(atom *atom1, atom *atom2, int degree)
    658679{
     680  OBSERVE;
    659681  bond *Binder = NULL;
    660682
     
    780802  for (molecule::iterator iter = begin(); !empty(); iter = begin())
    781803      erase(iter);
     804  return empty();
    782805};
    783806
     
    10001023  configuration.MaxPsiDouble /= 2;
    10011024  configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1;
    1002   if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2)) {
     1025  if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) {
    10031026    configuration.ProcPEGamma /= 2;
    10041027    configuration.ProcPEPsi *= 2;
     
    10071030    configuration.ProcPEPsi = 1;
    10081031  }
    1009   configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.MaxPsiDouble;
     1032  cout << configuration.PsiMaxNoDown << ">" << configuration.PsiMaxNoUp << endl;
     1033  if (configuration.PsiMaxNoDown > configuration.PsiMaxNoUp) {
     1034    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoDown;
     1035    cout << configuration.PsiMaxNoDown << " " << configuration.InitMaxMinStopStep << endl;
     1036  } else {
     1037    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoUp;
     1038    cout << configuration.PsiMaxNoUp << " " << configuration.InitMaxMinStopStep << endl;
     1039  }
    10101040};
    10111041
  • src/molecule.hpp

    r1b2d30 r55240c4  
    8989
    9090  public:
    91     typedef std::set<atom*> atomSet;
     91    typedef std::list<atom*> atomSet;
     92    typedef std::set<atomId_t> atomIdSet;
    9293    typedef ObservedIterator<atomSet> iterator;
    9394    typedef atomSet::const_iterator const_iterator;
     
    117118    Cacheable<int>    AtomCount;
    118119    moleculeId_t id;
    119     atomSet atoms; //<!set of atoms
     120    atomSet atoms; //<!list of atoms
     121    atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
    120122  protected:
    121123    //void CountAtoms();
     
    149151  size_t size() const;
    150152  const_iterator erase( const_iterator loc );
    151   const_iterator erase( atom *& key );
    152   const_iterator find (  atom *& key ) const;
     153  const_iterator erase( atom * key );
     154  const_iterator find (  atom * key ) const;
    153155  pair<iterator,bool> insert ( atom * const key );
     156  bool containsAtom(atom* key);
    154157
    155158
  • src/molecule_dynamics.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "World.hpp"
  • src/molecule_fragmentation.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <cstring>
  • src/molecule_geometry.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom.hpp"
     
    1618#include "molecule.hpp"
    1719#include "World.hpp"
     20#include "Plane.hpp"
     21#include <boost/foreach.hpp>
     22
    1823
    1924/************************************* Functions for class molecule *********************************/
     
    256261void molecule::Mirror(const Vector *n)
    257262{
    258   ActOnAllVectors( &Vector::Mirror, *n );
     263  OBSERVE;
     264  Plane p(*n,0);
     265  BOOST_FOREACH( atom* iter, atoms ){
     266    (*iter->node) = p.mirrorVector(*iter->node);
     267  }
    259268};
    260269
  • src/molecule_graph.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom.hpp"
  • src/molecule_pointcloud.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "atom.hpp"
     
    5557void molecule::GoToFirst() const
    5658{
    57   InternalPointer = atoms.begin();
     59  // evil hack necessary because
     60  // -# although InternalPointer is mutable
     61  // -# only const_iterator begin() is called due to const in the function declaration above
     62  // -# and there is no cast from const_iterator to const iterator
     63  atomSet::const_iterator test = begin();
     64  InternalPointer = *(reinterpret_cast<atomSet::iterator *>(&test));
    5865};
    5966
  • src/moleculelist.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79#include <cstring>
     
    3032 */
    3133MoleculeListClass::MoleculeListClass(World *_world) :
     34  Observable("MoleculeListClass"),
    3235  world(_world)
    3336{
     
    210213
    211214  // put all molecules of src into mol
    212   molecule::iterator runner;
    213   for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
    214     runner = iter++;
    215     srcmol->UnlinkAtom((*runner));
    216     mol->AddAtom((*runner));
     215  for (molecule::iterator iter = srcmol->begin(); !srcmol->empty(); iter=srcmol->begin()) {
     216    atom * const Walker = *iter;
     217    srcmol->UnlinkAtom(Walker);
     218    mol->AddAtom(Walker);
    217219  }
    218220
     
    257259    status = status && SimpleMerge(mol, srcmol);
    258260  }
     261  insert(mol);
    259262  return status;
    260263};
  • src/orbitals.db

    r1b2d30 r55240c4  
     1# atomicnumber numberoforbitals
    121       1
    232       0
  • src/parser.cpp

    r1b2d30 r55240c4  
    66
    77// ======================================= INCLUDES ==========================================
     8
     9#include "Helpers/MemDebug.hpp"
    810
    911#include <cstring>
  • src/periodentafel.cpp

    r1b2d30 r55240c4  
    44 *
    55 */
     6
     7#include "Helpers/MemDebug.hpp"
    68
    79using namespace std;
     
    371373      (*input) >> elements[Z]->Valence;
    372374      (*input) >> ws;
    373       //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
     375      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl;
    374376    }
    375377    return true;
     
    394396      (*input) >> elements[Z]->NoValenceOrbitals;
    395397      (*input) >> ws;
    396       //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     398      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
    397399    }
    398400    return true;
  • src/tesselation.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <fstream>
     
    1719#include "triangleintersectionlist.hpp"
    1820#include "vector.hpp"
     21#include "Line.hpp"
    1922#include "vector_ops.hpp"
    2023#include "verbose.hpp"
     
    441444
    442445  try {
    443     *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*MolCenter, *x);
    444   }
    445   catch (LinearDependenceException &excp) {
    446     Log() << Verbose(1) << excp;
    447     DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    448     return false;
    449   }
    450 
    451   DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
    452   DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
    453   DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    454 
    455   if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
    456     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    457     return true;
    458   }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
    459     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    460     return true;
    461   }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
    462     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    463     return true;
    464   }
    465   // Calculate cross point between one baseline and the line from the third endpoint to intersection
    466   int i = 0;
    467   do {
    468     try {
    469       CrossPoint = GetIntersectionOfTwoLinesOnPlane(*(endpoints[i%3]->node->node),
    470                                                     *(endpoints[(i+1)%3]->node->node),
    471                                                     *(endpoints[(i+2)%3]->node->node),
    472                                                     *Intersection);
     446    Line centerLine = makeLineThrough(*MolCenter, *x);
     447    *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(centerLine);
     448
     449    DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
     450    DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
     451    DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
     452
     453    if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
     454      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
     455      return true;
     456    }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
     457      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
     458      return true;
     459    }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
     460      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
     461      return true;
     462    }
     463    // Calculate cross point between one baseline and the line from the third endpoint to intersection
     464    int i = 0;
     465    do {
     466      Line line1 = makeLineThrough(*(endpoints[i%3]->node->node),*(endpoints[(i+1)%3]->node->node));
     467      Line line2 = makeLineThrough(*(endpoints[(i+2)%3]->node->node),*Intersection);
     468      CrossPoint = line1.getIntersection(line2);
    473469      helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    474470      CrossPoint -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
     
    477473      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    478474        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    479         i=4;
    480         break;
     475        return false;
    481476      }
    482477      i++;
    483     } catch (LinearDependenceException &excp){
    484       break;
    485     }
    486   } while (i < 3);
    487   if (i == 3) {
     478    } while (i < 3);
    488479    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    489480    return true;
    490   } else {
    491     DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl);
     481  }
     482  catch (MathException &excp) {
     483    Log() << Verbose(1) << excp;
     484    DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    492485    return false;
    493486  }
     
    516509  GetCenter(&Direction);
    517510  try {
    518     *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*x, Direction);
    519   }
    520   catch (LinearDependenceException &excp) {
     511    Line l = makeLineThrough(*x, Direction);
     512    *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(l);
     513  }
     514  catch (MathException &excp) {
    521515    (*ClosestPoint) = (*x);
    522516  }
     
    541535    Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    542536    // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
    543     CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node));
     537    Line l = makeLineThrough(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node));
     538    CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
    544539    CrossDirection[i] = CrossPoint[i] - InPlane;
    545540    CrossPoint[i] -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
  • src/tesselationhelpers.cpp

    r1b2d30 r55240c4  
    55 *      Author: heber
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <fstream>
     
    1416#include "tesselationhelpers.hpp"
    1517#include "vector.hpp"
     18#include "Line.hpp"
    1619#include "vector_ops.hpp"
    1720#include "verbose.hpp"
     
    666669  // calculate the intersection between this projected baseline and Base
    667670  Vector *Intersection = new Vector;
    668   *Intersection = GetIntersectionOfTwoLinesOnPlane(*(Base->endpoints[0]->node->node),
    669                                                    *(Base->endpoints[1]->node->node),
    670                                                      NewOffset, NewDirection);
     671  Line line1 = makeLineThrough(*(Base->endpoints[0]->node->node),*(Base->endpoints[1]->node->node));
     672  Line line2 = makeLineThrough(NewOffset, NewDirection);
     673  *Intersection = line1.getIntersection(line2);
    671674  Normal = (*Intersection) - (*Base->endpoints[0]->node->node);
    672675  DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "." << endl);
  • src/triangleintersectionlist.cpp

    r1b2d30 r55240c4  
    88 *      Author: heber
    99 */
     10
     11#include "Helpers/MemDebug.hpp"
    1012
    1113#include "triangleintersectionlist.hpp"
  • src/unittests/CacheableTest.cpp

    r1b2d30 r55240c4  
    5555
    5656  threeNumbers(int _x,int _y, int _z) :
     57    Observable("threeNumbers"),
    5758    x(_x),y(_y),z(_z),
    58     sum(this,boost::bind(&threeNumbers::calcSum,this)),
     59    sum(this,boost::bind(&threeNumbers::calcSum,this),"sum"),
    5960    hasRecalced(false)
    6061  {}
     
    8182  CPPUNIT_ASSERT_EQUAL( 9, *(numbers->sum));
    8283  CPPUNIT_ASSERT_EQUAL( true, numbers->hasRecalced);
     84  numbers->hasRecalced=false;
     85  CPPUNIT_ASSERT_EQUAL( 9, *(numbers->sum));
     86#ifndef NO_CACHING
     87  CPPUNIT_ASSERT_EQUAL( false, numbers->hasRecalced);
     88#else
     89  CPPUNIT_ASSERT_EQUAL( true, numbers->hasRecalced);
     90#endif
    8391}
  • src/unittests/Makefile.am

    r1b2d30 r55240c4  
    2626  InfoUnitTest \
    2727  LinearSystemOfEquationsUnitTest \
     28  LineUnittest \
    2829  LinkedCellUnitTest \
    2930  ListOfBondsUnitTest \
     
    6970  infounittest.cpp \
    7071  linearsystemofequationsunittest.cpp \
     72  LineUnittest.cpp \
    7173  LinkedCellUnitTest.cpp \
    7274  listofbondsunittest.cpp \
     
    104106  infounittest.hpp \
    105107  linearsystemofequationsunittest.hpp \
     108  LineUnittest.hpp \
    106109  LinkedCellUnitTest.hpp \
    107110  listofbondsunittest.hpp \
     
    170173LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
    171174
     175LineUnittest_SOURCES = UnitTestMain.cpp LineUnittest.cpp LineUnittest.hpp
     176LineUnittest_LDADD = ${ALLLIBS}
     177
    172178LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp
    173179LinkedCellUnitTest_LDADD = ${ALLLIBS}
  • src/unittests/ObserverTest.cpp

    r1b2d30 r55240c4  
    3333public:
    3434  UpdateCountObserver() :
     35    Observer("UpdateCountObserver"),
    3536    updates(0)
    3637  {};
     
    4546class SimpleObservable : public Observable {
    4647public:
     48  SimpleObservable() :
     49    Observable("SimpleObservable")
     50  {}
     51
    4752  void changeMethod() {
    4853    OBSERVE;
     
    5459class CallObservable : public Observable {
    5560public:
     61  CallObservable() :
     62    Observable("CallObservable")
     63  {}
     64
    5665  void changeMethod1() {
    5766    OBSERVE;
     
    7079class BlockObservable : public Observable {
    7180public:
     81  BlockObservable() :
     82    Observable("BlockObservable")
     83  {}
     84
    7285  void changeMethod1(){
    7386    OBSERVE;
     
    104117class SuperObservable : public Observable {
    105118public:
    106   SuperObservable(){
     119  SuperObservable():
     120    Observable("SuperObservable")
     121  {
    107122    subObservable = new SimpleObservable();
    108123    subObservable->signOn(this);
     
    123138public:
    124139  NotificationObservable() :
    125       notification1(new Notification(this)),
    126       notification2(new Notification(this))
     140    Observable("NotificationObservable"),
     141    notification1(new Notification(this)),
     142    notification2(new Notification(this))
    127143  {}
    128144
     
    149165public:
    150166  NotificationObserver(Notification_ptr notification) :
     167    Observer("NotificationObserver"),
    151168    requestedNotification(notification),
    152169    wasNotified(false)
     
    172189
    173190  ObservableCollection(int _num) :
    174   num(_num)
     191    Observable("ObservableCollection"),
     192    num(_num)
    175193  {
    176194    for(int i=0; i<num; ++i){
  • src/unittests/PlaneUnittest.cpp

    r1b2d30 r55240c4  
    1717
    1818#include "vector.hpp"
     19#include "Line.hpp"
    1920
    2021CPPUNIT_TEST_SUITE_REGISTRATION( PlaneUnittest );
     
    153154  CPPUNIT_ASSERT(fabs(p4->distance(e1)-1) < MYEPSILON);
    154155  CPPUNIT_ASSERT_EQUAL(zeroVec,p4->getClosestPoint(e1));
    155 
    156 
    157 }
     156}
     157
     158void PlaneUnittest::mirrorTest(){
     159  Vector fixture;
     160
     161  // some Vectors that lie on the planes
     162  fixture = p1->mirrorVector(e1);
     163  CPPUNIT_ASSERT_EQUAL(fixture,e1);
     164  fixture = p1->mirrorVector(e2);
     165  CPPUNIT_ASSERT_EQUAL(fixture,e2);
     166  fixture = p1->mirrorVector(e3);
     167  CPPUNIT_ASSERT_EQUAL(fixture,e3);
     168
     169  fixture = p2->mirrorVector(zeroVec);
     170  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
     171  fixture = p2->mirrorVector(e1);
     172  CPPUNIT_ASSERT_EQUAL(fixture,e1);
     173  fixture = p2->mirrorVector(e2);
     174  CPPUNIT_ASSERT_EQUAL(fixture,e2);
     175
     176  fixture = p3->mirrorVector(zeroVec);
     177  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
     178  fixture = p3->mirrorVector(e1);
     179  CPPUNIT_ASSERT_EQUAL(fixture,e1);
     180  fixture = p3->mirrorVector(e3);
     181  CPPUNIT_ASSERT_EQUAL(fixture,e3);
     182
     183  fixture = p4->mirrorVector(zeroVec);
     184  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
     185  fixture = p4->mirrorVector(e2);
     186  CPPUNIT_ASSERT_EQUAL(fixture,e2);
     187  fixture = p4->mirrorVector(e3);
     188  CPPUNIT_ASSERT_EQUAL(fixture,e3);
     189
     190  // some Vectors outside of the planes
     191  {
     192    Vector t = (2./3.)*(e1+e2+e3);
     193    fixture = p1->mirrorVector(zeroVec);
     194    CPPUNIT_ASSERT_EQUAL(fixture,t);
     195  }
     196
     197  fixture = p2->mirrorVector(e3);
     198  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
     199  fixture = p3->mirrorVector(e2);
     200  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
     201  fixture = p4->mirrorVector(e1);
     202  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
     203}
     204
     205void PlaneUnittest::LineIntersectionTest(){
     206  Vector fixture;
     207  // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
     208  Line l1 = makeLineThrough(zeroVec,Vector(2,1,0));
     209  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(e1, zeroVec).GetIntersection(l1) );
     210  CPPUNIT_ASSERT_EQUAL( zeroVec, fixture );
     211
     212  // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
     213  Line l2 = makeLineThrough(e1,Vector(0,1,1));
     214  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(e2, Vector(2,1,0)).GetIntersection(l2) );
     215  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
     216}
  • src/unittests/PlaneUnittest.hpp

    r1b2d30 r55240c4  
    2020  CPPUNIT_TEST ( pointsTest );
    2121  CPPUNIT_TEST ( operationsTest );
     22  CPPUNIT_TEST ( mirrorTest );
     23  CPPUNIT_TEST ( LineIntersectionTest );
    2224  CPPUNIT_TEST_SUITE_END();
    2325
     
    3032  void pointsTest();
    3133  void operationsTest();
     34  void mirrorTest();
     35  void LineIntersectionTest();
    3236
    3337private:
  • src/unittests/listofbondsunittest.cpp

    r1b2d30 r55240c4  
    249249void ListOfBondsTest::DeleteAtomTest()
    250250{
    251   bond *Binder = NULL;
    252   molecule::iterator iter = TestMolecule->begin();
    253   atom *atom1 = *iter;
    254   iter++;
    255   atom *atom2 = *iter;
    256   CPPUNIT_ASSERT( atom1 != NULL );
    257   CPPUNIT_ASSERT( atom2 != NULL );
    258 
    259   // add bond
    260   Binder = TestMolecule->AddBond(atom1, atom2, 1);
    261   CPPUNIT_ASSERT( Binder != NULL );
     251  atom *atom1 = NULL;
     252  atom *atom2 = NULL;
     253  bond *Binder = NULL;
     254  {
     255    molecule::iterator iter = TestMolecule->begin();
     256    atom1 = *iter;
     257    iter++;
     258    atom2 = *iter;
     259  }
     260  CPPUNIT_ASSERT( atom1 != NULL );
     261  CPPUNIT_ASSERT( atom2 != NULL );
     262
     263  // add bond
     264  Binder = TestMolecule->AddBond(atom1, atom2, 1);
     265  CPPUNIT_ASSERT( Binder != NULL );
     266
     267  CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom1->ListOfBonds.size() );
     268  CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom2->ListOfBonds.size() );
     269
     270  CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
    262271
    263272  // remove atom2
     
    268277
    269278  // check if removed from molecule
    270   CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
    271 };
     279  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
     280};
  • src/unittests/manipulateAtomsTest.cpp

    r1b2d30 r55240c4  
    5555public:
    5656  countObserver() :
     57    Observer("countObserver"),
    5758    count(0)
    5859    {}
  • src/unittests/vectorunittest.cpp

    r1b2d30 r55240c4  
    215215}
    216216
    217 /** UnitTest for line intersections.
    218  */
    219 void VectorTest::LineIntersectionTest()
    220 {
    221   // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
    222   CPPUNIT_ASSERT_NO_THROW(fixture = Plane(unit, zero).GetIntersection(zero, two) );
    223   CPPUNIT_ASSERT_EQUAL( zero, fixture );
    224 
    225   // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
    226   CPPUNIT_ASSERT_NO_THROW(fixture = Plane(otherunit, two).GetIntersection( unit, notunit) );
    227   CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
    228 
    229   // four vectors equal to zero
    230   CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(zero, zero, zero, zero), LinearDependenceException);
    231   //CPPUNIT_ASSERT_EQUAL( zero, fixture );
    232 
    233   // four vectors equal to unit
    234   CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, unit, unit, unit), LinearDependenceException);
    235   //CPPUNIT_ASSERT_EQUAL( zero, fixture );
    236 
    237   // two equal lines
    238   CPPUNIT_ASSERT_NO_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, unit, two));
    239   CPPUNIT_ASSERT_EQUAL( unit, fixture );
    240 
    241   // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
    242   CPPUNIT_ASSERT_NO_THROW( fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, unit, otherunit) );
    243   CPPUNIT_ASSERT_EQUAL( unit, fixture );
    244 
    245   // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
    246   CPPUNIT_ASSERT_NO_THROW( fixture = GetIntersectionOfTwoLinesOnPlane(unit, zero, zero, two) );
    247   CPPUNIT_ASSERT_EQUAL( zero, fixture );
    248 
    249   // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
    250   CPPUNIT_ASSERT_NO_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, zero, otherunit) );
    251   CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
    252 };
    253 
    254 /** UnitTest for vector rotations.
    255  */
    256 void VectorTest::VectorRotationTest()
    257 {
    258   fixture = Vector(-1.,0.,0.);
    259 
    260   // zero vector does not change
    261   fixture = RotateVector(zero,unit, 1.);
    262   CPPUNIT_ASSERT_EQUAL( zero, fixture );
    263 
    264   fixture = RotateVector(zero, two, 1.);
    265   CPPUNIT_ASSERT_EQUAL( zero,  fixture);
    266 
    267   // vector on axis does not change
    268   fixture = RotateVector(unit,unit, 1.);
    269   CPPUNIT_ASSERT_EQUAL( unit, fixture );
    270 
    271   // rotations
    272   fixture = RotateVector(otherunit, unit, M_PI);
    273   CPPUNIT_ASSERT_EQUAL( Vector(0.,-1.,0.), fixture );
    274 
    275   fixture = RotateVector(otherunit, unit, 2. * M_PI);
    276   CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
    277 
    278   fixture = RotateVector(otherunit,unit, 0);
    279   CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
    280 
    281   fixture = RotateVector(Vector(0.,0.,1.), notunit, M_PI);
    282   CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
    283 }
    284217
    285218/**
  • src/unittests/vectorunittest.hpp

    r1b2d30 r55240c4  
    2727    CPPUNIT_TEST ( ProjectionTest );
    2828    CPPUNIT_TEST ( NormalsTest );
    29     CPPUNIT_TEST ( LineIntersectionTest );
    30     CPPUNIT_TEST ( VectorRotationTest );
    3129    CPPUNIT_TEST ( IsInParallelepipedTest );
    3230    CPPUNIT_TEST_SUITE_END();
  • src/valence.db

    r1b2d30 r55240c4  
     1#atomicnumber numberofvalenceorbitals
    121       0.10000000000000E+01
    232       0.20000000000000E+01
  • src/vector.cpp

    r1b2d30 r55240c4  
    55 */
    66
     7#include "Helpers/MemDebug.hpp"
    78
    89#include "vector.hpp"
     
    2324Vector::Vector()
    2425{
    25   x[0] = x[1] = x[2] = 0.;
     26  content = gsl_vector_calloc (NDIM);
    2627};
    2728
     
    3233Vector::Vector(const Vector& src)
    3334{
    34   x[0] = src[0];
    35   x[1] = src[1];
    36   x[2] = src[2];
     35  content = gsl_vector_alloc(NDIM);
     36  gsl_vector_set(content,0,src[0]);
     37  gsl_vector_set(content,1,src[1]);
     38  gsl_vector_set(content,2,src[2]);
    3739}
    3840
     
    4143Vector::Vector(const double x1, const double x2, const double x3)
    4244{
    43   x[0] = x1;
    44   x[1] = x2;
    45   x[2] = x3;
     45  content = gsl_vector_alloc(NDIM);
     46  gsl_vector_set(content,0,x1);
     47  gsl_vector_set(content,1,x2);
     48  gsl_vector_set(content,2,x3);
    4649};
    4750
     
    5255  // check for self assignment
    5356  if(&src!=this){
    54     x[0] = src[0];
    55     x[1] = src[1];
    56     x[2] = src[2];
     57    gsl_vector_set(content,0,src[0]);
     58    gsl_vector_set(content,1,src[1]);
     59    gsl_vector_set(content,2,src[2]);
    5760  }
    5861  return *this;
     
    6164/** Desctructor of class vector.
    6265 */
    63 Vector::~Vector() {};
     66Vector::~Vector() {
     67  gsl_vector_free(content);
     68};
    6469
    6570/** Calculates square of distance between this and another vector.
     
    7176  double res = 0.;
    7277  for (int i=NDIM;i--;)
    73     res += (x[i]-y[i])*(x[i]-y[i]);
     78    res += (at(i)-y[i])*(at(i)-y[i]);
    7479  return (res);
    7580};
     
    199204  double res = 0.;
    200205  for (int i=NDIM;i--;)
    201     res += x[i]*y[i];
     206    res += at(i)*y[i];
    202207  return (res);
    203208};
     
    213218{
    214219  Vector tmp;
    215   tmp[0] = x[1]* (y[2]) - x[2]* (y[1]);
    216   tmp[1] = x[2]* (y[0]) - x[0]* (y[2]);
    217   tmp[2] = x[0]* (y[1]) - x[1]* (y[0]);
     220  for(int i=NDIM;i--;)
     221    tmp[i] = at((i+1)%NDIM)*y[(i+2)%NDIM] - at((i+2)%NDIM)*y[(i+1)%NDIM];
    218222  (*this) = tmp;
    219223};
     
    232236  *this -= tmp;
    233237};
    234 
    235 /** Calculates the minimum distance vector of this vector to the plane.
    236  * \param *out output stream for debugging
    237  * \param *PlaneNormal normal of plane
    238  * \param *PlaneOffset offset of plane
    239  * \return distance to plane
    240  * \return distance vector onto to plane
    241  */
    242 Vector Vector::GetDistanceVectorToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const
    243 {
    244   Vector temp = (*this) - PlaneOffset;
    245   temp.MakeNormalTo(PlaneNormal);
    246   temp.Scale(-1.);
    247   // then add connecting vector from plane to point
    248   temp += (*this)-PlaneOffset;
    249   double sign = temp.ScalarProduct(PlaneNormal);
    250   if (fabs(sign) > MYEPSILON)
    251     sign /= fabs(sign);
    252   else
    253     sign = 0.;
    254 
    255   temp.Normalize();
    256   temp.Scale(sign);
    257   return temp;
    258 };
    259 
    260238
    261239/** Calculates the minimum distance of this vector to the plane.
     
    334312bool Vector::IsZero() const
    335313{
    336   return (fabs(x[0])+fabs(x[1])+fabs(x[2]) < MYEPSILON);
     314  return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < MYEPSILON);
    337315};
    338316
     
    363341  bool status = true;
    364342  for (int i=0;i<NDIM;i++) {
    365     if (fabs(x[i] - a[i]) > MYEPSILON)
     343    if (fabs(at(i) - a[i]) > MYEPSILON)
    366344      status = false;
    367345  }
     
    391369double& Vector::operator[](size_t i){
    392370  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
    393   return x[i];
     371  return *gsl_vector_ptr (content, i);
    394372}
    395373
    396374const double& Vector::operator[](size_t i) const{
    397375  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
    398   return x[i];
     376  return *gsl_vector_ptr (content, i);
    399377}
    400378
     
    407385}
    408386
    409 double* Vector::get(){
    410   return x;
     387gsl_vector* Vector::get(){
     388  return content;
    411389}
    412390
     
    523501{
    524502  for (int i=NDIM;i--;)
    525     x[i] *= factor[i];
     503    at(i) *= factor[i];
    526504};
    527505
     
    531509{
    532510  for (int i=NDIM;i--;)
    533     x[i] *= factor;
     511    at(i) *= factor;
    534512};
    535513
     
    543521  // truncate to [0,1] for each axis
    544522  for (int i=0;i<NDIM;i++) {
    545     //x[i] += 0.5;  // set to center of box
    546     while (x[i] >= 1.)
    547       x[i] -= 1.;
    548     while (x[i] < 0.)
    549       x[i] += 1.;
     523    //at(i) += 0.5;  // set to center of box
     524    while (at(i) >= 1.)
     525      at(i) -= 1.;
     526    while (at(i) < 0.)
     527      at(i) += 1.;
    550528  }
    551529  MatrixMultiplication(M);
    552530};
    553531
     532std::pair<Vector,Vector> Vector::partition(const Vector &rhs) const{
     533  double factor = ScalarProduct(rhs)/rhs.NormSquared();
     534  Vector res= factor * rhs;
     535  return make_pair(res,(*this)-res);
     536}
     537
     538std::pair<pointset,Vector> Vector::partition(const pointset &points) const{
     539  Vector helper = *this;
     540  pointset res;
     541  for(pointset::const_iterator iter=points.begin();iter!=points.end();++iter){
     542    pair<Vector,Vector> currPart = helper.partition(*iter);
     543    res.push_back(currPart.first);
     544    helper = currPart.second;
     545  }
     546  return make_pair(res,helper);
     547}
     548
    554549/** Do a matrix multiplication.
    555550 * \param *matrix NDIM_NDIM array
     
    557552void Vector::MatrixMultiplication(const double * const M)
    558553{
     554  Vector tmp;
    559555  // do the matrix multiplication
    560   at(0) = M[0]*x[0]+M[3]*x[1]+M[6]*x[2];
    561   at(1) = M[1]*x[0]+M[4]*x[1]+M[7]*x[2];
    562   at(2) = M[2]*x[0]+M[5]*x[1]+M[8]*x[2];
     556  for(int i=NDIM;i--;)
     557    tmp[i] = M[i]*at(0)+M[i+3]*at(1)+M[i+6]*at(2);
     558
     559  (*this) = tmp;
    563560};
    564561
     
    585582    B[8] =  detAReci*RDET2(A[0],A[1],A[3],A[4]);    // A_33
    586583
    587     // do the matrix multiplication
    588     at(0) = B[0]*x[0]+B[3]*x[1]+B[6]*x[2];
    589     at(1) = B[1]*x[0]+B[4]*x[1]+B[7]*x[2];
    590     at(2) = B[2]*x[0]+B[5]*x[1]+B[8]*x[2];
     584    MatrixMultiplication(B);
    591585
    592586    return true;
     
    611605};
    612606
    613 /** Mirrors atom against a given plane.
    614  * \param n[] normal vector of mirror plane.
    615  */
    616 void Vector::Mirror(const Vector &n)
    617 {
    618   double projection;
    619   projection = ScalarProduct(n)/n.NormSquared();    // remove constancy from n (keep as logical one)
    620   // withdraw projected vector twice from original one
    621   for (int i=NDIM;i--;)
    622     at(i) -= 2.*projection*n[i];
    623 };
    624 
    625607/** Calculates orthonormal vector to one given vectors.
    626608 * Just subtracts the projection onto the given vector from this vector.
     
    633615  bool result = false;
    634616  double factor = y1.ScalarProduct(*this)/y1.NormSquared();
    635   Vector x1;
    636   x1 = factor * y1;
     617  Vector x1 = factor * y1;
    637618  SubtractVector(x1);
    638619  for (int i=NDIM;i--;)
    639     result = result || (fabs(x[i]) > MYEPSILON);
     620    result = result || (fabs(at(i)) > MYEPSILON);
    640621
    641622  return result;
     
    699680{
    700681  for(int i=NDIM;i--;)
    701     x[i] += y[i];
     682    at(i) += y[i];
    702683}
    703684
     
    708689{
    709690  for(int i=NDIM;i--;)
    710     x[i] -= y[i];
     691    at(i) -= y[i];
    711692}
    712693
  • src/vector.hpp

    r1b2d30 r55240c4  
    1616
    1717#include <memory>
     18#include <vector>
    1819
    1920#include "defs.hpp"
     
    2223/********************************************** declarations *******************************/
    2324
     25class Vector;
     26
     27typedef std::vector<Vector> pointset;
     28
    2429/** Single vector.
    2530 * basically, just a x[3] but with helpful functions
    2631 */
    2732class Vector : public Space{
    28 protected:
    29   // this struct is used to indicate calls to the Baseconstructor from inside vectors.
    30   struct Baseconstructor{};
    3133public:
    3234
     
    3941
    4042  double DistanceSquared(const Vector &y) const;
    41   Vector GetDistanceVectorToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const;
    4243  double DistanceToSpace(const Space& space) const;
    4344  double PeriodicDistance(const Vector &y, const double * const cell_size) const;
     
    5657  void ProjectIt(const Vector &y);
    5758  Vector Projection(const Vector &y) const;
    58   void Mirror(const Vector &x);
    5959  void ScaleAll(const double *factor);
    6060  void Scale(const double factor);
     
    6666  bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const;
    6767  void WrapPeriodically(const double * const M, const double * const Minv);
     68  std::pair<Vector,Vector> partition(const Vector&) const;
     69  std::pair<pointset,Vector> partition(const pointset&) const;
    6870
    6971  // Accessors ussually come in pairs... and sometimes even more than that
     
    7779
    7880  // Access to internal structure
    79   double* get();
     81  gsl_vector* get();
    8082
    8183  // Methods that are derived directly from other methods
     
    102104
    103105private:
    104   double x[NDIM];
     106  gsl_vector *content;
    105107
    106108};
  • src/vector_ops.cpp

    r1b2d30 r55240c4  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "vector.hpp"
     
    1517#include "Helpers/fast_functions.hpp"
    1618#include "Exceptions/LinearDependenceException.hpp"
     19#include "Exceptions/SkewException.hpp"
    1720
    1821#include <gsl/gsl_linalg.h>
     
    110113  return true;
    111114};
    112 
    113 /** Rotates the vector relative to the origin around the axis given by \a *axis by an angle of \a alpha.
    114  * \param *axis rotation axis
    115  * \param alpha rotation angle in radian
    116  */
    117 Vector RotateVector(const Vector &vec,const Vector &axis, const double alpha)
    118 {
    119   Vector a,y;
    120   Vector res;
    121   // normalise this vector with respect to axis
    122   a = vec;
    123   a.ProjectOntoPlane(axis);
    124   // construct normal vector
    125   try {
    126     y = Plane(axis,a,0).getNormal();
    127   }
    128   catch (MathException &excp) {
    129     // The normal vector cannot be created if there is linar dependency.
    130     // Then the vector to rotate is on the axis and any rotation leads to the vector itself.
    131     return vec;
    132   }
    133   y.Scale(vec.Norm());
    134   // scale normal vector by sine and this vector by cosine
    135   y.Scale(sin(alpha));
    136   a.Scale(cos(alpha));
    137   res = vec.Projection(axis);
    138   // add scaled normal vector onto this vector
    139   res += y;
    140   // add part in axis direction
    141   res += a;
    142   return res;
    143 };
    144 
    145 /** Calculates the intersection of the two lines that are both on the same plane.
    146  * This is taken from Weisstein, Eric W. "Line-Line Intersection." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html
    147  * \param *out output stream for debugging
    148  * \param *Line1a first vector of first line
    149  * \param *Line1b second vector of first line
    150  * \param *Line2a first vector of second line
    151  * \param *Line2b second vector of second line
    152  * \return true - \a this will contain the intersection on return, false - lines are parallel
    153  */
    154 Vector GetIntersectionOfTwoLinesOnPlane(const Vector &Line1a, const Vector &Line1b, const Vector &Line2a, const Vector &Line2b)
    155 {
    156   Info FunctionInfo(__func__);
    157 
    158   Vector res;
    159 
    160   auto_ptr<GSLMatrix> M = auto_ptr<GSLMatrix>(new GSLMatrix(4,4));
    161 
    162   M->SetAll(1.);
    163   for (int i=0;i<3;i++) {
    164     M->Set(0, i, Line1a[i]);
    165     M->Set(1, i, Line1b[i]);
    166     M->Set(2, i, Line2a[i]);
    167     M->Set(3, i, Line2b[i]);
    168   }
    169 
    170   //Log() << Verbose(1) << "Coefficent matrix is:" << endl;
    171   //for (int i=0;i<4;i++) {
    172   //  for (int j=0;j<4;j++)
    173   //    cout << "\t" << M->Get(i,j);
    174   //  cout << endl;
    175   //}
    176   if (fabs(M->Determinant()) > MYEPSILON) {
    177     Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
    178     throw LinearDependenceException(__FILE__,__LINE__);
    179   }
    180 
    181   Log() << Verbose(1) << "INFO: Line1a = " << Line1a << ", Line1b = " << Line1b << ", Line2a = " << Line2a << ", Line2b = " << Line2b << "." << endl;
    182 
    183 
    184   // constuct a,b,c
    185   Vector a = Line1b - Line1a;
    186   Vector b = Line2b - Line2a;
    187   Vector c = Line2a - Line1a;
    188   Vector d = Line2b - Line1b;
    189   Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl;
    190   if ((a.NormSquared() < MYEPSILON) || (b.NormSquared() < MYEPSILON)) {
    191    res.Zero();
    192    Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl;
    193    throw LinearDependenceException(__FILE__,__LINE__);
    194   }
    195 
    196   // check for parallelity
    197   Vector parallel;
    198   double factor = 0.;
    199   if (fabs(a.ScalarProduct(b)*a.ScalarProduct(b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) {
    200     parallel = Line1a - Line2a;
    201     factor = parallel.ScalarProduct(a)/a.Norm();
    202     if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
    203       res = Line2a;
    204       Log() << Verbose(1) << "Lines conincide." << endl;
    205       return res;
    206     } else {
    207       parallel = Line1a - Line2b;
    208       factor = parallel.ScalarProduct(a)/a.Norm();
    209       if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
    210         res = Line2b;
    211         Log() << Verbose(1) << "Lines conincide." << endl;
    212         return res;
    213       }
    214     }
    215     Log() << Verbose(1) << "Lines are parallel." << endl;
    216     res.Zero();
    217     throw LinearDependenceException(__FILE__,__LINE__);
    218   }
    219 
    220   // obtain s
    221   double s;
    222   Vector temp1, temp2;
    223   temp1 = c;
    224   temp1.VectorProduct(b);
    225   temp2 = a;
    226   temp2.VectorProduct(b);
    227   Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl;
    228   if (fabs(temp2.NormSquared()) > MYEPSILON)
    229     s = temp1.ScalarProduct(temp2)/temp2.NormSquared();
    230   else
    231     s = 0.;
    232   Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;
    233 
    234   // construct intersection
    235   res = a;
    236   res.Scale(s);
    237   res += Line1a;
    238   Log() << Verbose(1) << "Intersection is at " << res << "." << endl;
    239 
    240   return res;
    241 };
  • src/vector_ops.hpp

    r1b2d30 r55240c4  
    1010
    1111bool LSQdistance(Vector &res,const Vector **vectors, int num);
    12 Vector RotateVector(const Vector &vec,const Vector &axis, const double alpha);
    13 Vector GetIntersectionOfTwoLinesOnPlane(const Vector &Line1a, const Vector &Line1b, const Vector &Line2a, const Vector &Line2b);
    1412
    1513#endif /* VECTOR_OPS_HPP_ */
  • src/verbose.cpp

    r1b2d30 r55240c4  
    11using namespace std;
     2
     3#include "Helpers/MemDebug.hpp"
    24
    35#include "info.hpp"
  • tests/regression/Domain/2/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    1       # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      1       # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Domain/3/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    1       # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      1       # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Domain/4/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    1       # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      1       # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Domain/5/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  10      # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      10      # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    10      # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      10      # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    10      # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Filling/1/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1350    # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1350    # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    1350    # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      1350    # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    1350    # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Filling/1/pre/test.conf

    r1b2d30 r55240c4  
    7171Ion_Type2       3       6       1.0     3       3       12.01100000000  Carbon  C
    7272#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
    73 Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 0
    74 Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 1
    75 Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 2
    76 Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 3
    77 Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 4
    78 Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 5
    79 Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 6
    80 Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 7
    81 Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 8
    82 Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 9
    83 Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 10
     73Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 0
     74Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 1
     75Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 2
     76Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 3
     77Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 4
     78Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 5
     79Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 6
     80Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 7
     81Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 8
     82Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 9
     83Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 10
  • tests/regression/Molecules/6/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  10      # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      10      # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    10      # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      10      # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    10      # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Molecules/6/pre/test.conf

    r1b2d30 r55240c4  
    7171Ion_Type2       3       6       1.0     3       3       12.01100000000  Carbon  C
    7272#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
    73 Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 0
    74 Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 1
    75 Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 2
    76 Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 3
    77 Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 4
    78 Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 5
    79 Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 6
    80 Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 7
    81 Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 8
    82 Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 9
    83 Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 10
     73Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 0
     74Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 1
     75Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 2
     76Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 3
     77Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 4
     78Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 5
     79Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 6
     80Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 7
     81Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 8
     82Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 9
     83Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 10
  • tests/regression/Molecules/7/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  10      # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      10      # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    10      # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      10      # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    10      # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Molecules/7/pre/test.conf

    r1b2d30 r55240c4  
    7171Ion_Type2       3       6       1.0     3       3       12.01100000000  Carbon  C
    7272#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
    73 Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 0
    74 Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 1
    75 Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 2
    76 Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 3
    77 Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 4
    78 Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 5
    79 Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 6
    80 Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 7
    81 Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 8
    82 Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 9
    83 Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 10
     73Ion_Type1_1     9.782085945     2.645886050     2.645886050     0 # molecule nr 0
     74Ion_Type1_2     9.782085945     2.645886050     4.425886024     0 # molecule nr 1
     75Ion_Type1_3     10.672039608    3.904536878     3.535886037     0 # molecule nr 2
     76Ion_Type1_4     8.532785963     4.787886018     2.645886050     0 # molecule nr 3
     77Ion_Type1_5     8.532785963     4.787886018     4.425886024     0 # molecule nr 4
     78Ion_Type1_6     6.393632318     3.904536877     3.535886037     0 # molecule nr 5
     79Ion_Type1_7     7.283585982     2.645886050     2.645886050     0 # molecule nr 6
     80Ion_Type1_8     7.283585982     2.645886050     4.425886024     0 # molecule nr 7
     81Ion_Type2_1     9.782085945     3.275186040     3.535886037     0 # molecule nr 8
     82Ion_Type2_2     8.532785963     4.158586027     3.535886037     0 # molecule nr 9
     83Ion_Type2_3     7.283585982     3.275186040     3.535886037     0 # molecule nr 10
  • tests/regression/Simple_configuration/2/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       0       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   0       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/3/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       0       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   0       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/4/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/5/post/test.conf

    r1b2d30 r55240c4  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  0       # check every ..th steps
     37MaxMinStopStep  1       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      0       # check every ..th steps
     44InitMaxMinStopStep      1       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Tesselation/3/post/NonConvexEnvelope.dat

    r1b2d30 r55240c4  
    22VARIABLES = "X" "Y" "Z" "U"
    33ZONE T="test", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     46.9077 1.1106 0.1214 1
    450.3612 -3.628 1.323 1
    560.4884 -3.5983 -0.4521 3
     
    4546-6.8554 1.8134 -0.9499 1
    46477.1391 2.0447 0.0264 0
    47 6.9077 1.1106 0.1214 1
    4848
    49 31 43 44
    50 31 34 44
    51 33 34 44
    52 22 31 34
    53 16 22 34
    54 7 16 34
    55 7 9 16
    56 2 7 9
    57 2 7 34
    58 2 3 34
    59 3 28 34
    60 28 33 34
    61 1 2 3
    62 1 3 28
    63 1 14 28
    64 14 27 28
    65 27 28 33
    66 1 6 14
    67 6 13 14
    68 13 14 27
    69 13 24 27
    70 24 27 36
    71 27 33 36
    72 33 36 44
    73 36 43 44
    74 24 25 36
    75 24 25 26
    76 25 26 32
    77 25 32 43
    78 25 36 43
    79 13 24 26
    80 13 26 29
    81 5 13 29
    82 5 23 29
    83 23 29 35
    84 29 35 38
    85 26 29 38
    86 26 29 38
    87 15 26 29
    88 15 17 29
    89 15 17 26
    90 17 26 32
    91 17 22 32
    92 5 6 23
    93 5 6 13
    94 6 10 23
    95 10 19 23
    96 19 23 40
    97 23 35 40
    98 35 40 41
    99 10 19 21
    100 4 10 21
    101 4 6 10
    102 1 4 6
    103 35 37 38
    104 35 37 41
    105 17 29 30
    106 29 30 38
    107 30 38 39
    108 8 17 30
    109 8 16 17
    110 16 17 22
    111 8 18 30
    112 8 12 18
    113 12 18 30
    114 12 20 30
    115 20 30 42
    116 30 39 42
    117 8 11 12
    118 8 9 11
    119 8 9 16
    120 11 12 20
    121 11 20 21
    122 4 11 21
    123 2 4 11
    124 1 2 4
    125 2 9 11
    126 19 20 21
    127 19 20 40
    128 20 40 42
    129 40 41 42
    130 22 31 32
    131 31 32 43
    132 39 41 42
    133 37 39 41
    134 37 38 39
     491 32 44
     501 32 35
     511 34 35
     5223 32 35
     5317 23 35
     548 17 35
     558 10 17
     563 8 10
     573 8 35
     583 4 35
     594 29 35
     6029 34 35
     612 3 4
     622 4 29
     632 15 29
     6415 28 29
     6528 29 34
     662 7 15
     677 14 15
     6814 15 28
     6914 25 28
     7025 28 37
     7128 34 37
     721 34 37
     731 37 44
     7425 26 37
     7525 26 27
     7626 27 33
     7726 33 44
     7826 37 44
     7914 25 27
     8014 27 30
     816 14 30
     826 24 30
     8324 30 36
     8430 36 39
     8527 30 39
     8627 30 39
     8716 27 30
     8816 18 30
     8916 18 27
     9018 27 33
     9118 23 33
     926 7 24
     936 7 14
     947 11 24
     9511 20 24
     9620 24 41
     9724 36 41
     9836 41 42
     9911 20 22
     1005 11 22
     1015 7 11
     1022 5 7
     10336 38 39
     10436 38 42
     10518 30 31
     10630 31 39
     10731 39 40
     1089 18 31
     1099 17 18
     11017 18 23
     1119 19 31
     1129 13 19
     11313 19 31
     11413 21 31
     11521 31 43
     11631 40 43
     1179 12 13
     1189 10 12
     1199 10 17
     12012 13 21
     12112 21 22
     1225 12 22
     1233 5 12
     1242 3 5
     1253 10 12
     12620 21 22
     12720 21 41
     12821 41 43
     12941 42 43
     13023 32 33
     13132 33 44
     13240 42 43
     13338 40 42
     13438 39 40
  • tests/regression/Tesselation/3/post/NonConvexEnvelope.r3d

    r1b2d30 r55240c4  
    33# All atoms as spheres
    442
     5  0.939662 -3.01666 0.414493    0.1     1. 1. 1.
     62
     7  -0.152738 -1.94716 0.354093   0.1     1. 1. 1.
     82
     9  0.0659622 -1.03376 -0.880907  0.1     1. 1. 1.
     102
     11  -1.50434 -2.59696 0.0723932   0.1     1. 1. 1.
     122
     13  -0.0717378 -1.05346 1.57779   0.1     1. 1. 1.
     142
     15  1.52186 -0.603155 -0.873807   0.1     1. 1. 1.
     162
     17  -0.346038 -1.95996 -2.03011   0.1     1. 1. 1.
     182
     19  -2.63434 -1.74086 0.647893    0.1     1. 1. 1.
     202
     21  -1.61364 -2.66266 -1.47131    0.1     1. 1. 1.
     222
     23  1.36626 -0.519255 1.65039     0.1     1. 1. 1.
     242
     25  1.74646 0.246745 0.389693     0.1     1. 1. 1.
     262
     27  1.78606 0.287745 -2.09451     0.1     1. 1. 1.
     282
     29  -2.65324 -0.381955 -0.0548068         0.1     1. 1. 1.
     302
     31  -3.97304 -2.44796 0.426993    0.1     1. 1. 1.
     322
     33  3.21726 0.635145 0.478793     0.1     1. 1. 1.
     342
     35  3.13516 0.931145 -1.97401     0.1     1. 1. 1.
     362
     37  -3.80794 0.459345 0.492693    0.1     1. 1. 1.
     382
     39  3.34736 1.81094 1.44919       0.1     1. 1. 1.
     402
     41  3.76986 1.05884 -0.855107     0.1     1. 1. 1.
     422
     43  4.05806 -0.522555 1.01199     0.1     1. 1. 1.
     442
     45  -3.82684 1.81824 -0.210007    0.1     1. 1. 1.
     462
     47  5.16496 1.66244 -0.848507     0.1     1. 1. 1.
     482
     49  5.48576 -0.422855 0.476393    0.1     1. 1. 1.
     502
     51  -4.98154 2.65954 0.337493     0.1     1. 1. 1.
     522
     53  5.91796 1.03174 0.331693      0.1     1. 1. 1.
     542
     55  -5.00044 4.01854 -0.365207    0.1     1. 1. 1.
     562
     57  -6.30524 1.93554 0.0833932    0.1     1. 1. 1.
     582
     59  7.32406 1.08574 0.0829932     0.1     1. 1. 1.
     602
    561  0.777562 -3.65286 1.28459     0.1     1. 1. 1.
    6622
     
    941502
    95151  7.55546 2.01984 -0.0120068    0.1     1. 1. 1.
    96 2
    97   0.939662 -3.01666 0.414493    0.1     1. 1. 1.
    98 2
    99   -0.152738 -1.94716 0.354093   0.1     1. 1. 1.
    100 2
    101   0.0659622 -1.03376 -0.880907  0.1     1. 1. 1.
    102 2
    103   -1.50434 -2.59696 0.0723932   0.1     1. 1. 1.
    104 2
    105   -0.0717378 -1.05346 1.57779   0.1     1. 1. 1.
    106 2
    107   1.52186 -0.603155 -0.873807   0.1     1. 1. 1.
    108 2
    109   -0.346038 -1.95996 -2.03011   0.1     1. 1. 1.
    110 2
    111   -2.63434 -1.74086 0.647893    0.1     1. 1. 1.
    112 2
    113   -1.61364 -2.66266 -1.47131    0.1     1. 1. 1.
    114 2
    115   1.36626 -0.519255 1.65039     0.1     1. 1. 1.
    116 2
    117   1.74646 0.246745 0.389693     0.1     1. 1. 1.
    118 2
    119   1.78606 0.287745 -2.09451     0.1     1. 1. 1.
    120 2
    121   -2.65324 -0.381955 -0.0548068         0.1     1. 1. 1.
    122 2
    123   -3.97304 -2.44796 0.426993    0.1     1. 1. 1.
    124 2
    125   3.21726 0.635145 0.478793     0.1     1. 1. 1.
    126 2
    127   3.13516 0.931145 -1.97401     0.1     1. 1. 1.
    128 2
    129   -3.80794 0.459345 0.492693    0.1     1. 1. 1.
    130 2
    131   3.34736 1.81094 1.44919       0.1     1. 1. 1.
    132 2
    133   3.76986 1.05884 -0.855107     0.1     1. 1. 1.
    134 2
    135   4.05806 -0.522555 1.01199     0.1     1. 1. 1.
    136 2
    137   -3.82684 1.81824 -0.210007    0.1     1. 1. 1.
    138 2
    139   5.16496 1.66244 -0.848507     0.1     1. 1. 1.
    140 2
    141   5.48576 -0.422855 0.476393    0.1     1. 1. 1.
    142 2
    143   -4.98154 2.65954 0.337493     0.1     1. 1. 1.
    144 2
    145   5.91796 1.03174 0.331693      0.1     1. 1. 1.
    146 2
    147   -5.00044 4.01854 -0.365207    0.1     1. 1. 1.
    148 2
    149   -6.30524 1.93554 0.0833932    0.1     1. 1. 1.
    150 2
    151   7.32406 1.08574 0.0829932     0.1     1. 1. 1.
    152152# All tesselation triangles
    1531538
     
    156156  BACKFACE  0.3 0.3 1.0   0 0
    1571571
    158   5.67566 1.42984 -1.78291      7.55546 2.01984 -0.0120068      7.32406 1.08574 0.0829932       1. 0. 0.
    159 1
    160   5.67566 1.42984 -1.78291      5.53756 -0.911555 -0.496607     7.32406 1.08574 0.0829932       1. 0. 0.
    161 1
    162   6.16236 -0.927955 1.16559     5.53756 -0.911555 -0.496607     7.32406 1.08574 0.0829932       1. 0. 0.
     158  7.32406 1.08574 0.0829932     5.67566 1.42984 -1.78291        7.55546 2.01984 -0.0120068      1. 0. 0.
     1591
     160  7.32406 1.08574 0.0829932     5.67566 1.42984 -1.78291        5.53756 -0.911555 -0.496607     1. 0. 0.
     1611
     162  7.32406 1.08574 0.0829932     6.16236 -0.927955 1.16559       5.53756 -0.911555 -0.496607     1. 0. 0.
    1631631
    164164  3.60736 1.29684 -2.87381      5.67566 1.42984 -1.78291        5.53756 -0.911555 -0.496607     1. 0. 0.
     
    202202  4.07696 -0.484155 2.10119     6.16236 -0.927955 1.16559       5.68906 1.58194 1.24439         1. 0. 0.
    2032031
    204   6.16236 -0.927955 1.16559     5.68906 1.58194 1.24439         7.32406 1.08574 0.0829932       1. 0. 0.
    205 1
    206   5.68906 1.58194 1.24439       7.55546 2.01984 -0.0120068      7.32406 1.08574 0.0829932       1. 0. 0.
     204  7.32406 1.08574 0.0829932     6.16236 -0.927955 1.16559       5.68906 1.58194 1.24439         1. 0. 0.
     2051
     206  7.32406 1.08574 0.0829932     5.68906 1.58194 1.24439         7.55546 2.01984 -0.0120068      1. 0. 0.
    2072071
    208208  3.22946 1.45274 2.47189       4.33006 2.26874 1.33549         5.68906 1.58194 1.24439         1. 0. 0.
  • tests/regression/testsuite-tesselation.at

    r1b2d30 r55240c4  
    66AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
    77AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore])
    8 AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore])
     8#AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore])
    99AT_CLEANUP
    1010
     
    1414AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o 0 --convex-file ConvexEnvelope --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
    1515AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore])
    16 AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore])
     16#AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore])
    1717AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore])
    1818AT_CHECK([diff ConvexEnvelope.dat NonConvexEnvelope.dat], 0, [ignore], [ignore])
     
    2424AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
    2525AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
    26 AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
     26#AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
    2727AT_CLEANUP
    2828
Note: See TracChangeset for help on using the changeset viewer.