source: src/tesselation.hpp@ 5f8660a

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
Last change on this file since 5f8660a was 88b400, checked in by Frederik Heber <heber@…>, 15 years ago

converted #define's to enums, consts and typedefs [Meyers, "Effective C++", item 1].

basic changes:

  • #define bla 1.3 -> const double bla = 1.3
  • #define bla "test" -> const char * const bla = "test
  • use class specific constants! (HULLEPSILON)

const int Class::bla = 1.3; (in .cpp)
static const int bla; (in .hpp inside class private section)

  • "enum hack": #define bla 5 -> enum { bla = 5 };
    • if const int bla=5; impossible
    • e.g. necessary if constant is used in array declaration (int blabla[bla];)

details:

  • new file defs.cpp where const double reside in and are referenced by extern "C" const double
  • joiner.cpp: main() had to be changed due to concatenation of two #define possible, of two const char * not
  • class specific constants: HULLEPSILON, BONDTHRESHOLD, SPHERERADIUS
  • extended GetPathLengthonCircumCircle to additional parameter HULLEPSILON
  • Property mode set to 100644
File size: 7.9 KB
RevLine 
[357fba]1/*
2 * tesselation.hpp
3 *
[d74077]4 * The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors.
5 * As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
[357fba]6 *
7 * Created on: Aug 3, 2009
8 * Author: heber
9 */
10
11#ifndef TESSELATION_HPP_
12#define TESSELATION_HPP_
13
14using namespace std;
15
[f66195]16/*********************************************** includes ***********************************/
17
[357fba]18// include config.h
19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
23#include <map>
24#include <list>
[7c14ec]25#include <set>
[856098]26#include <stack>
[357fba]27
[d74077]28#include "BoundaryMaps.hpp"
29#include "PointCloud.hpp"
30#include "TesselPoint.hpp"
[6b919f8]31#include "atom_particleinfo.hpp"
[952f38]32#include "Helpers/helpers.hpp"
[57f243]33#include "LinearAlgebra/Vector.hpp"
[357fba]34
[d74077]35
[f66195]36/****************************************** forward declarations *****************************/
37
[357fba]38class BoundaryPointSet;
39class BoundaryLineSet;
40class BoundaryTriangleSet;
[d74077]41class CandidateForTesselation;
[f66195]42class LinkedCell;
[357fba]43class Tesselation;
[d4c9ae]44class Plane;
[357fba]45
[f66195]46/********************************************** definitions *********************************/
47
[88b400]48enum { DoTecplotOutput=1 };
49enum { DoRaster3DOutput=1 };
50enum { DoVRMLOutput=0 };
[57066a]51
[88b400]52extern "C" const char *TecplotSuffix;
53extern "C" const char *Raster3DSuffix;
54extern "C" const char *VRMLSUffix;
55
56extern "C" const double ParallelEpsilon;
[fad93c]57
[357fba]58// ======================================================= some template functions =========================================
59
[f66195]60/********************************************** declarations *******************************/
[357fba]61
62// =========================================================== class TESSELATION ===========================================
63
64/** Contains the envelope to a PointCloud.
65 */
[5c7bf8]66class Tesselation : public PointCloud {
[357fba]67 public:
68
69 Tesselation();
[5c7bf8]70 virtual ~Tesselation();
[357fba]71
[776b64]72 void AddTesselationPoint(TesselPoint* Candidate, const int n);
[f1ef60a]73 void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
[d74077]74 void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
[474961]75 void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
76 void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
[16d866]77 void AddTesselationTriangle();
[776b64]78 void AddTesselationTriangle(const int nr);
[6613ec]79 void AddCandidateTriangle(CandidateForTesselation &CandidateLine, enum centers type);
[711ac2]80 void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC);
[474961]81 void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell *LC);
[16d866]82 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
83 void RemoveTesselationLine(class BoundaryLineSet *line);
84 void RemoveTesselationPoint(class BoundaryPointSet *point);
[6613ec]85 bool CheckDegeneracy(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) const;
[16d866]86
[357fba]87
88 // concave envelope
[ce70970]89 bool FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
[776b64]90 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
[f07f86d]91 void FindThirdPointForTesselation(const Vector &NormalVector, const Vector &SearchDirection, const Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class BoundaryPointSet * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
92 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, const BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
[6613ec]93 bool FindCandidatesforOpenLines(const double RADIUS, const LinkedCell *&LCList);
[f1ef60a]94 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
[e138de]95 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
[357fba]96
97 // convex envelope
[e138de]98 void TesselateOnBoundary(const PointCloud * const cloud);
99 void GuessStartingTriangle();
100 bool InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC);
101 double RemovePointFromTesselatedSurface(class BoundaryPointSet *point);
102 class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base);
103 double PickFarthestofTwoBaselines(class BoundaryLineSet *Base);
104 class BoundaryPointSet *IsConvexRectangle(class BoundaryLineSet *Base);
[244a84]105 IndexToIndex * FindAllDegeneratedTriangles();
106 IndexToIndex * FindAllDegeneratedLines();
[7c14ec]107 void RemoveDegeneratedTriangles();
[e138de]108 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
[262bae]109 int CorrectAllDegeneratedPolygons();
[16d866]110
[244a84]111 TesselPointSet * GetAllConnectedPoints(const TesselPoint* const Point) const;
112 TriangleSet * GetAllTriangles(const BoundaryPointSet * const Point) const;
113 ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
114 ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
[d74077]115 TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
116 TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
[244a84]117 class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
118 TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
[d74077]119 TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
120 BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
[241485]121 bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
[244a84]122 double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
[8db598]123 double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
124 BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
[776b64]125 bool AddBoundaryPoint(TesselPoint * Walker, const int n);
[d74077]126 DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
127 BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
[ab1932]128
[0077b5]129 // print for debugging
[776b64]130 void PrintAllBoundaryPoints(ofstream *out) const;
131 void PrintAllBoundaryLines(ofstream *out) const;
132 void PrintAllBoundaryTriangles(ofstream *out) const;
[0077b5]133
[57066a]134 // store envelope in file
[e138de]135 void Output(const char *filename, const PointCloud * const cloud);
[0077b5]136
[357fba]137 PointMap PointsOnBoundary;
138 LineMap LinesOnBoundary;
[1e168b]139 CandidateMap OpenLines;
[357fba]140 TriangleMap TrianglesOnBoundary;
141 int PointsOnBoundaryCount;
142 int LinesOnBoundaryCount;
143 int TrianglesOnBoundaryCount;
144
[5c7bf8]145 // PointCloud implementation for PointsOnBoundary
[776b64]146 virtual Vector *GetCenter(ofstream *out) const;
147 virtual TesselPoint *GetPoint() const;
148 virtual void GoToNext() const;
149 virtual void GoToFirst() const;
150 virtual bool IsEmpty() const;
151 virtual bool IsEnd() const;
[5c7bf8]152
[357fba]153 class BoundaryPointSet *BPS[2];
154 class BoundaryLineSet *BLS[3];
155 class BoundaryTriangleSet *BTS;
[57066a]156 class BoundaryTriangleSet *LastTriangle;
157 int TriangleFilesWritten;
[5c7bf8]158
[08ef35]159 private:
[88b400]160 static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
161
[f1ef60a]162 mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
[08ef35]163
[776b64]164 mutable PointMap::const_iterator InternalPointer;
[f1ef60a]165
[f67b6e]166 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
[6613ec]167 void FindDegeneratedCandidatesforOpenLines(TesselPoint * const Sprinter, const Vector * const OptCenter);
[357fba]168};
169
170
171#endif /* TESSELATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.