Changes in / [1b2d30:55240c4]
- Files:
-
- 7 added
- 193 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/Doxyfile
r1b2d30 r55240c4 258 258 # Configuration::additions related to the search engine 259 259 #--------------------------------------------------------------------------- 260 SEARCHENGINE = NO260 SEARCHENGINE = YES -
src/Actions/Action.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <string> … … 15 17 using namespace std; 16 18 19 Action::state_ptr getEmptyState() { 20 return Action::state_ptr(Memory::ignore(new ActionState())); 21 } 22 17 23 // 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()));24 Action::state_ptr Action::success = getEmptyState(); 25 Action::state_ptr Action::failure = getEmptyState(); 20 26 21 27 Action::Action(std::string _name,bool _doRegister) : -
src/Actions/ActionHistory.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "ActionHistory.hpp" -
src/Actions/ActionRegistry.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/ActionRegistry.hpp" -
src/Actions/ActionSequence.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/ActionSequence.hpp" -
src/Actions/AnalysisAction/MolecularVolumeAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" -
src/Actions/AnalysisAction/PairCorrelationAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" -
src/Actions/AtomAction/AddAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AtomAction/AddAction.hpp" -
src/Actions/AtomAction/ChangeElementAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AtomAction/ChangeElementAction.hpp" -
src/Actions/AtomAction/RemoveAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/AtomAction/RemoveAction.hpp" -
src/Actions/CmdAction/BondLengthTableAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/BondLengthTableAction.hpp" -
src/Actions/CmdAction/ElementDbAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/ElementDbAction.hpp" -
src/Actions/CmdAction/FastParsingAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/FastParsingAction.hpp" -
src/Actions/CmdAction/HelpAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/HelpAction.hpp" -
src/Actions/CmdAction/VerboseAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/VerboseAction.hpp" -
src/Actions/CmdAction/VersionAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/CmdAction/VersionAction.hpp" -
src/Actions/ErrorAction.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp" -
src/Actions/FragmentationAction/FragmentationAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/FragmentationAction/FragmentationAction.hpp" -
src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp" -
src/Actions/MakroAction.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <string> -
src/Actions/ManipulateAtomsProcess.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "ManipulateAtomsProcess.hpp" -
src/Actions/MapOfActions.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 using namespace std; -
src/Actions/MethodAction.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/Actions/MoleculeAction/BondFileAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/BondFileAction.hpp" -
src/Actions/MoleculeAction/ChangeNameAction.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/ChangeNameAction.hpp" -
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp" -
src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp" -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp" -
src/Actions/MoleculeAction/SaveAdjacencyAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/SaveAdjacencyAction.hpp" -
src/Actions/MoleculeAction/SaveBondsAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/SaveBondsAction.hpp" -
src/Actions/MoleculeAction/SaveTemperatureAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/SaveTemperatureAction.hpp" -
src/Actions/MoleculeAction/SuspendInWaterAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/SuspendInWaterAction.hpp" -
src/Actions/MoleculeAction/TranslateAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/TranslateAction.hpp" -
src/Actions/MoleculeAction/VerletIntegrationAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/MoleculeAction/VerletIntegrationAction.hpp" -
src/Actions/ParserAction/LoadXyzAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/ParserAction/LoadXyzAction.hpp" -
src/Actions/ParserAction/SaveXyzAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/ParserAction/SaveXyzAction.hpp" -
src/Actions/Process.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 9 8 10 #include "Process.hpp" 9 11 … … 12 14 Process::Process(int _maxSteps, std::string _name, bool _doRegister) : 13 15 Action(_name,_doRegister), 16 Observable("Process"), 14 17 maxSteps(_maxSteps), 15 18 active(false), -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/TesselationAction/ConvexEnvelopeAction.hpp" -
src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp" -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/AddEmptyBoundaryAction.hpp" -
src/Actions/WorldAction/BoundInBoxAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/BoundInBoxAction.hpp" -
src/Actions/WorldAction/CenterInBoxAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/CenterInBoxAction.hpp" -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/CenterOnEdgeAction.hpp" -
src/Actions/WorldAction/ChangeBoxAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/ChangeBoxAction.hpp" -
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp" -
src/Actions/WorldAction/RepeatBoxAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/RepeatBoxAction.hpp" … … 78 80 for (n[2] = 0; n[2] < Repeater[2]; n[2]++) { 79 81 y[2] = n[2]; 80 if ( n[0] == n[1] == n[2] == 0)82 if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0)) 81 83 continue; 82 84 for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { -
src/Actions/WorldAction/ScaleBoxAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/ScaleBoxAction.hpp" -
src/Actions/WorldAction/SetDefaultNameAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/SetDefaultNameAction.hpp" -
src/Actions/WorldAction/SetGaussianBasisAction.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Actions/WorldAction/SetGaussianBasisAction.hpp" -
src/CommandLineParser.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <boost/program_options.hpp> -
src/Descriptors/AtomDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Descriptors/AtomDescriptor.hpp" -
src/Descriptors/AtomIdDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "AtomIdDescriptor.hpp" -
src/Descriptors/AtomTypeDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Descriptors/AtomTypeDescriptor.hpp" -
src/Descriptors/MoleculeDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Descriptors/MoleculeDescriptor.hpp" -
src/Descriptors/MoleculeIdDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "MoleculeIdDescriptor.hpp" -
src/Descriptors/MoleculePtrDescriptor.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "MoleculePtrDescriptor.hpp" -
src/Exceptions/CustomException.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "CustomException.hpp" -
src/Exceptions/LinearDependenceException.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "LinearDependenceException.hpp" -
src/Exceptions/MathException.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "MathException.hpp" -
src/Exceptions/ZeroVectorException.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "ZeroVectorException.hpp" -
src/Hbondangle.db
r1b2d30 r55240c4 1 # atomicnumber angles for single, double and triple bond (-1 no angle) 1 2 1 180 -1 -1 2 3 5 180 131.0 109.2 -
src/Hbonddistance.db
r1b2d30 r55240c4 1 #atomic number bond distances for single, double and triple bond (-1 no bond) 1 2 1 0.74 -1 -1 2 3 2 0.77429209 -1 -1 -
src/Helpers/Assert.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Helpers/Assert.hpp" … … 45 47 46 48 using namespace Assert; 49 50 #ifndef NDEBUG 47 51 48 52 Action _my_assert::defaultAction = Ask; … … 122 126 return ActionNames[defaultAction]; 123 127 } 128 129 #endif 130 -
src/Helpers/MemDebug.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #ifndef NDBEGUG 9 #ifndef NO_MEMDEBUG 10 8 11 #include <iostream> 9 12 #include <cstdlib> … … 11 14 #include <boost/thread.hpp> 12 15 16 #ifdef __GNUC__ 17 #include <execinfo.h> 18 #include <cxxabi.h> 19 #endif 20 13 21 using namespace std; 14 22 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 17 46 18 47 namespace Memory { … … 34 63 char file[length+1]; 35 64 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 36 70 size_t nbytes; 37 71 bool isUsed; … … 44 78 }; 45 79 46 boost::mutex memorylock; 80 81 mutex_t memorylock = mutex_init; 47 82 48 83 // start and end of the doubly-linked list … … 96 131 for(entry_t *pos=begin;pos;pos=pos->next){ 97 132 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 98 137 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; 100 171 } 101 172 … … 105 176 return; 106 177 178 mutex_lock(memorylock); 107 179 if(entry->prev){ 108 180 entry->prev->next = entry->next; … … 120 192 end = entry->prev; 121 193 } 194 Memory::state -= entry->info.nbytes; 195 mutex_unlock(memorylock); 122 196 entry->isIgnored = true; 123 Memory::state -= entry->info.nbytes; 197 124 198 } 125 199 … … 130 204 deleteEntry(entry); 131 205 } 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 291 void *operator new(size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc) { 138 292 139 293 // to avoid allocations of 0 bytes if someone screws up … … 153 307 } 154 308 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 337 void *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 } 161 354 162 355 // build the entry in front of the space … … 171 364 entry->info.location = (char*)res + entrySpace; 172 365 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); 185 369 186 370 // get the checksum... … … 196 380 } 197 381 382 #endif 383 198 384 void *operator new(size_t nbytes) throw(std::bad_alloc) { 199 385 // Just forward to the other operator, when we do not know from 200 386 // 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 201 404 return operator new(nbytes,"Unknown",0); 202 } 405 #endif 406 } 407 408 #ifdef __GNUC__ 409 410 void *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 203 416 204 417 void *operator new[] (size_t nbytes,const char* file, int line) throw(std::bad_alloc) { … … 207 420 } 208 421 422 #endif 423 209 424 void *operator new[] (size_t nbytes) throw(std::bad_alloc) { 210 425 // 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 211 443 return operator new[] (nbytes,"Unknown",0); 444 #endif 212 445 } 213 446 … … 217 450 return; 218 451 } 219 220 // we need to lock, so the linked list does not changed while we are in here221 boost::mutex::scoped_lock guard(Memory::memorylock);222 452 223 453 // get the size for the entry, including alignment -
src/Helpers/MemDebug.hpp
r1b2d30 r55240c4 28 28 #endif 29 29 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 30 41 namespace Memory { 31 42 … … 50 61 } 51 62 } 52 63 #ifdef __GNUC__ 64 void *operator new (size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc); 65 void *operator new[] (size_t nbytes,const char* file, int line, const char* func) throw(std::bad_alloc); 66 #else 53 67 void *operator new (size_t nbytes,const char* file, int line) throw(std::bad_alloc); 54 68 void *operator new[] (size_t nbytes,const char* file, int line) throw(std::bad_alloc); 69 #endif 55 70 void operator delete (void *ptr,const char*, int) throw(); 56 71 void operator delete[] (void *ptr,const char*, int) throw(); 72 73 57 74 58 75 /** … … 60 77 * version that allows tracking. 61 78 */ 79 #ifdef __GNUC__ 80 #define new new(__FILE__,__LINE__,__PRETTY_FUNCTION__) 81 #else 62 82 #define new new(__FILE__,__LINE__) 83 #endif 63 84 64 85 #endif 65 86 #endif 66 87 88 89 #ifdef NDEBUG 90 #undef MEMDEBUG 91 #endif 67 92 68 93 #ifndef MEMDEBUG -
src/Legacy/oldmenu.cpp
r1b2d30 r55240c4 6 6 * 7 7 */ 8 9 #include "Helpers/MemDebug.hpp" 8 10 9 11 #include "Legacy/oldmenu.hpp" … … 26 28 #include "vector_ops.hpp" 27 29 #include "Plane.hpp" 30 #include "Line.hpp" 28 31 29 32 #include "UIElements/UIFactory.hpp" … … 191 194 // rotate vector around first angle 192 195 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); 194 197 Log() << Verbose(0) << "Rotated vector: " << first->x << endl, 195 198 // remove the projection onto the rotation plane of the second angle … … 207 210 // rotate another vector around second angle 208 211 n = y; 209 n = RotateVector(n,x,c - M_PI);212 n = Line(zeroVec,x).rotateVector(n,c - M_PI); 210 213 Log() << Verbose(0) << "2nd Rotated vector: " << n << endl; 211 214 -
src/Line.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 9 8 10 #include "Line.hpp" 9 11 … … 11 13 12 14 #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 23 using namespace std; 24 25 Line::Line(const Vector &_origin, const Vector &_direction) : 16 26 direction(new Vector(_direction)) 17 27 { 18 28 direction->Normalize(); 19 } 29 origin.reset(new Vector(_origin.partition(*direction).second)); 30 } 31 32 Line::Line(const Line &src) : 33 origin(new Vector(*src.origin)), 34 direction(new Vector(*src.direction)) 35 {} 20 36 21 37 Line::~Line() … … 24 40 25 41 double 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(); 27 47 } 28 48 29 49 Vector 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 57 Vector Line::getDirection() const{ 58 return *direction; 59 } 60 61 Vector Line::getOrigin() const{ 62 return *origin; 63 } 64 65 vector<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 */ 82 Vector 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 */ 184 Vector 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 213 Plane Line::getOrthogonalPlane(const Vector &origin) const{ 214 return Plane(getDirection(),origin); 215 } 216 217 Line 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 12 12 13 13 #include <memory> 14 #include <vector> 14 15 15 16 class Vector; 17 class Plane; 16 18 17 19 class Line : public Space 18 20 { 19 21 public: 20 Line(Vector &_origin, Vector &_direction); 22 Line(const Vector &_origin, const Vector &_direction); 23 Line(const Line& _src); 21 24 virtual ~Line(); 22 25 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; 25 39 26 40 private: … … 29 43 }; 30 44 45 /** 46 * Named constructor to make a line through two points 47 */ 48 Line makeLineThrough(const Vector &x1, const Vector &x2); 49 31 50 #endif /* LINE_HPP_ */ -
src/Makefile.am
r1b2d30 r55240c4 118 118 Descriptors/AtomTypeDescriptor.cpp \ 119 119 Descriptors/MoleculeDescriptor.cpp \ 120 Descriptors/MoleculeIdDescriptor.cpp \ 120 Descriptors/MoleculeIdDescriptor.cpp \ 121 121 Descriptors/MoleculeNameDescriptor.cpp \ 122 Descriptors/MoleculePtrDescriptor.cpp 122 Descriptors/MoleculePtrDescriptor.cpp 123 123 124 124 … … 132 132 133 133 EXCEPTIONSOURCE = 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 137 138 138 139 EXCEPTIONHEADER = 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 142 144 143 145 SOURCE = \ -
src/Parser/ChangeTracker.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "ChangeTracker.hpp" … … 13 15 * Constructor. Signs on as an observer for the World. 14 16 */ 15 ChangeTracker::ChangeTracker() { 17 ChangeTracker::ChangeTracker() : 18 Observable("ChangeTracker") 19 { 16 20 isConsistent = true; 17 21 World::getInstance().signOn(this); -
src/Parser/FormatParser.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "FormatParser.hpp" … … 14 16 * Constructor. 15 17 */ 16 FormatParser::FormatParser() { 18 FormatParser::FormatParser() : 19 Observer("FormatParser") 20 { 17 21 ChangeTracker::get()->signOn(this); 18 22 saveStream = NULL; -
src/Parser/TremoloParser.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Helpers/Assert.hpp" -
src/Parser/XyzParser.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "XyzParser.hpp" -
src/Patterns/Cacheable.hpp
r1b2d30 r55240c4 35 35 return busy; 36 36 } 37 virtual std::string getName()=0; 37 38 protected: 38 39 bool busy; … … 64 65 // nothing to do when entering this 65 66 } 67 68 virtual std::string getName(){ 69 return "invalid"; 70 } 66 71 }; 67 72 … … 90 95 State::busy = false; 91 96 } 97 98 virtual std::string getName(){ 99 return "valid"; 100 } 92 101 private: 93 102 T content; … … 118 127 // nothing to do when entering this state 119 128 } 129 130 virtual std::string getName(){ 131 return "destroyed"; 132 } 120 133 }; 121 134 … … 124 137 125 138 public: 126 Cacheable(Observable *_owner, boost::function<T()> _recalcMethod );139 Cacheable(Observable *_owner, boost::function<T()> _recalcMethod, std::string name); 127 140 virtual ~Cacheable(); 128 141 … … 151 164 152 165 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)"), 154 168 owner(_owner), 155 169 recalcMethod(_recalcMethod) … … 206 220 void Cacheable<T>::switchState(state_ptr newState){ 207 221 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 208 226 state = newState; 209 227 state->enter(); … … 215 233 { 216 234 public: 217 Cacheable(Observable *_owner, boost::function<T()> _recalcMethod );235 Cacheable(Observable *_owner, boost::function<T()> _recalcMethod,std::string name); 218 236 virtual ~Cacheable(); 219 237 220 238 const bool isValid() const; 221 const T &operator*() const;239 const T operator*() const; 222 240 223 241 // methods implemented for base-class Observer … … 230 248 231 249 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), 233 252 recalcMethod(_recalcMethod) 234 253 {} 235 254 236 255 template<typename T> 237 const T &Cacheable<T>::operator*() const{256 const T Cacheable<T>::operator*() const{ 238 257 return recalcMethod(); 239 258 } -
src/Patterns/ObservedIterator.hpp
r1b2d30 r55240c4 84 84 { 85 85 --iter; 86 return *this; 86 87 } 87 88 -
src/Patterns/Observer.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 9 8 10 #include "Observer.hpp" 9 11 … … 12 14 13 15 #include "Helpers/Assert.hpp" 16 #include "Helpers/MemDebug.hpp" 14 17 15 18 using namespace std; … … 43 46 // if no entry for this observable is found, an new one is created 44 47 // 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 45 51 depth[publisher]++; 46 52 } … … 60 66 // if zero is reached all observed blocks are done and we can 61 67 // 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]){} 63 73 else{ 64 74 publisher->notifyAll(); … … 123 133 callees_t::iterator iter; 124 134 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 125 140 (*iter).second->update(this); 126 141 } … … 165 180 // we do not need to publish all the changes at each time we are called 166 181 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 167 186 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 168 193 } 169 194 } … … 177 202 void Observable::signOn(Observer *target,int priority) { 178 203 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 179 207 bool res = false; 180 208 callees_t &callees = callTable[this]; … … 194 222 void Observable::signOff(Observer *target) { 195 223 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 196 227 callees_t &callees = callTable[this]; 197 228 … … 238 269 /** Constructor for class Observable. 239 270 */ 240 Observable::Observable() 241 {} 271 Observable::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 } 242 279 243 280 /** Destructor for class Observable. … … 246 283 Observable::~Observable() 247 284 { 285 #ifdef LOG_OBSERVER 286 observerLog().addMessage() << "-- Destroying Observable " << observerLog().getName(this) << endl; 287 #endif 248 288 if(callTable.count(this)) { 249 289 // delete all entries for this observable … … 259 299 /** Constructor for class Observer. 260 300 */ 261 Observer::Observer() 262 {} 301 Observer::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 */ 314 Observer::Observer(Observer::BaseConstructor){ 315 #ifdef LOG_OBSERVER 316 observerLog().addObservable(this); 317 #endif 318 } 263 319 264 320 /** Destructor for class Observer. 265 321 */ 266 322 Observer::~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 } 268 330 269 331 /** … … 296 358 } 297 359 } 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 367 ObserverLog &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 375 ObserverLog::ObserverLog() : 376 count (0) 377 {} 378 379 ObserverLog::~ObserverLog(){} 380 381 string ObserverLog::getLog(){return log.str();} 382 383 std::string ObserverLog::getName(void* obj){ 384 return names[obj]; 385 } 386 387 bool ObserverLog::isObservable(void* obj){ 388 return observables.count(obj); 389 } 390 391 void ObserverLog::addName(void* obj , string name){ 392 stringstream sstr; 393 sstr << name << "_" << count++; 394 names[obj] = sstr.str(); 395 } 396 397 void ObserverLog::addObservable(void* obj){ 398 observables.insert(obj); 399 } 400 401 void ObserverLog::deleteName(void* obj){ 402 names.erase(obj); 403 } 404 405 void ObserverLog::deleteObservable(void* obj){ 406 observables.erase(obj); 407 } 408 409 stringstream &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 11 11 #include <map> 12 12 #include <set> 13 #include <string> 14 #include <sstream> 13 15 14 16 /** … … 28 30 */ 29 31 32 // Deactivate any logging when we are not in debug mode 33 #ifdef NDEBUG 34 #undef LOG_OBSERVER 35 #endif 36 30 37 class Observable; 31 38 class Notification; … … 58 65 template<class> friend class ObservedIterator; 59 66 60 public: 61 Observer(); 67 // indicates the constructor called from Observables 68 struct BaseConstructor{}; 69 70 public: 71 Observer(BaseConstructor); 72 Observer(std::string); 62 73 virtual ~Observer(); 63 74 … … 91 102 class Observable : public Observer { 92 103 public: 93 Observable( );104 Observable(std::string _name); 94 105 virtual ~Observable(); 95 106 … … 192 203 }; 193 204 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 */ 212 class ObserverLog{ 213 friend class Observable; 214 friend class Observer; 215 template <typename> friend class Cacheable; 216 public: 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*); 222 private: 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 234 ObserverLog &observerLog(); 235 236 #endif 237 194 238 // extra macro is necessary to work with __LINE__ 195 239 #define PASTE(a,b) PASTE_HELPER(a,b) -
src/Plane.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Plane.hpp" … … 14 16 #include "Helpers/Assert.hpp" 15 17 #include <cmath> 18 #include "Line.hpp" 19 #include "Exceptions/MultipleSolutionsException.hpp" 16 20 17 21 /** … … 42 46 /** 43 47 * Constructs a plane from two direction vectors and a offset. 44 * If no offset is given a plane through origin is assumed45 48 */ 46 49 Plane::Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException) : … … 113 116 } 114 117 115 Vector Plane::getOffsetVector() {118 Vector Plane::getOffsetVector() const { 116 119 return getOffset()*getNormal(); 117 120 } 118 121 119 vector<Vector> Plane::getPointsOnPlane() {122 vector<Vector> Plane::getPointsOnPlane() const{ 120 123 std::vector<Vector> res; 121 124 res.reserve(3); … … 147 150 * \return true - \a this contains intersection point on return, false - line is parallel to plane (even if in-plane) 148 151 */ 149 Vector Plane::GetIntersection(const Vector &Origin, const Vector &LineVector)152 Vector Plane::GetIntersection(const Line& line) const 150 153 { 151 154 Info FunctionInfo(__func__); 152 155 Vector res; 153 156 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()); 172 170 double scaleFactor = (offset-factor2)/factor1; 173 171 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."); 182 177 return res; 183 178 }; 179 180 Vector 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 186 Line Plane::getOrthogonalLine(const Vector &origin) const{ 187 return Line(origin,getNormal()); 188 } 184 189 185 190 /************ Methods inherited from Space ****************/ -
src/Plane.hpp
r1b2d30 r55240c4 17 17 18 18 class Vector; 19 class Line; 19 20 20 21 class Plane : public Space … … 42 43 * Same as getOffset()*getNormal(); 43 44 */ 44 Vector getOffsetVector() ;45 Vector getOffsetVector() const; 45 46 46 47 /** 47 48 * returns three seperate points on this plane 48 49 */ 49 std::vector<Vector> getPointsOnPlane() ;50 std::vector<Vector> getPointsOnPlane() const; 50 51 51 52 // 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; 53 64 54 65 /****** Methods inherited from Space ***********/ -
src/Space.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Space.hpp" … … 19 21 } 20 22 23 Vector Space::getVectorToPoint(const Vector &origin) const{ 24 Vector support = getClosestPoint(origin); 25 return support-origin; 26 } 27 21 28 bool Space::isContained(const Vector &point) const{ 22 29 return (distance(point)) < MYEPSILON; -
src/Space.hpp
r1b2d30 r55240c4 17 17 virtual ~Space(); 18 18 19 /** 20 * Calculates the distance between a Space and a Vector. 21 */ 19 22 virtual double distance(const Vector &point) const=0; 23 24 /** 25 * get the closest point inside the space to another point 26 */ 20 27 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 */ 21 43 virtual bool isContained(const Vector &point) const; 44 45 /** 46 * Tests if this space contains the center of the coordinate system. 47 */ 22 48 virtual bool hasZero() const; 23 49 -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 8 9 9 10 #include <iostream> -
src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 8 9 9 10 #include "CommandLineUI/CommandLineStatusIndicator.hpp" … … 15 16 using namespace std; 16 17 17 CommandLineStatusIndicator::CommandLineStatusIndicator() 18 CommandLineStatusIndicator::CommandLineStatusIndicator() : 19 Observer("CommandLineStatusIndicator") 18 20 { 19 21 Process::AddObserver(this); -
src/UIElements/CommandLineUI/CommandLineUIFactory.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 8 9 9 10 #include "CommandLineUI/CommandLineUIFactory.hpp" … … 31 32 return new CommandLineWindow(); 32 33 } 34 35 CommandLineUIFactory::description::description() : 36 UIFactory::factoryDescription("CommandLine") 37 {} 38 39 CommandLineUIFactory::description::~description() 40 {} 41 42 UIFactory* CommandLineUIFactory::description::makeFactory(){ 43 return new CommandLineUIFactory(); 44 } -
src/UIElements/CommandLineUI/CommandLineUIFactory.hpp
r1b2d30 r55240c4 21 21 virtual MainWindow* makeMainWindow(); 22 22 23 struct description : public UIFactory::factoryDescription { 24 description(); 25 virtual ~description(); 26 27 virtual UIFactory* makeFactory(); 28 }; 29 23 30 protected: 24 31 CommandLineUIFactory(); -
src/UIElements/CommandLineUI/CommandLineWindow.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <boost/bind.hpp> -
src/UIElements/Dialog.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <cassert> -
src/UIElements/MainWindow.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "MainWindow.hpp" -
src/UIElements/Menu/ActionMenuItem.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/UIElements/Menu/DisplayMenuItem.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <sstream> -
src/UIElements/Menu/Menu.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Menu.hpp" -
src/UIElements/Menu/MenuItem.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 8 #include "Helpers/MemDebug.hpp" 9 9 10 10 #include "Menu/MenuItem.hpp" -
src/UIElements/Menu/SeperatorItem.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 9 7 10 #include <string> 8 11 #include <sstream> -
src/UIElements/Menu/SubMenuItem.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "SubMenuItem.hpp" -
src/UIElements/Menu/TextMenu.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <boost/bind.hpp> -
src/UIElements/TextUI/TextDialog.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/UIElements/TextUI/TextStatusIndicator.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "TextUI/TextStatusIndicator.hpp" … … 14 16 using namespace std; 15 17 16 TextStatusIndicator::TextStatusIndicator() 18 TextStatusIndicator::TextStatusIndicator() : 19 Observer("TextStatusIndicator") 17 20 { 18 21 Process::AddObserver(this); -
src/UIElements/TextUI/TextUIFactory.cpp
r1b2d30 r55240c4 6 6 */ 7 7 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" 11 11 12 12 13 13 TextUIFactory::TextUIFactory() 14 { 15 // TODO Auto-generated constructor stub 16 17 } 14 {} 18 15 19 16 TextUIFactory::~TextUIFactory() 20 { 21 // TODO Auto-generated destructor stub 22 } 17 {} 23 18 24 19 … … 31 26 } 32 27 28 TextUIFactory::description::description() : 29 UIFactory::factoryDescription("Text") 30 {} 31 32 TextUIFactory::description::~description() 33 {} 34 35 UIFactory* TextUIFactory::description::makeFactory(){ 36 return new TextUIFactory(); 37 } 38 -
src/UIElements/TextUI/TextUIFactory.hpp
r1b2d30 r55240c4 21 21 virtual MainWindow* makeMainWindow(); 22 22 23 struct description : public UIFactory::factoryDescription { 24 description(); 25 virtual ~description(); 26 27 virtual UIFactory* makeFactory(); 28 }; 29 23 30 protected: 24 31 TextUIFactory(); -
src/UIElements/TextUI/TextWindow.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "TextUI/TextWindow.hpp" -
src/UIElements/UIFactory.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 8 9 9 #include < cassert>10 #include <utility> 10 11 #include "Patterns/Singleton_impl.hpp" 11 #include "UIFactory.hpp" 12 #include "UIElements/UIFactory.hpp" 13 #include "Helpers/Assert.hpp" 12 14 13 // all factories that can be used: 14 #include "TextUI/TextUIFactory.hpp" 15 #include "CommandLineUI/CommandLineUIFactory.hpp" 15 using namespace std; 16 17 std::map<std::string,boost::shared_ptr<UIFactory::factoryDescription> > UIFactory::factories; 16 18 17 19 UIFactory::UIFactory() 18 { 19 // TODO Auto-generated constructor stub 20 {} 20 21 22 UIFactory::~UIFactory() 23 {} 24 25 void 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()); 21 29 } 22 30 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 } 31 void 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))); 41 35 } 42 36 43 37 CONSTRUCT_SINGLETON(UIFactory) 38 39 UIFactory::factoryDescription::factoryDescription(string _name) : 40 name(_name) 41 {} 42 43 UIFactory::factoryDescription::~factoryDescription() 44 {} -
src/UIElements/UIFactory.hpp
r1b2d30 r55240c4 15 15 #include "Patterns/Singleton.hpp" 16 16 17 #include <string> 18 #include <map> 19 #include <boost/smart_ptr.hpp> 20 17 21 /** 18 22 * Abstract Factory to create any kind of User interface object needed by the programm. … … 24 28 class UIFactory : public Singleton<UIFactory,false> 25 29 { 26 30 friend class Singleton<UIFactory,false>; 27 31 public: 28 enum InterfaceTypes {Text, CommandLine};29 virtual ~UIFactory();30 31 32 /** 32 33 * Produce some kind of main window, of whichever type was chosen when the factory was created … … 42 43 protected: 43 44 UIFactory(); 45 virtual ~UIFactory(); 44 46 45 47 public: 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 }; 46 57 /** 47 58 * create a Factory of a certain type. From that moment on only those UIElements can be produced by the factory 48 59 */ 49 static void makeUserInterface(InterfaceTypes type); 50 60 static void makeUserInterface(std::string type); 61 static void registerFactory(factoryDescription *factoryDesc); 62 protected: 63 private: 64 static std::map<std::string,boost::shared_ptr<factoryDescription> > factories; 51 65 }; 52 66 -
src/UIElements/Views/MethodStringView.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "MethodStringView.hpp" -
src/UIElements/Views/StreamStringView.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <sstream> -
src/UIElements/Views/StringView.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "StringView.hpp" -
src/UIElements/Views/View.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "View.hpp" -
src/World.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "World.hpp" … … 283 285 284 286 World::World() : 287 Observable("World"), 285 288 periode(new periodentafel), 286 289 configuration(new config), -
src/analysis_bonds.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "analysis_bonds.hpp" -
src/analysis_correlation.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/analyzer.cpp
r1b2d30 r55240c4 7 7 8 8 //============================ INCLUDES =========================== 9 10 #include "Helpers/MemDebug.hpp" 9 11 10 12 #include <cstring> -
src/atom.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include "atom.hpp" … … 14 16 #include "vector.hpp" 15 17 #include "World.hpp" 18 #include "molecule.hpp" 16 19 17 20 /************************************* Functions for class atom *************************************/ … … 21 24 */ 22 25 atom::atom() : 23 previous(NULL), next(NULL), father(this), sort(&nr)26 father(this), sort(&nr), mol(0) 24 27 { 25 28 node = &x; // TesselPoint::x can only be referenced from here … … 29 32 */ 30 33 atom::atom(atom *pointer) : 31 ParticleInfo(pointer), 32 previous(NULL), next(NULL), father(pointer), sort(&nr) 34 ParticleInfo(pointer),father(pointer), sort(&nr) 33 35 { 34 36 type = pointer->type; // copy element of atom … … 37 39 FixedIon = pointer->FixedIon; 38 40 node = &x; 41 mol = 0; 39 42 }; 40 43 41 44 atom *atom::clone(){ 42 45 atom *res = new atom(this); 43 res->previous=0;44 res->next=0;45 46 res->father = this; 46 47 res->sort = &res->nr; … … 50 51 res->FixedIon = FixedIon; 51 52 res->node = &x; 53 res->mol = 0; 52 54 World::getInstance().registerAtom(res); 53 55 return res; … … 59 61 atom::~atom() 60 62 { 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 } 61 69 }; 62 70 … … 67 75 atom *atom::GetTrueFather() 68 76 { 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 } 76 86 }; 77 87 … … 305 315 } 306 316 307 atomId_t atom::getId() {317 atomId_t atom::getId() const { 308 318 return id; 309 319 } 320 321 void 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 330 void atom::removeFromMolecule(){ 331 if(mol){ 332 if(mol->containsAtom(this)){ 333 mol->erase(this); 334 } 335 mol=0; 336 } 337 } 338 310 339 311 340 atom* NewAtom(atomId_t _id){ -
src/atom.hpp
r1b2d30 r55240c4 34 34 class Vector; 35 35 class World; 36 class molecule; 36 37 37 38 /********************************************** declarations *******************************/ … … 44 45 friend void DeleteAtom(atom*); 45 46 public: 46 atom *previous; //!< previous atom in molecule list47 atom *next; //!< next atom in molecule list48 47 atom *father; //!< In many-body bond order fragmentations points to originating atom 49 48 int *sort; //!< sort criteria … … 80 79 void setWorld(World*); 81 80 82 virtual atomId_t getId() ;81 virtual atomId_t getId() const; 83 82 virtual bool changeId(atomId_t newId); 84 83 … … 89 88 virtual void setId(atomId_t); 90 89 90 void setMolecule(molecule*); 91 void removeFromMolecule(); 92 91 93 protected: 94 92 95 /** 93 96 * Protected constructor to ensure construction of atoms through the world. … … 108 111 virtual ~atom(); 109 112 private: 113 molecule *mol; // !< the molecule this atom belongs to 110 114 World* world; 111 115 atomId_t id; -
src/atom_atominfo.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "periodentafel.hpp" -
src/atom_bondedparticle.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom.hpp" -
src/atom_bondedparticleinfo.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom_bondedparticleinfo.hpp" -
src/atom_graphnode.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom_graphnode.hpp" -
src/atom_graphnodeinfo.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom_graphnodeinfo.hpp" -
src/atom_particleinfo.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom_particleinfo.hpp" -
src/atom_trajectoryparticle.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom.hpp" -
src/atom_trajectoryparticleinfo.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom_trajectoryparticleinfo.hpp" -
src/atom_trajectoryparticleinfo.hpp
r1b2d30 r55240c4 21 21 22 22 #include "vector.hpp" 23 #include "VectorSet.hpp" 23 24 24 25 /********************************************** declarations *******************************/ … … 28 29 struct 29 30 { 30 vector<Vector> R; //!< position vector31 vector<Vector> U; //!< velocity vector32 vector<Vector> F; //!< last force vector31 VectorSet<vector<Vector> > R; //!< position vector 32 VectorSet<vector<Vector> > U; //!< velocity vector 33 VectorSet<vector<Vector> > F; //!< last force vector 33 34 } Trajectory; 34 35 int FixedIon; //!< config variable that states whether forces act on the ion or not -
src/bond.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include "atom.hpp" -
src/bondgraph.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/boundary.cpp
r1b2d30 r55240c4 3 3 * Implementations and super-function for envelopes 4 4 */ 5 6 #include "Helpers/MemDebug.hpp" 5 7 6 8 #include "World.hpp" -
src/builder.cpp
r1b2d30 r55240c4 47 47 */ 48 48 49 #include "Helpers/MemDebug.hpp" 49 50 50 51 #include <boost/bind.hpp> … … 73 74 #include "periodentafel.hpp" 74 75 #include "UIElements/UIFactory.hpp" 76 #include "UIElements/TextUI/TextUIFactory.hpp" 77 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp" 75 78 #include "UIElements/MainWindow.hpp" 76 79 #include "UIElements/Dialog.hpp" … … 84 87 #include "version.h" 85 88 #include "World.hpp" 86 #include "Helpers/MemDebug.hpp" 89 87 90 88 91 /********************************************* Subsubmenu routine ************************************/ … … 1355 1358 }; 1356 1359 1357 #endif1358 1360 1359 1361 /** Tries given filename or standard on saving the config file. … … 1481 1483 }; 1482 1484 1485 #endif 1486 1483 1487 /** Parses the command line options. 1484 1488 * Note that this function is from now on transitional. All commands that are not passed … … 1498 1502 { 1499 1503 Vector x,y,z,n; // coordinates for absolute point in cell volume 1500 double *factor; // unit factor if desired1501 1504 ifstream test; 1502 1505 ofstream output; 1503 1506 string line; 1504 atom *first;1505 1507 bool SaveFlag = false; 1506 1508 int ExitFlag = 0; … … 1508 1510 double volume = 0.; 1509 1511 enum ConfigStatus configPresent = absent; 1510 clock_t start,end;1511 double MaxDistance = -1;1512 1512 int argptr; 1513 1513 molecule *mol = NULL; 1514 1514 string BondGraphFileName("\n"); 1515 bool DatabasePathGiven = false;1516 1515 1517 1516 if (argc > 1) { // config file specified as option … … 2190 2189 ActionRegistry::purgeInstance(); 2191 2190 ActionHistory::purgeInstance(); 2191 #ifdef LOG_OBSERVER 2192 cout << observerLog().getLog(); 2193 #endif 2192 2194 Memory::getState(); 2193 2195 } … … 2195 2197 int main(int argc, char **argv) 2196 2198 { 2197 config *configuration = World::getInstance().getConfig();2198 2199 // while we are non interactive, we want to abort from asserts 2199 2200 //ASSERT_DO(Assert::Abort); 2200 molecule *mol = NULL;2201 2201 Vector x, y, z, n; 2202 2202 ifstream test; … … 2255 2255 if (!CommandLineParser::getInstance().isEmpty()) { 2256 2256 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"); 2258 2259 } else { 2259 2260 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"); 2261 2263 } 2262 2264 } -
src/config.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <stdio.h> … … 1521 1523 char filename[MAXSTRINGSIZE]; 1522 1524 ofstream output; 1523 molecule *mol = World::getInstance().createMolecule(); 1524 mol->SetNameFromFilename(ConfigFileName); 1525 molecule *mol = NULL; 1525 1526 1526 1527 if (!strcmp(configpath, GetDefaultPath())) { … … 1553 1554 // translate each to its center and merge all molecules in MoleculeListClass into this molecule 1554 1555 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 } 1569 1578 } 1570 1579 1571 1580 Log() << Verbose(0) << "Storing configuration ... " << endl; 1572 1581 // get correct valence orbitals 1573 mol->CalculateOrbitals(*this);1574 InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble;1575 1582 if (ConfigFileName != NULL) { // test the file name 1576 1583 strcpy(filename, ConfigFileName); … … 1632 1639 } 1633 1640 1634 World::getInstance().destroyMolecule(mol); 1641 // don't destroy molecule as it contains all our atoms 1642 //World::getInstance().destroyMolecule(mol); 1635 1643 }; 1636 1644 -
src/datacreator.cpp
r1b2d30 r55240c4 6 6 7 7 //============================ INCLUDES =========================== 8 9 #include "Helpers/MemDebug.hpp" 8 10 9 11 #include "datacreator.hpp" -
src/element.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <iomanip> -
src/elements_db.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 const char *elementsDB =\ -
src/ellipsoid.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <gsl/gsl_multimin.h> -
src/errorlogger.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <fstream> -
src/graph.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 using namespace std; -
src/gslmatrix.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 using namespace std; -
src/gslvector.cpp
r1b2d30 r55240c4 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 9 8 10 #include <cassert> 9 11 #include <cmath> … … 11 13 #include "gslvector.hpp" 12 14 #include "defs.hpp" 15 #include "vector.hpp" 13 16 14 17 /** Constructor of class GSLVector. … … 59 62 gsl_vector_memcpy (vector, &m.vector); 60 63 }; 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 */ 70 void GSLVector::SetFromVector(Vector &v){ 71 gsl_vector_memcpy (vector, v.get()); 72 } 61 73 62 74 /** This function returns the i-th element of a vector. -
src/gslvector.hpp
r1b2d30 r55240c4 24 24 25 25 class GSLVector; 26 class Vector; 26 27 27 28 /********************************************** declarations *******************************/ … … 38 39 // Accessing 39 40 void SetFromDoubleArray(double *x); 41 void SetFromVector(Vector &v); 40 42 double Get(size_t m) const; 41 43 void Set(size_t m, double x); -
src/helpers.cpp
r1b2d30 r55240c4 4 4 */ 5 5 6 #include "Helpers/MemDebug.hpp" 6 7 7 8 #include "helpers.hpp" -
src/info.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "info.hpp" -
src/joiner.cpp
r1b2d30 r55240c4 7 7 8 8 //============================ INCLUDES =========================== 9 10 #include "Helpers/MemDebug.hpp" 9 11 10 12 #include <cstring> -
src/leastsquaremin.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <iostream> -
src/linearsystemofequations.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "defs.hpp" … … 54 56 { 55 57 assert ( columns == NDIM && "Vector class is always three-dimensional, unlike this LEqS!"); 56 b->SetFrom DoubleArray(x->get());58 b->SetFromVector(*x); 57 59 }; 58 60 -
src/linkedcell.cpp
r1b2d30 r55240c4 5 5 */ 6 6 7 #include "Helpers/MemDebug.hpp" 7 8 8 9 #include "atom.hpp" -
src/log.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "logger.hpp" -
src/logger.cpp
r1b2d30 r55240c4 5 5 * Author: metzler 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <fstream> -
src/memoryallocator.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 using namespace std; -
src/memoryusageobserver.cpp
r1b2d30 r55240c4 4 4 * This class represents a Singleton for observing memory usage. 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <cstdlib> -
src/molecule.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <cstring> … … 35 37 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero. 36 38 */ 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())39 molecule::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()) 43 45 { 44 46 … … 143 145 molecule::const_iterator iter = loc; 144 146 iter--; 145 atoms.erase( loc ); 147 atom* atom = *loc; 148 atomIds.erase( atom->getId() ); 149 atoms.remove( atom ); 150 atom->removeFromMolecule(); 146 151 return iter; 147 152 } 148 153 149 molecule::const_iterator molecule::erase( atom * &key )154 molecule::const_iterator molecule::erase( atom * key ) 150 155 { 151 156 cout << "trying to erase atom" << endl; 152 157 molecule::const_iterator iter = find(key); 153 158 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(); 156 162 } 157 163 return iter; 158 164 } 159 165 160 molecule::const_iterator molecule::find ( atom *& key ) const 161 { 162 return atoms.find( key ); 166 molecule::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()); 163 174 } 164 175 165 176 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 166 177 { 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 187 bool molecule::containsAtom(atom* key){ 188 return (find(key) != end()); 169 189 } 170 190 … … 192 212 } 193 213 insert(pointer); 214 pointer->setMolecule(this); 194 215 } 195 216 return true; … … 657 678 bond * molecule::AddBond(atom *atom1, atom *atom2, int degree) 658 679 { 680 OBSERVE; 659 681 bond *Binder = NULL; 660 682 … … 780 802 for (molecule::iterator iter = begin(); !empty(); iter = begin()) 781 803 erase(iter); 804 return empty(); 782 805 }; 783 806 … … 1000 1023 configuration.MaxPsiDouble /= 2; 1001 1024 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))) { 1003 1026 configuration.ProcPEGamma /= 2; 1004 1027 configuration.ProcPEPsi *= 2; … … 1007 1030 configuration.ProcPEPsi = 1; 1008 1031 } 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 } 1010 1040 }; 1011 1041 -
src/molecule.hpp
r1b2d30 r55240c4 89 89 90 90 public: 91 typedef std::set<atom*> atomSet; 91 typedef std::list<atom*> atomSet; 92 typedef std::set<atomId_t> atomIdSet; 92 93 typedef ObservedIterator<atomSet> iterator; 93 94 typedef atomSet::const_iterator const_iterator; … … 117 118 Cacheable<int> AtomCount; 118 119 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 120 122 protected: 121 123 //void CountAtoms(); … … 149 151 size_t size() const; 150 152 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; 153 155 pair<iterator,bool> insert ( atom * const key ); 156 bool containsAtom(atom* key); 154 157 155 158 -
src/molecule_dynamics.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "World.hpp" -
src/molecule_fragmentation.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <cstring> -
src/molecule_geometry.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom.hpp" … … 16 18 #include "molecule.hpp" 17 19 #include "World.hpp" 20 #include "Plane.hpp" 21 #include <boost/foreach.hpp> 22 18 23 19 24 /************************************* Functions for class molecule *********************************/ … … 256 261 void molecule::Mirror(const Vector *n) 257 262 { 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 } 259 268 }; 260 269 -
src/molecule_graph.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom.hpp" -
src/molecule_pointcloud.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "atom.hpp" … … 55 57 void molecule::GoToFirst() const 56 58 { 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)); 58 65 }; 59 66 -
src/moleculelist.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 #include <cstring> … … 30 32 */ 31 33 MoleculeListClass::MoleculeListClass(World *_world) : 34 Observable("MoleculeListClass"), 32 35 world(_world) 33 36 { … … 210 213 211 214 // 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); 217 219 } 218 220 … … 257 259 status = status && SimpleMerge(mol, srcmol); 258 260 } 261 insert(mol); 259 262 return status; 260 263 }; -
src/orbitals.db
r1b2d30 r55240c4 1 # atomicnumber numberoforbitals 1 2 1 1 2 3 2 0 -
src/parser.cpp
r1b2d30 r55240c4 6 6 7 7 // ======================================= INCLUDES ========================================== 8 9 #include "Helpers/MemDebug.hpp" 8 10 9 11 #include <cstring> -
src/periodentafel.cpp
r1b2d30 r55240c4 4 4 * 5 5 */ 6 7 #include "Helpers/MemDebug.hpp" 6 8 7 9 using namespace std; … … 371 373 (*input) >> elements[Z]->Valence; 372 374 (*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; 374 376 } 375 377 return true; … … 394 396 (*input) >> elements[Z]->NoValenceOrbitals; 395 397 (*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; 397 399 } 398 400 return true; -
src/tesselation.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <fstream> … … 17 19 #include "triangleintersectionlist.hpp" 18 20 #include "vector.hpp" 21 #include "Line.hpp" 19 22 #include "vector_ops.hpp" 20 23 #include "verbose.hpp" … … 441 444 442 445 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); 473 469 helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node); 474 470 CrossPoint -= (*endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 477 473 if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) { 478 474 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl); 479 i=4; 480 break; 475 return false; 481 476 } 482 477 i++; 483 } catch (LinearDependenceException &excp){ 484 break; 485 } 486 } while (i < 3); 487 if (i == 3) { 478 } while (i < 3); 488 479 DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl); 489 480 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); 492 485 return false; 493 486 } … … 516 509 GetCenter(&Direction); 517 510 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) { 521 515 (*ClosestPoint) = (*x); 522 516 } … … 541 535 Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node); 542 536 // 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); 544 539 CrossDirection[i] = CrossPoint[i] - InPlane; 545 540 CrossPoint[i] -= (*endpoints[i%3]->node->node); // cross point was returned as absolute vector -
src/tesselationhelpers.cpp
r1b2d30 r55240c4 5 5 * Author: heber 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include <fstream> … … 14 16 #include "tesselationhelpers.hpp" 15 17 #include "vector.hpp" 18 #include "Line.hpp" 16 19 #include "vector_ops.hpp" 17 20 #include "verbose.hpp" … … 666 669 // calculate the intersection between this projected baseline and Base 667 670 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); 671 674 Normal = (*Intersection) - (*Base->endpoints[0]->node->node); 672 675 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 8 8 * Author: heber 9 9 */ 10 11 #include "Helpers/MemDebug.hpp" 10 12 11 13 #include "triangleintersectionlist.hpp" -
src/unittests/CacheableTest.cpp
r1b2d30 r55240c4 55 55 56 56 threeNumbers(int _x,int _y, int _z) : 57 Observable("threeNumbers"), 57 58 x(_x),y(_y),z(_z), 58 sum(this,boost::bind(&threeNumbers::calcSum,this) ),59 sum(this,boost::bind(&threeNumbers::calcSum,this),"sum"), 59 60 hasRecalced(false) 60 61 {} … … 81 82 CPPUNIT_ASSERT_EQUAL( 9, *(numbers->sum)); 82 83 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 83 91 } -
src/unittests/Makefile.am
r1b2d30 r55240c4 26 26 InfoUnitTest \ 27 27 LinearSystemOfEquationsUnitTest \ 28 LineUnittest \ 28 29 LinkedCellUnitTest \ 29 30 ListOfBondsUnitTest \ … … 69 70 infounittest.cpp \ 70 71 linearsystemofequationsunittest.cpp \ 72 LineUnittest.cpp \ 71 73 LinkedCellUnitTest.cpp \ 72 74 listofbondsunittest.cpp \ … … 104 106 infounittest.hpp \ 105 107 linearsystemofequationsunittest.hpp \ 108 LineUnittest.hpp \ 106 109 LinkedCellUnitTest.hpp \ 107 110 listofbondsunittest.hpp \ … … 170 173 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS} 171 174 175 LineUnittest_SOURCES = UnitTestMain.cpp LineUnittest.cpp LineUnittest.hpp 176 LineUnittest_LDADD = ${ALLLIBS} 177 172 178 LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp 173 179 LinkedCellUnitTest_LDADD = ${ALLLIBS} -
src/unittests/ObserverTest.cpp
r1b2d30 r55240c4 33 33 public: 34 34 UpdateCountObserver() : 35 Observer("UpdateCountObserver"), 35 36 updates(0) 36 37 {}; … … 45 46 class SimpleObservable : public Observable { 46 47 public: 48 SimpleObservable() : 49 Observable("SimpleObservable") 50 {} 51 47 52 void changeMethod() { 48 53 OBSERVE; … … 54 59 class CallObservable : public Observable { 55 60 public: 61 CallObservable() : 62 Observable("CallObservable") 63 {} 64 56 65 void changeMethod1() { 57 66 OBSERVE; … … 70 79 class BlockObservable : public Observable { 71 80 public: 81 BlockObservable() : 82 Observable("BlockObservable") 83 {} 84 72 85 void changeMethod1(){ 73 86 OBSERVE; … … 104 117 class SuperObservable : public Observable { 105 118 public: 106 SuperObservable(){ 119 SuperObservable(): 120 Observable("SuperObservable") 121 { 107 122 subObservable = new SimpleObservable(); 108 123 subObservable->signOn(this); … … 123 138 public: 124 139 NotificationObservable() : 125 notification1(new Notification(this)), 126 notification2(new Notification(this)) 140 Observable("NotificationObservable"), 141 notification1(new Notification(this)), 142 notification2(new Notification(this)) 127 143 {} 128 144 … … 149 165 public: 150 166 NotificationObserver(Notification_ptr notification) : 167 Observer("NotificationObserver"), 151 168 requestedNotification(notification), 152 169 wasNotified(false) … … 172 189 173 190 ObservableCollection(int _num) : 174 num(_num) 191 Observable("ObservableCollection"), 192 num(_num) 175 193 { 176 194 for(int i=0; i<num; ++i){ -
src/unittests/PlaneUnittest.cpp
r1b2d30 r55240c4 17 17 18 18 #include "vector.hpp" 19 #include "Line.hpp" 19 20 20 21 CPPUNIT_TEST_SUITE_REGISTRATION( PlaneUnittest ); … … 153 154 CPPUNIT_ASSERT(fabs(p4->distance(e1)-1) < MYEPSILON); 154 155 CPPUNIT_ASSERT_EQUAL(zeroVec,p4->getClosestPoint(e1)); 155 156 157 } 156 } 157 158 void 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 205 void 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 20 20 CPPUNIT_TEST ( pointsTest ); 21 21 CPPUNIT_TEST ( operationsTest ); 22 CPPUNIT_TEST ( mirrorTest ); 23 CPPUNIT_TEST ( LineIntersectionTest ); 22 24 CPPUNIT_TEST_SUITE_END(); 23 25 … … 30 32 void pointsTest(); 31 33 void operationsTest(); 34 void mirrorTest(); 35 void LineIntersectionTest(); 32 36 33 37 private: -
src/unittests/listofbondsunittest.cpp
r1b2d30 r55240c4 249 249 void ListOfBondsTest::DeleteAtomTest() 250 250 { 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() ); 262 271 263 272 // remove atom2 … … 268 277 269 278 // 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 55 55 public: 56 56 countObserver() : 57 Observer("countObserver"), 57 58 count(0) 58 59 {} -
src/unittests/vectorunittest.cpp
r1b2d30 r55240c4 215 215 } 216 216 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 zero230 CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(zero, zero, zero, zero), LinearDependenceException);231 //CPPUNIT_ASSERT_EQUAL( zero, fixture );232 233 // four vectors equal to unit234 CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, unit, unit, unit), LinearDependenceException);235 //CPPUNIT_ASSERT_EQUAL( zero, fixture );236 237 // two equal lines238 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 change261 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 change268 fixture = RotateVector(unit,unit, 1.);269 CPPUNIT_ASSERT_EQUAL( unit, fixture );270 271 // rotations272 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 }284 217 285 218 /** -
src/unittests/vectorunittest.hpp
r1b2d30 r55240c4 27 27 CPPUNIT_TEST ( ProjectionTest ); 28 28 CPPUNIT_TEST ( NormalsTest ); 29 CPPUNIT_TEST ( LineIntersectionTest );30 CPPUNIT_TEST ( VectorRotationTest );31 29 CPPUNIT_TEST ( IsInParallelepipedTest ); 32 30 CPPUNIT_TEST_SUITE_END(); -
src/valence.db
r1b2d30 r55240c4 1 #atomicnumber numberofvalenceorbitals 1 2 1 0.10000000000000E+01 2 3 2 0.20000000000000E+01 -
src/vector.cpp
r1b2d30 r55240c4 5 5 */ 6 6 7 #include "Helpers/MemDebug.hpp" 7 8 8 9 #include "vector.hpp" … … 23 24 Vector::Vector() 24 25 { 25 x[0] = x[1] = x[2] = 0.;26 content = gsl_vector_calloc (NDIM); 26 27 }; 27 28 … … 32 33 Vector::Vector(const Vector& src) 33 34 { 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]); 37 39 } 38 40 … … 41 43 Vector::Vector(const double x1, const double x2, const double x3) 42 44 { 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); 46 49 }; 47 50 … … 52 55 // check for self assignment 53 56 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]); 57 60 } 58 61 return *this; … … 61 64 /** Desctructor of class vector. 62 65 */ 63 Vector::~Vector() {}; 66 Vector::~Vector() { 67 gsl_vector_free(content); 68 }; 64 69 65 70 /** Calculates square of distance between this and another vector. … … 71 76 double res = 0.; 72 77 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]); 74 79 return (res); 75 80 }; … … 199 204 double res = 0.; 200 205 for (int i=NDIM;i--;) 201 res += x[i]*y[i];206 res += at(i)*y[i]; 202 207 return (res); 203 208 }; … … 213 218 { 214 219 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]; 218 222 (*this) = tmp; 219 223 }; … … 232 236 *this -= tmp; 233 237 }; 234 235 /** Calculates the minimum distance vector of this vector to the plane.236 * \param *out output stream for debugging237 * \param *PlaneNormal normal of plane238 * \param *PlaneOffset offset of plane239 * \return distance to plane240 * \return distance vector onto to plane241 */242 Vector Vector::GetDistanceVectorToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const243 {244 Vector temp = (*this) - PlaneOffset;245 temp.MakeNormalTo(PlaneNormal);246 temp.Scale(-1.);247 // then add connecting vector from plane to point248 temp += (*this)-PlaneOffset;249 double sign = temp.ScalarProduct(PlaneNormal);250 if (fabs(sign) > MYEPSILON)251 sign /= fabs(sign);252 else253 sign = 0.;254 255 temp.Normalize();256 temp.Scale(sign);257 return temp;258 };259 260 238 261 239 /** Calculates the minimum distance of this vector to the plane. … … 334 312 bool Vector::IsZero() const 335 313 { 336 return (fabs( x[0])+fabs(x[1])+fabs(x[2]) < MYEPSILON);314 return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < MYEPSILON); 337 315 }; 338 316 … … 363 341 bool status = true; 364 342 for (int i=0;i<NDIM;i++) { 365 if (fabs( x[i]- a[i]) > MYEPSILON)343 if (fabs(at(i) - a[i]) > MYEPSILON) 366 344 status = false; 367 345 } … … 391 369 double& Vector::operator[](size_t i){ 392 370 ASSERT(i<=NDIM && i>=0,"Vector Index out of Range"); 393 return x[i];371 return *gsl_vector_ptr (content, i); 394 372 } 395 373 396 374 const double& Vector::operator[](size_t i) const{ 397 375 ASSERT(i<=NDIM && i>=0,"Vector Index out of Range"); 398 return x[i];376 return *gsl_vector_ptr (content, i); 399 377 } 400 378 … … 407 385 } 408 386 409 double* Vector::get(){410 return x;387 gsl_vector* Vector::get(){ 388 return content; 411 389 } 412 390 … … 523 501 { 524 502 for (int i=NDIM;i--;) 525 x[i]*= factor[i];503 at(i) *= factor[i]; 526 504 }; 527 505 … … 531 509 { 532 510 for (int i=NDIM;i--;) 533 x[i]*= factor;511 at(i) *= factor; 534 512 }; 535 513 … … 543 521 // truncate to [0,1] for each axis 544 522 for (int i=0;i<NDIM;i++) { 545 // x[i]+= 0.5; // set to center of box546 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.; 550 528 } 551 529 MatrixMultiplication(M); 552 530 }; 553 531 532 std::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 538 std::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 554 549 /** Do a matrix multiplication. 555 550 * \param *matrix NDIM_NDIM array … … 557 552 void Vector::MatrixMultiplication(const double * const M) 558 553 { 554 Vector tmp; 559 555 // 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; 563 560 }; 564 561 … … 585 582 B[8] = detAReci*RDET2(A[0],A[1],A[3],A[4]); // A_33 586 583 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); 591 585 592 586 return true; … … 611 605 }; 612 606 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 one621 for (int i=NDIM;i--;)622 at(i) -= 2.*projection*n[i];623 };624 625 607 /** Calculates orthonormal vector to one given vectors. 626 608 * Just subtracts the projection onto the given vector from this vector. … … 633 615 bool result = false; 634 616 double factor = y1.ScalarProduct(*this)/y1.NormSquared(); 635 Vector x1; 636 x1 = factor * y1; 617 Vector x1 = factor * y1; 637 618 SubtractVector(x1); 638 619 for (int i=NDIM;i--;) 639 result = result || (fabs( x[i]) > MYEPSILON);620 result = result || (fabs(at(i)) > MYEPSILON); 640 621 641 622 return result; … … 699 680 { 700 681 for(int i=NDIM;i--;) 701 x[i]+= y[i];682 at(i) += y[i]; 702 683 } 703 684 … … 708 689 { 709 690 for(int i=NDIM;i--;) 710 x[i]-= y[i];691 at(i) -= y[i]; 711 692 } 712 693 -
src/vector.hpp
r1b2d30 r55240c4 16 16 17 17 #include <memory> 18 #include <vector> 18 19 19 20 #include "defs.hpp" … … 22 23 /********************************************** declarations *******************************/ 23 24 25 class Vector; 26 27 typedef std::vector<Vector> pointset; 28 24 29 /** Single vector. 25 30 * basically, just a x[3] but with helpful functions 26 31 */ 27 32 class Vector : public Space{ 28 protected:29 // this struct is used to indicate calls to the Baseconstructor from inside vectors.30 struct Baseconstructor{};31 33 public: 32 34 … … 39 41 40 42 double DistanceSquared(const Vector &y) const; 41 Vector GetDistanceVectorToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const;42 43 double DistanceToSpace(const Space& space) const; 43 44 double PeriodicDistance(const Vector &y, const double * const cell_size) const; … … 56 57 void ProjectIt(const Vector &y); 57 58 Vector Projection(const Vector &y) const; 58 void Mirror(const Vector &x);59 59 void ScaleAll(const double *factor); 60 60 void Scale(const double factor); … … 66 66 bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const; 67 67 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; 68 70 69 71 // Accessors ussually come in pairs... and sometimes even more than that … … 77 79 78 80 // Access to internal structure 79 double* get();81 gsl_vector* get(); 80 82 81 83 // Methods that are derived directly from other methods … … 102 104 103 105 private: 104 double x[NDIM];106 gsl_vector *content; 105 107 106 108 }; -
src/vector_ops.cpp
r1b2d30 r55240c4 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "vector.hpp" … … 15 17 #include "Helpers/fast_functions.hpp" 16 18 #include "Exceptions/LinearDependenceException.hpp" 19 #include "Exceptions/SkewException.hpp" 17 20 18 21 #include <gsl/gsl_linalg.h> … … 110 113 return true; 111 114 }; 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 axis115 * \param alpha rotation angle in radian116 */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 axis122 a = vec;123 a.ProjectOntoPlane(axis);124 // construct normal vector125 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 cosine135 y.Scale(sin(alpha));136 a.Scale(cos(alpha));137 res = vec.Projection(axis);138 // add scaled normal vector onto this vector139 res += y;140 // add part in axis direction141 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.html147 * \param *out output stream for debugging148 * \param *Line1a first vector of first line149 * \param *Line1b second vector of first line150 * \param *Line2a first vector of second line151 * \param *Line2b second vector of second line152 * \return true - \a this will contain the intersection on return, false - lines are parallel153 */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,c185 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 parallelity197 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 s221 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 else231 s = 0.;232 Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;233 234 // construct intersection235 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 10 10 11 11 bool 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);14 12 15 13 #endif /* VECTOR_OPS_HPP_ */ -
src/verbose.cpp
r1b2d30 r55240c4 1 1 using namespace std; 2 3 #include "Helpers/MemDebug.hpp" 2 4 3 5 #include "info.hpp" -
tests/regression/Domain/2/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0# here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0# here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states57 MaxPsiDouble 1 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 1 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Domain/3/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0# here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0# here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states57 MaxPsiDouble 1 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 1 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Domain/4/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0# here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0# here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states57 MaxPsiDouble 1 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 1 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Domain/5/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0 # check every ..th steps37 MaxMinStopStep 10 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0 # check every ..th steps44 InitMaxMinStopStep 10 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0 # here: specifying maximum number of SpinDown-states57 MaxPsiDouble 10 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 10 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 10 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Filling/1/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0 # check every ..th steps37 MaxMinStopStep 1350 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0 # check every ..th steps44 InitMaxMinStopStep 1350 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0 # here: specifying maximum number of SpinDown-states57 MaxPsiDouble 1350 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 1350 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 1350 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Filling/1/pre/test.conf
r1b2d30 r55240c4 71 71 Ion_Type2 3 6 1.0 3 3 12.01100000000 Carbon C 72 72 #Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon) 73 Ion_Type 2_1 9.782085945 3.275186040 3.5358860370 # molecule nr 074 Ion_Type 2_2 8.532785963 4.158586027 3.5358860370 # molecule nr 175 Ion_Type 2_3 7.283585982 3.2751860403.535886037 0 # molecule nr 276 Ion_Type1_ 1 9.782085945 2.6458860502.645886050 0 # molecule nr 377 Ion_Type1_ 2 9.782085945 2.6458860504.425886024 0 # molecule nr 478 Ion_Type1_ 3 10.672039608 3.9045368783.535886037 0 # molecule nr 579 Ion_Type1_ 4 8.532785963 4.7878860182.645886050 0 # molecule nr 680 Ion_Type1_ 5 8.532785963 4.7878860184.425886024 0 # molecule nr 781 Ion_Type 1_6 6.393632318 3.9045368773.535886037 0 # molecule nr 882 Ion_Type 1_7 7.283585982 2.645886050 2.6458860500 # molecule nr 983 Ion_Type 1_8 7.283585982 2.645886050 4.4258860240 # molecule nr 1073 Ion_Type1_1 9.782085945 2.645886050 2.645886050 0 # molecule nr 0 74 Ion_Type1_2 9.782085945 2.645886050 4.425886024 0 # molecule nr 1 75 Ion_Type1_3 10.672039608 3.904536878 3.535886037 0 # molecule nr 2 76 Ion_Type1_4 8.532785963 4.787886018 2.645886050 0 # molecule nr 3 77 Ion_Type1_5 8.532785963 4.787886018 4.425886024 0 # molecule nr 4 78 Ion_Type1_6 6.393632318 3.904536877 3.535886037 0 # molecule nr 5 79 Ion_Type1_7 7.283585982 2.645886050 2.645886050 0 # molecule nr 6 80 Ion_Type1_8 7.283585982 2.645886050 4.425886024 0 # molecule nr 7 81 Ion_Type2_1 9.782085945 3.275186040 3.535886037 0 # molecule nr 8 82 Ion_Type2_2 8.532785963 4.158586027 3.535886037 0 # molecule nr 9 83 Ion_Type2_3 7.283585982 3.275186040 3.535886037 0 # molecule nr 10 -
tests/regression/Molecules/6/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0 # check every ..th steps37 MaxMinStopStep 10 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0 # check every ..th steps44 InitMaxMinStopStep 10 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0 # here: specifying maximum number of SpinDown-states57 MaxPsiDouble 10 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 10 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 10 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Molecules/6/pre/test.conf
r1b2d30 r55240c4 71 71 Ion_Type2 3 6 1.0 3 3 12.01100000000 Carbon C 72 72 #Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon) 73 Ion_Type 2_1 9.782085945 3.275186040 3.5358860370 # molecule nr 074 Ion_Type 2_2 8.532785963 4.158586027 3.5358860370 # molecule nr 175 Ion_Type 2_3 7.283585982 3.2751860403.535886037 0 # molecule nr 276 Ion_Type1_ 1 9.782085945 2.6458860502.645886050 0 # molecule nr 377 Ion_Type1_ 2 9.782085945 2.6458860504.425886024 0 # molecule nr 478 Ion_Type1_ 3 10.672039608 3.9045368783.535886037 0 # molecule nr 579 Ion_Type1_ 4 8.532785963 4.7878860182.645886050 0 # molecule nr 680 Ion_Type1_ 5 8.532785963 4.7878860184.425886024 0 # molecule nr 781 Ion_Type 1_6 6.393632318 3.9045368773.535886037 0 # molecule nr 882 Ion_Type 1_7 7.283585982 2.645886050 2.6458860500 # molecule nr 983 Ion_Type 1_8 7.283585982 2.645886050 4.4258860240 # molecule nr 1073 Ion_Type1_1 9.782085945 2.645886050 2.645886050 0 # molecule nr 0 74 Ion_Type1_2 9.782085945 2.645886050 4.425886024 0 # molecule nr 1 75 Ion_Type1_3 10.672039608 3.904536878 3.535886037 0 # molecule nr 2 76 Ion_Type1_4 8.532785963 4.787886018 2.645886050 0 # molecule nr 3 77 Ion_Type1_5 8.532785963 4.787886018 4.425886024 0 # molecule nr 4 78 Ion_Type1_6 6.393632318 3.904536877 3.535886037 0 # molecule nr 5 79 Ion_Type1_7 7.283585982 2.645886050 2.645886050 0 # molecule nr 6 80 Ion_Type1_8 7.283585982 2.645886050 4.425886024 0 # molecule nr 7 81 Ion_Type2_1 9.782085945 3.275186040 3.535886037 0 # molecule nr 8 82 Ion_Type2_2 8.532785963 4.158586027 3.535886037 0 # molecule nr 9 83 Ion_Type2_3 7.283585982 3.275186040 3.535886037 0 # molecule nr 10 -
tests/regression/Molecules/7/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0 # check every ..th steps37 MaxMinStopStep 10 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0 # check every ..th steps44 InitMaxMinStopStep 10 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 55 55 RiemannTensor 0 # (Use metric) 56 56 PsiType 0 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states59 PsiMaxNoDown 0 # here: specifying maximum number of SpinDown-states57 MaxPsiDouble 10 # here: specifying both maximum number of SpinUp- and -Down-states 58 PsiMaxNoUp 10 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 10 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Molecules/7/pre/test.conf
r1b2d30 r55240c4 71 71 Ion_Type2 3 6 1.0 3 3 12.01100000000 Carbon C 72 72 #Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon) 73 Ion_Type 2_1 9.782085945 3.275186040 3.5358860370 # molecule nr 074 Ion_Type 2_2 8.532785963 4.158586027 3.5358860370 # molecule nr 175 Ion_Type 2_3 7.283585982 3.2751860403.535886037 0 # molecule nr 276 Ion_Type1_ 1 9.782085945 2.6458860502.645886050 0 # molecule nr 377 Ion_Type1_ 2 9.782085945 2.6458860504.425886024 0 # molecule nr 478 Ion_Type1_ 3 10.672039608 3.9045368783.535886037 0 # molecule nr 579 Ion_Type1_ 4 8.532785963 4.7878860182.645886050 0 # molecule nr 680 Ion_Type1_ 5 8.532785963 4.7878860184.425886024 0 # molecule nr 781 Ion_Type 1_6 6.393632318 3.9045368773.535886037 0 # molecule nr 882 Ion_Type 1_7 7.283585982 2.645886050 2.6458860500 # molecule nr 983 Ion_Type 1_8 7.283585982 2.645886050 4.4258860240 # molecule nr 1073 Ion_Type1_1 9.782085945 2.645886050 2.645886050 0 # molecule nr 0 74 Ion_Type1_2 9.782085945 2.645886050 4.425886024 0 # molecule nr 1 75 Ion_Type1_3 10.672039608 3.904536878 3.535886037 0 # molecule nr 2 76 Ion_Type1_4 8.532785963 4.787886018 2.645886050 0 # molecule nr 3 77 Ion_Type1_5 8.532785963 4.787886018 4.425886024 0 # molecule nr 4 78 Ion_Type1_6 6.393632318 3.904536877 3.535886037 0 # molecule nr 5 79 Ion_Type1_7 7.283585982 2.645886050 2.645886050 0 # molecule nr 6 80 Ion_Type1_8 7.283585982 2.645886050 4.425886024 0 # molecule nr 7 81 Ion_Type2_1 9.782085945 3.275186040 3.535886037 0 # molecule nr 8 82 Ion_Type2_2 8.532785963 4.158586027 3.535886037 0 # molecule nr 9 83 Ion_Type2_3 7.283585982 3.275186040 3.535886037 0 # molecule nr 10 -
tests/regression/Simple_configuration/2/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 0 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 0 # check every ..th steps 46 46 … … 54 54 Level0Factor 2 # factor by which node number increases from S to 0 level 55 55 RiemannTensor 0 # (Use metric) 56 PsiType 0# 0 - doubly occupied, 1 - SpinUp,SpinDown56 PsiType 1 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states 58 58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Simple_configuration/3/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 0 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 0 # check every ..th steps 46 46 … … 54 54 Level0Factor 2 # factor by which node number increases from S to 0 level 55 55 RiemannTensor 0 # (Use metric) 56 PsiType 0# 0 - doubly occupied, 1 - SpinUp,SpinDown56 PsiType 1 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states 58 58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Simple_configuration/4/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 54 54 Level0Factor 2 # factor by which node number increases from S to 0 level 55 55 RiemannTensor 0 # (Use metric) 56 PsiType 0# 0 - doubly occupied, 1 - SpinUp,SpinDown56 PsiType 1 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states 58 58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Simple_configuration/5/post/test.conf
r1b2d30 r55240c4 35 35 RelEpsTotalE 1e-07 # relative change in total energy 36 36 RelEpsKineticE 1e-05 # relative change in kinetic energy 37 MaxMinStopStep 0# check every ..th steps37 MaxMinStopStep 1 # check every ..th steps 38 38 MaxMinGapStopStep 1 # check every ..th steps 39 39 … … 42 42 InitRelEpsTotalE 1e-05 # relative change in total energy 43 43 InitRelEpsKineticE 0.0001 # relative change in kinetic energy 44 InitMaxMinStopStep 0# check every ..th steps44 InitMaxMinStopStep 1 # check every ..th steps 45 45 InitMaxMinGapStopStep 1 # check every ..th steps 46 46 … … 54 54 Level0Factor 2 # factor by which node number increases from S to 0 level 55 55 RiemannTensor 0 # (Use metric) 56 PsiType 0# 0 - doubly occupied, 1 - SpinUp,SpinDown56 PsiType 1 # 0 - doubly occupied, 1 - SpinUp,SpinDown 57 57 MaxPsiDouble 0 # here: specifying both maximum number of SpinUp- and -Down-states 58 58 PsiMaxNoUp 0 # here: specifying maximum number of SpinUp-states 59 PsiMaxNoDown 0# here: specifying maximum number of SpinDown-states59 PsiMaxNoDown 1 # here: specifying maximum number of SpinDown-states 60 60 AddPsis 0 # Additional unoccupied Psis for bandgap determination 61 61 -
tests/regression/Tesselation/3/post/NonConvexEnvelope.dat
r1b2d30 r55240c4 2 2 VARIABLES = "X" "Y" "Z" "U" 3 3 ZONE T="test", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 6.9077 1.1106 0.1214 1 4 5 0.3612 -3.628 1.323 1 5 6 0.4884 -3.5983 -0.4521 3 … … 45 46 -6.8554 1.8134 -0.9499 1 46 47 7.1391 2.0447 0.0264 0 47 6.9077 1.1106 0.1214 148 48 49 31 434450 31 34 44 51 33 34 44 52 2 2 31 3453 1 6 22 3454 7 16 34 55 7 9 16 56 2 7 9 57 2 7 34 58 2 3 34 59 3 28 34 60 2 8 33 3461 1 2 3 62 1 3 28 63 1 14 28 64 1 4 27 2865 2 7 28 3366 1 6 14 67 6 13 14 68 1 3 14 2769 1 3 24 2770 2 4 27 3671 2 7 33 3672 33 36 44 73 36 434474 2 4 25 3675 2 4 25 2676 2 5 26 3277 2 5 32 4378 2 5 36 4379 1 3 24 2680 1 3 26 2981 5 13 29 82 5 23 29 83 2 3 29 3584 29 35 38 85 2 6 29 3886 2 6 29 3887 1 5 26 2988 1 5 17 2989 1 5 17 2690 1 7 26 3291 1 7 22 3292 5 6 23 93 5 6 13 94 6 10 23 95 1 0 19 2396 19 23 40 97 2 3 35 4098 3 5 40 4199 1 0 19 21100 4 10 21 101 4 6 10 102 1 4 6 103 3 5 37 38104 3 5 37 41105 1 7 29 30106 29 30 38 107 3 0 38 39108 8 17 30 109 8 16 17 110 1 6 17 22111 8 18 30 112 8 12 18 113 1 2 18 30114 1 2 20 30115 2 0 30 42116 3 0 39 42117 8 11 12 118 8 9 11 119 8 9 16 120 1 1 12 20121 1 1 20 21122 4 11 21 123 2 4 11 124 1 2 4 125 2 9 11 126 19 20 21 127 19 20 40 128 2 0 40 42129 4 0 41 42130 2 2 31 32131 3 1 32 43132 39 41 42 133 3 7 39 41134 3 7 38 3949 1 32 44 50 1 32 35 51 1 34 35 52 23 32 35 53 17 23 35 54 8 17 35 55 8 10 17 56 3 8 10 57 3 8 35 58 3 4 35 59 4 29 35 60 29 34 35 61 2 3 4 62 2 4 29 63 2 15 29 64 15 28 29 65 28 29 34 66 2 7 15 67 7 14 15 68 14 15 28 69 14 25 28 70 25 28 37 71 28 34 37 72 1 34 37 73 1 37 44 74 25 26 37 75 25 26 27 76 26 27 33 77 26 33 44 78 26 37 44 79 14 25 27 80 14 27 30 81 6 14 30 82 6 24 30 83 24 30 36 84 30 36 39 85 27 30 39 86 27 30 39 87 16 27 30 88 16 18 30 89 16 18 27 90 18 27 33 91 18 23 33 92 6 7 24 93 6 7 14 94 7 11 24 95 11 20 24 96 20 24 41 97 24 36 41 98 36 41 42 99 11 20 22 100 5 11 22 101 5 7 11 102 2 5 7 103 36 38 39 104 36 38 42 105 18 30 31 106 30 31 39 107 31 39 40 108 9 18 31 109 9 17 18 110 17 18 23 111 9 19 31 112 9 13 19 113 13 19 31 114 13 21 31 115 21 31 43 116 31 40 43 117 9 12 13 118 9 10 12 119 9 10 17 120 12 13 21 121 12 21 22 122 5 12 22 123 3 5 12 124 2 3 5 125 3 10 12 126 20 21 22 127 20 21 41 128 21 41 43 129 41 42 43 130 23 32 33 131 32 33 44 132 40 42 43 133 38 40 42 134 38 39 40 -
tests/regression/Tesselation/3/post/NonConvexEnvelope.r3d
r1b2d30 r55240c4 3 3 # All atoms as spheres 4 4 2 5 0.939662 -3.01666 0.414493 0.1 1. 1. 1. 6 2 7 -0.152738 -1.94716 0.354093 0.1 1. 1. 1. 8 2 9 0.0659622 -1.03376 -0.880907 0.1 1. 1. 1. 10 2 11 -1.50434 -2.59696 0.0723932 0.1 1. 1. 1. 12 2 13 -0.0717378 -1.05346 1.57779 0.1 1. 1. 1. 14 2 15 1.52186 -0.603155 -0.873807 0.1 1. 1. 1. 16 2 17 -0.346038 -1.95996 -2.03011 0.1 1. 1. 1. 18 2 19 -2.63434 -1.74086 0.647893 0.1 1. 1. 1. 20 2 21 -1.61364 -2.66266 -1.47131 0.1 1. 1. 1. 22 2 23 1.36626 -0.519255 1.65039 0.1 1. 1. 1. 24 2 25 1.74646 0.246745 0.389693 0.1 1. 1. 1. 26 2 27 1.78606 0.287745 -2.09451 0.1 1. 1. 1. 28 2 29 -2.65324 -0.381955 -0.0548068 0.1 1. 1. 1. 30 2 31 -3.97304 -2.44796 0.426993 0.1 1. 1. 1. 32 2 33 3.21726 0.635145 0.478793 0.1 1. 1. 1. 34 2 35 3.13516 0.931145 -1.97401 0.1 1. 1. 1. 36 2 37 -3.80794 0.459345 0.492693 0.1 1. 1. 1. 38 2 39 3.34736 1.81094 1.44919 0.1 1. 1. 1. 40 2 41 3.76986 1.05884 -0.855107 0.1 1. 1. 1. 42 2 43 4.05806 -0.522555 1.01199 0.1 1. 1. 1. 44 2 45 -3.82684 1.81824 -0.210007 0.1 1. 1. 1. 46 2 47 5.16496 1.66244 -0.848507 0.1 1. 1. 1. 48 2 49 5.48576 -0.422855 0.476393 0.1 1. 1. 1. 50 2 51 -4.98154 2.65954 0.337493 0.1 1. 1. 1. 52 2 53 5.91796 1.03174 0.331693 0.1 1. 1. 1. 54 2 55 -5.00044 4.01854 -0.365207 0.1 1. 1. 1. 56 2 57 -6.30524 1.93554 0.0833932 0.1 1. 1. 1. 58 2 59 7.32406 1.08574 0.0829932 0.1 1. 1. 1. 60 2 5 61 0.777562 -3.65286 1.28459 0.1 1. 1. 1. 6 62 2 … … 94 150 2 95 151 7.55546 2.01984 -0.0120068 0.1 1. 1. 1. 96 297 0.939662 -3.01666 0.414493 0.1 1. 1. 1.98 299 -0.152738 -1.94716 0.354093 0.1 1. 1. 1.100 2101 0.0659622 -1.03376 -0.880907 0.1 1. 1. 1.102 2103 -1.50434 -2.59696 0.0723932 0.1 1. 1. 1.104 2105 -0.0717378 -1.05346 1.57779 0.1 1. 1. 1.106 2107 1.52186 -0.603155 -0.873807 0.1 1. 1. 1.108 2109 -0.346038 -1.95996 -2.03011 0.1 1. 1. 1.110 2111 -2.63434 -1.74086 0.647893 0.1 1. 1. 1.112 2113 -1.61364 -2.66266 -1.47131 0.1 1. 1. 1.114 2115 1.36626 -0.519255 1.65039 0.1 1. 1. 1.116 2117 1.74646 0.246745 0.389693 0.1 1. 1. 1.118 2119 1.78606 0.287745 -2.09451 0.1 1. 1. 1.120 2121 -2.65324 -0.381955 -0.0548068 0.1 1. 1. 1.122 2123 -3.97304 -2.44796 0.426993 0.1 1. 1. 1.124 2125 3.21726 0.635145 0.478793 0.1 1. 1. 1.126 2127 3.13516 0.931145 -1.97401 0.1 1. 1. 1.128 2129 -3.80794 0.459345 0.492693 0.1 1. 1. 1.130 2131 3.34736 1.81094 1.44919 0.1 1. 1. 1.132 2133 3.76986 1.05884 -0.855107 0.1 1. 1. 1.134 2135 4.05806 -0.522555 1.01199 0.1 1. 1. 1.136 2137 -3.82684 1.81824 -0.210007 0.1 1. 1. 1.138 2139 5.16496 1.66244 -0.848507 0.1 1. 1. 1.140 2141 5.48576 -0.422855 0.476393 0.1 1. 1. 1.142 2143 -4.98154 2.65954 0.337493 0.1 1. 1. 1.144 2145 5.91796 1.03174 0.331693 0.1 1. 1. 1.146 2147 -5.00044 4.01854 -0.365207 0.1 1. 1. 1.148 2149 -6.30524 1.93554 0.0833932 0.1 1. 1. 1.150 2151 7.32406 1.08574 0.0829932 0.1 1. 1. 1.152 152 # All tesselation triangles 153 153 8 … … 156 156 BACKFACE 0.3 0.3 1.0 0 0 157 157 1 158 5.67566 1.42984 -1.78291 7.55546 2.01984 -0.0120068 7.32406 1.08574 0.08299321. 0. 0.159 1 160 5.67566 1.42984 -1.78291 5.53756 -0.911555 -0.496607 7.32406 1.08574 0.08299321. 0. 0.161 1 162 6.16236 -0.927955 1.16559 5.53756 -0.911555 -0.496607 7.32406 1.08574 0.08299321. 0. 0.158 7.32406 1.08574 0.0829932 5.67566 1.42984 -1.78291 7.55546 2.01984 -0.0120068 1. 0. 0. 159 1 160 7.32406 1.08574 0.0829932 5.67566 1.42984 -1.78291 5.53756 -0.911555 -0.496607 1. 0. 0. 161 1 162 7.32406 1.08574 0.0829932 6.16236 -0.927955 1.16559 5.53756 -0.911555 -0.496607 1. 0. 0. 163 163 1 164 164 3.60736 1.29684 -2.87381 5.67566 1.42984 -1.78291 5.53756 -0.911555 -0.496607 1. 0. 0. … … 202 202 4.07696 -0.484155 2.10119 6.16236 -0.927955 1.16559 5.68906 1.58194 1.24439 1. 0. 0. 203 203 1 204 6.16236 -0.927955 1.16559 5.68906 1.58194 1.24439 7.32406 1.08574 0.08299321. 0. 0.205 1 206 5.68906 1.58194 1.24439 7.55546 2.01984 -0.0120068 7.32406 1.08574 0.08299321. 0. 0.204 7.32406 1.08574 0.0829932 6.16236 -0.927955 1.16559 5.68906 1.58194 1.24439 1. 0. 0. 205 1 206 7.32406 1.08574 0.0829932 5.68906 1.58194 1.24439 7.55546 2.01984 -0.0120068 1. 0. 0. 207 207 1 208 208 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 6 6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) 7 7 AT_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]) 9 9 AT_CLEANUP 10 10 … … 14 14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o 0 --convex-file ConvexEnvelope --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) 15 15 AT_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]) 17 17 AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore]) 18 18 AT_CHECK([diff ConvexEnvelope.dat NonConvexEnvelope.dat], 0, [ignore], [ignore]) … … 24 24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) 25 25 AT_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]) 27 27 AT_CLEANUP 28 28
Note:
See TracChangeset
for help on using the changeset viewer.