Ignore:
Timestamp:
Aug 3, 2009, 2:48:42 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
d8fce3, e78824
Parents:
4e4940
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
  • molecuilder/src/molecules.hpp

    r4e4940 r834ff3  
    2525#include <vector>
    2626
     27#include "atom.hpp"
     28#include "bond.hpp"
    2729#include "helpers.hpp"
     30#include "linkedcell.hpp"
    2831#include "parser.hpp"
    2932#include "periodentafel.hpp"
    3033#include "stackclass.hpp"
     34#include "tesselation.hpp"
    3135#include "vector.hpp"
    3236
    33 class atom;
    34 class bond;
    3537class config;
    3638class molecule;
     
    3840class MoleculeListClass;
    3941class Verbose;
    40 class Tesselation;
    4142
    4243/******************************** Some definitions for easier reading **********************************/
     
    5859#define BoundariesTestPair pair< Boundaries::iterator, bool>
    5960
    60 #define PointMap map < int, class BoundaryPointSet * >
    61 #define PointPair pair < int, class BoundaryPointSet * >
    62 #define PointTestPair pair < PointMap::iterator, bool >
    63 #define CandidateList list <class CandidateForTesselation *>
    64 
    65 #define LineMap multimap < int, class BoundaryLineSet * >
    66 #define LinePair pair < int, class BoundaryLineSet * >
    67 #define LineTestPair pair < LineMap::iterator, bool >
    68 
    69 #define TriangleMap map < int, class BoundaryTriangleSet * >
    70 #define TrianglePair pair < int, class BoundaryTriangleSet * >
    71 #define TriangleTestPair pair < TrianglePair::iterator, bool >
    72 
    73 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    74 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
    75 
    7661#define MoleculeList list <molecule *>
    7762#define MoleculeListTest pair <MoleculeList::iterator, bool>
     
    125110};
    126111
    127 /** Single atom.
    128  * Class incoporates position, type
    129  */
    130 class atom {
    131   public:
    132     Vector x;       //!< coordinate array of atom, giving position within cell
    133     Vector v;       //!< velocity array of atom
    134     element *type;  //!< pointing to element
    135     atom *previous; //!< previous atom in molecule list
    136     atom *next;     //!< next atom in molecule list
    137     atom *father;   //!< In many-body bond order fragmentations points to originating atom
    138     atom *Ancestor; //!< "Father" in Depth-First-Search
    139     char *Name;      //!< unique name used during many-body bond-order fragmentation
    140     int FixedIon;   //!< config variable that states whether forces act on the ion or not
    141     int *sort;      //!< sort criteria
    142     int nr;         //!< continuous, unique number
    143     int GraphNr;      //!< unique number, given in DepthFirstSearchAnalysis()
    144     int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
    145     int LowpointNr; //!< needed in DepthFirstSearchAnalysis() to detect nonseparable components, is the lowest possible number of an atom to reach via tree edges only followed by at most one back edge.
    146     bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
    147     bool IsCyclic;        //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
    148     unsigned char AdaptiveOrder;  //!< current present bond order at site (0 means "not set")
    149     bool MaxOrder;  //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
    150 
    151   atom();
    152   atom(class atom *pointer);
    153   ~atom();
    154 
    155   bool Output(int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;
    156   bool OutputXYZLine(ofstream *out) const;
    157   atom *GetTrueFather();
    158   bool Compare(atom &ptr);
    159 
    160   private:
    161 };
    162 
    163 ostream & operator << (ostream &ost, const atom &a);
    164 
    165 /** Bonds between atoms.
    166  * Class incorporates bonds between atoms in a molecule,
    167  * used to derive tge fragments in many-body bond order
    168  * calculations.
    169  */
    170 class bond {
    171   public:
    172     atom *leftatom;    //!< first bond partner
    173     atom *rightatom;  //!< second bond partner
    174     bond *previous; //!< previous atom in molecule list
    175     bond *next;     //!< next atom in molecule list
    176     int HydrogenBond;  //!< Number of hydrogen atoms in the bond
    177     int BondDegree;    //!< single, double, triple, ... bond
    178     int nr;           //!< unique number in a molecule, updated by molecule::CreateAdjacencyList()
    179     bool Cyclic;      //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
    180     enum EdgeType Type;//!< whether this is a tree or back edge
    181 
    182   atom * GetOtherAtom(atom *Atom) const;
    183   bond * GetFirstBond();
    184   bond * GetLastBond();
    185 
    186   bool MarkUsed(enum Shading color);
    187   enum Shading IsUsed();
    188   void ResetUsed();
    189   bool Contains(const atom *ptr);
    190   bool Contains(const int nr);
    191 
    192   bond();
    193   bond(atom *left, atom *right);
    194   bond(atom *left, atom *right, int degree);
    195   bond(atom *left, atom *right, int degree, int number);
    196   ~bond();
    197 
    198   private:
    199     enum Shading Used;        //!< marker in depth-first search, DepthFirstSearchAnalysis()
    200 };
    201 
    202 
    203 ostream & operator << (ostream &ost, const bond &b);
    204112
    205113#define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
     
    210118 * Class incorporates number of types
    211119 */
    212 class molecule {
     120class molecule : public PointCloud {
    213121  public:
    214122    double cell_size[6];//!< cell size
     
    234142    char name[MAXSTRINGSIZE];         //!< arbitrary name
    235143    int IndexNr;        //!< index of molecule in a MoleculeListClass
     144    class Tesselation *TesselStruct;
    236145
    237146  molecule(periodentafel *teil);
    238147  ~molecule();
     148
     149  // re-definition of virtual functions from PointCloud
     150  Vector *GetCenter(ofstream *out);
     151  TesselPoint *GetPoint();
     152  TesselPoint *GetTerminalPoint();
     153  void GoToNext();
     154  void GoToPrevious();
     155  void GoToFirst();
     156  void GoToLast();
     157  bool IsEmpty();
     158  bool IsLast();
    239159
    240160  /// remove atoms from molecule.
     
    350270  private:
    351271  int last_atom;      //!< number given to last atom
     272  atom *InternalPointer;  //!< internal pointer for PointCloud
    352273};
    353274
     
    524445  char *GetDefaultPath() const;
    525446  void SetDefaultPath(const char *path);
    526   void InitThermostats(ifstream *source);
     447  void InitThermostats(class ConfigFileBuffer *fb);
    527448};
    528449
Note: See TracChangeset for help on using the changeset viewer.