source: src/tesselation.hpp@ 7d059d

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 7d059d was af2c424, checked in by Frederik Heber <heber@…>, 14 years ago

LinkedCell constructor rewritten.

  • had to introduce getValue(iterator) to: molecule, tesselation, LinkedCell::LinkedNodes
  • LinkedCell::LinkedNodes is not a typedef anymore
  • new class LinkedCell::LinkedNodes derived from stl::list<TesselPoint *> to add getValue(iterator).
  • LinkedCell constructors changed:
    • use template for all classes that have begin(), end() and ... sigh ... getValue()
    • Argh! STL containers do all have begin() and end() but no consistent operator* (maps return pair<> ...)
    • specialized version for PointCloud derivatives
    • various functions had to be changed due to changed signature of LinkedCell constructor
  • Property mode set to 100644
File size: 8.3 KB
Line 
1/*
2 * tesselation.hpp
3 *
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.
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
16/*********************************************** includes ***********************************/
17
18// include config.h
19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
23#include <map>
24#include <list>
25#include <set>
26#include <stack>
27
28#include "BoundaryMaps.hpp"
29#include "BoundaryPointSet.hpp"
30#include "PointCloud.hpp"
31#include "TesselPoint.hpp"
32#include "atom_particleinfo.hpp"
33#include "Helpers/helpers.hpp"
34#include "LinearAlgebra/Vector.hpp"
35
36
37/****************************************** forward declarations *****************************/
38
39class BoundaryPointSet;
40class BoundaryLineSet;
41class BoundaryTriangleSet;
42class CandidateForTesselation;
43class LinkedCell;
44class Tesselation;
45class Plane;
46
47/********************************************** definitions *********************************/
48
49enum { DoTecplotOutput=1 };
50enum { DoRaster3DOutput=1 };
51enum { DoVRMLOutput=0 };
52
53extern "C" const char *TecplotSuffix;
54extern "C" const char *Raster3DSuffix;
55extern "C" const char *VRMLSUffix;
56
57extern "C" const double ParallelEpsilon;
58
59// ======================================================= some template functions =========================================
60
61/********************************************** declarations *******************************/
62
63// =========================================================== class TESSELATION ===========================================
64
65/** Contains the envelope to a PointCloud.
66 */
67class Tesselation : public PointCloud {
68 public:
69
70 Tesselation();
71 virtual ~Tesselation();
72
73 void AddTesselationPoint(TesselPoint* Candidate, const int n);
74 void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
75 void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
76 void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
77 void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
78 void AddTesselationTriangle();
79 void AddTesselationTriangle(const int nr);
80 void AddCandidateTriangle(CandidateForTesselation &CandidateLine, enum centers type);
81 void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC);
82 void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell *LC);
83 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
84 void RemoveTesselationLine(class BoundaryLineSet *line);
85 void RemoveTesselationPoint(class BoundaryPointSet *point);
86 bool CheckDegeneracy(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) const;
87
88
89 // concave envelope
90 bool FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
91 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
92 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;
93 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, const BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
94 bool FindCandidatesforOpenLines(const double RADIUS, const LinkedCell *&LCList);
95 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
96 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
97
98 // convex envelope
99 void TesselateOnBoundary(const PointCloud * const cloud);
100 void GuessStartingTriangle();
101 bool InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC);
102 double RemovePointFromTesselatedSurface(class BoundaryPointSet *point);
103 class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base);
104 double PickFarthestofTwoBaselines(class BoundaryLineSet *Base);
105 class BoundaryPointSet *IsConvexRectangle(class BoundaryLineSet *Base);
106 IndexToIndex * FindAllDegeneratedTriangles();
107 IndexToIndex * FindAllDegeneratedLines();
108 void RemoveDegeneratedTriangles();
109 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
110 int CorrectAllDegeneratedPolygons();
111
112 TesselPointSet * GetAllConnectedPoints(const TesselPoint* const Point) const;
113 TriangleSet * GetAllTriangles(const BoundaryPointSet * const Point) const;
114 ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
115 ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
116 TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
117 TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
118 class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
119 TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
120 TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
121 BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
122 bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
123 double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
124 double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
125 BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
126 bool AddBoundaryPoint(TesselPoint * Walker, const int n);
127 DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
128 BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
129
130 // print for debugging
131 void PrintAllBoundaryPoints(ofstream *out) const;
132 void PrintAllBoundaryLines(ofstream *out) const;
133 void PrintAllBoundaryTriangles(ofstream *out) const;
134
135 // store envelope in file
136 void Output(const char *filename, const PointCloud * const cloud);
137
138 PointMap PointsOnBoundary;
139 LineMap LinesOnBoundary;
140 CandidateMap OpenLines;
141 TriangleMap TrianglesOnBoundary;
142 int PointsOnBoundaryCount;
143 int LinesOnBoundaryCount;
144 int TrianglesOnBoundaryCount;
145
146 typedef PointMap::iterator iterator;
147 typedef PointMap::const_iterator const_iterator;
148 TesselPoint * getValue(const_iterator &rhs) const;
149 TesselPoint * getValue(iterator &rhs) const;
150 iterator begin() { return PointsOnBoundary.begin(); }
151 const_iterator begin() const { return PointsOnBoundary.begin(); }
152 iterator end() { return PointsOnBoundary.end(); }
153 const_iterator end() const { return PointsOnBoundary.end(); }
154 // PointCloud implementation for PointsOnBoundary
155 virtual Vector *GetCenter(ofstream *out) const;
156 virtual TesselPoint *GetPoint() const;
157 virtual void GoToNext() const;
158 virtual void GoToFirst() const;
159 virtual bool IsEmpty() const;
160 virtual bool IsEnd() const;
161
162 class BoundaryPointSet *BPS[2];
163 class BoundaryLineSet *BLS[3];
164 class BoundaryTriangleSet *BTS;
165 class BoundaryTriangleSet *LastTriangle;
166 int TriangleFilesWritten;
167
168 private:
169 static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
170
171 mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
172
173 mutable PointMap::const_iterator InternalPointer;
174
175 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
176 void FindDegeneratedCandidatesforOpenLines(TesselPoint * const Sprinter, const Vector * const OptCenter);
177};
178
179
180#endif /* TESSELATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.