ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/utils/OpenMDBitSet.cpp
(Generate patch)

Comparing:
trunk/src/utils/OpenMDBitSet.cpp (file contents), Revision 1442 by gezelter, Mon May 10 17:28:26 2010 UTC vs.
branches/development/src/utils/OpenMDBitSet.cpp (file contents), Revision 1767 by gezelter, Fri Jul 6 22:01:58 2012 UTC

# Line 36 | Line 36
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38   * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <algorithm>
44   #include <cassert>
45   #include <string>
46 + #include <iterator>
47  
48   #include "utils/OpenMDBitSet.hpp"
49   #include "utils/Algorithm.hpp"
# Line 63 | Line 65 | namespace OpenMD {
65      assert(fromIndex <= toIndex);
66      assert(fromIndex >=0);
67      assert(toIndex <= size());
68 <    std::vector<char>::iterator first = bitset_.begin() + fromIndex;
69 <    std::vector<char>::iterator last = bitset_.begin() + toIndex;
68 >    std::vector<bool>::iterator first = bitset_.begin() + fromIndex;
69 >    std::vector<bool>::iterator last = bitset_.begin() + toIndex;
70  
71      std::transform(first, last, first, std::logical_not<bool>());
72          
# Line 74 | Line 76 | namespace OpenMD {
76      assert(fromIndex <= toIndex);
77      assert(fromIndex >=0);
78      assert(toIndex <= size());
79 <    std::vector<char>::iterator first = bitset_.begin() + fromIndex;
80 <    std::vector<char>::iterator last = bitset_.begin() + toIndex;
79 >    std::vector<bool>::iterator first = bitset_.begin() + fromIndex;
80 >    std::vector<bool>::iterator last = bitset_.begin() + toIndex;
81  
82      OpenMDBitSet result;
83      std::copy(first, last, std::back_inserter(result.bitset_));
# Line 83 | Line 85 | namespace OpenMD {
85    }
86  
87    bool OpenMDBitSet::none() {
88 <    std::vector<char>::iterator i = std::find(bitset_.begin(), bitset_.end(), true);
88 >    std::vector<bool>::iterator i = std::find(bitset_.begin(), bitset_.end(), true);
89      return i == bitset_.end() ? true : false;
90    }
91      
# Line 141 | Line 143 | namespace OpenMD {
143      assert(fromIndex <= toIndex);
144      assert(fromIndex >=0);
145      assert(toIndex <= size());
146 <    std::vector<char>::iterator first = bitset_.begin() + fromIndex;
147 <    std::vector<char>::iterator last = bitset_.begin() + toIndex;
146 >    std::vector<bool>::iterator first = bitset_.begin() + fromIndex;
147 >    std::vector<bool>::iterator last = bitset_.begin() + toIndex;
148      std::fill(first, last, value);
149    }
150  
# Line 197 | Line 199 | namespace OpenMD {
199    //}
200  
201    std::ostream& operator<< ( std::ostream& os, const OpenMDBitSet& bs) {
202 <    for (int i = 0; i < bs.bitset_.size(); ++i) {
202 >    for (unsigned int i = 0; i < bs.bitset_.size(); ++i) {
203        std::string val = bs[i] ? "true" : "false";
204        os << "OpenMDBitSet[" << i <<"] = " << val << std::endl;
205      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines