Changeset 357fba for src/boundary.hpp


Ignore:
Timestamp:
Aug 3, 2009, 2:48:42 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Branches:
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
Children:
a80fbdf, caf4ba
Parents:
2319ed
Message:

Huge refactoring of Tesselation routines, but not finished yet.

  • new file tesselation.cpp with all of classes tesselation, Boundary..Set and CandidatesForTesselationOB
  • new file tesselationhelper.cpp with all auxiliary functions.
  • boundary.cpp just contains super functions, combininb molecule and Tesselation pointers
  • new pointer molecule::TesselStruct
  • PointMap, LineMap, TriangleMap DistanceMap have been moved from molecules.hpp to tesselation.hpp
  • new abstract class PointCloud and TesselPoint
  • atom inherits TesselPoint
  • molecule inherits PointCloud (i.e. a set of TesselPoints) and implements all virtual functions for the chained list
  • TriangleFilesWritten is thrown out, intermediate steps are written in find_nonconvex_border and not in find_next_triangle()
  • LinkedCell class uses TesselPoint as its nodes, i.e. as long as any class inherits TesselPoint, it may make use of LinkedCell as well and a PointCloud is used to initialize
  • class atom and bond definitions have been moved to own header files

NOTE: This is not bugfree yet. Tesselation of heptan produces way too many triangles, but runs without faults or leaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.hpp

    r2319ed r357fba  
    11#ifndef BOUNDARY_HPP_
    22#define BOUNDARY_HPP_
    3 
    4 class BoundaryPointSet;
    5 class BoundaryLineSet;
    6 class BoundaryTriangleSet;
    7 class CandidateForTesselation;
    83
    94// include config.h
     
    1712#include <deque>
    1813
    19 #include <gsl/gsl_poly.h>
    20 
    2114#include "linkedcell.hpp"
    2215#include "molecules.hpp"
     16#include "tesselation.hpp"
     17#include "tesselationhelpers.hpp"
    2318
    24 template <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 
    35 class 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 
    49 class 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 
    66 class 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 
    84 class 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 
    95 class 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 
    117     PointMap PointsOnBoundary;
    118     LineMap LinesOnBoundary;
    119     TriangleMap TrianglesOnBoundary;
    120     class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
    121     class BoundaryPointSet *BPS[2];
    122     class BoundaryLineSet *BLS[3];
    123     class BoundaryTriangleSet *BTS;
    124     int PointsOnBoundaryCount;
    125     int LinesOnBoundaryCount;
    126     int TrianglesOnBoundaryCount;
    127     int TriangleFilesWritten;
    128 };
    129 
    130 
    131 ostream & operator << (ostream &ost, BoundaryPointSet &a);
    132 ostream & operator << (ostream &ost, BoundaryLineSet &a);
    133 ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
    134 
     19#define DEBUG 1
     20#define DoSingleStepOutput 0
     21#define DoTecplotOutput 1
     22#define DoRaster3DOutput 1
     23#define DoVRMLOutput 1
     24#define TecplotSuffix ".dat"
     25#define Raster3DSuffix ".r3d"
     26#define VRMLSUffix ".wrl"
    13527
    13628double VolumeOfConvexEnvelope(ofstream *out, class Tesselation *TesselStruct, class config *configuration);
     
    14133void Find_non_convex_border(ofstream *out, molecule* mol, class Tesselation *T, class LinkedCell *LC, const char *tempbasename, const double RADIUS);
    14234void Find_next_suitable_point(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
    143 bool Choose_preferable_third_point(atom *Candidate, atom *OptCandidate, class BoundaryLineSet *BaseLine, atom *ThirdNode, Tesselation *Tess);
    144 bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4);
    145 bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2);
     35Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol);
    14636
    14737#endif /*BOUNDARY_HPP_*/
Note: See TracChangeset for help on using the changeset viewer.