Changeset a0064e for src


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

Moved stuff in src/Helpers and src/Patterns out to stand-alone project CodePatterns.

Makefile.am's:

  • CodePatterns added to AM_LDFLAGS and AM_CFLAGS
  • libMoleCuilderHelpers removed

Helpers/...

  • defs.hpp include prefixed with Helpers/
  • helpers.?pp removed lots of old, unused functions: bound, ask_value, ...
  • fast_functions.hpp has lots of functions removed as well.
  • all other files and unit tests moved to project CodePatterns.

Patterns/...

  • added ax_codepatterns.m4 containing AM_PATH_CODEPATTERNS to configure.ac
Location:
src
Files:
41 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109ACTIONSSOURCE = \
  • src/Actions/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    2120        ../../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    2221        ../../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    23         ../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     22        ${CodePatterns_LIBS} \
    2423        $(BOOST_LIB)
    2524ALLLIBS = \
  • src/Descriptors/AtomOfMoleculeSelectionDescriptor.cpp

    rf28a26 ra0064e  
    2626
    2727#include "Helpers/helpers.hpp"
     28
    2829
    2930AtomOfMoleculeSelectionDescriptor_impl::AtomOfMoleculeSelectionDescriptor_impl(){}
  • src/Descriptors/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    1918        ../../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    2019        ../../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    21         ../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     20        ${CodePatterns_LIBS} \
    2221        $(BOOST_LIB)
    2322ALLLIBS = \
  • src/Exceptions/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
    77# Position-Independent Code necessary for shared library
    8 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    9 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     8AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    109
    1110EXCEPTIONSOURCE = \
  • src/Formula.hpp

    rf28a26 ra0064e  
    1818#include "Helpers/helpers.hpp"
    1919
     20#include "Helpers/enumeration.hpp"
     21
    2022class element;
     23
    2124
    2225class Formula
  • src/Helpers/fast_functions.hpp

    rf28a26 ra0064e  
    5151};
    5252
    53 /** Returns the power of \a n with respect to \a base.
    54  * \param base basis
    55  * \param n power
    56  * \return \f$base^n\f$
    57  */
    58 inline int pot(int base, int n)
    59 {
    60   int res = 1;
    61   int j;
    62   for (j=n;j--;)
    63     res *= base;
    64   return res;
    65 };
    66 
    67 /*************************** Templatized functions ************************************/
    68 
    69 /** Flips two values.
    70  * \param x first value
    71  * \param y second value
    72  */
    73 template <typename T>
    74 inline void flip(T &x, T &y)
    75 {
    76   T tmp;
    77   tmp = x;
    78   x = y;
    79   y = tmp;
    80 };
    8153
    8254#endif /* FAST_FUNCTIONS_HPP_ */
  • src/Helpers/helpers.cpp

    • Property mode changed from 100755 to 100644
    rf28a26 ra0064e  
    2828
    2929
    30 /** Asks for a double value and checks input
    31  * \param *text question
    32  */
    33 double ask_value(const char *text)
    34 {
    35   double test = 0.1439851348959832147598734598273456723948652983045928346598365;
    36   do {
    37     DoLog(0) && (Log() << Verbose(0) << text);
    38     cin >> test;
    39   } while (test == 0.1439851348959832147598734598273456723948652983045928346598365);
    40   return test;
    41 };
    42 
    4330/** Output of a debug message to stderr.
    4431 * \param *P Problem at hand, points to ParallelSimulationData#me
     
    5340#endif
    5441
    55 /** modulo operator for doubles.
    56  * \param *b pointer to double
    57  * \param lower_bound lower bound
    58  * \param upper_bound upper bound
    59  */
    60 void bound(double *b, double lower_bound, double upper_bound)
    61 {
    62   double step = (upper_bound - lower_bound);
    63   while (*b >= upper_bound)
    64     *b -= step;
    65   while (*b < lower_bound)
    66     *b += step;
    67 };
    68 
    69 /** Counts lines in file.
    70  * Note we are scanning lines from current position, not from beginning.
    71  * \param InputFile file to be scanned.
    72  */
    73 int CountLinesinFile(ifstream &InputFile)
    74 {
    75   char *buffer = new char[MAXSTRINGSIZE];
    76   int lines=0;
    77 
    78   int PositionMarker = InputFile.tellg();  // not needed as Inputfile is copied, given by value, not by ref
    79   // count the number of lines, i.e. the number of fragments
    80   InputFile.getline(buffer, MAXSTRINGSIZE); // skip comment lines
    81   InputFile.getline(buffer, MAXSTRINGSIZE);
    82   while(!InputFile.eof()) {
    83     InputFile.getline(buffer, MAXSTRINGSIZE);
    84     lines++;
    85   }
    86   InputFile.seekg(PositionMarker, ios::beg);
    87   delete[](buffer);
    88   return lines;
    89 };
    9042
    9143/** Returns a string with \a i prefixed with 0s to match order of total number of molecules in digits.
     
    11769};
    11870
    119 /** Tests whether a given string contains a valid number or not.
    120  * \param *string
    121  * \return true - is a number, false - is not a valid number
    122  */
    123 bool IsValidNumber( const char *string)
    124 {
    125   int ptr = 0;
    126   if ((string[ptr] == '.') || (string[ptr] == '-')) // number may be negative or start with dot
    127     ptr++;
    128   if ((string[ptr] >= '0') && (string[ptr] <= '9'))
    129     return true;
    130   return false;
    131 };
    132 
    133 /** Comparison function for GSL heapsort on distances in two molecules.
    134  * \param *a
    135  * \param *b
    136  * \return <0, \a *a less than \a *b, ==0 if equal, >0 \a *a greater than \a *b
    137  */
    138 int CompareDoubles (const void * a, const void * b)
    139 {
    140   if (*(double *)a > *(double *)b)
    141     return -1;
    142   else if (*(double *)a < *(double *)b)
    143     return 1;
    144   else
    145     return 0;
    146 };
    147 
    148 
    14971/**
    15072 * Calls exit(255).
  • src/Helpers/helpers.hpp

    rf28a26 ra0064e  
    5050} sign_t;
    5151
    52 double ask_value(const char *text);
    53 bool check_bounds(double *x, double *cell_size);
    54 void bound(double *b, double lower_bound, double upper_bound);
    55 int CountLinesinFile(ifstream &InputFile);
    5652char *FixedDigitNumber(const int FragmentNumber, const int digits);
    57 bool IsValidNumber( const char *string);
    58 int CompareDoubles (const void * a, const void * b);
    5953void performCriticalExit();
    6054sign_t sign(double value);
     
    6256/********************************************** helpful template functions *********************************/
    6357
    64 
    65 /** returns greater of the two values.
    66  * \param x first value
    67  * \param y second value
    68  * \return greater of the two (by operator>())
    69  */
    70 template <typename T> T Max(T x, T y)
    71 {
    72   if (x > y)
    73     return x;
    74   else return y;
    75 };
    76 
    77 /** returns smaller of the two values.
    78  * \param x first value
    79  * \param y second value
    80  * \return smaller of the two (by operator<())
    81  */
    82 template <typename T> T Min(T x, T y)
    83 {
    84   if (x < y)
    85     return x;
    86   else return y;
    87 };
    8858
    8959/** Creates a lookup table for true father's Atom::Nr -> atom ptr.
     
    144114
    145115
    146 /** Frees a two-dimensional array.
    147  * \param *ptr pointer to array
    148  * \param dim first dim of array
    149  */
    150 template <typename X> void Free2DArray(X **ptr, int dim)
    151 {
    152   int i;
    153   if (ptr != NULL) {
    154     for(i=dim;i--;)
    155       if (ptr[i] != NULL)
    156         free(ptr[i]);
    157     free(ptr);
    158   }
    159 };
    160 
    161 template <typename T> void Increment(T *value, T *inc)
    162 {
    163   *value += *inc;
    164 };
    165 
    166 template <typename T> void AbsoluteValue(T *value, T *abs)
    167 {
    168   *value = *abs;
    169 };
    170 
    171 template <typename T> void IncrementalAbsoluteValue(T *value, T *abs)
    172 {
    173   *value = *abs;
    174   (*abs) += 1;
    175 };
    176 
    177116#define PLURAL_S(v) (((v)==1)?"":"s")
    178117
     
    201140};
    202141
    203 /************ struct to contain simple enumerations ***************/
    204 template <class C>
    205 struct enumeration{
    206   enumeration() : max(0) {}
    207   enumeration(unsigned int i) : max(i) {}
    208   enumeration(const enumeration &src) :
    209     there(src.there),
    210     back(src.back),
    211     max(src.max)
    212   {}
    213   enumeration &operator=(const enumeration &src){
    214     /* no self-assignment check needed */
    215     there = src.there;
    216     back = src.back;
    217     max = src.max;
    218     return *this;
    219   }
    220   void add(const C &value){
    221     if(!there.count(value)){
    222       there[value]=max;
    223       back[max++]=value;
    224     }
    225   }
    226   unsigned int getMax() const{
    227     return max;
    228   }
    229 
    230   map<C,unsigned int> there;
    231   map<unsigned int,C> back;
    232 private:
    233   unsigned int max;
    234 };
    235 
    236 /***** A counter to generate sequential numbers *******************/
    237 struct counter{
    238   inline counter() : count(0){};
    239   inline counter(int i) : count(i){};
    240   inline unsigned int operator()(){
    241     return count++;
    242   }
    243 private:
    244   unsigned int count;
    245 };
    246 
    247 template <class C,class ForwardIterator>
    248 enumeration<C> enumerate(ForwardIterator first,ForwardIterator last){
    249   enumeration<C> res;
    250   for_each(first,last,bind1st(mem_fun(&enumeration<C>::add),&res));
    251   return res;
    252 }
    253 
    254142#endif /*HELPERS_HPP_*/
  • src/LinearAlgebra/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    76# Position-Independent Code necessary for shared library
    8 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    9 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     7AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     8AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    109
    1110LINALGSOURCE = \
    12   ${HELPERSOURCE} \
     11  ../Helpers/defs.cpp \
     12  ../Helpers/helpers.cpp \
    1313  BoxVector.cpp \
    1414  Eigenspace.cpp \
     
    3030                           
    3131LINALGHEADER = \
     32  ../Helpers/defs.hpp \
     33  ../Helpers/helpers.hpp \
    3234  BoxVector.hpp \
    3335  Eigenspace.hpp \
  • src/LinearAlgebra/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    2625        ../../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    2726        ../../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    28         ../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     27        ${CodePatterns_LIBS} \
    2928        $(BOOST_LIB)
    3029
  • src/Makefile.am

    rf28a26 ra0064e  
    22# Also indentation by a single tab
    33
    4 SUBDIRS = Actions Exceptions Helpers LinearAlgebra Parser UIElements
    5 
    6 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     4SUBDIRS = Actions Exceptions LinearAlgebra Parser UIElements
     5
     6AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
    77
    88ATOMSOURCE = \
     
    6767
    6868
    69 PATTERNSOURCE = \
    70   Patterns/Observer.cpp
    71 PATTERNHEADER = \
    72   Patterns/Cacheable.hpp \
    73   Patterns/Observer.hpp \
    74   Patterns/Singleton.hpp
    75  
    7669SHAPESOURCE = \
    7770  Shapes/BaseShapes.cpp \
     
    182175  ${THERMOSTATSOURCE} \
    183176  ${TESSELATIONSOURCE} \
     177  Helpers/defs.cpp \
     178  Helpers/helpers.cpp \
    184179  bond.cpp \
    185180  bondgraph.cpp \
     
    218213  ${THERMOSTATHEADER} \
    219214  ${TESSELATIONHEADER} \
     215  Helpers/defs.hpp \
     216  Helpers/fast_functions.hpp \
     217  Helpers/helpers.hpp \
    220218  bond.hpp \
    221219  bondgraph.hpp \
     
    243241libMolecuilder_LIBS = \
    244242        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
     243        ${CodePatterns_LIBS} \
    245244        ${BOOST_PROGRAM_OPTIONS_LIB}
    246245
     
    306305
    307306SubspaceFactorizer_CXXFLAGS = $(BOOST_CPPFLAGS)
    308 SubspaceFactorizer_SOURCES = SubspaceFactorizer.cpp
     307SubspaceFactorizer_SOURCES = SubspaceFactorizer.cpp Helpers/defs.cpp Helpers/defs.hpp Helpers/helpers.cpp Helpers/helpers.hpp
    309308SubspaceFactorizer_LDADD = \
    310309        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    311310        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    312         Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     311        ${CodePatterns_LIBS} \
    313312        $(GSLLIB) \
    314313        $(BOOST_LIB)
     
    325324        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    326325        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    327         Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     326        ${CodePatterns_LIBS} \
    328327        $(BOOST_LIB)
    329328
     
    344343        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    345344        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    346         Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     345        ${CodePatterns_LIBS} \
    347346        $(BOOST_LIB) \
    348347        ${GUI_LIBS}
     
    356355        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    357356        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    358         Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     357        ${CodePatterns_LIBS} \
    359358        $(BOOST_LIB)
    360359
     
    367366        LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    368367        Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    369         Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     368        ${CodePatterns_LIBS} \
    370369        $(BOOST_LIB)
    371370
  • src/Parser/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109PARSERSOURCE = \
  • src/Parser/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    2019        ../../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    2120        ../../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    22         ../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     21        ${CodePatterns_LIBS} \
    2322        $(BOOST_LIB)
    2423
  • src/Shapes/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    1918        ../../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    2019        ../../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    21         ../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
     20        ${CodePatterns_LIBS} \
    2221        $(BOOST_LIB)
    2322
  • src/SubspaceFactorizer.cpp

    rf28a26 ra0064e  
    2323
    2424#include "Helpers/Assert.hpp"
     25#include "Helpers/defs.hpp"
    2526#include "Helpers/Log.hpp"
    2627#include "Helpers/toString.hpp"
  • src/UIElements/Makefile.am

    rf28a26 ra0064e  
    33INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/UIElements
    44
    5 AM_LDFLAGS = -ldl
    6 AM_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS}
    7 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     5AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     6AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS} ${QT_CXXFLAGS}
    87 
    98VIEWSOURCE = \
  • src/UIElements/Menu/unittests/Makefile.am

    rf28a26 ra0064e  
    44INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/UIElements
    55
    6 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    7 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    8 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     6AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     7AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    98
    109TESTS = \
     
    1716BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_THREAD_LIB)
    1817MENULIBS = \
    19         ../../../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
    2018        $(BOOST_LIB)
    2119
  • src/atom.hpp

    rf28a26 ra0064e  
    3030#include "TesselPoint.hpp"
    3131#include "types.hpp"
     32
     33#include "Helpers/enumeration.hpp"
    3234
    3335/****************************************** forward declarations *****************************/
  • src/molecule.cpp

    rf28a26 ra0064e  
    4848#include "Exceptions/LinearDependenceException.hpp"
    4949
     50#include "Helpers/enumeration.hpp"
    5051
    5152/************************************* Functions for class molecule *********************************/
  • src/molecule_dynamics.cpp

    rf28a26 ra0064e  
    3232#include "ThermoStatContainer.hpp"
    3333#include "Thermostats/Berendsen.hpp"
     34
     35#include "Helpers/enumeration.hpp"
    3436
    3537#include <gsl/gsl_matrix.h>
  • src/molecule_fragmentation.cpp

    rf28a26 ra0064e  
    308308};
    309309
     310/** Counts lines in file.
     311 * Note we are scanning lines from current position, not from beginning.
     312 * \param InputFile file to be scanned.
     313 */
     314int CountLinesinFile(ifstream &InputFile)
     315{
     316  char *buffer = new char[MAXSTRINGSIZE];
     317  int lines=0;
     318
     319  int PositionMarker = InputFile.tellg();  // not needed as Inputfile is copied, given by value, not by ref
     320  // count the number of lines, i.e. the number of fragments
     321  InputFile.getline(buffer, MAXSTRINGSIZE); // skip comment lines
     322  InputFile.getline(buffer, MAXSTRINGSIZE);
     323  while(!InputFile.eof()) {
     324    InputFile.getline(buffer, MAXSTRINGSIZE);
     325    lines++;
     326  }
     327  InputFile.seekg(PositionMarker, ios::beg);
     328  delete[](buffer);
     329  return lines;
     330};
     331
     332
    310333/** Scans the adaptive order file and insert (index, value) into map.
    311334 * \param &path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
     
    526549    SortIndex[(*iter)->nr] = AtomNo++;
    527550  }
    528   //SetIndexedArrayForEachAtomTo( SortIndex, &atom::nr, &IncrementalAbsoluteValue, AtomNo );
    529551
    530552  return true;
  • src/molecule_graph.cpp

    rf28a26 ra0064e  
    9999    DoLog(2) && (Log() << Verbose(2) << "Looking for atoms " << atom1 << " and " << atom2 << "." << endl);
    100100    if (atom2 < atom1) //Sort indices of atoms in order
    101       flip(atom1, atom2);
     101      std::swap(atom1, atom2);
    102102    Walker = FindAtom(atom1);
    103103    ASSERT(Walker,"Could not find an atom with the ID given in dbond file");
  • src/moleculelist.cpp

    rf28a26 ra0064e  
    4343#include "Box.hpp"
    4444
     45#include "Helpers/fast_functions.hpp"
     46
    4547#include "Helpers/Assert.hpp"
    4648
     
    8587  ListOfMolecules.remove(mol);
    8688};
     89
     90/** Comparison function for two values.
     91 * \param *a
     92 * \param *b
     93 * \return <0, \a *a less than \a *b, ==0 if equal, >0 \a *a greater than \a *b
     94 */
     95int CompareDoubles (const void * a, const void * b)
     96{
     97  if (*(double *)a > *(double *)b)
     98    return -1;
     99  else if (*(double *)a < *(double *)b)
     100    return 1;
     101  else
     102    return 0;
     103};
     104
    87105
    88106/** Compare whether two molecules are equal.
  • src/tesselation.cpp

    rf28a26 ra0064e  
    4444#include "Exceptions/LinearDependenceException.hpp"
    4545#include "Helpers/Assert.hpp"
     46
     47#include "Helpers/fast_functions.hpp"
    4648
    4749class molecule;
     
    24162418
    24172419      if ((lengthEndA > lengthBase) || (lengthEndB > lengthBase) || ((lengthEndA < MYEPSILON) || (lengthEndB < MYEPSILON))) { // intersection would be outside, take closer endpoint
    2418         const double lengthEnd = Min(lengthEndA, lengthEndB);
     2420        const double lengthEnd = std::min(lengthEndA, lengthEndB);
    24192421        if (lengthEnd - MinDistance < -MYEPSILON) { // new best line
    24202422          ClosestLines.clear();
  • src/unittests/Makefile.am

    rf28a26 ra0064e  
    55        ../Actions/unittests \
    66        ../Descriptors/unittests \
    7         ../Helpers/unittests \
    87        ../LinearAlgebra/unittests \
    98        ../Parser/unittests \
    10         ../Patterns/unittests \
    119        ../UIElements/Menu/unittests
    1210
    1311INCLUDES = -I$(top_srcdir)/src
    1412
    15 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    16 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    17 AM_CPPFLAGS = ${BOOST_CPPFLAGS}
     13AM_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     14AM_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
    1815
    1916TESTS = \
     
    4239        ../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
    4340        ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
    44         ../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
    4541        $(BOOST_LIB)
    4642ALLLIBS = \
     
    6561  BondGraphUnitTest.cpp \
    6662  BoxUnitTest.cpp \
    67   ../Patterns/unittests/CacheableUnitTest.cpp \
    6863  CountBondsUnitTest.cpp \
    6964  FormulaUnitTest.cpp \
    70   ../Helpers/unittests/InfoUnitTest.cpp \
    7165  ../LinearAlgebra/unittests/LinearSystemOfEquationsUnitTest.cpp \
    7266  ../LinearAlgebra/unittests/LineUnitTest.cpp \
    7367  LinkedCellUnitTest.cpp \
    7468  ListOfBondsUnitTest.cpp \
    75   ../Helpers/unittests/LogUnitTest.cpp \
    7669  ../Actions/unittests/ManipulateAtomsUnitTest.cpp \
    7770  ../LinearAlgebra/unittests/MatrixContentSymmetricUnitTest.cpp \
     
    8073  ../UIElements/Menu/unittests/MenuDescriptionUnitTest.cpp \
    8174  ../Descriptors/unittests/MoleculeDescriptorUnitTest.cpp \
    82   ../Patterns/unittests/ObserverUnitTest.cpp \
    8375  ../Parser/unittests/ParserCommonUnitTest.cpp \
    8476  ../Parser/unittests/ParserTremoloUnitTest.cpp \
    8577  PeriodentafelUnitTest.cpp \
    8678  ../LinearAlgebra/unittests/PlaneUnitTest.cpp \
    87   ../Patterns/unittests/RegistryUnitTest.cpp \
    8879  ../Shapes/unittests/ShapeUnitTest.cpp \
    89   ../Patterns/unittests/SingletonUnitTest.cpp \
    9080  TesselationUnitTest.cpp \
    9181  Tesselation_BoundaryTriangleUnitTest.cpp \
     
    10595  BondGraphUnitTest.hpp \
    10696  BoxUnitTest.hpp \
    107   ../Patterns/unittests/CacheableUnitTest.hpp \
    10897  CountBondsUnitTest.hpp \
    10998  FormulaUnitTest.hpp \
    110   ../Helpers/unittests/InfoUnitTest.hpp \
    11199  ../LinearAlgebra/unittests/LinearSystemOfEquationsUnitTest.hpp \
    112100  ../LinearAlgebra/unittests/LineUnitTest.hpp \
    113101  LinkedCellUnitTest.hpp \
    114102  ListOfBondsUnitTest.hpp \
    115   ../Helpers/unittests/LogUnitTest.hpp \
    116103  ../Actions/unittests/ManipulateAtomsUnitTest.hpp \
    117104  ../LinearAlgebra/unittests/MatrixContentSymmetricUnitTest.hpp \
     
    120107  ../UIElements/Menu/unittests/MenuDescriptionUnitTest.hpp \
    121108  ../Descriptors/unittests/MoleculeDescriptorUnitTest.hpp \
    122   ../Patterns/unittests/ObserverUnitTest.hpp \
    123109  ../Parser/unittests/ParserCommonUnitTest.hpp \
    124110  ../Parser/unittests/ParserTremoloUnitTest.hpp \
    125111  PeriodentafelUnitTest.hpp \
    126112  ../LinearAlgebra/unittests/PlaneUnitTest.hpp \
    127   ../Patterns/unittests/RegistryUnitTest.hpp \
    128113  ../Shapes/unittests/ShapeUnitTest.hpp \
    129   ../Patterns/unittests/SingletonUnitTest.hpp \
    130114  TesselationUnitTest.hpp \
    131115  Tesselation_BoundaryTriangleUnitTest.hpp \
  • src/unittests/SubspaceFactorizerUnitTest.cpp

    rf28a26 ra0064e  
    3030
    3131#include "Helpers/Assert.hpp"
     32#include "Helpers/defs.hpp"
    3233#include "Helpers/Log.hpp"
    3334#include "Helpers/toString.hpp"
Note: See TracChangeset for help on using the changeset viewer.