Changeset bdc91e for src/boundary.cpp


Ignore:
Timestamp:
Jul 1, 2010, 2:33:13 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
edb454
Parents:
8e0c63
git-author:
Frederik Heber <heber@…> (07/01/10 14:26:41)
git-committer:
Frederik Heber <heber@…> (07/01/10 14:33:13)
Message:

MEMFIXES: Tesselation routines were leaking memory.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r8e0c63 rbdc91e  
    296296 * \param *out output stream for debugging
    297297 * \param *mol molecule structure with Atom's and Bond's.
     298 * \param *BoundaryPts set of boundary points to use or NULL
    298299 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return
    299300 * \param *LCList atoms in LinkedCell list
     
    301302 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename.
    302303 */
    303 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
     304void FindConvexBorder(const molecule* mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    304305{
    305306        Info FunctionInfo(__func__);
     
    312313
    313314  // 1. Find all points on the boundary
    314   if (BoundaryPoints == NULL) {
    315       BoundaryFreeFlag = true;
    316       BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
     315  if (BoundaryPts == NULL) {
     316    BoundaryFreeFlag = true;
     317    BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    317318  } else {
    318       DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);
     319    BoundaryPoints = BoundaryPts;
     320    DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);
    319321  }
    320322
    321323// printing all inserted for debugging
    322   for (int axis=0; axis < NDIM; axis++)
    323     {
    324       DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl);
    325       int i=0;
    326       for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    327         if (runner != BoundaryPoints[axis].begin())
    328           DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second);
    329         else
    330           DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second);
    331         i++;
    332       }
    333       DoLog(0) && (Log() << Verbose(0) << endl);
    334     }
     324  for (int axis=0; axis < NDIM; axis++) {
     325    DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl);
     326    int i=0;
     327    for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
     328      if (runner != BoundaryPoints[axis].begin())
     329        DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second);
     330      else
     331        DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second);
     332      i++;
     333    }
     334    DoLog(0) && (Log() << Verbose(0) << endl);
     335  }
    335336
    336337  // 2. fill the boundary point list
     
    338339    for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++)
    339340        if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0))
    340           DoeLog(2) && (eLog()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl);
     341          DoLog(2) && (Log()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present." << endl);
    341342
    342343  DoLog(0) && (Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl);
     
    672673
    673674  IsAngstroem = configuration->GetIsAngstroem();
     675  BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    674676  GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem);
    675   BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    676677  LinkedCell *LCList = new LinkedCell(mol, 10.);
    677   FindConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, NULL);
     678  FindConvexBorder(mol, BoundaryPoints, TesselStruct, (const LinkedCell *&)LCList, NULL);
    678679  delete (LCList);
     680  delete[] BoundaryPoints;
    679681
    680682
     
    684686  else
    685687    clustervolume = ClusterVolume;
     688
     689  delete TesselStruct;
    686690
    687691  for (int i = 0; i < NDIM; i++)
     
    736740    mol->CenterInBox();
    737741  }
     742  delete GreatestDiameter;
    738743  // update Box of atoms by boundary
    739744  mol->SetBoxDimension(&BoxLengths);
     
    892897            }
    893898      }
     899  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
     900    delete LCList[*ListRunner];
     901    delete TesselStruct[(*ListRunner)];
     902  }
    894903  delete[](M);
    895904  delete[](MInverse);
Note: See TracChangeset for help on using the changeset viewer.