Changeset a33931 for src/parser.cpp
- Timestamp:
- Oct 5, 2009, 4:05:53 PM (16 years ago)
- 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:
- c26f44
- Parents:
- 7dea7c (diff), c0917c (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
Legend:
- Unmodified
- Added
- Removed
-
src/parser.cpp
r7dea7c ra33931 8 8 9 9 #include "helpers.hpp" 10 #include "memoryallocator.hpp" 10 11 #include "parser.hpp" 11 12 … … 56 57 MatrixContainer::MatrixContainer() { 57 58 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 molecule60 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"); 62 63 Header[0] = NULL; 63 64 Matrix[0] = NULL; … … 74 75 if ((ColumnCounter != NULL) && (RowCounter != NULL)) { 75 76 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]); 78 79 } 79 80 } 80 81 if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL)) 81 82 for(int j=RowCounter[MatrixCounter]+1;j--;) 82 Free( (void **)&Matrix[MatrixCounter][j], "MatrixContainer::~MatrixContainer: *Matrix[MatrixCounter][]");83 Free(&Matrix[MatrixCounter][j]); 83 84 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); 86 87 } 87 88 if (Indices != NULL) 88 89 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); 92 93 93 94 if (Header != NULL) 94 95 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); 99 100 }; 100 101 … … 109 110 if (Matrix == NULL) { 110 111 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"); 112 113 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[]"); 114 115 for(int j=RowCounter[i];j--;) 115 116 Indices[i][j] = j; … … 119 120 if (MatrixCounter != Matrix->MatrixCounter) 120 121 return false; 121 Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "MatrixContainer::InitialiseIndices: **Indices");122 Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices"); 122 123 for(int i=MatrixCounter+1;i--;) { 123 124 if (RowCounter[i] != Matrix->RowCounter[i]) 124 125 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[]"); 126 127 for(int j=Matrix->RowCounter[i];j--;) { 127 128 Indices[i][j] = Matrix->Indices[i][j]; … … 162 163 163 164 // parse header 164 Header[MatrixNr] = (char *) Malloc(sizeof(char)*1024, "MatrixContainer::ParseMatrix: *Header[]");165 Header[MatrixNr] = Malloc<char>(1024, "MatrixContainer::ParseMatrix: *Header[]"); 165 166 for (int m=skiplines+1;m--;) 166 167 input.getline(Header[MatrixNr], 1023); … … 197 198 // allocate matrix if it's not zero dimension in one direction 198 199 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[]"); 200 201 201 202 // parse in each entry for this matrix … … 209 210 strncpy(Header[MatrixNr], line.str().c_str(), 1023); 210 211 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[][]"); 212 213 input.getline(filename, 1023); 213 214 stringstream lines(filename); … … 220 221 } 221 222 //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]][]"); 223 224 for(int j=ColumnCounter[MatrixNr];j--;) 224 225 Matrix[MatrixNr][ RowCounter[MatrixNr] ][j] = 0.; … … 274 275 275 276 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 molecule277 Matrix = (double ***) ReAlloc(Matrix, sizeof(double **)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule278 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"); 280 281 for(int i=MatrixCounter+1;i--;) { 281 282 Matrix[i] = NULL; … … 291 292 if (!ParseMatrix(file.str().c_str(), skiplines, skipcolumns, i)) 292 293 return false; 293 Free( (void **)&FragmentNumber, "MatrixContainer::ParseFragmentMatrix: *FragmentNumber");294 Free(&FragmentNumber); 294 295 } 295 296 return true; … … 306 307 { 307 308 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 molecule310 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"); 312 313 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]"); 314 315 strncpy(Header[i], GivenHeader[i], 1023); 315 316 RowCounter[i] = RCounter[i]; 316 317 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[]"); 318 319 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[][]"); 320 321 for(int k=ColumnCounter[i];k--;) 321 322 Matrix[i][j][k] = 0.; … … 466 467 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 467 468 line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix; 468 Free( (void **)&FragmentNumber, "*FragmentNumber");469 Free(&FragmentNumber); 469 470 output.open(line.str().c_str(), ios::out); 470 471 if (output == NULL) { … … 520 521 { 521 522 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"); 523 524 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[]"); 525 526 for(int j=RowCounter[i];j--;) 526 527 Indices[i][j] = j; … … 579 580 // allocate last plus one matrix 580 581 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[]"); 582 583 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[][]"); 584 585 585 586 // try independently to parse global energysuffix file if present … … 606 607 607 608 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"); 609 610 line << name << FRAGMENTPREFIX << FORCESFILE; 610 611 input.open(line.str().c_str(), ios::in); … … 619 620 line.str(filename); 620 621 // 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[]"); 622 623 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 623 624 //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:"; 624 Free( (void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber");625 Free(&FragmentNumber); 625 626 for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) { 626 627 line >> Indices[i][j]; … … 629 630 //cout << endl; 630 631 } 631 Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");632 Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]"); 632 633 for(int j=RowCounter[MatrixCounter];j--;) { 633 634 Indices[MatrixCounter][j] = j; … … 714 715 // allocate last plus one matrix 715 716 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[]"); 717 718 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[][]"); 719 720 720 721 // try independently to parse global forcesuffix file if present … … 743 744 744 745 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"); 746 747 line << name << FRAGMENTPREFIX << FORCESFILE; 747 748 input.open(line.str().c_str(), ios::in); … … 756 757 line.str(filename); 757 758 // 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[]"); 759 760 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 760 761 //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:"; 761 Free( (void **)&FragmentNumber, "HessianMatrix::ParseIndices: *FragmentNumber");762 Free(&FragmentNumber); 762 763 for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) { 763 764 line >> Indices[i][j]; … … 766 767 //cout << endl; 767 768 } 768 Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");769 Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]"); 769 770 for(int j=RowCounter[MatrixCounter];j--;) { 770 771 Indices[MatrixCounter][j] = j; … … 938 939 // allocate last plus one matrix 939 940 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[]"); 941 942 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[][]"); 943 944 944 945 // try independently to parse global forcesuffix file if present … … 970 971 KeySetsContainer::~KeySetsContainer() { 971 972 for(int i=FragmentCounter;i--;) 972 Free( (void **)&KeySets[i], "KeySetsContainer::~KeySetsContainer: *KeySets[]");973 Free(&KeySets[i]); 973 974 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); 979 980 }; 980 981 … … 993 994 FragmentCounter = FCounter; 994 995 cout << "Parsing key sets." << endl; 995 KeySets = (int **) Malloc(sizeof(int *)*FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");996 KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets"); 996 997 for(int i=FragmentCounter;i--;) 997 998 KeySets[i] = NULL; … … 1003 1004 } 1004 1005 1005 AtomCounter = (int *) Malloc(sizeof(int)*FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");1006 AtomCounter = Malloc<int>(FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter"); 1006 1007 for(int i=0;(i<FragmentCounter) && (!input.eof());i++) { 1007 1008 stringstream line; 1008 1009 AtomCounter[i] = ACounter[i]; 1009 1010 // 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[]"); 1011 1012 for(int j=AtomCounter[i];j--;) 1012 1013 KeySets[i][j] = -1; 1013 1014 FragmentNumber = FixedDigitNumber(FragmentCounter, i); 1014 1015 //cout << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:"; 1015 Free( (void **)&FragmentNumber, "KeySetsContainer::ParseKeySets: *FragmentNumber");1016 Free(&FragmentNumber); 1016 1017 input.getline(filename, 1023); 1017 1018 line.str(filename); … … 1047 1048 1048 1049 // 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"); 1050 1051 for(int i=Order;i--;) 1051 1052 FragmentsPerOrder[i] = 0; … … 1061 1062 1062 1063 // 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"); 1064 1065 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[]"); 1066 1067 for(int i=Order;i--;) 1067 1068 FragmentsPerOrder[i] = 0;
Note:
See TracChangeset
for help on using the changeset viewer.