#ifndef INTERFACE_H #define INTERFACE_H #include #include #include /* CLASS Interface Defines an interface container and used to store interfaces between molecules. KEYWORDS Interface, Molecule, Particle AUTHORS Inbal Halperin (inbalhal@math.tau.ac.il), Dina Duhovny (duhovka@math.tau.ac.il) and Yuval Inbar (inbaryuv@math.tau.ac.il) Copyright: SAMBA group, Tel-Aviv Univ. Israel, 1997. CHANGES LOG
  • 10/01/05 Dina in addAdjacency function: if the adjacency already exists, we now check if we can update the distance. if the new distance is smaller, we update it. setDistance was added to Adjacency for this purpose. buildHigherLevel function was re-written, to iterate over interface instead of group1
  • 25/12/03 Dina added union and intersection functions for neighbours of two particles added adjacencies function that returns ParticleAdjacency for particle, instead of previous option that copied them into vector.
& group1, const std::vector& group2); //// Class that stores a pair of adjacent particles and their distance class Adjacency { public: Adjacency() {} Adjacency(unsigned int p1, unsigned int p2, float d): particle1(p1), particle2(p2), distance(d) {} Adjacency(const Interface::Adjacency& a): particle1(a.particle1), particle2(a.particle2), distance(a.distance) {} unsigned int first() const { return particle1; } unsigned int second() const { return particle2; } float dist() const { return distance; } void setDistance(float dist) { distance = dist; } friend std::ostream& operator<<(std::ostream& s, const Adjacency& adjacency) { s << adjacency.first() << ' ' << adjacency.second() << ' ' <& vAdj, unsigned int index1) const; typedef std::unordered_map ParticleAdjacency;//int = index2 typedef std::unordered_map InterfaceAdjacency;//int = index1 //// return ParticleAdjacency for a given index const ParticleAdjacency& adjacencies(unsigned int index1) const; //// return the intersection of neighbours of two particle adjacencies void neighboursIntersection(const ParticleAdjacency& pa1, const ParticleAdjacency& pa2, std::vector& intersection) const; //// return the intersection of neighbours of two indices void neighboursIntersection(unsigned int index1, unsigned int index2, std::vector& intersection) const; //// return the union of neighbours of two particle adjacencies void neighboursUnion(const ParticleAdjacency& pa1, const ParticleAdjacency& pa2, std::vector& nUnion) const; //// return the union of neighbours of two indices void neighboursUnion(unsigned int index1, unsigned int index2, std::vector& nUnion) const; //// Interface iterator class iterator { public: iterator(); iterator(InterfaceAdjacency::iterator iInterfaceAdjIt, ParticleAdjacency::iterator iParticleAdjIt, InterfaceAdjacency::iterator iInterfaceAdjacencyEnd); iterator operator++(); const Adjacency& operator*() const; bool operator==(const Interface::iterator& it1) const; bool operator!=(const Interface::iterator& it1) const; protected: InterfaceAdjacency::iterator interfaceAdjIt; ParticleAdjacency::iterator particleAdjIt; InterfaceAdjacency::iterator interfaceAdjacencyEnd; }; iterator begin(); iterator end(); protected: //// Interface container InterfaceAdjacency interfaceAdjacency; //// Number of pairs in interface unsigned int adjacencyCounter; }; #endif