Changeset 8afe31 for molecuilder/src/moleculelist.cpp
- Timestamp:
- Oct 5, 2009, 4:05:53 PM (16 years ago)
- Children:
- 58808e
- Parents:
- e1f6d7 (diff), bf497f (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. - File:
-
- 1 edited
-
molecuilder/src/moleculelist.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/moleculelist.cpp
re1f6d7 r8afe31 8 8 #include "config.hpp" 9 9 #include "molecules.hpp" 10 #include "memoryallocator.hpp" 10 11 11 12 /*********************************** Functions for class MoleculeListClass *************************/ … … 412 413 413 414 // 0b. allocate memory for constants 414 FitConstant = (double ***) Malloc(sizeof(double **) *3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");415 FitConstant = Malloc<double**>(3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant"); 415 416 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[]"); 417 418 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[][]"); 419 420 } 420 421 } … … 461 462 462 463 // 0d. allocate final correction matrix 463 correction = (double **) Malloc(sizeof(double *) *a, "MoleculeListClass::AddHydrogenCorrection: **correction");464 correction = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **correction"); 464 465 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[]"); 466 467 467 468 // 1a. go through every molecule in the list … … 537 538 output.close(); 538 539 // 6. free memory of parsed matrices 539 FitConstant = (double ***) Malloc(sizeof(double **) *a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");540 FitConstant = Malloc<double**>(a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant"); 540 541 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[]"); 542 543 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[][]"); 544 545 } 545 546 } … … 702 703 //outputFragment.clear(); 703 704 delete (FragmentNumber); 704 //Free( (void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");705 //Free(&FragmentNumber); 705 706 } 706 707 cout << " done." << endl; … … 845 846 if ((FreeList) && (ListOfLocalAtoms != NULL)) { 846 847 // free the index lookup list 847 Free( (void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");848 Free(&ListOfLocalAtoms[FragmentCounter]); 848 849 if (FragmentCounter == 0) // first fragments frees the initial pointer to list 849 Free( (void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");850 Free(&ListOfLocalAtoms); 850 851 } 851 852 FragmentCounter--; … … 910 911 if (ListOfLocalAtoms == NULL) { // allocated initial pointer 911 912 // 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"); 913 914 if (ListOfLocalAtoms != NULL) { 914 915 for (int i = Counter; i--;) … … 954 955 if (FragmentList == NULL) { 955 956 KeySetCounter = Count(); 956 FragmentList = (Graph **) Malloc(sizeof(Graph *) *KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");957 FragmentList = Malloc<Graph*>(KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList"); 957 958 for (int i = KeySetCounter; i--;) 958 959 FragmentList[i] = NULL; … … 990 991 if ((FreeList) && (ListOfLocalAtoms != NULL)) { 991 992 // free the index lookup list 992 Free( (void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");993 Free(&ListOfLocalAtoms[FragmentCounter]); 993 994 if (FragmentCounter == 0) // first fragments frees the initial pointer to list 994 Free( (void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");995 Free(&ListOfLocalAtoms); 995 996 } 996 997 *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.
