ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/staticProps/RadialDistrFunc.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/staticProps/RadialDistrFunc.cpp (file contents):
Revision 2045 by tim, Thu Feb 17 18:30:54 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC

# Line 46 | Line 46 | RadialDistrFunc::        RadialDistrFunc(SimInfo* info
46   #include "primitives/Molecule.hpp"
47   namespace oopse {
48  
49 < RadialDistrFunc::        RadialDistrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2)
50 <        : info_(info), currentSnapshot_(NULL), dumpFilename_(filename), step_(1),
51 <          selectionScript1_(sele1), selectionScript2_(sele2), evaluator1_(info), evaluator2_(info),
52 <          seleMan1_(info), seleMan2_(info), common_(info), sele1_minus_common_(info), sele2_minus_common_(info){
49 >  RadialDistrFunc::        RadialDistrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2)
50 >    : info_(info), currentSnapshot_(NULL), dumpFilename_(filename), step_(1),
51 >      selectionScript1_(sele1), selectionScript2_(sele2), evaluator1_(info), evaluator2_(info),
52 >      seleMan1_(info), seleMan2_(info), common_(info), sele1_minus_common_(info), sele2_minus_common_(info){
53            
54 <    evaluator1_.loadScriptString(sele1);
55 <    evaluator2_.loadScriptString(sele2);
54 >      evaluator1_.loadScriptString(sele1);
55 >      evaluator2_.loadScriptString(sele2);
56  
57 <    if (!evaluator1_.isDynamic()) {
57 >      if (!evaluator1_.isDynamic()) {
58          seleMan1_.setSelectionSet(evaluator1_.evaluate());
59          validateSelection1(seleMan1_);
60 <    }
61 <    if (!evaluator2_.isDynamic()) {
60 >      }
61 >      if (!evaluator2_.isDynamic()) {
62          seleMan2_.setSelectionSet(evaluator2_.evaluate());
63          validateSelection2(seleMan2_);
64 <    }
64 >      }
65  
66 <    if (!evaluator1_.isDynamic() && !evaluator2_.isDynamic()) {
66 >      if (!evaluator1_.isDynamic() && !evaluator2_.isDynamic()) {
67          //if all selections are static,  we can precompute the number of real pairs    
68          common_ = seleMan1_ & seleMan2_;
69          sele1_minus_common_ = seleMan1_ - common_;
# Line 74 | Line 74 | RadialDistrFunc::        RadialDistrFunc(SimInfo* info
74          int nIntersect = common_.getSelectionCount();
75          
76          nPairs_ = nSelected1 * nSelected2 - (nIntersect +1) * nIntersect/2;            
77 <    }
77 >      }
78      
79 < }
79 >    }
80  
81 < void RadialDistrFunc::process() {
81 >  void RadialDistrFunc::process() {
82      Molecule* mol;
83      RigidBody* rb;
84      SimInfo::MoleculeIterator mi;
# Line 91 | Line 91 | void RadialDistrFunc::process() {
91      nProcessed_ = nFrames / step_;
92  
93      for (int i = 0; i < nFrames; i += step_) {
94 <        reader.readFrame(i);
95 <        currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot();
94 >      reader.readFrame(i);
95 >      currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot();
96  
97 <        if (evaluator1_.isDynamic()) {
98 <            seleMan1_.setSelectionSet(evaluator1_.evaluate());
99 <            validateSelection1(seleMan1_);
100 <        }
101 <        if (evaluator2_.isDynamic()) {
102 <            seleMan2_.setSelectionSet(evaluator2_.evaluate());
103 <            validateSelection2(seleMan2_);
104 <        }
97 >      if (evaluator1_.isDynamic()) {
98 >        seleMan1_.setSelectionSet(evaluator1_.evaluate());
99 >        validateSelection1(seleMan1_);
100 >      }
101 >      if (evaluator2_.isDynamic()) {
102 >        seleMan2_.setSelectionSet(evaluator2_.evaluate());
103 >        validateSelection2(seleMan2_);
104 >      }
105  
106 <        for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) {
106 >      for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) {
107  
108 <            //change the positions of atoms which belong to the rigidbodies
109 <            for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
110 <                rb->updateAtoms();
111 <            }
112 <        }
108 >        //change the positions of atoms which belong to the rigidbodies
109 >        for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
110 >          rb->updateAtoms();
111 >        }
112 >      }
113          
114 <        initalizeHistogram();
114 >      initalizeHistogram();
115  
116  
117          
118 <        //selections may overlap.
119 <        //
120 <        // |s1 -c | c |
121 <        //            | c |s2 - c|
122 <        //
123 <        // s1 : number of selected stuntdoubles in selection1
124 <        // s2 : number of selected stuntdoubles in selection2
125 <        // c   : number of intersect stuntdouble between selection1 and selection2
126 <        //when loop over the pairs, we can divide the looping into 3 stages
127 <        //stage 1 :     [s1-c]      [s2]
128 <        //stage 2 :     [c]            [s2 - c]
129 <        //stage 3 :     [c]            [c]
130 <        //stage 1 and stage 2 are completly non-overlapping
131 <        //stage 3 are completely overlapping
118 >      //selections may overlap.
119 >      //
120 >      // |s1 -c | c |
121 >      //            | c |s2 - c|
122 >      //
123 >      // s1 : number of selected stuntdoubles in selection1
124 >      // s2 : number of selected stuntdoubles in selection2
125 >      // c   : number of intersect stuntdouble between selection1 and selection2
126 >      //when loop over the pairs, we can divide the looping into 3 stages
127 >      //stage 1 :     [s1-c]      [s2]
128 >      //stage 2 :     [c]            [s2 - c]
129 >      //stage 3 :     [c]            [c]
130 >      //stage 1 and stage 2 are completly non-overlapping
131 >      //stage 3 are completely overlapping
132  
133 <        if (evaluator1_.isDynamic() || evaluator2_.isDynamic()) {
133 >      if (evaluator1_.isDynamic() || evaluator2_.isDynamic()) {
134  
135 <            common_ = seleMan1_ & seleMan2_;
136 <            sele1_minus_common_ = seleMan1_ - common_;
137 <            sele2_minus_common_ = seleMan2_ - common_;            
138 <            int nSelected1 = seleMan1_.getSelectionCount();
139 <            int nSelected2 = seleMan2_.getSelectionCount();
140 <            int nIntersect = common_.getSelectionCount();
135 >        common_ = seleMan1_ & seleMan2_;
136 >        sele1_minus_common_ = seleMan1_ - common_;
137 >        sele2_minus_common_ = seleMan2_ - common_;            
138 >        int nSelected1 = seleMan1_.getSelectionCount();
139 >        int nSelected2 = seleMan2_.getSelectionCount();
140 >        int nIntersect = common_.getSelectionCount();
141              
142 <            nPairs_ = nSelected1 * nSelected2 - (nIntersect +1) * nIntersect/2;                      
143 <        }
142 >        nPairs_ = nSelected1 * nSelected2 - (nIntersect +1) * nIntersect/2;                      
143 >      }
144  
145 <        processNonOverlapping(sele1_minus_common_, seleMan2_);
146 <        processNonOverlapping(common_, sele2_minus_common_);        
147 <        processOverlapping(common_);
145 >      processNonOverlapping(sele1_minus_common_, seleMan2_);
146 >      processNonOverlapping(common_, sele2_minus_common_);        
147 >      processOverlapping(common_);
148          
149          
150 <        processHistogram();
150 >      processHistogram();
151          
152      }
153  
154      postProcess();
155  
156      writeRdf();
157 < }
157 >  }
158  
159 < void RadialDistrFunc::processNonOverlapping( SelectionManager& sman1, SelectionManager& sman2) {
159 >  void RadialDistrFunc::processNonOverlapping( SelectionManager& sman1, SelectionManager& sman2) {
160      StuntDouble* sd1;
161      StuntDouble* sd2;
162      int i;    
# Line 164 | Line 164 | void RadialDistrFunc::processNonOverlapping( Selection
164      
165      for (sd1 = sman1.beginSelected(i); sd1 != NULL; sd1 = sman1.nextSelected(i)) {
166  
167 <        for (sd2 = sman2.beginSelected(j); sd2 != NULL; sd2 = sman2.nextSelected(j)) {
168 <            collectHistogram(sd1, sd2);
169 <        }            
167 >      for (sd2 = sman2.beginSelected(j); sd2 != NULL; sd2 = sman2.nextSelected(j)) {
168 >        collectHistogram(sd1, sd2);
169 >      }            
170      }
171  
172 < }
172 >  }
173  
174 < void RadialDistrFunc::processOverlapping( SelectionManager& sman) {
174 >  void RadialDistrFunc::processOverlapping( SelectionManager& sman) {
175      StuntDouble* sd1;
176      StuntDouble* sd2;
177      int i;    
# Line 182 | Line 182 | void RadialDistrFunc::processOverlapping( SelectionMan
182      //  for (int j = i + 1; j < n; ++j) {}
183      
184      for (sd1 = sman.beginSelected(i); sd1 != NULL; sd1 = sman.nextSelected(i)) {                    
185 <        for (j  = i, sd2 = sman.nextSelected(j); sd2 != NULL; sd2 = sman.nextSelected(j)) {
186 <            collectHistogram(sd1, sd2);
187 <        }            
185 >      for (j  = i, sd2 = sman.nextSelected(j); sd2 != NULL; sd2 = sman.nextSelected(j)) {
186 >        collectHistogram(sd1, sd2);
187 >      }            
188      }
189  
190 < }
190 >  }
191  
192   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines