Changeset 13a574


Ignore:
Timestamp:
Oct 5, 2009, 6:45:06 PM (16 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:
33f9f7
Parents:
aba92d (diff), fa861b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ConvexHull' into ActOnAll

Conflicts:

molecuilder/src/Makefile.am

Boost implementation commit was overlapping with ActOnAllTest

Files:
9 added
23 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    raba92d r13a574  
    2424# Checks for libraries.
    2525AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
     26
     27# Boost libraries
     28AX_BOOST_BASE([1.33.1])
     29AX_BOOST_PROGRAM_OPTIONS
     30#AX_BOOST_FOREACH
     31#AX_BOOST_FILESYSTEM
     32#AX_BOOST_THREAD
     33#AX_BOOST_PROGRAM_OPTIONS
     34#AX_BOOST_SERIALIZATION
    2635
    2736# Checks for header files.
  • src/Makefile.am

    • Property mode changed from 100755 to 100644
    raba92d r13a574  
    11SOURCE = atom.cpp bond.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp moleculelist.cpp molecules.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
    2 HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
     2HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
    33
    4 noinst_PROGRAMS =  ActOnAllTest VectorUnitTest TesselationUnitTest
     4noinst_PROGRAMS =  ActOnAllTest VectorUnitTest MemoryAllocatorUnitTest MemoryUsageObserverUnitTest TesselationUnitTest
     5
     6BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
    57
    68bin_PROGRAMS = molecuilder joiner analyzer
    79molecuilderdir = ${bindir}
    810molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
     11molecuilder_LDFLAGS = $(BOOST_LIB)
    912molecuilder_SOURCES =  ${SOURCE} builder.cpp  ${HEADER}
    10 joiner_SOURCES = joiner.cpp datacreator.cpp element.cpp helpers.cpp periodentafel.cpp parser.cpp verbose.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    11 analyzer_SOURCES = analyzer.cpp datacreator.cpp element.cpp helpers.cpp periodentafel.cpp parser.cpp verbose.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp
     13joiner_SOURCES = joiner.cpp datacreator.cpp element.cpp helpers.cpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp periodentafel.cpp parser.cpp verbose.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
     14analyzer_SOURCES = analyzer.cpp datacreator.cpp element.cpp helpers.cpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp periodentafel.cpp parser.cpp verbose.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp
    1215
    13 TESTS = VectorUnitTest TesselationUnitTest
     16TESTS = VectorUnitTest MemoryAllocatorUnitTest MemoryUsageObserverUnitTest TesselationUnitTest
    1417check_PROGRAMS = $(TESTS)
    15 VectorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp vectorunittest.cpp vectorunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
     18VectorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp vectorunittest.cpp vectorunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
    1619VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
    1720VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
    18 TesselationUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp linkedcell.cpp linkedcell.hpp tesselation.cpp tesselation.hpp tesselationhelpers.cpp tesselationhelpers.hpp tesselationunittest.cpp tesselationunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
     21TesselationUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp linkedcell.cpp linkedcell.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp tesselation.cpp tesselation.hpp tesselationhelpers.cpp tesselationhelpers.hpp tesselationunittest.cpp tesselationunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp
    1922TesselationUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
    2023TesselationUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
     
    2427
    2528
     29MemoryAllocatorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp verbose.cpp verbose.hpp
     30MemoryAllocatorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
     31MemoryAllocatorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
     32
     33MemoryUsageObserverUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp memoryusageobserver.hpp memoryusageobserver.cpp verbose.cpp verbose.hpp
     34MemoryUsageObserverUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
     35MemoryUsageObserverUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
     36
    2637EXTRA_DIST = ${molecuilder_DATA}
  • src/analyzer.cpp

    raba92d r13a574  
    1010#include "datacreator.hpp"
    1111#include "helpers.hpp"
     12#include "memoryallocator.hpp"
    1213#include "parser.hpp"
    1314#include "periodentafel.hpp"
     
    7273    return 1;
    7374  } else {
    74     dir = (char *) Malloc(sizeof(char)*(strlen(argv[2])+2), "main: *dir");
     75    dir = Malloc<char>(strlen(argv[2]) + 2, "main: *dir");
    7576    strcpy(dir, "/");
    7677    strcat(dir, argv[2]);
     
    555556  // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
    556557  delete(periode);
    557   Free((void **)&dir, "main: *dir");
     558  Free(&dir);
    558559  cout << "done." << endl;
    559560  return 0;
  • src/atom.cpp

    raba92d r13a574  
    66
    77#include "atom.hpp"
     8#include "memoryallocator.hpp"
    89
    910/************************************* Functions for class atom *************************************/
     
    3839  previous = NULL;
    3940  next = NULL;
    40   father = this;  // generally, father is itself
     41  father = pointer;  // generally, father is itself
    4142  Ancestor = NULL;
    4243  GraphNr = -1;
     
    5354  nr = -1;
    5455  sort = &nr;
     56  node = &x;
    5557}
    5658
     
    6062atom::~atom()
    6163{
    62   Free((void **)&ComponentNr, "atom::~atom: *ComponentNr");
    63   Free((void **)&Name, "atom::~atom: *Name");
     64  Free<int>(&ComponentNr, "atom::~atom: *ComponentNr");
     65  Free<char>(&Name, "atom::~atom: *Name");
    6466};
    6567
  • src/boundary.cpp

    raba92d r13a574  
    66
    77#include "boundary.hpp"
     8#include "memoryallocator.hpp"
    89
    910#include<gsl/gsl_poly.h>
  • src/builder.cpp

    • Property mode changed from 100755 to 100644
    raba92d r13a574  
    5353#include "ellipsoid.hpp"
    5454#include "helpers.hpp"
     55#include "memoryusageobserverunittest.hpp"
    5556#include "molecules.hpp"
    5657/********************************************* Subsubmenu routine ************************************/
     
    15581559                  delete(Subgraphs);
    15591560                  for (int i=0;i<FragmentCounter;i++)
    1560                     Free((void **)&ListOfLocalAtoms[FragmentCounter], "ParseCommandLineOptions: **ListOfLocalAtoms[]");
    1561                   Free((void **)&ListOfLocalAtoms, "ParseCommandLineOptions: ***ListOfLocalAtoms");
     1561                    Free(&ListOfLocalAtoms[FragmentCounter]);
     1562                  Free(&ListOfLocalAtoms);
    15621563                }
    15631564                delete(BackEdgeStack);
     
    20412042      delete(molecules); // also free's all molecules contained
    20422043      delete(periode);
    2043       return j;
     2044      cout << Verbose(0) <<  "Maximum of allocated memory: "
     2045        << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2046      cout << Verbose(0) <<  "Remaining non-freed memory: "
     2047        << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
     2048     return j;
    20442049      break;
    20452050    case 1:  // just for -v and -h options
    20462051      delete(molecules); // also free's all molecules contained
    20472052      delete(periode);
     2053      cout << Verbose(0) <<  "Maximum of allocated memory: "
     2054        << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2055      cout << Verbose(0) <<  "Remaining non-freed memory: "
     2056        << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
    20482057      return 0;
     2058      break;
     2059    case 2:  // just for -f option
     2060      delete(molecules); // also free's all molecules contained
     2061      delete(periode);
     2062      cout << Verbose(0) <<  "Maximum of allocated memory: "
     2063        << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2064      cout << Verbose(0) <<  "Remaining non-freed memory: "
     2065        << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
     2066      return 2;
    20492067      break;
    20502068    default:
     
    21442162  delete(molecules); // also free's all molecules contained
    21452163  delete(periode);
     2164
     2165  cout << Verbose(0) <<  "Maximum of allocated memory: "
     2166    << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2167  cout << Verbose(0) <<  "Remaining non-freed memory: "
     2168    << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
     2169
    21462170  return (0);
    21472171}
  • src/config.cpp

    raba92d r13a574  
    66
    77#include "config.hpp"
     8#include "memoryallocator.hpp"
    89
    910/******************************** Functions for class ConfigFileBuffer **********************/
     
    8687    return;
    8788  } else
    88     buffer = (char **) Malloc(sizeof(char *)*NoLines, "ConfigFileBuffer::ConfigFileBuffer: **buffer");
     89    buffer = Malloc<char*>(NoLines, "ConfigFileBuffer::ConfigFileBuffer: **buffer");
    8990
    9091  // scan each line and put into buffer
     
    9293  int i;
    9394  do {
    94     buffer[lines] = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "ConfigFileBuffer::ConfigFileBuffer: *buffer[]");
     95    buffer[lines] = Malloc<char>(MAXSTRINGSIZE, "ConfigFileBuffer::ConfigFileBuffer: *buffer[]");
    9596    file->getline(buffer[lines], MAXSTRINGSIZE-1);
    9697    i = strlen(buffer[lines]);
     
    112113{
    113114  for(int i=0;i<NoLines;++i)
    114     Free((void **)&buffer[i], "ConfigFileBuffer::~ConfigFileBuffer: *buffer[]");
    115   Free((void **)&buffer, "ConfigFileBuffer::~ConfigFileBuffer: **buffer");
    116   Free((void **)&LineMapping, "ConfigFileBuffer::~ConfigFileBuffer: *LineMapping");
     115    Free(&buffer[i]);
     116  Free(&buffer);
     117  Free(&LineMapping);
    117118}
    118119
     
    122123void ConfigFileBuffer::InitMapping()
    123124{
    124   LineMapping = (int *) Malloc(sizeof(int)*NoLines, "ConfigFileBuffer::InitMapping: *LineMapping");
     125  LineMapping = Malloc<int>(NoLines, "ConfigFileBuffer::InitMapping: *LineMapping");
    125126  for (int i=0;i<NoLines;i++)
    126127    LineMapping[i] = i;
     
    163164config::config()
    164165{
    165   mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    166   defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: defaultpath");
    167   pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: pseudopotpath");
    168   databasepath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: databasepath");
    169   configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configpath");
    170   configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configname");
    171   ThermostatImplemented = (int *) Malloc((MaxThermostats)*(sizeof(int)), "config constructor: *ThermostatImplemented");
    172   ThermostatNames = (char **) Malloc((MaxThermostats)*(sizeof(char *)), "config constructor: *ThermostatNames");
     166  mainname = Malloc<char>(MAXSTRINGSIZE,"config constructor: mainname");
     167  defaultpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: defaultpath");
     168  pseudopotpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: pseudopotpath");
     169  databasepath = Malloc<char>(MAXSTRINGSIZE,"config constructor: databasepath");
     170  configpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: configpath");
     171  configname = Malloc<char>(MAXSTRINGSIZE,"config constructor: configname");
     172  ThermostatImplemented = Malloc<int>(MaxThermostats, "config constructor: *ThermostatImplemented");
     173  ThermostatNames = Malloc<char*>(MaxThermostats, "config constructor: *ThermostatNames");
    173174  for (int j=0;j<MaxThermostats;j++)
    174     ThermostatNames[j] = (char *) MallocString(12*(sizeof(char)), "config constructor: ThermostatNames[]");
     175    ThermostatNames[j] = Malloc<char>(12, "config constructor: ThermostatNames[]");
    175176  Thermostat = 4;
    176177  alpha = 0.;
     
    263264config::~config()
    264265{
    265   Free((void **)&mainname, "config::~config: *mainname");
    266   Free((void **)&defaultpath, "config::~config: *defaultpath");
    267   Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
    268   Free((void **)&databasepath, "config::~config: *databasepath");
    269   Free((void **)&configpath, "config::~config: *configpath");
    270   Free((void **)&configname, "config::~config: *configname");
    271   Free((void **)&ThermostatImplemented, "config::~config: *ThermostatImplemented");
     266  Free(&mainname);
     267  Free(&defaultpath);
     268  Free(&pseudopotpath);
     269  Free(&databasepath);
     270  Free(&configpath);
     271  Free(&configname);
     272  Free(&ThermostatImplemented);
    272273  for (int j=0;j<MaxThermostats;j++)
    273     Free((void **)&ThermostatNames[j], "config::~config: *ThermostatNames[]");
    274   Free((void **)&ThermostatNames, "config::~config: **ThermostatNames");
     274    Free(&ThermostatNames[j]);
     275  Free(&ThermostatNames);
    275276};
    276277
     
    280281void config::InitThermostats(class ConfigFileBuffer *fb)
    281282{
    282   char *thermo = MallocString(12, "IonsInitRead: thermo");
     283  char *thermo = Malloc<char>(12, "IonsInitRead: thermo");
    283284  int verbose = 0;
    284285
     
    347348    Thermostat = None;
    348349  }
    349   Free((void **)&thermo, "InitThermostats: thermo");
     350  Free(&thermo);
    350351};
    351352
     
    15361537  long file_position = file->tellg(); // mark current position
    15371538  char *dummy1, *dummy, *free_dummy;    // pointers in the line that is read in per step
    1538   dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char), "config::ParseForParameter: *free_dummy");
     1539  dummy1 = free_dummy = Malloc<char>(256, "config::ParseForParameter: *free_dummy");
    15391540
    15401541  //fprintf(stderr,"Parsing for %s\n",name);
     
    15511552      if (file->eof()) {
    15521553        if ((critical) && (found == 0)) {
    1553           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1554          Free(&free_dummy);
    15541555          //Error(InitReading, name);
    15551556          fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    15591560          file->clear();
    15601561          file->seekg(file_position, ios::beg);  // rewind to start position
    1561           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1562          Free(&free_dummy);
    15621563          return 0;
    15631564        }
     
    16111612              if (file->eof()) {
    16121613                if ((critical) && (found == 0)) {
    1613                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1614                  Free(&free_dummy);
    16141615                  //Error(InitReading, name);
    16151616                  fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    16191620                  file->clear();
    16201621                  file->seekg(file_position, ios::beg);  // rewind to start position
    1621                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1622                  Free(&free_dummy);
    16221623                  return 0;
    16231624                }
     
    16601661                  if (critical) {
    16611662                    if (verbose) fprintf(stderr,"Error: EoL at %i and still missing %i value(s) for parameter %s\n", line, yth-j, name);
    1662                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1663                    Free(&free_dummy);
    16631664                    //return 0;
    16641665                    exit(255);
     
    16681669                    file->clear();
    16691670                    file->seekg(file_position, ios::beg);  // rewind to start position
    1670                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1671                    Free(&free_dummy);
    16711672                    return 0;
    16721673                  }
     
    16811682                  file->seekg(file_position, ios::beg);  // rewind to start position
    16821683                }
    1683                 Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1684                Free(&free_dummy);
    16841685                return 0;
    16851686              }
     
    17351736    }
    17361737  }
    1737   if ((type >= row_int) && (verbose)) fprintf(stderr,"\n");
    1738   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1738  if ((type >= row_int) && (verbose))
     1739    fprintf(stderr,"\n");
     1740  Free(&free_dummy);
    17391741  if (!sequential) {
    17401742    file->clear();
     
    18141816        dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword)
    18151817        //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name);
    1816         //Free((void **)&free_dummy);
     1818        //Free(&free_dummy);
    18171819        //Error(FileOpenParams, NULL);
    18181820      } else {
  • src/defs.hpp

    raba92d r13a574  
    77#ifndef DEFS_HPP_
    88#define DEFS_HPP_
    9 
    10 using namespace std;
    119
    1210#define MYEPSILON 1e-13   //!< machine epsilon precision
  • src/helpers.cpp

    • Property mode changed from 100755 to 100644
    raba92d r13a574  
    66
    77#include "helpers.hpp"
     8#include "memoryusageobserver.hpp"
    89
    910/********************************************** helpful functions *********************************/
     
    3435void debug_in(const char *output, const char *file, const int line) {}  // print nothing
    3536#endif
    36 
    37 /** Wrapper for allocating'ing a memory range with *output if it fails.
    38  * \param size number of chars to alloc for \a *buffer
    39  * \param *output message if malloc fails
    40  * \return pointer to memory range
    41  */
    42 void * Malloc(size_t size, const char* output)
    43 {
    44   void *buffer = NULL;
    45   buffer = (void *)malloc(size); // alloc
    46   if (buffer == NULL)
    47     cout << Verbose(0) << "Malloc failed - pointer is NULL: " << output << endl;
    48   return(buffer);
    49 };
    50 
    51 /** Wrapper for allocating'ing a memory range with *output if it fails.
    52  * \param size number of chars to alloc for \a *buffer
    53  * \param *output message if malloc fails
    54  * \return pointer to memory range
    55  */
    56 void * Calloc(size_t size, const char* output)
    57 {
    58   void *buffer = NULL;
    59   buffer = (void *)calloc(size, (size_t)0); // alloc
    60   if (buffer == NULL)
    61     cout << Verbose(0) << "Calloc failed - pointer is NULL: " << output << endl;
    62   return(buffer);
    63 };
    64 
    65 /** Wrapper for reallocating'ing a memory range with *output if it fails.
    66  * \param *OldPointer pointer to old memory range
    67  * \param size number of chars to alloc for \a *buffer
    68  * \param *output message if malloc fails
    69  * \return pointer to memory range
    70  */
    71 void * ReAlloc(void * OldPointer, size_t size, const char* output)
    72 {
    73   void *buffer = NULL;
    74   if (OldPointer == NULL)
    75     //cout << Verbose(0) << "ReAlloc impossible - old is NULL: " << output << endl;
    76     buffer = (void *)malloc(size); // malloc
    77   else
    78     buffer = (void *)realloc(OldPointer, size); // realloc
    79   if (buffer == NULL)
    80     cout << Verbose(0) << "ReAlloc failed - new is NULL: " << output << endl;
    81   return(buffer);
    82 };
    83 
    84 /** Wrapper for free'ing an allocated memory range with *output if it fails.
    85  * \param *buffer pointer to buffer to be free'd
    86  * \param *output message if free fails
    87  */
    88 void Free(void ** buffer, const char* output)
    89 {
    90   if (*buffer == NULL) {
    91     //cout << Verbose(5) << "Free not necesary: " << output << endl;
    92   } else {
    93     free(*buffer);
    94     *buffer = NULL;
    95   }
    96 };
    97 
    98 /** Malloc string array and set its length to the allocated length.
    99  * \param *output message if malloc fails
    100  * \param size number of chars to alloc for \a *buffer
    101  * \return pointer to string array
    102  */
    103 char* MallocString(size_t size, const char* output)
    104 {
    105   size_t i;
    106   char *buffer;
    107   buffer = (char *)malloc(sizeof(char) * (size+1)); // alloc
    108   if (buffer == NULL)
    109     cout << Verbose(0) << output << endl;
    110   for (i=size;i--;)  // reset
    111     buffer[i] = i % 2 == 0 ? 'p': 'c';
    112   buffer[size] = '\0'; // and set length marker on its end
    113   return(buffer);
    114 }
    11537
    11638/** modulo operator for doubles.
     
    17092  }
    17193  // allocate string
    172   returnstring = (char *) Malloc(sizeof(char)*(order+2), "FixedDigitNumber: *returnstring");
     94  returnstring = Malloc<char>(order + 2, "FixedDigitNumber: *returnstring");
    17395  // terminate  and fill string array from end backward
    17496  returnstring[order] = '\0';
     
    196118};
    197119
     120/**
     121 * Allocates a memory range using malloc().
     122 * Prints the provided error message in case of a failure.
     123 *
     124 * \param number of memory slices of type X to allocate
     125 * \param failure message which is printed if the allocation fails
     126 * \return pointer to the allocated memory range, will be NULL if a failure occurred
     127 */
     128template <> char* Malloc<char>(size_t size, const char* output)
     129{
     130  char* buffer = NULL;
     131  buffer = (char*) malloc(sizeof(char) * (size + 1));
     132  for (size_t i = size; i--;)
     133    buffer[i] = (i % 2 == 0) ? 'p': 'c';
     134  buffer[size] = '\0';
    198135
     136  if (buffer != NULL) {
     137    MemoryUsageObserver::getInstance()->addMemory(buffer, size);
     138  } else {
     139    cout << Verbose(0) << "Malloc for datatype " << typeid(char).name()
     140      << " failed - pointer is NULL: " << output << endl;
     141  }
     142
     143  return buffer;
     144};
     145
     146
  • src/helpers.hpp

    raba92d r13a574  
    2323#include "defs.hpp"
    2424#include "verbose.hpp"
     25#include "memoryallocator.hpp"
    2526
    2627/********************************************** helpful functions *********************************/
     
    5051void flip(double *x, double *y);
    5152int pot(int base, int n);
    52 void * Malloc(size_t size, const char* output);
    53 void * Calloc(size_t size, const char* output);
    54 void * ReAlloc(void * OldPointer, size_t size, const char* output);
    55 char* MallocString(size_t size, const char* output);
    56 void Free(void ** buffer, const char* output);
     53//void * Malloc(size_t size, const char* output);
     54//void * Calloc(size_t size, const char* output);
     55//void * ReAlloc(void * OldPointer, size_t size, const char* output);
     56//char* MallocString(size_t size, const char* output);
     57//void Free(void ** buffer, const char* output);
    5758char *FixedDigitNumber(const int FragmentNumber, const int digits);
    5859bool IsValidNumber( const char *string);
     
    9394
    9495  // allocat and fill
    95   LookupTable = (T **) Malloc(sizeof(T *)*count, "CreateFatherLookupTable - **LookupTable");
     96  LookupTable = Malloc<T*>(count, "CreateFatherLookupTable - **LookupTable");
    9697  if (LookupTable == NULL) {
    9798    cerr << "LookupTable memory allocation failed!" << endl;
     
    273274
    274275
     276
    275277#endif /*HELPERS_HPP_*/
  • src/joiner.cpp

    raba92d r13a574  
    1010#include "datacreator.hpp"
    1111#include "helpers.hpp"
     12#include "memoryallocator.hpp"
    1213#include "parser.hpp"
    1314#include "periodentafel.hpp"
     
    5556    return 1;
    5657  } else {
    57     dir = (char *) Malloc(sizeof(char)*(strlen(argv[2])+2), "main: *dir");
     58    dir = Malloc<char>(strlen(argv[2]) + 2, "main: *dir");
    5859    strcpy(dir, "/");
    5960    strcat(dir, argv[2]);
     
    240241  // exit
    241242  delete(periode);
    242   Free((void **)&dir, "main: *dir");
     243  Free(&dir);
    243244  cout << "done." << endl;
    244245  return 0;
  • src/moleculelist.cpp

    raba92d r13a574  
    88#include "config.hpp"
    99#include "molecules.hpp"
     10#include "memoryallocator.hpp"
    1011
    1112/*********************************** Functions for class MoleculeListClass *************************/
     
    412413
    413414  // 0b. allocate memory for constants
    414   FitConstant = (double ***) Malloc(sizeof(double **) * 3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     415  FitConstant = Malloc<double**>(3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    415416  for (int k = 0; k < 3; k++) {
    416     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     417    FitConstant[k] = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    417418    for (int i = a; i--;) {
    418       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     419      FitConstant[k][i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    419420    }
    420421  }
     
    461462
    462463  // 0d. allocate final correction matrix
    463   correction = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **correction");
     464  correction = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **correction");
    464465  for (int i = a; i--;)
    465     correction[i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
     466    correction[i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
    466467
    467468  // 1a. go through every molecule in the list
     
    537538  output.close();
    538539  // 6. free memory of parsed matrices
    539   FitConstant = (double ***) Malloc(sizeof(double **) * a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     540  FitConstant = Malloc<double**>(a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    540541  for (int k = 0; k < 3; k++) {
    541     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     542    FitConstant[k] = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    542543    for (int i = a; i--;) {
    543       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     544      FitConstant[k][i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    544545    }
    545546  }
     
    702703    //outputFragment.clear();
    703704    delete (FragmentNumber);
    704     //Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");
     705    //Free(&FragmentNumber);
    705706  }
    706707  cout << " done." << endl;
     
    845846  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    846847    // free the index lookup list
    847     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
     848    Free(&ListOfLocalAtoms[FragmentCounter]);
    848849    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    849       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     850      Free(&ListOfLocalAtoms);
    850851  }
    851852  FragmentCounter--;
     
    910911  if (ListOfLocalAtoms == NULL) { // allocated initial pointer
    911912    // allocate and set each field to NULL
    912     ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **) * Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     913    ListOfLocalAtoms = Malloc<atom**>(Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    913914    if (ListOfLocalAtoms != NULL) {
    914915      for (int i = Counter; i--;)
     
    954955  if (FragmentList == NULL) {
    955956    KeySetCounter = Count();
    956     FragmentList = (Graph **) Malloc(sizeof(Graph *) * KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
     957    FragmentList = Malloc<Graph*>(KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
    957958    for (int i = KeySetCounter; i--;)
    958959      FragmentList[i] = NULL;
     
    990991  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    991992    // free the index lookup list
    992     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
     993    Free(&ListOfLocalAtoms[FragmentCounter]);
    993994    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    994       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
     995      Free(&ListOfLocalAtoms);
    995996  }
    996997  *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
  • src/molecules.cpp

    raba92d r13a574  
    66
    77#include "config.hpp"
     8#include "memoryallocator.hpp"
    89#include "molecules.hpp"
    910
     
    5556  if (ListOfBondsPerAtom != NULL)
    5657    for(int i=AtomCount;i--;)
    57       Free((void **)&ListOfBondsPerAtom[i], "molecule::~molecule: ListOfBondsPerAtom[i]");
    58   Free((void **)&ListOfBondsPerAtom, "molecule::~molecule: ListOfBondsPerAtom");
    59   Free((void **)&NumberOfBondsPerAtom, "molecule::~molecule: NumberOfBondsPerAtom");
     58      Free(&ListOfBondsPerAtom[i]);
     59  Free(&ListOfBondsPerAtom);
     60  Free(&NumberOfBondsPerAtom);
    6061  if (TesselStruct != NULL)
    6162    delete(TesselStruct);
     
    163164        NoNonHydrogen++;
    164165      if (pointer->Name == NULL) {
    165         Free((void **)&pointer->Name, "molecule::AddAtom: *pointer->Name");
    166         pointer->Name = (char *) Malloc(sizeof(char)*6, "molecule::AddAtom: *pointer->Name");
     166        Free(&pointer->Name);
     167        pointer->Name = Malloc<char>(6, "molecule::AddAtom: *pointer->Name");
    167168        sprintf(pointer->Name, "%2s%02d", pointer->type->symbol, pointer->nr+1);
    168169      }
     
    176177 * Increases molecule::last_atom and gives last number to added atom.
    177178 * \param *pointer allocated and set atom
    178  * \return true - succeeded, false - atom not found in list
     179 * \return pointer to the newly added atom
    179180 */
    180181atom * molecule::AddCopyAtom(atom *pointer)
     
    182183  if (pointer != NULL) {
    183184    atom *walker = new atom(pointer);
    184     walker->Name = (char *) Malloc(sizeof(char)*strlen(pointer->Name)+1, "atom::atom: *Name");
     185    walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name");
    185186    strcpy (walker->Name, pointer->Name);
    186187    walker->nr = last_atom++;  // increase number within molecule
     
    267268    Orthovector1.MatrixMultiplication(matrix);
    268269    InBondvector.SubtractVector(&Orthovector1); // subtract just the additional translation
    269     Free((void **)&matrix, "molecule::AddHydrogenReplacementAtom: *matrix");
     270    Free(&matrix);
    270271    bondlength = InBondvector.Norm();
    271272//    *out << Verbose(4) << "Corrected InBondvector is now: ";
     
    612613  return copy;
    613614};
     615
     616
     617/**
     618 * Copies all atoms of a molecule which are within the defined parallelepiped.
     619 *
     620 * @param offest for the origin of the parallelepiped
     621 * @param three vectors forming the matrix that defines the shape of the parallelpiped
     622 */
     623molecule* molecule::CopyMoleculeFromSubRegion(Vector offset, double *parallelepiped) {
     624  molecule *copy = new molecule(elemente);
     625  atom *Walker = start;
     626
     627  while(Walker->next != end) {
     628    Walker = Walker->next;
     629    if (Walker->x.IsInParallelepiped(offset, parallelepiped)) {
     630      cout << "Adding atom " << *Walker << endl;
     631      copy->AddCopyAtom(Walker);
     632    }
     633  }
     634
     635  //TODO: copy->BuildInducedSubgraph((ofstream *)&cout, this);
     636
     637  return copy;
     638}
    614639
    615640/** Adds a bond to a the molecule specified by two atoms, \a *first and \a *second.
     
    10601085    }
    10611086  } while (!flag);
    1062   Free((void **)&matrix, "molecule::DetermineCenter: *matrix");
     1087  Free(&matrix);
    10631088  Center.Scale(1./(double)AtomCount);
    10641089};
     
    13191344{
    13201345  stringstream zeile1, zeile2;
    1321   int *DoubleList = (int *) Malloc(Nr*sizeof(int), "PrintPermutationMap: *DoubleList");
     1346  int *DoubleList = Malloc<int>(Nr, "PrintPermutationMap: *DoubleList");
    13221347  int doubles = 0;
    13231348  for (int i=0;i<Nr;i++)
     
    13341359    doubles++;
    13351360 // *out << "Found " << doubles << " Doubles." << endl;
    1336   Free((void **)&DoubleList, "PrintPermutationMap: *DoubleList");
     1361  Free(&DoubleList);
    13371362//  *out << zeile1.str() << endl << zeile2.str() << endl;
    13381363};
     
    13681393{
    13691394  double Potential, OldPotential, OlderPotential;
    1370   PermutationMap = (atom **) Malloc(AtomCount*sizeof(atom *), "molecule::MinimiseConstrainedPotential: **PermutationMap");
    1371   DistanceMap **DistanceList = (DistanceMap **) Malloc(AtomCount*sizeof(DistanceMap *), "molecule::MinimiseConstrainedPotential: **DistanceList");
    1372   DistanceMap::iterator *DistanceIterators = (DistanceMap::iterator *) Malloc(AtomCount*sizeof(DistanceMap::iterator), "molecule::MinimiseConstrainedPotential: *DistanceIterators");
    1373   int *DoubleList = (int *) Malloc(AtomCount*sizeof(int), "molecule::MinimiseConstrainedPotential: *DoubleList");
    1374   DistanceMap::iterator *StepList = (DistanceMap::iterator *) Malloc(AtomCount*sizeof(DistanceMap::iterator), "molecule::MinimiseConstrainedPotential: *StepList");
     1395  PermutationMap = Malloc<atom*>(AtomCount, "molecule::MinimiseConstrainedPotential: **PermutationMap");
     1396  DistanceMap **DistanceList = Malloc<DistanceMap*>(AtomCount, "molecule::MinimiseConstrainedPotential: **DistanceList");
     1397  DistanceMap::iterator *DistanceIterators = Malloc<DistanceMap::iterator>(AtomCount, "molecule::MinimiseConstrainedPotential: *DistanceIterators");
     1398  int *DoubleList = Malloc<int>(AtomCount, "molecule::MinimiseConstrainedPotential: *DoubleList");
     1399  DistanceMap::iterator *StepList = Malloc<DistanceMap::iterator>(AtomCount, "molecule::MinimiseConstrainedPotential: *StepList");
    13751400  double constants[3];
    13761401  int round;
     
    14481473    }
    14491474  *out << Verbose(1) << "done." << endl;
    1450   Free((void **)&DoubleList, "molecule::MinimiseConstrainedPotential: *DoubleList");
     1475  Free(&DoubleList);
    14511476  // argument minimise the constrained potential in this injective PermutationMap
    14521477  *out << Verbose(1) << "Argument minimising the PermutationMap, at current potential " << OldPotential << " ... " << endl;
     
    15291554  for (int i=AtomCount; i--;)
    15301555    DistanceList[i]->clear();
    1531   Free((void **)&DistanceList, "molecule::MinimiseConstrainedPotential: **DistanceList");
    1532   Free((void **)&DistanceIterators, "molecule::MinimiseConstrainedPotential: *DistanceIterators");
     1556  Free(&DistanceList);
     1557  Free(&DistanceIterators);
    15331558  return ConstrainedPotential(out, PermutationMap, startstep, endstep, constants, IsAngstroem);
    15341559};
     
    15811606    MinimiseConstrainedPotential(out, PermutationMap, startstep, endstep, configuration.GetIsAngstroem());
    15821607  else {
    1583     PermutationMap = (atom **) Malloc(AtomCount*sizeof(atom *), "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");
     1608    PermutationMap = Malloc<atom *>(AtomCount, "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");
    15841609    Walker = start;
    15851610    while (Walker->next != end) {
     
    16371662 
    16381663  // store the list to single step files
    1639   int *SortIndex = (int *) Malloc(AtomCount*sizeof(int), "molecule::LinearInterpolationBetweenConfiguration: *SortIndex");
     1664  int *SortIndex = Malloc<int>(AtomCount, "molecule::LinearInterpolationBetweenConfiguration: *SortIndex");
    16401665  for (int i=AtomCount; i--; )
    16411666    SortIndex[i] = i;
     
    16431668 
    16441669  // free and return
    1645   Free((void **)&PermutationMap, "molecule::MinimiseConstrainedPotential: *PermutationMap");
     1670  Free(&PermutationMap);
    16461671  delete(MoleculePerStep);
    16471672  return status;
     
    17021727      ConstrainedPotentialEnergy = MinimiseConstrainedPotential(out, PermutationMap,configuration.DoConstrainedMD, 0, configuration.GetIsAngstroem());
    17031728      EvaluateConstrainedForces(out, configuration.DoConstrainedMD, 0, PermutationMap, &Force);
    1704       Free((void **)&PermutationMap, "molecule::MinimiseConstrainedPotential: *PermutationMap");
     1729      Free(&PermutationMap);
    17051730    }
    17061731   
     
    24022427        if (Walker->type->Z != 1) // count non-hydrogen atoms whilst at it
    24032428          NoNonHydrogen++;
    2404         Free((void **)&Walker->Name, "molecule::CountAtoms: *walker->Name");
    2405         Walker->Name = (char *) Malloc(sizeof(char)*6, "molecule::CountAtoms: *walker->Name");
     2429        Free(&Walker->Name);
     2430        Walker->Name = Malloc<char>(6, "molecule::CountAtoms: *walker->Name");
    24062431        sprintf(Walker->Name, "%2s%02d", Walker->type->symbol, Walker->nr+1);
    24072432        *out << "Naming atom nr. " << Walker->nr << " " << Walker->Name << "." << endl;
     
    26142639    NumberCells = divisor[0]*divisor[1]*divisor[2];
    26152640    *out << Verbose(1) << "Allocating " << NumberCells << " cells." << endl;
    2616     CellList = (molecule **) Malloc(sizeof(molecule *)*NumberCells, "molecule::CreateAdjacencyList - ** CellList");
     2641    CellList = Malloc<molecule*>(NumberCells, "molecule::CreateAdjacencyList - ** CellList");
    26172642    for (int i=NumberCells;i--;)
    26182643      CellList[i] = NULL;
     
    26962721        delete(CellList[i]);
    26972722      }
    2698     Free((void **)&CellList, "molecule::CreateAdjacencyList - ** CellList");
     2723    Free(&CellList);
    26992724
    27002725    // create the adjacency list per atom
     
    27612786    *out << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
    27622787  *out << Verbose(0) << "End of CreateAdjacencyList." << endl;
    2763   Free((void **)&matrix, "molecule::CreateAdjacencyList: *matrix");
     2788  Free(&matrix);
    27642789
    27652790};
     
    29712996void molecule::CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *  BackEdgeStack, int *&MinimumRingSize)
    29722997{
    2973   atom **PredecessorList = (atom **) Malloc(sizeof(atom *)*AtomCount, "molecule::CyclicStructureAnalysis: **PredecessorList");
    2974   int *ShortestPathList = (int *) Malloc(sizeof(int)*AtomCount, "molecule::CyclicStructureAnalysis: *ShortestPathList");
    2975   enum Shading *ColorList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::CyclicStructureAnalysis: *ColorList");
     2998  atom **PredecessorList = Malloc<atom*>(AtomCount, "molecule::CyclicStructureAnalysis: **PredecessorList");
     2999  int *ShortestPathList = Malloc<int>(AtomCount, "molecule::CyclicStructureAnalysis: *ShortestPathList");
     3000  enum Shading *ColorList = Malloc<enum Shading>(AtomCount, "molecule::CyclicStructureAnalysis: *ColorList");
    29763001  class StackClass<atom *> *BFSStack = new StackClass<atom *> (AtomCount);   // will hold the current ring
    29773002  class StackClass<atom *> *TouchedStack = new StackClass<atom *> (AtomCount);   // contains all "touched" atoms (that need to be reset after BFS loop)
     
    31643189    *out << Verbose(1) << "No rings were detected in the molecular structure." << endl;
    31653190
    3166   Free((void **)&PredecessorList, "molecule::CyclicStructureAnalysis: **PredecessorList");
    3167   Free((void **)&ShortestPathList, "molecule::CyclicStructureAnalysis: **ShortestPathList");
    3168   Free((void **)&ColorList, "molecule::CyclicStructureAnalysis: **ColorList");
     3191  Free(&PredecessorList);
     3192  Free(&ShortestPathList);
     3193  Free(&ColorList);
    31693194  delete(BFSStack);
    31703195};
     
    32103235    Walker = Walker->next;
    32113236    if (Walker->ComponentNr != NULL)
    3212       Free((void **)&Walker->ComponentNr, "molecule::InitComponentNumbers: **Walker->ComponentNr");
    3213     Walker->ComponentNr = (int *) Malloc(sizeof(int)*NumberOfBondsPerAtom[Walker->nr], "molecule::InitComponentNumbers: *Walker->ComponentNr");
     3237      Free(&Walker->ComponentNr);
     3238    Walker->ComponentNr = Malloc<int>(NumberOfBondsPerAtom[Walker->nr], "molecule::InitComponentNumbers: *Walker->ComponentNr");
    32143239    for (int i=NumberOfBondsPerAtom[Walker->nr];i--;)
    32153240      Walker->ComponentNr[i] = -1;
     
    33343359  int NumberOfFragments = 0;
    33353360  double TEFactor;
    3336   char *filename = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::ParseKeySetFile - filename");
     3361  char *filename = Malloc<char>(MAXSTRINGSIZE, "molecule::ParseKeySetFile - filename");
    33373362
    33383363  if (FragmentList == NULL) { // check list pointer
     
    33463371  if (InputFile != NULL) {
    33473372    // each line represents a new fragment
    3348     char *buffer = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::ParseKeySetFile - *buffer");
     3373    char *buffer = Malloc<char>(MAXSTRINGSIZE, "molecule::ParseKeySetFile - *buffer");
    33493374    // 1. parse keysets and insert into temp. graph
    33503375    while (!InputFile.eof()) {
     
    33613386    InputFile.close();
    33623387    InputFile.clear();
    3363     Free((void **)&buffer, "molecule::ParseKeySetFile - *buffer");
     3388    Free(&buffer);
    33643389    *out << Verbose(1) << "done." << endl;
    33653390  } else {
     
    33943419
    33953420  // free memory
    3396   Free((void **)&filename, "molecule::ParseKeySetFile - filename");
     3421  Free(&filename);
    33973422
    33983423  return status;
     
    35013526  stringstream filename;
    35023527  bool status = true;
    3503   char *buffer = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::CheckAdjacencyFileAgainstMolecule: *buffer");
     3528  char *buffer = Malloc<char>(MAXSTRINGSIZE, "molecule::CheckAdjacencyFileAgainstMolecule: *buffer");
    35043529
    35053530  filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
     
    35093534    // allocate storage structure
    35103535    int NonMatchNumber = 0;   // will number of atoms with differing bond structure
    3511     int *CurrentBonds = (int *) Malloc(sizeof(int)*8, "molecule::CheckAdjacencyFileAgainstMolecule - CurrentBonds"); // contains parsed bonds of current atom
     3536    int *CurrentBonds = Malloc<int>(8, "molecule::CheckAdjacencyFileAgainstMolecule - CurrentBonds"); // contains parsed bonds of current atom
    35123537    int CurrentBondsOfAtom;
    35133538
     
    35543579    } else
    35553580      *out << Verbose(1) << "done: Not equal by " << NonMatchNumber << " atoms." << endl;
    3556     Free((void **)&CurrentBonds, "molecule::CheckAdjacencyFileAgainstMolecule - **CurrentBonds");
     3581    Free(&CurrentBonds);
    35573582  } else {
    35583583    *out << Verbose(1) << "Adjacency file not found." << endl;
     
    35603585  }
    35613586  *out << endl;
    3562   Free((void **)&buffer, "molecule::CheckAdjacencyFileAgainstMolecule: *buffer");
     3587  Free(&buffer);
    35633588
    35643589  return status;
     
    35883613      return false;
    35893614    // parse the EnergyPerFragment file
    3590     char *buffer = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "molecule::CheckOrderAtSite: *buffer");
     3615    char *buffer = Malloc<char>(MAXSTRINGSIZE, "molecule::CheckOrderAtSite: *buffer");
    35913616    sprintf(buffer, "%s/%s%s.dat", path, FRAGMENTPREFIX, ENERGYPERFRAGMENT);
    35923617    InputFile.open(buffer, ios::in);
     
    36953720      }
    36963721    }
    3697     Free((void **)&buffer, "molecule::CheckOrderAtSite: *buffer");
     3722    Free(&buffer);
    36983723    // pick a given number of highest values and set AtomMask
    36993724  } else { // global increase of Bond Order
     
    37483773    return false;
    37493774  }
    3750   SortIndex = (int *) Malloc(sizeof(int)*AtomCount, "molecule::FragmentMolecule: *SortIndex");
     3775  SortIndex = Malloc<int>(AtomCount, "molecule::FragmentMolecule: *SortIndex");
    37513776  for(int i=AtomCount;i--;)
    37523777    SortIndex[i] = -1;
     
    38223847  // === compare it with adjacency file ===
    38233848  FragmentationToDo = FragmentationToDo && CheckAdjacencyFileAgainstMolecule(out, configuration->configpath, ListOfAtoms);
    3824   Free((void **)&ListOfAtoms, "molecule::FragmentMolecule - **ListOfAtoms");
     3849  Free(&ListOfAtoms);
    38253850
    38263851  // ===== 2. perform a DFS analysis to gather info on cyclic structure and a list of disconnected subgraphs =====
     
    39113936    delete(Subgraphs);
    39123937  }
    3913   Free((void **)&FragmentList, "molecule::FragmentMolecule - **FragmentList");
     3938  Free(&FragmentList);
    39143939
    39153940  // ===== 8b. gather keyset lists (graphs) from all subgraphs and transform into MoleculeListClass =====
     
    39583983      *out << Verbose(1) << "Freeing bond memory" << endl;
    39593984      delete(FragmentList); // remove bond molecule from memory
    3960       Free((void **)&SortIndex, "molecule::FragmentMolecule: *SortIndex");
     3985      Free(&SortIndex);
    39613986    } else
    39623987      *out << Verbose(1) << "FragmentList is zero on return, splitting failed." << endl;
     
    40464071bool molecule::ParseOrderAtSiteFromFile(ofstream *out, char *path)
    40474072{
    4048   unsigned char *OrderArray = (unsigned char *) Malloc(sizeof(unsigned char)*AtomCount, "molecule::ParseOrderAtSiteFromFile - *OrderArray");
    4049   bool *MaxArray = (bool *) Malloc(sizeof(bool)*AtomCount, "molecule::ParseOrderAtSiteFromFile - *MaxArray");
     4073  unsigned char *OrderArray = Malloc<unsigned char>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *OrderArray");
     4074  bool *MaxArray = Malloc<bool>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *MaxArray");
    40504075  bool status;
    40514076  int AtomNr, value;
     
    40884113    status = false;
    40894114  }
    4090   Free((void **)&OrderArray, "molecule::ParseOrderAtSiteFromFile - *OrderArray");
    4091   Free((void **)&MaxArray, "molecule::ParseOrderAtSiteFromFile - *MaxArray");
     4115  Free(&OrderArray);
     4116  Free(&MaxArray);
    40924117
    40934118  *out << Verbose(1) << "End of ParseOrderAtSiteFromFile" << endl;
     
    41124137  if (ListOfBondsPerAtom != NULL) {
    41134138    for(int i=AtomCount;i--;)
    4114       Free((void **)&ListOfBondsPerAtom[i], "molecule::CreateListOfBondsPerAtom: ListOfBondsPerAtom[i]");
    4115     Free((void **)&ListOfBondsPerAtom, "molecule::CreateListOfBondsPerAtom: ListOfBondsPerAtom");
     4139      Free(&ListOfBondsPerAtom[i]);
     4140    Free(&ListOfBondsPerAtom);
    41164141  }
    41174142  if (NumberOfBondsPerAtom != NULL)
    4118     Free((void **)&NumberOfBondsPerAtom, "molecule::CreateListOfBondsPerAtom: NumberOfBondsPerAtom");
    4119   ListOfBondsPerAtom = (bond ***) Malloc(sizeof(bond **)*AtomCount, "molecule::CreateListOfBondsPerAtom: ***ListOfBondsPerAtom");
    4120   NumberOfBondsPerAtom = (int *) Malloc(sizeof(int)*AtomCount, "molecule::CreateListOfBondsPerAtom: *NumberOfBondsPerAtom");
     4143    Free(&NumberOfBondsPerAtom);
     4144  ListOfBondsPerAtom = Malloc<bond**>(AtomCount, "molecule::CreateListOfBondsPerAtom: ***ListOfBondsPerAtom");
     4145  NumberOfBondsPerAtom = Malloc<int>(AtomCount, "molecule::CreateListOfBondsPerAtom: *NumberOfBondsPerAtom");
    41214146
    41224147  // reset bond counts per atom
     
    41324157  for(int i=AtomCount;i--;) {
    41334158    // allocate list of bonds per atom
    4134     ListOfBondsPerAtom[i] = (bond **) Malloc(sizeof(bond *)*NumberOfBondsPerAtom[i], "molecule::CreateListOfBondsPerAtom: **ListOfBondsPerAtom[]");
     4159    ListOfBondsPerAtom[i] = Malloc<bond*>(NumberOfBondsPerAtom[i], "molecule::CreateListOfBondsPerAtom: **ListOfBondsPerAtom[]");
    41354160    // clear the list again, now each NumberOfBondsPerAtom marks current free field
    41364161    NumberOfBondsPerAtom[i] = 0;
     
    41744199void molecule::BreadthFirstSearchAdd(ofstream *out, molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem)
    41754200{
    4176   atom **PredecessorList = (atom **) Malloc(sizeof(atom *)*AtomCount, "molecule::BreadthFirstSearchAdd: **PredecessorList");
    4177   int *ShortestPathList = (int *) Malloc(sizeof(int)*AtomCount, "molecule::BreadthFirstSearchAdd: *ShortestPathList");
    4178   enum Shading *ColorList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::BreadthFirstSearchAdd: *ColorList");
     4201  atom **PredecessorList = Malloc<atom*>(AtomCount, "molecule::BreadthFirstSearchAdd: **PredecessorList");
     4202  int *ShortestPathList = Malloc<int>(AtomCount, "molecule::BreadthFirstSearchAdd: *ShortestPathList");
     4203  enum Shading *ColorList = Malloc<enum Shading>(AtomCount, "molecule::BreadthFirstSearchAdd: *ColorList");
    41794204  class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount);
    41804205  atom *Walker = NULL, *OtherAtom = NULL;
     
    42814306    *out << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    42824307  }
    4283   Free((void **)&PredecessorList, "molecule::BreadthFirstSearchAdd: **PredecessorList");
    4284   Free((void **)&ShortestPathList, "molecule::BreadthFirstSearchAdd: **ShortestPathList");
    4285   Free((void **)&ColorList, "molecule::BreadthFirstSearchAdd: **ColorList");
     4308  Free(&PredecessorList);
     4309  Free(&ShortestPathList);
     4310  Free(&ColorList);
    42864311  delete(AtomStack);
    42874312};
     
    43004325  atom *Walker = NULL, *OtherAtom = NULL;
    43014326  bool status = true;
    4302   atom **ParentList = (atom **) Malloc(sizeof(atom *)*Father->AtomCount, "molecule::BuildInducedSubgraph: **ParentList");
     4327  atom **ParentList = Malloc<atom*>(Father->AtomCount, "molecule::BuildInducedSubgraph: **ParentList");
    43034328
    43044329  *out << Verbose(2) << "Begin of BuildInducedSubgraph." << endl;
     
    43394364  }
    43404365
    4341   Free((void **)&ParentList, "molecule::BuildInducedSubgraph: **ParentList");
     4366  Free(&ParentList);
    43424367  *out << Verbose(2) << "End of BuildInducedSubgraph." << endl;
    43434368  return status;
     
    43824407{
    43834408  atom *Runner = NULL, *FatherOfRunner = NULL, *OtherFather = NULL;
    4384   atom **SonList = (atom **) Malloc(sizeof(atom *)*AtomCount, "molecule::StoreFragmentFromStack: **SonList");
     4409  atom **SonList = Malloc<atom*>(AtomCount, "molecule::StoreFragmentFromStack: **SonList");
    43854410  molecule *Leaf = new molecule(elemente);
    43864411  bool LonelyFlag = false;
     
    44524477  Leaf->CreateListOfBondsPerAtom(out);
    44534478  //Leaflet->Leaf->ScanForPeriodicCorrection(out);
    4454   Free((void **)&SonList, "molecule::StoreFragmentFromStack: **SonList");
     4479  Free(&SonList);
    44554480//  *out << Verbose(1) << "End of StoreFragmentFromKeyset." << endl;
    44564481  return Leaf;
     
    44734498MoleculeListClass * molecule::CreateListOfUniqueFragmentsOfOrder(ofstream *out, int Order, config *configuration)
    44744499{
    4475   atom **PredecessorList = (atom **) Malloc(sizeof(atom *)*AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: **PredecessorList");
    4476   int *ShortestPathList = (int *) Malloc(sizeof(int)*AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ShortestPathList");
    4477   int *Labels = (int *) Malloc(sizeof(int)*AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *Labels");
    4478   enum Shading *ColorVertexList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorList");
    4479   enum Shading *ColorEdgeList = (enum Shading *) Malloc(sizeof(enum Shading)*BondCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorBondList");
     4500  atom **PredecessorList = Malloc<atom*>(AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: **PredecessorList");
     4501  int *ShortestPathList = Malloc<int>(AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ShortestPathList");
     4502  int *Labels = Malloc<int>(AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *Labels");
     4503  enum Shading *ColorVertexList = Malloc<enum Shading>(AtomCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorList");
     4504  enum Shading *ColorEdgeList = Malloc<enum Shading>(BondCount, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorBondList");
    44804505  StackClass<atom *> *RootStack = new StackClass<atom *>(AtomCount);
    44814506  StackClass<atom *> *TouchedStack = new StackClass<atom *>((int)pow(4,Order)+2); // number of atoms reached from one with maximal 4 bonds plus Root itself
     
    46074632
    46084633  // free memory and exit
    4609   Free((void **)&PredecessorList, "molecule::CreateListOfUniqueFragmentsOfOrder: **PredecessorList");
    4610   Free((void **)&ShortestPathList, "molecule::CreateListOfUniqueFragmentsOfOrder: *ShortestPathList");
    4611   Free((void **)&Labels, "molecule::CreateListOfUniqueFragmentsOfOrder: *Labels");
    4612   Free((void **)&ColorVertexList, "molecule::CreateListOfUniqueFragmentsOfOrder: *ColorList");
     4634  Free(&PredecessorList);
     4635  Free(&ShortestPathList);
     4636  Free(&Labels);
     4637  Free(&ColorVertexList);
    46134638  delete(RootStack);
    46144639  delete(TouchedStack);
     
    46604685  int Removal;
    46614686  int SpaceLeft;
    4662   int *TouchedList = (int *) Malloc(sizeof(int)*(SubOrder+1), "molecule::SPFragmentGenerator: *TouchedList");
     4687  int *TouchedList = Malloc<int>(SubOrder + 1, "molecule::SPFragmentGenerator: *TouchedList");
    46634688  bond *Binder = NULL;
    46644689  bond **BondsList = NULL;
     
    46684693
    46694694  // Hier muessen von 1 bis NumberOfBondsPerAtom[Walker->nr] alle Kombinationen
    4670   // von Endstuecken (aus den Bonds) hinzugefᅵᅵgt werden und fᅵᅵr verbleibende ANOVAOrder
    4671   // rekursiv GraphCrawler in der nᅵᅵchsten Ebene aufgerufen werden
     4695  // von Endstuecken (aus den Bonds) hinzugefuegt werden und fuer verbleibende ANOVAOrder
     4696  // rekursiv GraphCrawler in der naechsten Ebene aufgerufen werden
    46724697
    46734698  *out << Verbose(1+verbosity) << "Begin of SPFragmentGenerator." << endl;
     
    47294754          }
    47304755          // then allocate and fill the list
    4731           BondsList = (bond **) Malloc(sizeof(bond *)*SubSetDimension, "molecule::SPFragmentGenerator: **BondsList");
     4756          BondsList = Malloc<bond*>(SubSetDimension, "molecule::SPFragmentGenerator: **BondsList");
    47324757          SubSetDimension = 0;
    47334758          Binder = FragmentSearch->BondsPerSPList[2*SP];
     
    47414766          *out << Verbose(2+verbosity) << "Calling subset generator " << SP << " away from root " << *FragmentSearch->Root << " with sub set dimension " << SubSetDimension << "." << endl;
    47424767          SPFragmentGenerator(out, FragmentSearch, SP, BondsList, SubSetDimension, SubOrder-bits);
    4743           Free((void **)&BondsList, "molecule::SPFragmentGenerator: **BondsList");
     4768          Free(&BondsList);
    47444769        }
    47454770      } else {
     
    47754800    }
    47764801  }
    4777   Free((void **)&TouchedList, "molecule::SPFragmentGenerator: *TouchedList");
     4802  Free(&TouchedList);
    47784803  *out << Verbose(1+verbosity) << "End of SPFragmentGenerator, " << RootDistance << " away from Root " << *FragmentSearch->Root << " and SubOrder is " << SubOrder << "." << endl;
    47794804};
     
    49534978    *out << Verbose(0) << "Preparing subset for this root and calling generator." << endl;
    49544979    // prepare the subset and call the generator
    4955     BondsList = (bond **) Malloc(sizeof(bond *)*FragmentSearch.BondsPerSPCount[0], "molecule::PowerSetGenerator: **BondsList");
     4980    BondsList = Malloc<bond*>(FragmentSearch.BondsPerSPCount[0], "molecule::PowerSetGenerator: **BondsList");
    49564981    BondsList[0] = FragmentSearch.BondsPerSPList[0]->next;  // on SP level 0 there's only the root bond
    49574982
    49584983    SPFragmentGenerator(out, &FragmentSearch, 0, BondsList, FragmentSearch.BondsPerSPCount[0], Order);
    49594984
    4960     Free((void **)&BondsList, "molecule::PowerSetGenerator: **BondsList");
     4985    Free(&BondsList);
    49614986  } else {
    49624987    *out << Verbose(0) << "Not enough total number of edges to build " << Order << "-body fragments." << endl;
     
    50125037  *out << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl;
    50135038
    5014   ColorList = (enum Shading *) Malloc(sizeof(enum Shading)*AtomCount, "molecule::ScanForPeriodicCorrection: *ColorList");
     5039  ColorList = Malloc<enum Shading>(AtomCount, "molecule::ScanForPeriodicCorrection: *ColorList");
    50155040  while (flag) {
    50165041    // remove bonds that are beyond bonddistance
     
    50735098  // free allocated space from ReturnFullMatrixforSymmetric()
    50745099  delete(AtomStack);
    5075   Free((void **)&ColorList, "molecule::ScanForPeriodicCorrection: *ColorList");
    5076   Free((void **)&matrix, "molecule::ScanForPeriodicCorrection: *matrix");
     5100  Free(&ColorList);
     5101  Free(&matrix);
    50775102  *out << Verbose(2) << "End of ScanForPeriodicCorrection." << endl;
    50785103};
     
    50845109double * molecule::ReturnFullMatrixforSymmetric(double *symm)
    50855110{
    5086   double *matrix = (double *) Malloc(sizeof(double)*NDIM*NDIM, "molecule::ReturnFullMatrixforSymmetric: *matrix");
     5111  double *matrix = Malloc<double>(NDIM * NDIM, "molecule::ReturnFullMatrixforSymmetric: *matrix");
    50875112  matrix[0] = symm[0];
    50885113  matrix[1] = symm[1];
     
    52115236  // FragmentLowerOrdersList is a 2D-array of pointer to MoleculeListClass objects, one dimension represents the ANOVA expansion of a single order (i.e. 5)
    52125237  // with all needed lower orders that are subtracted, the other dimension is the BondOrder (i.e. from 1 to 5)
    5213   NumMoleculesOfOrder = (int *) Malloc(sizeof(int)*UpgradeCount, "molecule::FragmentBOSSANOVA: *NumMoleculesOfOrder");
    5214   FragmentLowerOrdersList = (Graph ***) Malloc(sizeof(Graph **)*UpgradeCount, "molecule::FragmentBOSSANOVA: ***FragmentLowerOrdersList");
     5238  NumMoleculesOfOrder = Malloc<int>(UpgradeCount, "molecule::FragmentBOSSANOVA: *NumMoleculesOfOrder");
     5239  FragmentLowerOrdersList = Malloc<Graph**>(UpgradeCount, "molecule::FragmentBOSSANOVA: ***FragmentLowerOrdersList");
    52155240
    52165241  // initialise the fragments structure
    5217   FragmentSearch.ShortestPathList = (int *) Malloc(sizeof(int)*AtomCount, "molecule::PowerSetGenerator: *ShortestPathList");
     5242  FragmentSearch.ShortestPathList = Malloc<int>(AtomCount, "molecule::PowerSetGenerator: *ShortestPathList");
    52185243  FragmentSearch.FragmentCounter = 0;
    52195244  FragmentSearch.FragmentSet = new KeySet;
     
    52505275
    52515276      // initialise Order-dependent entries of UniqueFragments structure
    5252       FragmentSearch.BondsPerSPList = (bond **) Malloc(sizeof(bond *)*Order*2, "molecule::PowerSetGenerator: ***BondsPerSPList");
    5253       FragmentSearch.BondsPerSPCount = (int *) Malloc(sizeof(int)*Order, "molecule::PowerSetGenerator: *BondsPerSPCount");
     5277      FragmentSearch.BondsPerSPList = Malloc<bond*>(Order * 2, "molecule::PowerSetGenerator: ***BondsPerSPList");
     5278      FragmentSearch.BondsPerSPCount = Malloc<int>(Order, "molecule::PowerSetGenerator: *BondsPerSPCount");
    52545279      for (int i=Order;i--;) {
    52555280        FragmentSearch.BondsPerSPList[2*i] = new bond();    // start node
     
    52625287      // allocate memory for all lower level orders in this 1D-array of ptrs
    52635288      NumLevels = 1 << (Order-1); // (int)pow(2,Order);
    5264       FragmentLowerOrdersList[RootNr] = (Graph **) Malloc(sizeof(Graph *)*NumLevels, "molecule::FragmentBOSSANOVA: **FragmentLowerOrdersList[]");
     5289      FragmentLowerOrdersList[RootNr] = Malloc<Graph*>(NumLevels, "molecule::FragmentBOSSANOVA: **FragmentLowerOrdersList[]");
    52655290      for (int i=0;i<NumLevels;i++)
    52665291        FragmentLowerOrdersList[RootNr][i] = NULL;
     
    53295354
    53305355      // free Order-dependent entries of UniqueFragments structure for next loop cycle
    5331       Free((void **)&FragmentSearch.BondsPerSPCount, "molecule::PowerSetGenerator: *BondsPerSPCount");
     5356      Free(&FragmentSearch.BondsPerSPCount);
    53325357      for (int i=Order;i--;) {
    53335358        delete(FragmentSearch.BondsPerSPList[2*i]);
    53345359        delete(FragmentSearch.BondsPerSPList[2*i+1]);
    53355360      }
    5336       Free((void **)&FragmentSearch.BondsPerSPList, "molecule::PowerSetGenerator: ***BondsPerSPList");
     5361      Free(&FragmentSearch.BondsPerSPList);
    53375362    }
    53385363  }
     
    53425367
    53435368  // cleanup FragmentSearch structure
    5344   Free((void **)&FragmentSearch.ShortestPathList, "molecule::PowerSetGenerator: *ShortestPathList");
     5369  Free(&FragmentSearch.ShortestPathList);
    53455370  delete(FragmentSearch.FragmentSet);
    53465371
     
    53735398      }
    53745399    }
    5375     Free((void **)&FragmentLowerOrdersList[RootNr], "molecule::FragmentBOSSANOVA: **FragmentLowerOrdersList[]");
     5400    Free(&FragmentLowerOrdersList[RootNr]);
    53765401    RootNr++;
    53775402  }
    5378   Free((void **)&FragmentLowerOrdersList, "molecule::FragmentBOSSANOVA: ***FragmentLowerOrdersList");
    5379   Free((void **)&NumMoleculesOfOrder, "molecule::FragmentBOSSANOVA: *NumMoleculesOfOrder");
     5403  Free(&FragmentLowerOrdersList);
     5404  Free(&NumMoleculesOfOrder);
    53805405
    53815406  *out << Verbose(0) << "End of FragmentBOSSANOVA." << endl;
     
    54675492  if (result) {
    54685493    *out << Verbose(5) << "Calculating distances" << endl;
    5469     Distances = (double *) Malloc(sizeof(double)*AtomCount, "molecule::IsEqualToWithinThreshold: Distances");
    5470     OtherDistances = (double *) Malloc(sizeof(double)*AtomCount, "molecule::IsEqualToWithinThreshold: OtherDistances");
     5494    Distances = Malloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: Distances");
     5495    OtherDistances = Malloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: OtherDistances");
    54715496    Walker = start;
    54725497    while (Walker->next != end) {
     
    54825507    /// ... sort each list (using heapsort (o(N log N)) from GSL)
    54835508    *out << Verbose(5) << "Sorting distances" << endl;
    5484     PermMap = (size_t *) Malloc(sizeof(size_t)*AtomCount, "molecule::IsEqualToWithinThreshold: *PermMap");
    5485     OtherPermMap = (size_t *) Malloc(sizeof(size_t)*AtomCount, "molecule::IsEqualToWithinThreshold: *OtherPermMap");
     5509    PermMap = Malloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermMap");
     5510    OtherPermMap = Malloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *OtherPermMap");
    54865511    gsl_heapsort_index (PermMap, Distances, AtomCount, sizeof(double), CompareDoubles);
    54875512    gsl_heapsort_index (OtherPermMap, OtherDistances, AtomCount, sizeof(double), CompareDoubles);
    5488     PermutationMap = (int *) Malloc(sizeof(int)*AtomCount, "molecule::IsEqualToWithinThreshold: *PermutationMap");
     5513    PermutationMap = Malloc<int>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermutationMap");
    54895514    *out << Verbose(5) << "Combining Permutation Maps" << endl;
    54905515    for(int i=AtomCount;i--;)
    54915516      PermutationMap[PermMap[i]] = (int) OtherPermMap[i];
    54925517
    5493     /// ... and compare them step by step, whether the difference is individiually(!) below \a threshold for all
     5518    /// ... and compare them step by step, whether the difference is individually(!) below \a threshold for all
    54945519    *out << Verbose(4) << "Comparing distances" << endl;
    54955520    flag = 0;
     
    54995524        flag = 1;
    55005525    }
    5501     Free((void **)&PermMap, "molecule::IsEqualToWithinThreshold: *PermMap");
    5502     Free((void **)&OtherPermMap, "molecule::IsEqualToWithinThreshold: *OtherPermMap");
    5503 
    5504     /// free memory
    5505     Free((void **)&Distances, "molecule::IsEqualToWithinThreshold: Distances");
    5506     Free((void **)&OtherDistances, "molecule::IsEqualToWithinThreshold: OtherDistances");
     5526
     5527    // free memory
     5528    Free(&PermMap);
     5529    Free(&OtherPermMap);
     5530    Free(&Distances);
     5531    Free(&OtherDistances);
    55075532    if (flag) { // if not equal
    5508       Free((void **)&PermutationMap, "molecule::IsEqualToWithinThreshold: *PermutationMap");
     5533      Free(&PermutationMap);
    55095534      result = false;
    55105535    }
     
    55325557  atom *Walker = NULL, *OtherWalker = NULL;
    55335558  *out << Verbose(3) << "Begin of GetFatherAtomicMap." << endl;
    5534   int *AtomicMap = (int *) Malloc(sizeof(int)*AtomCount, "molecule::GetAtomicMap: *AtomicMap");  //Calloc
     5559  int *AtomicMap = Malloc<int>(AtomCount, "molecule::GetAtomicMap: *AtomicMap");
    55355560  for (int i=AtomCount;i--;)
    55365561    AtomicMap[i] = -1;
  • src/molecules.hpp

    raba92d r13a574  
    207207
    208208  molecule *CopyMolecule();
     209  molecule* CopyMoleculeFromSubRegion(Vector offset, double *parallelepiped);
    209210
    210211  /// Fragment molecule by two different approaches:
  • src/parser.cpp

    raba92d r13a574  
    88
    99#include "helpers.hpp"
     10#include "memoryallocator.hpp"
    1011#include "parser.hpp"
    1112
     
    5657MatrixContainer::MatrixContainer() {
    5758  Indices = NULL;
    58   Header = (char **) Malloc(sizeof(char)*1, "MatrixContainer::MatrixContainer: **Header");
    59   Matrix = (double ***) Malloc(sizeof(double **)*(1), "MatrixContainer::MatrixContainer: ***Matrix"); // one more each for the total molecule
    60   RowCounter = (int *) Malloc(sizeof(int)*(1), "MatrixContainer::MatrixContainer: *RowCounter");
    61   ColumnCounter = (int *) Malloc(sizeof(int)*(1), "MatrixContainer::MatrixContainer: *ColumnCounter");
     59  Header = Malloc<char*>(1, "MatrixContainer::MatrixContainer: **Header");
     60  Matrix = Malloc<double**>(1, "MatrixContainer::MatrixContainer: ***Matrix"); // one more each for the total molecule
     61  RowCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *RowCounter");
     62  ColumnCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *ColumnCounter");
    6263  Header[0] = NULL;
    6364  Matrix[0] = NULL;
     
    7475      if ((ColumnCounter != NULL) && (RowCounter != NULL)) {
    7576          for(int j=RowCounter[i]+1;j--;)
    76             Free((void **)&Matrix[i][j], "MatrixContainer::~MatrixContainer: *Matrix[][]");
    77         Free((void **)&Matrix[i], "MatrixContainer::~MatrixContainer: **Matrix[]");
     77            Free(&Matrix[i][j]);
     78        Free(&Matrix[i]);
    7879      }
    7980    }
    8081    if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL))
    8182      for(int j=RowCounter[MatrixCounter]+1;j--;)
    82         Free((void **)&Matrix[MatrixCounter][j], "MatrixContainer::~MatrixContainer: *Matrix[MatrixCounter][]");
     83        Free(&Matrix[MatrixCounter][j]);
    8384    if (MatrixCounter != 0)
    84       Free((void **)&Matrix[MatrixCounter], "MatrixContainer::~MatrixContainer: **Matrix[MatrixCounter]");
    85     Free((void **)&Matrix, "MatrixContainer::~MatrixContainer: ***Matrix");
     85      Free(&Matrix[MatrixCounter]);
     86    Free(&Matrix);
    8687  }
    8788  if (Indices != NULL)
    8889    for(int i=MatrixCounter+1;i--;) {
    89       Free((void **)&Indices[i], "MatrixContainer::~MatrixContainer: *Indices[]");
    90     }
    91   Free((void **)&Indices, "MatrixContainer::~MatrixContainer: **Indices");
     90      Free(&Indices[i]);
     91    }
     92  Free(&Indices);
    9293 
    9394  if (Header != NULL)
    9495    for(int i=MatrixCounter+1;i--;)
    95       Free((void **)&Header[i], "MatrixContainer::~MatrixContainer: *Header[]");
    96   Free((void **)&Header, "MatrixContainer::~MatrixContainer: **Header");
    97   Free((void **)&RowCounter, "MatrixContainer::~MatrixContainer: *RowCounter");
    98   Free((void **)&ColumnCounter, "MatrixContainer::~MatrixContainer: *RowCounter");
     96      Free(&Header[i]);
     97  Free(&Header);
     98  Free(&RowCounter);
     99  Free(&ColumnCounter);
    99100};
    100101
     
    109110  if (Matrix == NULL) {
    110111    cout << " with trivial mapping." << endl;
    111     Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "MatrixContainer::InitialiseIndices: **Indices");
     112    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    112113    for(int i=MatrixCounter+1;i--;) {
    113       Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
     114      Indices[i] = Malloc<int>(RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
    114115      for(int j=RowCounter[i];j--;)
    115116        Indices[i][j] = j;
     
    119120    if (MatrixCounter != Matrix->MatrixCounter)
    120121      return false;
    121     Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "MatrixContainer::InitialiseIndices: **Indices");
     122    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    122123    for(int i=MatrixCounter+1;i--;) {
    123124      if (RowCounter[i] != Matrix->RowCounter[i])
    124125        return false;
    125       Indices[i] = (int *) Malloc(sizeof(int)*Matrix->RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
     126      Indices[i] = Malloc<int>(Matrix->RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
    126127      for(int j=Matrix->RowCounter[i];j--;) {
    127128        Indices[i][j] = Matrix->Indices[i][j];
     
    162163
    163164  // parse header
    164   Header[MatrixNr] = (char *) Malloc(sizeof(char)*1024, "MatrixContainer::ParseMatrix: *Header[]");
     165  Header[MatrixNr] = Malloc<char>(1024, "MatrixContainer::ParseMatrix: *Header[]");
    165166  for (int m=skiplines+1;m--;)
    166167    input.getline(Header[MatrixNr], 1023);
     
    197198  // allocate matrix if it's not zero dimension in one direction
    198199  if ((ColumnCounter[MatrixNr] > 0) && (RowCounter[MatrixNr] > -1)) {
    199     Matrix[MatrixNr] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixNr]+1), "MatrixContainer::ParseMatrix: **Matrix[]");
     200    Matrix[MatrixNr] = Malloc<double*>(RowCounter[MatrixNr] + 1, "MatrixContainer::ParseMatrix: **Matrix[]");
    200201 
    201202    // parse in each entry for this matrix
     
    209210    strncpy(Header[MatrixNr], line.str().c_str(), 1023); 
    210211    for(int j=0;j<RowCounter[MatrixNr];j++) {
    211       Matrix[MatrixNr][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[][]");
     212      Matrix[MatrixNr][j] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[][]");
    212213      input.getline(filename, 1023);
    213214      stringstream lines(filename);
     
    220221      }
    221222      //cout << endl;
    222       Matrix[MatrixNr][ RowCounter[MatrixNr] ] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
     223      Matrix[MatrixNr][ RowCounter[MatrixNr] ] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
    223224      for(int j=ColumnCounter[MatrixNr];j--;)
    224225        Matrix[MatrixNr][ RowCounter[MatrixNr] ][j] = 0.;
     
    274275
    275276  cout << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;
    276   Header = (char **) ReAlloc(Header, sizeof(char *)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
    277   Matrix = (double ***) ReAlloc(Matrix, sizeof(double **)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
    278   RowCounter = (int *) ReAlloc(RowCounter, sizeof(int)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: *RowCounter");
    279   ColumnCounter = (int *) ReAlloc(ColumnCounter, sizeof(int)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: *ColumnCounter");
     277  Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
     278  Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
     279  RowCounter = ReAlloc<int>(RowCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *RowCounter");
     280  ColumnCounter = ReAlloc<int>(ColumnCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *ColumnCounter");
    280281  for(int i=MatrixCounter+1;i--;) {
    281282    Matrix[i] = NULL;
     
    291292    if (!ParseMatrix(file.str().c_str(), skiplines, skipcolumns, i))
    292293      return false;
    293     Free((void **)&FragmentNumber, "MatrixContainer::ParseFragmentMatrix: *FragmentNumber");
     294    Free(&FragmentNumber);
    294295  }
    295296  return true;
     
    306307{
    307308  MatrixCounter = MCounter;
    308   Header = (char **) Malloc(sizeof(char *)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *Header");
    309   Matrix = (double ***) Malloc(sizeof(double **)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: ***Matrix"); // one more each for the total molecule
    310   RowCounter = (int *) Malloc(sizeof(int)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *RowCounter");
    311   ColumnCounter = (int *) Malloc(sizeof(int)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *ColumnCounter");
     309  Header = Malloc<char*>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *Header");
     310  Matrix = Malloc<double**>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: ***Matrix"); // one more each for the total molecule
     311  RowCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *RowCounter");
     312  ColumnCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *ColumnCounter");
    312313  for(int i=MatrixCounter+1;i--;) {
    313     Header[i] = (char *) Malloc(sizeof(char)*1024, "MatrixContainer::AllocateMatrix: *Header[i]");
     314    Header[i] = Malloc<char>(1024, "MatrixContainer::AllocateMatrix: *Header[i]");
    314315    strncpy(Header[i], GivenHeader[i], 1023);
    315316    RowCounter[i] = RCounter[i];
    316317    ColumnCounter[i] = CCounter[i];
    317     Matrix[i] = (double **) Malloc(sizeof(double *)*(RowCounter[i]+1), "MatrixContainer::AllocateMatrix: **Matrix[]"); 
     318    Matrix[i] = Malloc<double*>(RowCounter[i] + 1, "MatrixContainer::AllocateMatrix: **Matrix[]");
    318319    for(int j=RowCounter[i]+1;j--;) {
    319       Matrix[i][j] = (double *) Malloc(sizeof(double)*ColumnCounter[i], "MatrixContainer::AllocateMatrix: *Matrix[][]");
     320      Matrix[i][j] = Malloc<double>(ColumnCounter[i], "MatrixContainer::AllocateMatrix: *Matrix[][]");
    320321      for(int k=ColumnCounter[i];k--;)
    321322        Matrix[i][j][k] = 0.;
     
    466467    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    467468    line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix;
    468     Free((void **)&FragmentNumber, "*FragmentNumber");
     469    Free(&FragmentNumber);
    469470    output.open(line.str().c_str(), ios::out);
    470471    if (output == NULL) {
     
    520521{
    521522  cout << "Parsing energy indices." << endl;
    522   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "EnergyMatrix::ParseIndices: **Indices");
     523  Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices");
    523524  for(int i=MatrixCounter+1;i--;) {
    524     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "EnergyMatrix::ParseIndices: *Indices[]");
     525    Indices[i] = Malloc<int>(RowCounter[i], "EnergyMatrix::ParseIndices: *Indices[]");
    525526    for(int j=RowCounter[i];j--;)
    526527      Indices[i][j] = j;
     
    579580    // allocate last plus one matrix
    580581    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    581     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     582    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    582583    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    583       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     584      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    584585   
    585586    // try independently to parse global energysuffix file if present
     
    606607
    607608  cout << "Parsing force indices for " << MatrixCounter << " matrices." << endl;
    608   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "ForceMatrix::ParseIndices: **Indices");
     609  Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices");
    609610  line << name << FRAGMENTPREFIX << FORCESFILE;
    610611  input.open(line.str().c_str(), ios::in);
     
    619620    line.str(filename);
    620621    // parse the values
    621     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
     622    Indices[i] = Malloc<int>(RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
    622623    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    623624    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    624     Free((void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber");
     625    Free(&FragmentNumber);
    625626    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    626627      line >> Indices[i][j];
     
    629630    //cout << endl;
    630631  }
    631   Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
     632  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
    632633  for(int j=RowCounter[MatrixCounter];j--;) {
    633634    Indices[MatrixCounter][j] = j;
     
    714715    // allocate last plus one matrix
    715716    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    716     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     717    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    717718    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    718       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     719      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    719720
    720721    // try independently to parse global forcesuffix file if present
     
    743744 
    744745  cout << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;
    745   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "HessianMatrix::ParseIndices: **Indices");
     746  Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices");
    746747  line << name << FRAGMENTPREFIX << FORCESFILE;
    747748  input.open(line.str().c_str(), ios::in);
     
    756757    line.str(filename);
    757758    // parse the values
    758     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
     759    Indices[i] = Malloc<int>(RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
    759760    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    760761    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    761     Free((void **)&FragmentNumber, "HessianMatrix::ParseIndices: *FragmentNumber");
     762    Free(&FragmentNumber);
    762763    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    763764      line >> Indices[i][j];
     
    766767    //cout << endl;
    767768  }
    768   Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
     769  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
    769770  for(int j=RowCounter[MatrixCounter];j--;) {
    770771    Indices[MatrixCounter][j] = j;
     
    938939    // allocate last plus one matrix
    939940    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    940     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     941    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    941942    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    942       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     943      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    943944
    944945    // try independently to parse global forcesuffix file if present
     
    970971KeySetsContainer::~KeySetsContainer() {
    971972  for(int i=FragmentCounter;i--;)
    972     Free((void **)&KeySets[i], "KeySetsContainer::~KeySetsContainer: *KeySets[]");
     973    Free(&KeySets[i]);
    973974  for(int i=Order;i--;)
    974     Free((void **)&OrderSet[i], "KeySetsContainer::~KeySetsContainer: *OrderSet[]");
    975   Free((void **)&KeySets, "KeySetsContainer::~KeySetsContainer: **KeySets");
    976   Free((void **)&OrderSet, "KeySetsContainer::~KeySetsContainer: **OrderSet");
    977   Free((void **)&AtomCounter, "KeySetsContainer::~KeySetsContainer: *AtomCounter");
    978   Free((void **)&FragmentsPerOrder, "KeySetsContainer::~KeySetsContainer: *FragmentsPerOrder");
     975    Free(&OrderSet[i]);
     976  Free(&KeySets);
     977  Free(&OrderSet);
     978  Free(&AtomCounter);
     979  Free(&FragmentsPerOrder);
    979980};
    980981
     
    993994  FragmentCounter = FCounter;
    994995  cout << "Parsing key sets." << endl;
    995   KeySets = (int **) Malloc(sizeof(int *)*FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
     996  KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
    996997  for(int i=FragmentCounter;i--;)
    997998    KeySets[i] = NULL;
     
    10031004  }
    10041005
    1005   AtomCounter = (int *) Malloc(sizeof(int)*FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");
     1006  AtomCounter = Malloc<int>(FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");
    10061007  for(int i=0;(i<FragmentCounter) && (!input.eof());i++) {
    10071008    stringstream line;
    10081009    AtomCounter[i] = ACounter[i];
    10091010    // parse the values
    1010     KeySets[i] = (int *) Malloc(sizeof(int)*AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
     1011    KeySets[i] = Malloc<int>(AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
    10111012    for(int j=AtomCounter[i];j--;)
    10121013      KeySets[i][j] = -1;
    10131014    FragmentNumber = FixedDigitNumber(FragmentCounter, i);
    10141015    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
    1015     Free((void **)&FragmentNumber, "KeySetsContainer::ParseKeySets: *FragmentNumber");
     1016    Free(&FragmentNumber);
    10161017    input.getline(filename, 1023);
    10171018    line.str(filename);
     
    10471048
    10481049  // scan through all to determine fragments per order
    1049   FragmentsPerOrder = (int *) Malloc(sizeof(int)*Order, "KeySetsContainer::ParseManyBodyTerms: *FragmentsPerOrder");
     1050  FragmentsPerOrder = Malloc<int>(Order, "KeySetsContainer::ParseManyBodyTerms: *FragmentsPerOrder");
    10501051  for(int i=Order;i--;)
    10511052    FragmentsPerOrder[i] = 0;
     
    10611062
    10621063  // scan through all to gather indices to each order set
    1063   OrderSet = (int **) Malloc(sizeof(int *)*Order, "KeySetsContainer::ParseManyBodyTerms: **OrderSet");
     1064  OrderSet = Malloc<int*>(Order, "KeySetsContainer::ParseManyBodyTerms: **OrderSet");
    10641065  for(int i=Order;i--;)
    1065     OrderSet[i] = (int *) Malloc(sizeof(int)*FragmentsPerOrder[i], "KeySetsContainer::ParseManyBodyTermsKeySetsContainer::ParseManyBodyTerms: *OrderSet[]");
     1066    OrderSet[i] = Malloc<int>(FragmentsPerOrder[i], "KeySetsContainer::ParseManyBodyTermsKeySetsContainer::ParseManyBodyTerms: *OrderSet[]");
    10661067  for(int i=Order;i--;)
    10671068    FragmentsPerOrder[i] = 0;
  • src/stackclass.hpp

    raba92d r13a574  
    33
    44#include "verbose.hpp"
     5#include "memoryallocator.hpp"
    56
    67template <typename T> class StackClass;
     
    4344  NextFreeField = 0;
    4445  EntryCount = dimension;
    45   StackList = (T *) Malloc(sizeof(T)*EntryCount, "StackClass::StackClass: **StackList");
     46  StackList = Malloc<T>(EntryCount, "StackClass::StackClass: **StackList");
    4647};
    4748
     
    5051template <typename T> StackClass<T>::~StackClass()
    5152{
    52   Free((void **)&StackList, "StackClass::StackClass: **StackList");
     53  Free(&StackList);
    5354};
    5455
  • src/tesselation.cpp

    raba92d r13a574  
    88#include "helpers.hpp"
    99#include "linkedcell.hpp"
     10#include "memoryallocator.hpp"
    1011#include "tesselation.hpp"
    1112#include "tesselationhelpers.hpp"
  • src/tesselationunittest.cpp

    raba92d r13a574  
    8484  delete(TesselStruct);
    8585  for (LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    86     delete((*Runner)->Name);
     86    delete[]((*Runner)->Name);
    8787    delete((*Runner)->node);
    8888    delete(*Runner);
     
    178178    for (set<BoundaryTriangleSet*>::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); TriangleRunner++)
    179179      CPPUNIT_ASSERT_EQUAL( true, (*TriangleRunner)->ContainsBoundaryPoint(Walker) );
     180    delete(triangles);
    180181  }
    181182}
  • src/vector.cpp

    raba92d r13a574  
    88#include "defs.hpp"
    99#include "helpers.hpp"
     10#include "memoryallocator.hpp"
    1011#include "leastsquaremin.hpp"
    1112#include "vector.hpp"
     
    473474};
    474475
    475 /** Rotates the vector around the axis given by \a *axis by an angle of \a alpha.
     476/** Rotates the vector relative to the origin around the axis given by \a *axis by an angle of \a alpha.
    476477 * \param *axis rotation axis
    477478 * \param alpha rotation angle in radian
     
    484485  a.ProjectOntoPlane(axis);
    485486  // construct normal vector
    486   y.MakeNormalVector(axis,this);
     487  bool rotatable = y.MakeNormalVector(axis,&a);
     488  // The normal vector cannot be created if there is linar dependency.
     489  // Then the vector to rotate is on the axis and any rotation leads to the vector itself.
     490  if (!rotatable) {
     491    return;
     492  }
    487493  y.Scale(Norm());
    488494  // scale normal vector by sine and this vector by cosine
    489495  y.Scale(sin(alpha));
    490   Scale(cos(alpha));
     496  a.Scale(cos(alpha));
     497  CopyVector(Projection(axis));
    491498  // add scaled normal vector onto this vector
    492499  AddVector(&y);
     
    674681double * Vector::InverseMatrix(double *A)
    675682{
    676   double *B = (double *) Malloc(sizeof(double)*NDIM*NDIM, "Vector::InverseMatrix: *B");
     683  double *B = Malloc<double>(NDIM * NDIM, "Vector::InverseMatrix: *B");
    677684  double detA = RDET3(A);
    678685  double detAReci;
     
    12211228  return true;
    12221229};
     1230
     1231/**
     1232 * Checks whether this vector is within the parallelepiped defined by the given three vectors and
     1233 * their offset.
     1234 *
     1235 * @param offest for the origin of the parallelepiped
     1236 * @param three vectors forming the matrix that defines the shape of the parallelpiped
     1237 */
     1238bool Vector::IsInParallelepiped(Vector offset, double *parallelepiped)
     1239{
     1240  Vector a;
     1241  a.CopyVector(this);
     1242  a.SubtractVector(&offset);
     1243  a.InverseMatrixMultiplication(parallelepiped);
     1244  bool isInside = true;
     1245
     1246  for (int i=NDIM;i--;)
     1247    isInside = isInside && ((a.x[i] <= 1) && (a.x[i] >= 0));
     1248
     1249  return isInside;
     1250}
  • src/vector.hpp

    raba92d r13a574  
    6868  void AskPosition(double *cell_size, bool check);
    6969  bool Output(ofstream *out) const;
     70  bool IsInParallelepiped(Vector offset, double *parallelepiped);
    7071};
    7172
  • src/vectorunittest.cpp

    raba92d r13a574  
    5555void VectorTest::SimpleAlgebraTest()
    5656{
    57   Vector helper;
    5857  double factor;
     58  // copy vector
     59  fixture.Init(2.,3.,4.);
     60  CPPUNIT_ASSERT_EQUAL( Vector(2.,3.,4.), fixture );
    5961  // summation and scaling
    60   helper.CopyVector(&zero);
    61   helper.AddVector(&unit);
    62   CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
    63   helper.CopyVector(&zero);
    64   helper.SubtractVector(&unit);
    65   CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
    66   CPPUNIT_ASSERT_EQUAL( false, helper.IsZero() );
    67   helper.CopyVector(&zero);
    68   helper.AddVector(&zero);
    69   CPPUNIT_ASSERT_EQUAL( true, helper.IsZero() );
    70   helper.CopyVector(&notunit);
    71   helper.SubtractVector(&otherunit);
    72   CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
    73   helper.CopyVector(&unit);
    74   helper.AddVector(&otherunit);
    75   CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
    76   helper.CopyVector(&notunit);
    77   helper.SubtractVector(&unit);
    78   helper.SubtractVector(&otherunit);
    79   CPPUNIT_ASSERT_EQUAL( false, helper.IsZero() );
    80   helper.CopyVector(&unit);
    81   helper.Scale(0.98);
    82   CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
    83   helper.CopyVector(&unit);
    84   helper.Scale(1.);
    85   CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
    86   helper.CopyVector(&unit);
     62  fixture.CopyVector(&zero);
     63  fixture.AddVector(&unit);
     64  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
     65  fixture.CopyVector(&zero);
     66  fixture.SubtractVector(&unit);
     67  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
     68  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
     69  fixture.CopyVector(&zero);
     70  fixture.AddVector(&zero);
     71  CPPUNIT_ASSERT_EQUAL( true, fixture.IsZero() );
     72  fixture.CopyVector(&notunit);
     73  fixture.SubtractVector(&otherunit);
     74  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
     75  fixture.CopyVector(&unit);
     76  fixture.AddVector(&otherunit);
     77  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
     78  fixture.CopyVector(&notunit);
     79  fixture.SubtractVector(&unit);
     80  fixture.SubtractVector(&otherunit);
     81  CPPUNIT_ASSERT_EQUAL( false, fixture.IsZero() );
     82  fixture.CopyVector(&unit);
     83  fixture.Scale(0.98);
     84  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
     85  fixture.CopyVector(&unit);
     86  fixture.Scale(1.);
     87  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
     88  fixture.CopyVector(&unit);
    8789  factor = 0.98;
    88   helper.Scale(factor);
    89   CPPUNIT_ASSERT_EQUAL( false, helper.IsOne() );
    90   helper.CopyVector(&unit);
     90  fixture.Scale(factor);
     91  CPPUNIT_ASSERT_EQUAL( false, fixture.IsOne() );
     92  fixture.CopyVector(&unit);
    9193  factor = 1.;
    92   helper.Scale(factor);
    93   CPPUNIT_ASSERT_EQUAL( true, helper.IsOne() );
     94  fixture.Scale(factor);
     95  CPPUNIT_ASSERT_EQUAL( true, fixture.IsOne() );
    9496};
    9597
     
    183185void VectorTest::LineIntersectionTest()
    184186{
    185   Vector helper;
    186187  // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
    187   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
    188   CPPUNIT_ASSERT_EQUAL( zero, helper );
     188  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &unit, &zero, &zero, &two) );
     189  CPPUNIT_ASSERT_EQUAL( zero, fixture );
    189190
    190191  // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
    191   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
    192   CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), helper );
     192  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionWithPlane((ofstream *)&cout, &otherunit, &two, &unit, &notunit) );
     193  CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
    193194
    194195  // four vectors equal to zero
    195   CPPUNIT_ASSERT_EQUAL( false, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
    196   CPPUNIT_ASSERT_EQUAL( zero, helper );
     196  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &zero, &zero, &zero, &zero, NULL) );
     197  CPPUNIT_ASSERT_EQUAL( zero, fixture );
    197198
    198199  // four vectors equal to unit
    199   CPPUNIT_ASSERT_EQUAL( false, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
    200   CPPUNIT_ASSERT_EQUAL( zero, helper );
     200  CPPUNIT_ASSERT_EQUAL( false, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &unit, &unit, &unit, NULL) );
     201  CPPUNIT_ASSERT_EQUAL( zero, fixture );
    201202
    202203  // two equal lines
    203   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
    204   CPPUNIT_ASSERT_EQUAL( unit, helper );
     204  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &two, NULL) );
     205  CPPUNIT_ASSERT_EQUAL( unit, fixture );
    205206
    206207  // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
    207   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
    208   CPPUNIT_ASSERT_EQUAL( unit, helper );
     208  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &unit, &otherunit, NULL) );
     209  CPPUNIT_ASSERT_EQUAL( unit, fixture );
    209210
    210211  // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
    211   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
    212   CPPUNIT_ASSERT_EQUAL( zero, helper );
     212  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &zero, &zero, &two, NULL) );
     213  CPPUNIT_ASSERT_EQUAL( zero, fixture );
    213214
    214215  // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
    215   CPPUNIT_ASSERT_EQUAL( true, helper.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
    216   CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), helper );
    217 };
     216  CPPUNIT_ASSERT_EQUAL( true, fixture.GetIntersectionOfTwoLinesOnPlane((ofstream *)&cout, &unit, &two, &zero, &otherunit, NULL) );
     217  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
     218};
     219
     220/** UnitTest for vector rotations.
     221 */
     222void VectorTest::VectorRotationTest()
     223{
     224  fixture.Init(-1.,0.,0.);
     225
     226  // zero vector does not change
     227  fixture.CopyVector(&zero);
     228  fixture.RotateVector(&unit, 1.);
     229  CPPUNIT_ASSERT_EQUAL( zero, fixture );
     230
     231  fixture.RotateVector(&two, 1.);
     232  CPPUNIT_ASSERT_EQUAL( zero,  fixture);
     233
     234  // vector on axis does not change
     235  fixture.CopyVector(&unit);
     236  fixture.RotateVector(&unit, 1.);
     237  CPPUNIT_ASSERT_EQUAL( unit, fixture );
     238
     239  fixture.RotateVector(&unit, 1.);
     240  CPPUNIT_ASSERT_EQUAL( unit, fixture );
     241
     242  // rotations
     243  fixture.CopyVector(&otherunit);
     244  fixture.RotateVector(&unit, M_PI);
     245  CPPUNIT_ASSERT_EQUAL( Vector(0.,-1.,0.), fixture );
     246
     247  fixture.CopyVector(&otherunit);
     248  fixture.RotateVector(&unit, 2. * M_PI);
     249  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
     250
     251  fixture.CopyVector(&otherunit);
     252  fixture.RotateVector(&unit, 0);
     253  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
     254
     255  fixture.Init(0.,0.,1.);
     256  fixture.RotateVector(&notunit, M_PI);
     257  CPPUNIT_ASSERT_EQUAL( otherunit, fixture );
     258}
     259
     260/**
     261 * UnitTest for Vector::IsInParallelepiped().
     262 */
     263void VectorTest::IsInParallelepipedTest()
     264{
     265  double parallelepiped[NDIM*NDIM];
     266  parallelepiped[0] = 1;
     267  parallelepiped[1] = 0;
     268  parallelepiped[2] = 0;
     269  parallelepiped[3] = 0;
     270  parallelepiped[4] = 1;
     271  parallelepiped[5] = 0;
     272  parallelepiped[6] = 0;
     273  parallelepiped[7] = 0;
     274  parallelepiped[8] = 1;
     275
     276  fixture.CopyVector(zero);
     277  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     278  fixture.Init(2.5,2.5,2.5);
     279  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     280  fixture.Init(1.,1.,1.);
     281  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     282  fixture.Init(3.5,3.5,3.5);
     283  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     284  fixture.Init(2.,2.,2.);
     285  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     286  fixture.Init(2.,3.,2.);
     287  CPPUNIT_ASSERT_EQUAL( true, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     288  fixture.Init(-2.,2.,-1.);
     289  CPPUNIT_ASSERT_EQUAL( false, fixture.IsInParallelepiped(Vector(2.,2.,2.), parallelepiped) );
     290}
     291
    218292
    219293/********************************************** Main routine **************************************/
  • src/vectorunittest.hpp

    raba92d r13a574  
    2727    CPPUNIT_TEST ( ProjectionTest );
    2828    CPPUNIT_TEST ( LineIntersectionTest );
     29    CPPUNIT_TEST ( VectorRotationTest );
     30    CPPUNIT_TEST ( IsInParallelepipedTest );
    2931    CPPUNIT_TEST_SUITE_END();
    3032
    3133public:
    32       void setUp();
    33       void tearDown();
     34    void setUp();
     35    void tearDown();
    3436
    35      void UnityTest();
    36      void OperatorAlgebraTest();
    37      void SimpleAlgebraTest();
    38      void EuclidianScalarProductTest();
    39      void EuclidianNormTest();
    40      void EuclidianDistancesTest();
    41      void EuclidianAnglesTest();
    42      void ProjectionTest();
    43      void LineIntersectionTest();
     37    void UnityTest();
     38    void OperatorAlgebraTest();
     39    void SimpleAlgebraTest();
     40    void EuclidianScalarProductTest();
     41    void EuclidianNormTest();
     42    void EuclidianDistancesTest();
     43    void EuclidianAnglesTest();
     44    void ProjectionTest();
     45    void LineIntersectionTest();
     46    void VectorRotationTest();
     47    void IsInParallelepipedTest();
    4448
    4549private:
    46      Vector zero;
    47      Vector unit;
    48      Vector otherunit;
    49      Vector notunit;
    50      Vector two;
     50    // vector to execute tests on, may be modified during run
     51    Vector fixture;
     52    // never modify these during run, other tests might rely on them
     53    Vector zero;
     54    Vector unit;
     55    Vector otherunit;
     56    Vector notunit;
     57    Vector two;
    5158};
    5259
  • tests/testsuite.at

    raba92d r13a574  
    3333AT_DATA([test.conf], [])
    3434AT_CHECK([../../molecuilder test.conf -e ./ -p test.xyz], 0, [ignore], [ignore])
    35 AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1       10.000000000    10.000000000    10.000000000    0 # Number in molecule 0
     35AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1       10.000000000    10.000000000    10.000000000    0 # molecule nr 0
    3636], [ignore])
    37 AT_CHECK([cp test.conf main_pcp_linux], 0, [ignore], [ignore])
    38 AT_DATA([input], [aa 10. 10. 10. 1
     37AT_CHECK([mv test.conf main_pcp_linux], 0, [ignore], [ignore])
     38AT_DATA([input], [maa 10. 10. 10. 1
    3939s
    4040q
    4141])
    42 AT_CHECK([../../molecuilder -e ./ <input], 0, [ignore], [ignore])
     42AT_CHECK([../../molecuilder test.conf -e ./ <input], 0, [ignore], [ignore])
    4343AT_CHECK([diff main_pcp_linux test.conf], 0, [ignore], [ignore])
    4444# 4. test some more configuration
    45 AT_CHECK([../../molecuilder test.conf -e ./ -t -s -b -F -E -c -b -a -U -T -u], 0, [ignore], [stderr])
    46 AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [10
     45AT_CHECK([../../molecuilder test.conf -e ./ -t -s -b -E -c -b -a -U -T -u], 0, [ignore], [stderr])
     46AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [9
    4747], [ignore])
    4848AT_CLEANUP
     
    7575# 4. create the config and check it
    7676AT_CHECK([../../molecuilder test.conf -e ./ -p test.xyz], 0, [ignore], [ignore])
    77 AT_CHECK([fgrep "Ion_Type1_4" test.conf], 0, [Ion_Type1_4       8.532785963     4.787886018     2.645886050     0 # Number in molecule 6
     77AT_CHECK([fgrep "Ion_Type1_4" test.conf], 0, [Ion_Type1_4       8.532785963     4.787886018     2.645886050     0 # molecule nr 6
    7878], [ignore])
    7979AT_CHECK([fgrep "Ion_Type2_4" test.conf], 1, [ignore], [ignore])
Note: See TracChangeset for help on using the changeset viewer.