| 1 | #ifndef BOUNDARY_HPP_
 | 
|---|
| 2 | #define BOUNDARY_HPP_
 | 
|---|
| 3 | 
 | 
|---|
| 4 | class BoundaryPointSet;
 | 
|---|
| 5 | class BoundaryLineSet;
 | 
|---|
| 6 | class BoundaryTriangleSet;
 | 
|---|
| 7 | 
 | 
|---|
| 8 | // include config.h
 | 
|---|
| 9 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 10 | #include <config.h>
 | 
|---|
| 11 | #endif
 | 
|---|
| 12 | 
 | 
|---|
| 13 | // STL headers
 | 
|---|
| 14 | #include <map>
 | 
|---|
| 15 | #include <set>
 | 
|---|
| 16 | #include <deque>
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #include <gsl/gsl_poly.h>
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "molecules.hpp"
 | 
|---|
| 21 | 
 | 
|---|
| 22 | #define DistanceNrPair pair < double, atom* >
 | 
|---|
| 23 | #define DistanceMap multimap < double, atom* >
 | 
|---|
| 24 | #define DistanceTestPair pair < DistanceMap::iterator, bool>
 | 
|---|
| 25 | 
 | 
|---|
| 26 | #define Boundaries map <double, DistanceNrPair >
 | 
|---|
| 27 | #define BoundariesPair pair<double, DistanceNrPair >
 | 
|---|
| 28 | #define BoundariesTestPair pair< Boundaries::iterator, bool>
 | 
|---|
| 29 | 
 | 
|---|
| 30 | #define PointMap map < int, class BoundaryPointSet * > 
 | 
|---|
| 31 | #define PointPair pair < int, class BoundaryPointSet * > 
 | 
|---|
| 32 | #define PointTestPair pair < PointMap::iterator, bool > 
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #define LineMap map < int, class BoundaryLineSet * > 
 | 
|---|
| 35 | #define LinePair pair < int, class BoundaryLineSet * > 
 | 
|---|
| 36 | #define LineTestPair pair < LinePair::iterator, bool > 
 | 
|---|
| 37 | 
 | 
|---|
| 38 | #define TriangleMap map < int, class BoundaryTriangleSet * > 
 | 
|---|
| 39 | #define TrianglePair pair < int, class BoundaryTriangleSet * > 
 | 
|---|
| 40 | #define TriangleTestPair pair < TrianglePair::iterator, bool > 
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
 | 
|---|
| 43 | #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
 | 
|---|
| 44 | 
 | 
|---|
| 45 | template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
 | 
|---|
| 46 | {
 | 
|---|
| 47 |   if (endpoint1->Nr < endpoint2->Nr) {
 | 
|---|
| 48 |     endpoints[0] = endpoint1;
 | 
|---|
| 49 |     endpoints[1] = endpoint2;
 | 
|---|
| 50 |   } else {
 | 
|---|
| 51 |     endpoints[0] = endpoint2;
 | 
|---|
| 52 |     endpoints[1] = endpoint1;
 | 
|---|
| 53 |   }
 | 
|---|
| 54 | };
 | 
|---|
| 55 | 
 | 
|---|
| 56 | class BoundaryPointSet {
 | 
|---|
| 57 |   public:
 | 
|---|
| 58 |     BoundaryPointSet();
 | 
|---|
| 59 |     BoundaryPointSet(atom *Walker);
 | 
|---|
| 60 |     ~BoundaryPointSet();
 | 
|---|
| 61 |     
 | 
|---|
| 62 |     void AddLine(class BoundaryLineSet *line);
 | 
|---|
| 63 |     
 | 
|---|
| 64 |     LineMap lines;
 | 
|---|
| 65 |     int LinesCount;
 | 
|---|
| 66 |     atom *node;
 | 
|---|
| 67 |     int Nr;
 | 
|---|
| 68 | };
 | 
|---|
| 69 | 
 | 
|---|
| 70 | class BoundaryLineSet {
 | 
|---|
| 71 |   public:
 | 
|---|
| 72 |     BoundaryLineSet();
 | 
|---|
| 73 |     BoundaryLineSet(class BoundaryPointSet *Point[2], int number);
 | 
|---|
| 74 |     ~BoundaryLineSet();
 | 
|---|
| 75 | 
 | 
|---|
| 76 |     void AddTriangle(class BoundaryTriangleSet *triangle);
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     class BoundaryPointSet *endpoints[2];
 | 
|---|
| 79 |     TriangleMap triangles;
 | 
|---|
| 80 |     int TrianglesCount;
 | 
|---|
| 81 |     int Nr;
 | 
|---|
| 82 | };
 | 
|---|
| 83 | 
 | 
|---|
| 84 | class BoundaryTriangleSet {
 | 
|---|
| 85 |   public:
 | 
|---|
| 86 |     BoundaryTriangleSet();
 | 
|---|
| 87 |     BoundaryTriangleSet(class BoundaryLineSet *line[3], int number);
 | 
|---|
| 88 |     ~BoundaryTriangleSet();
 | 
|---|
| 89 |     
 | 
|---|
| 90 |     void GetNormalVector(vector &NormalVector);
 | 
|---|
| 91 |     
 | 
|---|
| 92 |     class BoundaryPointSet *endpoints[3];
 | 
|---|
| 93 |     class BoundaryLineSet *lines[3];
 | 
|---|
| 94 |     int Nr;
 | 
|---|
| 95 | };
 | 
|---|
| 96 | 
 | 
|---|
| 97 | class Tesselation {
 | 
|---|
| 98 |   public:
 | 
|---|
| 99 |     
 | 
|---|
| 100 |     Tesselation();
 | 
|---|
| 101 |     ~Tesselation();
 | 
|---|
| 102 |     
 | 
|---|
| 103 |     void TesselateOnBoundary(ofstream *out, config *configuration, molecule *mol);
 | 
|---|
| 104 |     void GuessStartingTriangle(ofstream *out);
 | 
|---|
| 105 |     void AddPoint(atom * Walker);
 | 
|---|
| 106 |     
 | 
|---|
| 107 |     PointMap PointsOnBoundary;
 | 
|---|
| 108 |     LineMap LinesOnBoundary;
 | 
|---|
| 109 |     TriangleMap TrianglesOnBoundary;
 | 
|---|
| 110 |     class BoundaryPointSet *BPS[2];
 | 
|---|
| 111 |     class BoundaryLineSet *BLS[3];
 | 
|---|
| 112 |     class BoundaryTriangleSet *BTS;
 | 
|---|
| 113 |     int PointsOnBoundaryCount;
 | 
|---|
| 114 |     int LinesOnBoundaryCount;
 | 
|---|
| 115 |     int TrianglesOnBoundaryCount;
 | 
|---|
| 116 | };
 | 
|---|
| 117 | 
 | 
|---|
| 118 | 
 | 
|---|
| 119 | ostream & operator << (ostream &ost, BoundaryPointSet &a);
 | 
|---|
| 120 | ostream & operator << (ostream &ost, BoundaryLineSet &a);
 | 
|---|
| 121 | ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
 | 
|---|
| 122 | 
 | 
|---|
| 123 | 
 | 
|---|
| 124 | double VolumeOfConvexEnvelope(ofstream *out, config *configuration, Boundaries *BoundaryPoints, molecule *mol);
 | 
|---|
| 125 | void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, int repetition[NDIM], double celldensity);
 | 
|---|
| 126 | 
 | 
|---|
| 127 | 
 | 
|---|
| 128 | #endif /*BOUNDARY_HPP_*/
 | 
|---|