Changeset 613790


Ignore:
Timestamp:
Oct 19, 2014, 5:13:09 PM (10 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:
bb86bd
Parents:
cead3f
git-author:
Frederik Heber <heber@…> (09/25/14 18:26:20)
git-committer:
Frederik Heber <heber@…> (10/19/14 17:13:09)
Message:

FIX: Changed all performCriticalExit() into ASSERT() in tesselation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tesselation/tesselation.cpp

    rcead3f r613790  
    23312331  }
    23322332
    2333   if ((!CandidateLine.pointlist.empty()) && (!CandidateLine.CheckValidity(RADIUS, LC))) {
    2334     ELOG(0, "There were other points contained in the rolling sphere as well!");
    2335     performCriticalExit();
    2336   }
     2333  ASSERT(CandidateLine.pointlist.empty() || (CandidateLine.CheckValidity(RADIUS, LC)),
     2334      std::string("Tesselation::FindThirdPointForTesselation()")
     2335      +std::string("There were other points contained in the rolling sphere as well!"));
    23372336}
    23382337;
     
    28202819  // calculate central point
    28212820  triangles = FindTriangles(TrianglePoints);
    2822   if ((triangles != NULL) && (!triangles->empty())) {
    2823     for (TriangleList::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2824       PlaneNormal += (*Runner)->NormalVector;
    2825   } else {
    2826     ELOG(0, "Could not find any triangles for point " << *Point << ".");
    2827     performCriticalExit();
    2828   }
     2821  ASSERT((triangles == NULL) || (triangles->empty()),
     2822      std::string("Tesselation::GetCircleOfConnectedTriangles()")
     2823      +std::string("Could not find any triangles for point "+toString(*Point)+"."));
     2824  for (TriangleList::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
     2825    PlaneNormal += (*Runner)->NormalVector;
    28292826  PlaneNormal.Scale(1.0 / triangles->size());
    28302827  LOG(4, "DEBUG: Calculated PlaneNormal of all circle points is " << PlaneNormal << ".");
     
    28382835    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    28392836    AngleZero.ProjectOntoPlane(PlaneNormal);
    2840     if (AngleZero.NormSquared() < MYEPSILON) {
    2841       ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!");
    2842       performCriticalExit();
    2843     }
     2837    ASSERT (AngleZero.NormSquared() > MYEPSILON,
     2838        std::string("Tesselation::GetCircleOfConnectedTriangles() - ")
     2839        +std::string("AngleZero is 0 even with alternative reference.")
     2840        +std::string("The algorithm has to be changed here!"));
    28442841  }
    28452842  LOG(4, "DEBUG: Reference vector on this plane representing angle 0 is " << AngleZero << ".");
     
    29402937    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    29412938    AngleZero.ProjectOntoPlane(PlaneNormal);
    2942     if (AngleZero.NormSquared() < MYEPSILON) {
    2943       ELOG(0, "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!");
    2944       performCriticalExit();
    2945     }
     2939    ASSERT(AngleZero.NormSquared() > MYEPSILON,
     2940        std::string("Tesselation::GetCircleOfSetOfPoints() - ")
     2941        +std::string("AngleZero is 0 even with alternative reference.")
     2942        +std::string("The algorithm has to be changed here!"));
    29462943  }
    29472944  LOG(4, "DEBUG: Reference vector on this plane representing angle 0 is " << AngleZero << ".");
     
    29622959    LOG(4, "DEBUG: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << ".");
    29632960    InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner)));
    2964     if (!InserterTest.second) {
    2965       ELOG(0, "GetCircleOfSetOfPoints() got two atoms with same angle: " << *((InserterTest.first)->second) << " and " << (*listRunner));
    2966       performCriticalExit();
    2967     }
     2961    ASSERT(InserterTest.second,
     2962        std::string("Tesselation::GetCircleOfSetOfPoints() - ")
     2963        +std::string("got two atoms with same angle "+toString(*((InserterTest.first)->second)))
     2964        +std::string(" and "+toString((*listRunner))));
    29682965  }
    29692966
     
    33043301        TriangleCandidates[2] = *EndNode;
    33053302        triangle = GetPresentTriangle(TriangleCandidates);
    3306         if (triangle != NULL) {
    3307           ELOG(0, "New triangle already present, skipping!");
     3303        if (triangle != NULL) {
     3304          // check orientation of normal vector (that points inside)
     3305          ASSERT( triangle->NormalVector.ScalarProduct(NormalVector) > std::numeric_limits<double>::epsilon()*1e2,
     3306              "Tesselation::RemovePointFromTesselatedSurface() - New triangle with same orientation already present as "
     3307              +toString(*triangle)+"!");
     3308        }
     3309        if (0) {
    33083310          StartNode++;
    33093311          MiddleNode++;
     
    33383340        LOG(2, "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << ".");
    33393341        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
     3342        ASSERT(connectedPath->size() >= 2,
     3343            "Tesselation::RemovePointFromTesselatedSurface() - There are only two endpoints left!");
    33403344        if (connectedPath->size() == 2) { // we are done
    33413345          connectedPath->remove(*StartNode); // remove the start node
    33423346          connectedPath->remove(*EndNode); // remove the end node
    33433347          break;
    3344         } else if (connectedPath->size() < 2) { // something's gone wrong!
    3345           ELOG(0, "CRITICAL: There are only two endpoints left!");
    3346           performCriticalExit();
    33473348        } else {
    33483349          MiddleNode = StartNode;
     
    34893490    }
    34903491    default:
    3491       ELOG(0, "Number of wildcards is greater than 3, cannot happen!");
    3492       performCriticalExit();
     3492      ASSERT(0,
     3493          "Tesselation::FindTriangles() - Number of wildcards is greater than 3, cannot happen!");
    34933494      break;
    34943495  }
     
    37913792  for (int i = 0; i < 3; i++) { // look for the same line as BestLine (only it's its degenerated companion)
    37923793    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    3793       if (BestLine == BTS->lines[i]) {
    3794         ELOG(0, "BestLine is same as found line, something's wrong here!");
    3795         performCriticalExit();
    3796       }
     3794      ASSERT(BestLine != BTS->lines[i],
     3795          std::string("Tesselation::AddBoundaryPointByDegeneratedTriangle() - ")
     3796          +std::string("BestLine is same as found line, something's wrong here!"));
    37973797      BTS->lines[i]->triangles.insert(pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle));
    37983798      TempTriangle->lines[nr] = BTS->lines[i];
     
    39933993    // The Problem is probably due to two degenerated polygons being connected by a bridging, non-degenerated polygon, as somehow one node has
    39943994    // connections to either polygon ...
    3995     if (T->size() % 2 != 0) {
    3996       ELOG(0, " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!");
    3997       performCriticalExit();
    3998     }
     3995    ASSERT (T->size() % 2 == 0,
     3996        std::string("Tesselation::CorrectAllDegeneratedPolygons() - ")
     3997        +std::string(" degenerated polygon contains an odd number of triangles,")
     3998        +std::string(" probably contains bridging non-degenerated ones, too!"));
    39993999    TriangleSet::iterator TriangleWalker = T->begin(); // is the inner iterator
    40004000    /// 4a. Get NormalVector for one side (this is "front")
Note: See TracChangeset for help on using the changeset viewer.