- Timestamp:
- Jun 29, 2010, 3:37:58 PM (15 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:
- 56fb09, bdc91e
- Parents:
- ef7d30
- git-author:
- Frederik Heber <heber@…> (06/29/10 15:25:53)
- git-committer:
- Frederik Heber <heber@…> (06/29/10 15:37:58)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/parser.cpp
ref7d30 r8e0c63 76 76 MatrixContainer::~MatrixContainer() { 77 77 if (Matrix != NULL) { 78 // free Matrix[MatrixCounter] 79 if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL)) 80 for(int j=RowCounter[MatrixCounter]+1;j--;) 81 delete[](Matrix[MatrixCounter][j]); 82 //if (MatrixCounter != 0) 83 delete[](Matrix[MatrixCounter]); 84 // free all matrices but ultimate one 78 85 for(int i=MatrixCounter;i--;) { 79 86 if ((ColumnCounter != NULL) && (RowCounter != NULL)) { … … 83 90 } 84 91 } 85 if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL))86 for(int j=RowCounter[MatrixCounter]+1;j--;)87 delete[](Matrix[MatrixCounter][j]);88 if (MatrixCounter != 0)89 delete[](Matrix[MatrixCounter]);90 92 delete[](Matrix); 91 93 } 94 // free indices 92 95 if (Indices != NULL) 93 96 for(int i=MatrixCounter+1;i--;) { … … 96 99 delete[](Indices); 97 100 101 // free header and counters 98 102 if (Header != NULL) 99 103 for(int i=MatrixCounter+1;i--;) … … 168 172 169 173 // parse header 174 if (Header[MatrixNr] != NULL) 175 delete[] Header[MatrixNr]; 170 176 Header[MatrixNr] = new char[1024]; 171 177 for (int m=skiplines+1;m--;) … … 207 213 // allocate matrix if it's not zero dimension in one direction 208 214 if ((ColumnCounter[MatrixNr] > 0) && (RowCounter[MatrixNr] > -1)) { 215 if (Matrix[MatrixNr] != NULL) 216 delete[] Matrix[MatrixNr]; 209 217 Matrix[MatrixNr] = new double*[RowCounter[MatrixNr] + 1]; 210 218 for(int j=0;j<RowCounter[MatrixNr]+1;j++) 219 Matrix[MatrixNr][j] = 0; 220 211 221 // parse in each entry for this matrix 212 222 input.clear(); … … 219 229 strncpy(Header[MatrixNr], line.str().c_str(), 1023); 220 230 for(int j=0;j<RowCounter[MatrixNr];j++) { 231 if (Matrix[MatrixNr][j] != NULL) 232 delete[] Matrix[MatrixNr][j]; 221 233 Matrix[MatrixNr][j] = new double[ColumnCounter[MatrixNr]]; 234 for(int k=0;k<ColumnCounter[MatrixNr];k++) 235 Matrix[MatrixNr][j][k] = 0; 236 222 237 input.getline(filename, 1023); 223 238 stringstream lines(filename); … … 229 244 //Log() << Verbose(1) << " " << setprecision(2) << Matrix[MatrixNr][j][k] << endl; 230 245 } 246 if (Matrix[MatrixNr][ RowCounter[MatrixNr] ] != NULL) 247 delete[] Matrix[MatrixNr][ RowCounter[MatrixNr] ]; 231 248 Matrix[MatrixNr][ RowCounter[MatrixNr] ] = new double[ColumnCounter[MatrixNr]]; 232 249 for(int j=ColumnCounter[MatrixNr];j--;)
Note:
See TracChangeset
for help on using the changeset viewer.