source: molecuilder/src/boundary.hpp@ 0e2190

Last change on this file since 0e2190 was 0e2190, checked in by Frederik Heber <heber@…>, 16 years ago

Merge branch 'ConcaveHull' of ssh://heber@192.168.194.2/home/metzler/workspace/espack into ConcaveHull

Conflicts:

molecuilder/src/atom.cpp
molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/linkedcell.cpp
molecuilder/src/linkedcell.hpp
molecuilder/src/molecules.hpp
molecuilder/src/vector.hpp

  • added Saskia Metzler's code that finds whether a point is in- or outside.
  • The code is not yet incorporated, but I rather want to continue with merging TesselationRefactoring first.
  • Property mode set to 100755
File size: 5.9 KB
Line 
1#ifndef BOUNDARY_HPP_
2#define BOUNDARY_HPP_
3
4class BoundaryPointSet;
5class BoundaryLineSet;
6class BoundaryTriangleSet;
7class CandidateForTesselation;
8
9// include config.h
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
14// STL headers
15#include <map>
16#include <set>
17#include <deque>
18
19#include <gsl/gsl_poly.h>
20
21#include "linkedcell.hpp"
22#include "molecules.hpp"
23
24template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
25{
26 if (endpoint1->Nr < endpoint2->Nr) {
27 endpoints[0] = endpoint1;
28 endpoints[1] = endpoint2;
29 } else {
30 endpoints[0] = endpoint2;
31 endpoints[1] = endpoint1;
32 }
33};
34
35class BoundaryPointSet {
36 public:
37 BoundaryPointSet();
38 BoundaryPointSet(atom *Walker);
39 ~BoundaryPointSet();
40
41 void AddLine(class BoundaryLineSet *line);
42
43 LineMap lines;
44 int LinesCount;
45 atom *node;
46 int Nr;
47};
48
49class BoundaryLineSet {
50 public:
51 BoundaryLineSet();
52 BoundaryLineSet(class BoundaryPointSet *Point[2], int number);
53 ~BoundaryLineSet();
54
55 void AddTriangle(class BoundaryTriangleSet *triangle);
56 bool IsConnectedTo(class BoundaryLineSet *line);
57 bool ContainsBoundaryPoint(class BoundaryPointSet *point);
58 bool CheckConvexityCriterion(ofstream *out);
59
60 class BoundaryPointSet *endpoints[2];
61 TriangleMap triangles;
62 int TrianglesCount;
63 int Nr;
64};
65
66class BoundaryTriangleSet {
67 public:
68 BoundaryTriangleSet();
69 BoundaryTriangleSet(class BoundaryLineSet *line[3], int number);
70 ~BoundaryTriangleSet();
71
72 void GetNormalVector(Vector &NormalVector);
73 bool GetIntersectionInsideTriangle(ofstream *out, Vector *MolCenter, Vector *x, Vector *Intersection);
74 bool ContainsBoundaryLine(class BoundaryLineSet *line);
75 bool ContainsBoundaryPoint(class BoundaryPointSet *point);
76
77 class BoundaryPointSet *endpoints[3];
78 class BoundaryLineSet *lines[3];
79 Vector NormalVector;
80 int Nr;
81};
82
83
84class CandidateForTesselation {
85 public :
86 CandidateForTesselation(atom* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
87 ~CandidateForTesselation();
88 atom *point;
89 BoundaryLineSet *BaseLine;
90 Vector OptCenter;
91 Vector OtherOptCenter;
92};
93
94
95class Tesselation {
96 public:
97
98 Tesselation();
99 ~Tesselation();
100
101 void TesselateOnBoundary(ofstream *out, molecule *mol);
102 void GuessStartingTriangle(ofstream *out);
103 void AddPoint(atom * Walker);
104 void AddTrianglePoint(atom* Candidate, int n);
105 void AddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
106 void AlwaysAddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
107 void AddTriangle();
108 void Find_starting_triangle(ofstream *out, molecule* mol, const double RADIUS, LinkedCell *LC);
109 bool Find_next_suitable_triangle(ofstream *out, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, const char *filename, LinkedCell *LC);
110 int CheckPresenceOfTriangle(ofstream *out, atom *Candidates[3]);
111 void Find_next_suitable_point_via_Angle_of_Sphere(atom* a, atom* b, atom* c, atom* Candidate, atom* Parent, int RecursionLevel, Vector *Chord, Vector *direction1, Vector *OldNormal, Vector ReferencePoint, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol);
112 class BoundaryTriangleSet * FindClosestTriangleToPoint(ofstream *out, Vector *x);
113 bool IsInside(Vector *pointer);
114 bool InsertStraddlingPoints(ofstream *out, molecule *mol);
115 bool CorrectConcaveBaselines(ofstream *out);
116 list<atom*> *getClosestConnectedAtoms(atom* Atom, atom* AtomToCheck);
117 list<BoundaryTriangleSet*> *FindTriangles(atom* TrianglePoints[3]);
118
119 PointMap PointsOnBoundary;
120 LineMap LinesOnBoundary;
121 TriangleMap TrianglesOnBoundary;
122 class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
123 class BoundaryPointSet *BPS[2];
124 class BoundaryLineSet *BLS[3];
125 class BoundaryTriangleSet *BTS;
126 int PointsOnBoundaryCount;
127 int LinesOnBoundaryCount;
128 int TrianglesOnBoundaryCount;
129 int TriangleFilesWritten;
130};
131
132
133ostream & operator << (ostream &ost, BoundaryPointSet &a);
134ostream & operator << (ostream &ost, BoundaryLineSet &a);
135ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
136
137
138double VolumeOfConvexEnvelope(ofstream *out, class Tesselation *TesselStruct, class config *configuration);
139double * GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol, bool IsAngstroem);
140void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity);
141molecule * FillBoxWithMolecule(ofstream *out, MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandAtomDisplacement, double RandMolDisplacement, bool DoRandomRotation);
142void Find_convex_border(ofstream *out, molecule* mol, class Tesselation *&TesselStruct, class LinkedCell *LCList, const char *filename);
143void Find_non_convex_border(ofstream *out, molecule* mol, class Tesselation *T, class LinkedCell *LC, const char *tempbasename, const double RADIUS);
144void Find_next_suitable_point(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
145bool Choose_preferable_third_point(atom *Candidate, atom *OptCandidate, class BoundaryLineSet *BaseLine, atom *ThirdNode, Tesselation *Tess);
146bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4);
147bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2);
148bool IsInnerPoint(Vector Point, class Tesselation *Tess, LinkedCell* LC);
149bool IsInnerAtom(atom *Atom, class Tesselation *Tess, LinkedCell* LC);
150atom* findClosestAtom(const atom* Atom, LinkedCell* LC);
151double getAngle(Vector point, Vector reference, Vector center, Vector OrthogonalVector);
152
153#endif /*BOUNDARY_HPP_*/
Note: See TracBrowser for help on using the repository browser.