Changes in src/atom_atominfo.cpp [112b09:d74077]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/atom_atominfo.cpp ¶
r112b09 rd74077 10 10 #include "periodentafel.hpp" 11 11 #include "World.hpp" 12 #include "element.hpp" 12 13 #include "atom_atominfo.hpp" 13 14 14 15 /** Constructor of class AtomInfo. 15 16 */ 16 AtomInfo::AtomInfo() : type(NULL) {}; 17 AtomInfo::AtomInfo() : AtomicElement(NULL) {}; 18 19 /** Copy constructor of class AtomInfo. 20 */ 21 AtomInfo::AtomInfo(const AtomInfo &_atom) : AtomicPosition(_atom.AtomicPosition), AtomicElement(_atom.AtomicElement) {}; 22 23 AtomInfo::AtomInfo(const VectorInterface &_v) : AtomicPosition(_v.getPosition()), AtomicElement(NULL) 24 {}; 17 25 18 26 /** Destructor of class AtomInfo. … … 22 30 }; 23 31 24 const element *AtomInfo::getType(){ 25 return type; 32 const element *AtomInfo::getType() const 33 { 34 return AtomicElement; 35 } 36 37 const double& AtomInfo::operator[](size_t i) const 38 { 39 return AtomicPosition[i]; 40 } 41 42 const double& AtomInfo::at(size_t i) const 43 { 44 return AtomicPosition.at(i); 45 } 46 47 void AtomInfo::set(size_t i, const double value) 48 { 49 AtomicPosition.at(i) = value; 50 } 51 52 const Vector& AtomInfo::getPosition() const 53 { 54 return AtomicPosition; 26 55 } 27 56 28 57 void AtomInfo::setType(const element* _type) { 29 type= _type;58 AtomicElement = _type; 30 59 } 31 60 32 void AtomInfo::setType( int Z) {61 void AtomInfo::setType(const int Z) { 33 62 const element *elem = World::getInstance().getPeriode()->FindElement(Z); 34 63 setType(elem); 35 64 } 65 66 void AtomInfo::setPosition(const Vector& _vector) 67 { 68 AtomicPosition = _vector; 69 //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl; 70 } 71 72 const VectorInterface& AtomInfo::operator+=(const Vector& b) 73 { 74 AtomicPosition += b; 75 return *this; 76 } 77 78 const VectorInterface& AtomInfo::operator-=(const Vector& b) 79 { 80 AtomicPosition -= b; 81 return *this; 82 } 83 84 Vector const AtomInfo::operator+(const Vector& b) const 85 { 86 Vector a(AtomicPosition); 87 a += b; 88 return a; 89 } 90 91 Vector const AtomInfo::operator-(const Vector& b) const 92 { 93 Vector a(AtomicPosition); 94 a -= b; 95 return a; 96 } 97 98 double AtomInfo::distance(const Vector &point) const 99 { 100 return AtomicPosition.distance(point); 101 } 102 103 double AtomInfo::DistanceSquared(const Vector &y) const 104 { 105 return AtomicPosition.DistanceSquared(y); 106 } 107 108 double AtomInfo::distance(const VectorInterface &_atom) const 109 { 110 return _atom.distance(AtomicPosition); 111 } 112 113 double AtomInfo::DistanceSquared(const VectorInterface &_atom) const 114 { 115 return _atom.DistanceSquared(AtomicPosition); 116 } 117 118 VectorInterface &AtomInfo::operator=(const Vector& _vector) 119 { 120 AtomicPosition = _vector; 121 return *this; 122 } 123 124 void AtomInfo::ScaleAll(const double *factor) 125 { 126 AtomicPosition.ScaleAll(factor); 127 } 128 129 void AtomInfo::ScaleAll(const Vector &factor) 130 { 131 AtomicPosition.ScaleAll(factor); 132 } 133 134 void AtomInfo::Scale(const double factor) 135 { 136 AtomicPosition.Scale(factor); 137 } 138 139 void AtomInfo::Zero() 140 { 141 AtomicPosition.Zero(); 142 } 143 144 void AtomInfo::One(const double one) 145 { 146 AtomicPosition.One(one); 147 } 148 149 void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors) 150 { 151 AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors); 152 } 153 154 const AtomInfo& operator*=(AtomInfo& a, const double m) 155 { 156 a.Scale(m); 157 return a; 158 } 159 160 AtomInfo const operator*(const AtomInfo& a, const double m) 161 { 162 AtomInfo copy(a); 163 copy *= m; 164 return copy; 165 } 166 167 AtomInfo const operator*(const double m, const AtomInfo& a) 168 { 169 AtomInfo copy(a); 170 copy *= m; 171 return copy; 172 } 173 174 std::ostream & AtomInfo::operator << (std::ostream &ost) const 175 { 176 return (ost << getPosition()); 177 } 178 179 std::ostream & operator << (std::ostream &ost, const AtomInfo &a) 180 { 181 ost << a; 182 return ost; 183 } 184
Note:
See TracChangeset
for help on using the changeset viewer.