Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r986ed3 r952f38  
    1212#include "config.hpp"
    1313#include "element.hpp"
    14 #include "helpers.hpp"
    15 #include "info.hpp"
     14#include "Helpers/helpers.hpp"
     15#include "Helpers/Info.hpp"
    1616#include "linkedcell.hpp"
    17 #include "verbose.hpp"
    18 #include "log.hpp"
     17#include "Helpers/Verbose.hpp"
     18#include "Helpers/Log.hpp"
    1919#include "molecule.hpp"
    2020#include "tesselation.hpp"
    2121#include "tesselationhelpers.hpp"
    2222#include "World.hpp"
    23 #include "Plane.hpp"
    24 #include "Matrix.hpp"
     23#include "LinearAlgebra/Plane.hpp"
     24#include "LinearAlgebra/Matrix.hpp"
    2525#include "Box.hpp"
    2626
     
    301301 * \param *out output stream for debugging
    302302 * \param *mol molecule structure with Atom's and Bond's.
     303 * \param *BoundaryPts set of boundary points to use or NULL
    303304 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return
    304305 * \param *LCList atoms in LinkedCell list
     
    306307 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename.
    307308 */
    308 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
     309void FindConvexBorder(const molecule* mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    309310{
    310311        Info FunctionInfo(__func__);
     
    317318
    318319  // 1. Find all points on the boundary
    319   if (BoundaryPoints == NULL) {
    320       BoundaryFreeFlag = true;
    321       BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
     320  if (BoundaryPts == NULL) {
     321    BoundaryFreeFlag = true;
     322    BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    322323  } else {
    323       DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);
     324    BoundaryPoints = BoundaryPts;
     325    DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);
    324326  }
    325327
    326328// printing all inserted for debugging
    327   for (int axis=0; axis < NDIM; axis++)
    328     {
    329       DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl);
    330       int i=0;
    331       for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    332         if (runner != BoundaryPoints[axis].begin())
    333           DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second);
    334         else
    335           DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second);
    336         i++;
    337       }
    338       DoLog(0) && (Log() << Verbose(0) << endl);
    339     }
     329  for (int axis=0; axis < NDIM; axis++) {
     330    DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl);
     331    int i=0;
     332    for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
     333      if (runner != BoundaryPoints[axis].begin())
     334        DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second);
     335      else
     336        DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second);
     337      i++;
     338    }
     339    DoLog(0) && (Log() << Verbose(0) << endl);
     340  }
    340341
    341342  // 2. fill the boundary point list
     
    343344    for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++)
    344345        if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0))
    345           DoeLog(2) && (eLog()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl);
     346          DoLog(2) && (Log()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present." << endl);
    346347
    347348  DoLog(0) && (Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl);
     
    677678
    678679  IsAngstroem = configuration->GetIsAngstroem();
     680  BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    679681  GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem);
    680   BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    681682  LinkedCell *LCList = new LinkedCell(mol, 10.);
    682   FindConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, NULL);
     683  FindConvexBorder(mol, BoundaryPoints, TesselStruct, (const LinkedCell *&)LCList, NULL);
    683684  delete (LCList);
     685  delete[] BoundaryPoints;
    684686
    685687
     
    689691  else
    690692    clustervolume = ClusterVolume;
     693
     694  delete TesselStruct;
    691695
    692696  for (int i = 0; i < NDIM; i++)
     
    741745    mol->CenterInBox();
    742746  }
     747  delete GreatestDiameter;
    743748  // update Box of atoms by boundary
    744749  mol->SetBoxDimension(&BoxLengths);
     
    895900            }
    896901      }
     902  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
     903    delete LCList[*ListRunner];
     904    delete TesselStruct[(*ListRunner)];
     905  }
    897906
    898907  return Filling;
Note: See TracChangeset for help on using the changeset viewer.