Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r36166d rbdc91e  
    99
    1010#include <fstream>
    11 #include <iomanip>
    1211
    1312#include "helpers.hpp"
     
    16491648  bool AddFlag = false;
    16501649  LinkedCell *BoundaryPoints = NULL;
     1650  bool SuccessFlag = true;
    16511651
    16521652  cloud->GoToFirst();
     
    16621662    // get the next triangle
    16631663    triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints);
    1664     BTS = triangles->front();
    1665     if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
     1664    if (triangles != NULL)
     1665      BTS = triangles->front();
     1666    else
     1667      BTS = NULL;
     1668    delete triangles;
     1669    if ((BTS == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    16661670      DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl);
    16671671      cloud->GoToNext();
     
    17331737    } else { // something is wrong with FindClosestTriangleToPoint!
    17341738      DoeLog(1) && (eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl);
    1735       return false;
     1739      SuccessFlag = false;
     1740      break;
    17361741    }
    17371742    cloud->GoToNext();
     
    17401745  // exit
    17411746  delete (Center);
    1742   return true;
     1747  delete (BoundaryPoints);
     1748  return SuccessFlag;
    17431749}
    17441750;
     
    22432249  for (int i = 0; i < NDIM; i++) { // each axis
    22442250    LC->n[i] = LC->N[i] - 1; // current axis is topmost cell
    2245     for (LC->n[(i + 1) % NDIM] = 0; LC->n[(i + 1) % NDIM] < LC->N[(i + 1) % NDIM]; LC->n[(i + 1) % NDIM]++)
    2246       for (LC->n[(i + 2) % NDIM] = 0; LC->n[(i + 2) % NDIM] < LC->N[(i + 2) % NDIM]; LC->n[(i + 2) % NDIM]++) {
     2251    const int map[NDIM] = {i, (i + 1) % NDIM, (i + 2) % NDIM};
     2252    for (LC->n[map[1]] = 0; LC->n[map[1]] < LC->N[map[1]]; LC->n[map[1]]++)
     2253      for (LC->n[map[2]] = 0; LC->n[map[2]] < LC->N[map[2]]; LC->n[map[2]]++) {
    22472254        const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    22482255        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    22492256        if (List != NULL) {
    22502257          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    2251             if ((*Runner)->node->at(i) > maxCoordinate[i]) {
    2252               DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
    2253               maxCoordinate[i] = (*Runner)->node->at(i);
    2254               MaxPoint[i] = (*Runner);
     2258            if ((*Runner)->node->at(map[0]) > maxCoordinate[map[0]]) {
     2259              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
     2260              maxCoordinate[map[0]] = (*Runner)->node->at(map[0]);
     2261              MaxPoint[map[0]] = (*Runner);
    22552262            }
    22562263          }
Note: See TracChangeset for help on using the changeset viewer.