Ignore:
Timestamp:
Oct 5, 2009, 2:35:06 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
bf497f
Parents:
2aea0b (diff), 14db08 (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 'ConcaveHull' of ssh://stud64d-02/home/metzler/workspace/espack into ConcaveHull

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r2aea0b r7794d8  
    77#include "config.hpp"
    88#include "molecules.hpp"
     9#include "memoryallocator.hpp"
    910
    1011/*********************************** Functions for class MoleculeListClass *************************/
     
    375376
    376377  // 0b. allocate memory for constants
    377   FitConstant = (double ***) Malloc(sizeof(double **) * 3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     378  FitConstant = Malloc<double**>(3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    378379  for (int k = 0; k < 3; k++) {
    379     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     380    FitConstant[k] = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    380381    for (int i = a; i--;) {
    381       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     382      FitConstant[k][i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    382383    }
    383384  }
     
    424425
    425426  // 0d. allocate final correction matrix
    426   correction = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **correction");
     427  correction = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **correction");
    427428  for (int i = a; i--;)
    428     correction[i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
     429    correction[i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
    429430
    430431  // 1a. go through every molecule in the list
     
    500501  output.close();
    501502  // 6. free memory of parsed matrices
    502   FitConstant = (double ***) Malloc(sizeof(double **) * a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     503  FitConstant = Malloc<double**>(a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    503504  for (int k = 0; k < 3; k++) {
    504     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     505    FitConstant[k] = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    505506    for (int i = a; i--;) {
    506       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     507      FitConstant[k][i] = Malloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    507508    }
    508509  }
     
    665666    //outputFragment.clear();
    666667    delete (FragmentNumber);
    667     //Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");
     668    //Free(&FragmentNumber);
    668669  }
    669670  cout << " done." << endl;
     
    808809  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    809810    // free the index lookup list
    810     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
     811    Free(&ListOfLocalAtoms[FragmentCounter]);
    811812    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    812       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     813      Free(&ListOfLocalAtoms);
    813814  }
    814815  FragmentCounter--;
     
    873874  if (ListOfLocalAtoms == NULL) { // allocated initial pointer
    874875    // allocate and set each field to NULL
    875     ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **) * Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     876    ListOfLocalAtoms = Malloc<atom**>(Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    876877    if (ListOfLocalAtoms != NULL) {
    877878      for (int i = Counter; i--;)
     
    917918  if (FragmentList == NULL) {
    918919    KeySetCounter = Count();
    919     FragmentList = (Graph **) Malloc(sizeof(Graph *) * KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
     920    FragmentList = Malloc<Graph*>(KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
    920921    for (int i = KeySetCounter; i--;)
    921922      FragmentList[i] = NULL;
     
    953954  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    954955    // free the index lookup list
    955     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
     956    Free(&ListOfLocalAtoms[FragmentCounter]);
    956957    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    957       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
     958      Free(&ListOfLocalAtoms);
    958959  }
    959960  *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
Note: See TracChangeset for help on using the changeset viewer.