Changeset 7dea7c for src/boundary.cpp


Ignore:
Timestamp:
Oct 2, 2009, 3:19:51 PM (16 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:
a33931, aba92d
Parents:
e4a379
Message:

Fixes to the (Non)ConvexTesselation, working with 1_2_dimethoxyethylene

minor changes:

major changes:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    re4a379 r7dea7c  
    572572
    573573  // third step: IsConvexRectangle
    574   LineRunner = TesselStruct->LinesOnBoundary.begin();
    575   LineAdvance = LineRunner;  // we need an advanced line, as the LineRunner might get removed
    576   while (LineRunner != TesselStruct->LinesOnBoundary.end()) {
    577     LineAdvance++;
    578     line = LineRunner->second;
    579     *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;
    580     //if (LineAdvance != TesselStruct->LinesOnBoundary.end())
    581       //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;
    582     if (!line->CheckConvexityCriterion(out)) {
    583       *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;
    584 
    585       // take highest of both lines
    586       point = TesselStruct->IsConvexRectangle(out, line);
    587       if (point != NULL)
    588         volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);
    589     }
    590     LineRunner = LineAdvance;
    591   }
     574//  LineRunner = TesselStruct->LinesOnBoundary.begin();
     575//  LineAdvance = LineRunner;  // we need an advanced line, as the LineRunner might get removed
     576//  while (LineRunner != TesselStruct->LinesOnBoundary.end()) {
     577//    LineAdvance++;
     578//    line = LineRunner->second;
     579//    *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;
     580//    //if (LineAdvance != TesselStruct->LinesOnBoundary.end())
     581//      //*out << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;
     582//    if (!line->CheckConvexityCriterion(out)) {
     583//      *out << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;
     584//
     585//      // take highest of both lines
     586//      point = TesselStruct->IsConvexRectangle(out, line);
     587//      if (point != NULL)
     588//        volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);
     589//    }
     590//    LineRunner = LineAdvance;
     591//  }
    592592
    593593  CalculateConcavityPerBoundaryPoint(out, TesselStruct);
     
    600600};
    601601
    602 /** Calculates the concavity for each of the BoundaryPointSet's in a Tesselation.
    603  * Sets BoundaryPointSet::value equal to the number of connected lines that are not convex.
    604  * \param *out output stream for debugging
    605  * \param *TesselStruct pointer to Tesselation structure
    606  */
    607 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct)
    608 {
    609   class BoundaryPointSet *point = NULL;
    610   class BoundaryLineSet *line = NULL;
    611   // calculate remaining concavity
    612   for (PointMap::iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
    613     point = PointRunner->second;
    614     *out << Verbose(1) << "INFO: Current point is " << *point << "." << endl;
    615     point->value = 0;
    616     for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    617       line = LineRunner->second;
    618       *out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    619       if (!line->CheckConvexityCriterion(out))
    620         point->value += 1;
    621     }
    622   }
    623 };
    624 
    625 /** Stores triangles to file.
    626  * \param *out output stream for debugging
    627  * \param *mol molecule with atoms and bonds
    628  * \param *filename prefix of filename
    629  * \param *extraSuffix intermediate suffix
    630  */
    631 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)
    632 {
    633   // 4. Store triangles in tecplot file
    634   if (filename != NULL) {
    635     if (DoTecplotOutput) {
    636       string OutputName(filename);
    637       OutputName.append(extraSuffix);
    638       OutputName.append(TecplotSuffix);
    639       ofstream *tecplot = new ofstream(OutputName.c_str());
    640       WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
    641       tecplot->close();
    642       delete(tecplot);
    643     }
    644     if (DoRaster3DOutput) {
    645       string OutputName(filename);
    646       OutputName.append(extraSuffix);
    647       OutputName.append(Raster3DSuffix);
    648       ofstream *rasterplot = new ofstream(OutputName.c_str());
    649       WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
    650       rasterplot->close();
    651       delete(rasterplot);
    652     }
    653   }
    654 };
    655602
    656603/** Determines the volume of a cluster.
     
    699646
    700647  return volume;
    701 }
    702 ;
     648};
     649
     650/** Stores triangles to file.
     651 * \param *out output stream for debugging
     652 * \param *mol molecule with atoms and bonds
     653 * \param *filename prefix of filename
     654 * \param *extraSuffix intermediate suffix
     655 */
     656void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)
     657{
     658  // 4. Store triangles in tecplot file
     659  if (filename != NULL) {
     660    if (DoTecplotOutput) {
     661      string OutputName(filename);
     662      OutputName.append(extraSuffix);
     663      OutputName.append(TecplotSuffix);
     664      ofstream *tecplot = new ofstream(OutputName.c_str());
     665      WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
     666      tecplot->close();
     667      delete(tecplot);
     668    }
     669    if (DoRaster3DOutput) {
     670      string OutputName(filename);
     671      OutputName.append(extraSuffix);
     672      OutputName.append(Raster3DSuffix);
     673      ofstream *rasterplot = new ofstream(OutputName.c_str());
     674      WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
     675      rasterplot->close();
     676      delete(rasterplot);
     677    }
     678  }
     679};
    703680
    704681/** Creates multiples of the by \a *mol given cluster and suspends them in water with a given final density.
     
    990967void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL)
    991968{
    992   int N = 0;
    993969  bool freeLC = false;
    994970
     
    1005981  LineMap::iterator testline;
    1006982  *out << Verbose(0) << "Begin of FindNonConvexBorder\n";
    1007   bool flag = false;  // marks whether we went once through all baselines without finding any without two triangles
    1008   bool failflag = false;
     983  bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
     984  bool TesselationFailFlag = false;
    1009985
    1010986  // initialise Linked Cell
     
    1020996  baseline = mol->TesselStruct->LinesOnBoundary.begin();
    1021997  baseline++; // skip first line
    1022   while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (flag)) {
     998  while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    1023999    if (baseline->second->triangles.size() == 1) {
    10241000      // 3. find next triangle
    1025       failflag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    1026       flag = flag || failflag;
    1027       if (!failflag)
     1001      TesselationFailFlag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
     1002      OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
     1003      if (!TesselationFailFlag)
    10281004        cerr << "WARNING: FindNextSuitableTriangle failed." << endl;
    10291005
    10301006      // write temporary envelope
    10311007      if (filename != NULL) {
    1032         if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0) || (mol->TesselStruct->TrianglesOnBoundary.size() > 8520 && mol->TesselStruct->TrianglesOnBoundary.size() <= 8530)))) { // if we have a new triangle and want to output each new triangle configuration
     1008        if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    10331009          mol->TesselStruct->Output(out, filename, mol);
    10341010        }
    10351011      }
    10361012      baseline = mol->TesselStruct->LinesOnBoundary.end();
     1013      *out << Verbose(2) << "Baseline set to end." << endl;
    10371014    } else {
    10381015      //cout << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
     
    10411018    }
    10421019
    1043     N++;
    1044     if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (flag)) {
     1020    if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    10451021      baseline = mol->TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    1046       baseline++;
    1047       flag = false;
    1048     }
    1049   }
     1022      OneLoopWithoutSuccessFlag = false;
     1023    }
     1024    baseline++;
     1025  }
     1026  // check envelope for consistency
     1027  CheckListOfBaselines(out, mol->TesselStruct);
     1028
    10501029  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    10511030  mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList);
     
    10671046  mol->TesselStruct->RemoveDegeneratedTriangles();
    10681047
    1069   cout << Verbose(2) << "Check: List of Baselines with not two connected triangles:" << endl;
    1070   int counter = 0;
    1071   for (testline = mol->TesselStruct->LinesOnBoundary.begin(); testline != mol->TesselStruct->LinesOnBoundary.end(); testline++) {
    1072     if (testline->second->triangles.size() != 2) {
    1073       cout << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
    1074       counter++;
    1075     }
    1076   }
    1077   if (counter == 0)
    1078     *out << Verbose(2) << "None." << endl;
     1048  // check envelope for consistency
     1049  CheckListOfBaselines(out, mol->TesselStruct);
    10791050
    10801051  // write final envelope
Note: See TracChangeset for help on using the changeset viewer.