Changeset 390a2b for molecuilder/src/moleculelist.cpp
- Timestamp:
- Sep 21, 2009, 11:48:42 AM (16 years ago)
- Children:
- 14db08, 39d983
- Parents:
- bc3953
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/moleculelist.cpp
rbc3953 r390a2b 7 7 #include "config.hpp" 8 8 #include "molecules.hpp" 9 #include "memoryallocator.hpp" 9 10 10 11 /*********************************** Functions for class MoleculeListClass *************************/ … … 375 376 376 377 // 0b. allocate memory for constants 377 FitConstant = (double ***) Malloc(sizeof(double **) *3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");378 FitConstant = Malloc<double**>(3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant"); 378 379 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[]"); 380 381 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[][]"); 382 383 } 383 384 } … … 424 425 425 426 // 0d. allocate final correction matrix 426 correction = (double **) Malloc(sizeof(double *) *a, "MoleculeListClass::AddHydrogenCorrection: **correction");427 correction = Malloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **correction"); 427 428 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[]"); 429 430 430 431 // 1a. go through every molecule in the list … … 500 501 output.close(); 501 502 // 6. free memory of parsed matrices 502 FitConstant = (double ***) Malloc(sizeof(double **) *a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");503 FitConstant = Malloc<double**>(a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant"); 503 504 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[]"); 505 506 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[][]"); 507 508 } 508 509 } … … 665 666 //outputFragment.clear(); 666 667 delete (FragmentNumber); 667 //Free( (void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");668 //Free(&FragmentNumber); 668 669 } 669 670 cout << " done." << endl; … … 808 809 if ((FreeList) && (ListOfLocalAtoms != NULL)) { 809 810 // free the index lookup list 810 Free( (void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");811 Free(&ListOfLocalAtoms[FragmentCounter]); 811 812 if (FragmentCounter == 0) // first fragments frees the initial pointer to list 812 Free( (void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");813 Free(&ListOfLocalAtoms); 813 814 } 814 815 FragmentCounter--; … … 873 874 if (ListOfLocalAtoms == NULL) { // allocated initial pointer 874 875 // 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"); 876 877 if (ListOfLocalAtoms != NULL) { 877 878 for (int i = Counter; i--;) … … 917 918 if (FragmentList == NULL) { 918 919 KeySetCounter = Count(); 919 FragmentList = (Graph **) Malloc(sizeof(Graph *) *KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");920 FragmentList = Malloc<Graph*>(KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList"); 920 921 for (int i = KeySetCounter; i--;) 921 922 FragmentList[i] = NULL; … … 953 954 if ((FreeList) && (ListOfLocalAtoms != NULL)) { 954 955 // free the index lookup list 955 Free( (void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");956 Free(&ListOfLocalAtoms[FragmentCounter]); 956 957 if (FragmentCounter == 0) // first fragments frees the initial pointer to list 957 Free( (void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");958 Free(&ListOfLocalAtoms); 958 959 } 959 960 *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.