ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ConstraintManager.hpp
Revision: 1232
Committed: Thu Jun 3 21:51:55 2004 UTC (20 years, 1 month ago) by tim
File size: 1539 byte(s)
Log Message:
new implementation of constraint

File Contents

# Content
1 #ifndef _CONSTRAINTMANAGER_H_
2 #define _CONSTRAINTMANAGER_H_
3
4 #include <list>
5 #include <vector>
6
7 #include "Molecule.hpp"
8
9 #include "ConstraintIterator.hpp"
10
11 using namespace std;
12
13 class ConstraintAlgorithm;
14 class SimInfo;
15
16 struct ListIteratorInfo{
17 list<vector<ConstraintElement*> >::iterator firstElement;
18 list<vector<ConstraintPair*> >::iterator firstPair;
19 };
20
21 typedef map<Molecule*, ListIteratorInfo> MolIterInfoMap;
22
23 //Constraint Manager
24 class ConstraintManager{
25 public:
26 //constructor
27 ConstraintManager(SimInfo* info);
28
29 //virtual destructor
30 ~ConstraintManager();
31
32 //add all constraints of the molecule into constraint manager
33 void addConstraints(Molecule* mol);
34
35 //remove all constraints of the molecule from constraint manager
36 void removeConstraints(Molecule* mol);
37
38 //creat an iterator of constraint element
39 virtual ConstraintElementIterator* creatElementIterator();
40
41 //creat an iterator of constraint pair
42 virtual ConstraintPairIterator* creatPairIterator();
43
44 protected:
45
46 //since we don't need to provide random access for constraint pair and constraint object
47 //we can use list<vector> which will make addConstraints() and removeConstraints fast
48 //Using Iterator Pattern, the data structure is encapsulated inside the iterator.
49 //Therefore,the navigation is still easy
50
51 list<vector<ConstraintElement*> > consElements;
52 list<vector<ConstraintPair*> > consPairs;
53 MolIterInfoMap iterInfoMap;
54 };
55
56 #endif //endif _CONSTRAINTMANAGER_H_

Properties

Name Value
svn:executable *