source: src/tesselation.hpp@ 2d292d

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 2d292d was 8f4df1, checked in by Frederik Heber <heber@…>, 15 years ago

Merge branch 'AtomicPositionEncapsulation' into stable

Conflicts:

src/Actions/AtomAction/ChangeElementAction.cpp
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
src/Makefile.am
src/UIElements/TextUI/TextDialog.cpp
src/analysis_correlation.hpp
src/atom.cpp
src/atom_atominfo.hpp
src/bond.cpp
src/boundary.cpp
src/molecule_geometry.cpp
src/tesselation.cpp
src/tesselationhelpers.cpp
src/triangleintersectionlist.cpp
src/unittests/Makefile.am

  • fixed #includes due to moves to Helpers and LinearAlgebra
  • moved VectorInterface.* and vector_ops.* to LinearAlgebra
  • no more direct access of atom::node, remapped to set/getPosition()
  • no more direct access to atom::type, remapped to set/getType() (also in atom due to derivation and atominfo::AtomicElement is private not protected).
  • Property mode set to 100644
File size: 7.7 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 "PointCloud.hpp"
30#include "TesselPoint.hpp"
31#include "atom_particleinfo.hpp"
32#include "Helpers/helpers.hpp"
33#include "LinearAlgebra/Vector.hpp"
34
35
36/****************************************** forward declarations *****************************/
37
38class BoundaryPointSet;
39class BoundaryLineSet;
40class BoundaryTriangleSet;
41class CandidateForTesselation;
42class LinkedCell;
43class Tesselation;
44class Plane;
45
46/********************************************** definitions *********************************/
47
48#define DoTecplotOutput 1
49#define DoRaster3DOutput 1
50#define DoVRMLOutput 0
51#define TecplotSuffix ".dat"
52#define Raster3DSuffix ".r3d"
53#define VRMLSUffix ".wrl"
54
55#define ParallelEpsilon 1e-3
56
57// ======================================================= some template functions =========================================
58
59/********************************************** declarations *******************************/
60
61// =========================================================== class TESSELATION ===========================================
62
63/** Contains the envelope to a PointCloud.
64 */
65class Tesselation : public PointCloud {
66 public:
67
68 Tesselation();
69 virtual ~Tesselation();
70
71 void AddTesselationPoint(TesselPoint* Candidate, const int n);
72 void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
73 void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
74 void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
75 void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
76 void AddTesselationTriangle();
77 void AddTesselationTriangle(const int nr);
78 void AddCandidateTriangle(CandidateForTesselation &CandidateLine, enum centers type);
79 void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC);
80 void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell *LC);
81 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
82 void RemoveTesselationLine(class BoundaryLineSet *line);
83 void RemoveTesselationPoint(class BoundaryPointSet *point);
84 bool CheckDegeneracy(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) const;
85
86
87 // concave envelope
88 bool FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
89 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
90 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;
91 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, const BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
92 bool FindCandidatesforOpenLines(const double RADIUS, const LinkedCell *&LCList);
93 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
94 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
95
96 // convex envelope
97 void TesselateOnBoundary(const PointCloud * const cloud);
98 void GuessStartingTriangle();
99 bool InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC);
100 double RemovePointFromTesselatedSurface(class BoundaryPointSet *point);
101 class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base);
102 double PickFarthestofTwoBaselines(class BoundaryLineSet *Base);
103 class BoundaryPointSet *IsConvexRectangle(class BoundaryLineSet *Base);
104 IndexToIndex * FindAllDegeneratedTriangles();
105 IndexToIndex * FindAllDegeneratedLines();
106 void RemoveDegeneratedTriangles();
107 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
108 int CorrectAllDegeneratedPolygons();
109
110 TesselPointSet * GetAllConnectedPoints(const TesselPoint* const Point) const;
111 TriangleSet * GetAllTriangles(const BoundaryPointSet * const Point) const;
112 ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
113 ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
114 TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
115 TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
116 class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
117 TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
118 TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
119 BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
120 bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
121 double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
122 double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
123 BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
124 bool AddBoundaryPoint(TesselPoint * Walker, const int n);
125 DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
126 BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
127
128 // print for debugging
129 void PrintAllBoundaryPoints(ofstream *out) const;
130 void PrintAllBoundaryLines(ofstream *out) const;
131 void PrintAllBoundaryTriangles(ofstream *out) const;
132
133 // store envelope in file
134 void Output(const char *filename, const PointCloud * const cloud);
135
136 PointMap PointsOnBoundary;
137 LineMap LinesOnBoundary;
138 CandidateMap OpenLines;
139 TriangleMap TrianglesOnBoundary;
140 int PointsOnBoundaryCount;
141 int LinesOnBoundaryCount;
142 int TrianglesOnBoundaryCount;
143
144 // PointCloud implementation for PointsOnBoundary
145 virtual Vector *GetCenter(ofstream *out) const;
146 virtual TesselPoint *GetPoint() const;
147 virtual void GoToNext() const;
148 virtual void GoToFirst() const;
149 virtual bool IsEmpty() const;
150 virtual bool IsEnd() const;
151
152 class BoundaryPointSet *BPS[2];
153 class BoundaryLineSet *BLS[3];
154 class BoundaryTriangleSet *BTS;
155 class BoundaryTriangleSet *LastTriangle;
156 int TriangleFilesWritten;
157
158 private:
159 mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
160
161 mutable PointMap::const_iterator InternalPointer;
162
163 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
164 void FindDegeneratedCandidatesforOpenLines(TesselPoint * const Sprinter, const Vector * const OptCenter);
165};
166
167
168#endif /* TESSELATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.