source: src/boundary.hpp@ 02da9e

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 02da9e was 3d919e, checked in by Frederik Heber <heber@…>, 16 years ago

All of Saskia Metzler's changes so far to remove bugs from Tesselation (still not working)

Principle ideas:

  • allow maximum of two triangles per triple of atomic indices to also tesselate "flat" areas
  • detect degeneracies by having a list of candidates and adding multiple triangles (one for each) by an angle criteria

New functions:

  • existsIntersection(): Checks per distance minimiser whether two lines intersect (for intersecting triangles)
  • MinIntersectDistance(): Calculates the minimal distance between two lines (function to minimize)
  • sortCandidates(): Sorting function for the third point candidates
  • CheckPresenceOfTriangle(): For a triple of atomic indices, checks whether a triangle between them already exists (needed for allowing max of two triangles per triple)
  • Property mode set to 100755
File size: 4.6 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
57 class BoundaryPointSet *endpoints[2];
58 TriangleMap triangles;
59 int TrianglesCount;
60 int Nr;
61};
62
63class BoundaryTriangleSet {
64 public:
65 BoundaryTriangleSet();
66 BoundaryTriangleSet(class BoundaryLineSet *line[3], int number);
67 ~BoundaryTriangleSet();
68
69 void GetNormalVector(Vector &NormalVector);
70
71 class BoundaryPointSet *endpoints[3];
72 class BoundaryLineSet *lines[3];
73 Vector NormalVector;
74 int Nr;
75};
76
77
78class CandidateForTesselation {
79 public :
80 CandidateForTesselation(atom* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
81 ~CandidateForTesselation();
82 atom *point;
83 BoundaryLineSet *BaseLine;
84 Vector OptCenter;
85 Vector OtherOptCenter;
86};
87
88
89class Tesselation {
90 public:
91
92 Tesselation();
93 ~Tesselation();
94
95 void TesselateOnBoundary(ofstream *out, config *configuration, molecule *mol);
96 void GuessStartingTriangle(ofstream *out);
97 void AddPoint(atom * Walker);
98 void AddTrianglePoint(atom* Candidate, int n);
99 void AddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
100 void AlwaysAddTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
101 void AddTriangleToLines();
102 void Find_starting_triangle(ofstream *out, molecule* mol, const double RADIUS, LinkedCell *LC);
103 bool Find_next_suitable_triangle(ofstream *out, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, const char *filename, LinkedCell *LC);
104 int CheckPresenceOfTriangle(ofstream *out, atom *Candidates[3]);
105 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);
106
107 PointMap PointsOnBoundary;
108 LineMap LinesOnBoundary;
109 TriangleMap TrianglesOnBoundary;
110 class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
111 class BoundaryPointSet *BPS[2];
112 class BoundaryLineSet *BLS[3];
113 class BoundaryTriangleSet *BTS;
114 int PointsOnBoundaryCount;
115 int LinesOnBoundaryCount;
116 int TrianglesOnBoundaryCount;
117 int TriangleFilesWritten;
118};
119
120
121ostream & operator << (ostream &ost, BoundaryPointSet &a);
122ostream & operator << (ostream &ost, BoundaryLineSet &a);
123ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
124
125
126double VolumeOfConvexEnvelope(ofstream *out, const char *filename, config *configuration, Boundaries *BoundaryPoints, molecule *mol);
127double * GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol, bool IsAngstroem);
128void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity);
129void Find_non_convex_border(ofstream *out, molecule* mol, class Tesselation *T, class LinkedCell *LC, const char *tempbasename, const double RADIUS);
130void Find_next_suitable_point(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
131bool Choose_preferable_third_point(atom *Candidate, atom *OptCandidate, class BoundaryLineSet *BaseLine, atom *ThirdNode, Tesselation *Tess);
132bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4);
133bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2);
134
135#endif /*BOUNDARY_HPP_*/
Note: See TracBrowser for help on using the repository browser.