--- branches/new_design/OOPSE-2.0/src/primitives/Molecule.hpp 2004/11/01 20:15:58 1692 +++ branches/new_design/OOPSE-2.0/src/primitives/Molecule.hpp 2004/11/12 06:19:04 1733 @@ -38,9 +38,16 @@ #include "math/Vector3.hpp" #include "primitives/Atom.hpp" #include "primitives/RigidBody.hpp" +//#include "primitives/Bond.hpp" +//#include "primitives/Bend.hpp" +//#include "primitives/Torsion.hpp" +#include "primitives/SRI.hpp" +#include "primitives/CutoffGroup.hpp" namespace oopse{ +class Constraint; + /** * @class Molecule Molecule.hpp "primitives/Molecule.hpp" * @brief @@ -48,7 +55,15 @@ class Molecule { class Molecule { public: - Molecule(); + typedef std::vector::iterator AtomIterator; + typedef std::vector::iterator BondIterator; + typedef std::vector::iterator BendIterator; + typedef std::vector::iterator TorsionIterator; + typedef std::vector::iterator RigidBodyIterator; + typedef std::vector::iterator CutoffGroupIterator; + typedef std::vector::iterator IntegrableObjectIterator; + + Molecule(int stampId, int globalIndex, const std::string& molName); virtual ~Molecule(); /** @@ -60,21 +75,28 @@ class Molecule { } /** - * Sets the global index of this molecule. - * @param new global index to be set + * Returns the stamp id of this molecule + * @note Ideally, every molecule should keep a pointer of its molecule stamp instead of its + * stamp id. However, the pointer will become invalid, if the molecule migrate to other processor. */ - void setGlobalIndex(int index) { - return globalIndex_; + int getStampId() { + return stampId_; } + + /** Returns the name of the molecule */ + std::string getType() { + return moleculeName_; + } - /** - * Returns the local index of this molecule - * @return the local index of this molecule + /** + * Sets the global index of this molecule. + * @param new global index to be set */ - int getLocalIndex() { - return localIndex_; + int setGlobalIndex(int index) { + return globalIndex_; } + /** add an atom into this molecule */ void addAtom(Atom* atom); @@ -131,6 +153,15 @@ class Molecule { return cutoffGroups_.size(); } + /** Returns the total number of constraints in this molecule */ + unsigned int getNConstraints() { + return constraints_.size(); + } + + Atom* getAtomAt(unsigned int i) { + assert(i < atoms_.size()); + return atoms_[i]; + } /** * Returns the first atom in this molecule and initialize the iterator. * @return the first atom, return NULL if there is not cut off group in this molecule @@ -198,6 +229,10 @@ class Molecule { */ CutoffGroup* nextCutoffGroup(std::vector::iterator& i); + Constraint* beginConstraint(std::vector::iterator& i); + + Constraint* nextConstraint(std::vector::iterator& i); + //void setStampID( int info ) {stampID = info;} void calcForces( void ); @@ -212,7 +247,7 @@ class Molecule { Vector3d getCom(); /** Moves the center of this molecule */ - void moveCom(const Vetor3d& delta); + void moveCom(const Vector3d& delta); /** Returns the velocity of center of mass of this molecule */ Vector3d getComVel(); @@ -220,10 +255,10 @@ class Molecule { /** Returns the total mass of this molecule */ double getTotalMass(); - friend std::ostream& operator <<(std::ostream& o, const Molecule& mol); + friend std::ostream& operator <<(std::ostream& o, Molecule& mol); private: - int localIndex_; + int globalIndex_; std::vector atoms_; @@ -233,6 +268,10 @@ class Molecule { std::vector rigidBodies_; std::vector integrableObjects_; std::vector cutoffGroups_; + std::vector constraints_; + + int stampId_; + std::string moleculeName_; }; } //namespace oopse