Ignore:
Timestamp:
Oct 27, 2009, 8:54:44 AM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
8b6ee4
Parents:
2e6aa1
Message:

Begun with ticket #38 (make const what is const).

  • basically all changes to member function that now state that they do not change member attributes.
  • in molecule_template.hpp all member functions are declared const, as we only need start and end from molecule and these are never changed (lots of overloaded templates removed thereby).
  • Vector::Distance...() and ...DistanceSquared() are const now too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/atom.cpp

    r2e6aa1 r94d0ad  
    4343  sort = &nr;
    4444  node = &x;
    45 }
     45};
    4646
    4747
     
    8383 * \param **res return value (only set if atom::father is equal to \a *ptr)
    8484 */
    85 void atom::EqualsFather ( atom *ptr, atom **res )
     85void atom::EqualsFather ( const atom *ptr, const atom **res ) const
    8686{
    8787  if ( ptr == father )
     
    9494 * \return true - is inside, false - is not
    9595 */
    96 bool atom::IsInParallelepiped(Vector offset, double *parallelepiped)
     96bool atom::IsInParallelepiped(const Vector offset, const double *parallelepiped) const
    9797{
    9898  return (node->IsInParallelepiped(offset, parallelepiped));
     
    110110};
    111111
    112 /** Output of a single atom.
     112/** Output of a single atom with given numbering.
    113113 * \param ElementNo cardinal number of the element
    114114 * \param AtomNo cardinal number among these atoms of the same element
     
    117117  * \return true - \a *out present, false - \a *out is NULL
    118118 */
    119 bool atom::Output(ofstream *out, int ElementNo, int AtomNo, const char *comment) const
     119bool atom::OutputIndexed(ofstream *out, const int ElementNo, const int AtomNo, const char *comment) const
    120120{
    121121  if (out != NULL) {
     
    133133    return false;
    134134};
    135 bool atom::Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment)
     135
     136/** Output of a single atom with numbering from array according to atom::type.
     137 * \param *ElementNo cardinal number of the element
     138 * \param *AtomNo cardinal number among these atoms of the same element
     139 * \param *out stream to output to
     140 * \param *comment commentary after '#' sign
     141  * \return true - \a *out present, false - \a *out is NULL
     142 */
     143bool atom::OutputArrayIndexed(ofstream *out, const int *ElementNo, int *AtomNo, const char *comment) const
    136144{
    137145  AtomNo[type->Z]++;  // increment number
     
    171179  * \return true - \a *out present, false - \a *out is NULL
    172180 */
    173 bool atom::OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const
     181bool atom::OutputTrajectory(ofstream *out, const int *ElementNo, int *AtomNo, const int step) const
    174182{
    175183  AtomNo[type->Z]++;
     
    193201 * \return true - \a *out present, false - \a *out is NULL
    194202 */
    195 bool atom::OutputTrajectoryXYZ(ofstream *out, int step) const
     203bool atom::OutputTrajectoryXYZ(ofstream *out, const int step) const
    196204{
    197205  if (out != NULL) {
     
    210218 * \param *AtomNo pointer to atom counter that is increased by one
    211219 */
    212 void atom::OutputMPQCLine(ofstream *out, Vector *center, int *AtomNo = NULL) const
     220void atom::OutputMPQCLine(ofstream *out, const Vector *center, int *AtomNo = NULL) const
    213221{
    214222  *out << "\t\t" << type->symbol << " [ " << x.x[0]-center->x[0] << "\t" << x.x[1]-center->x[1] << "\t" << x.x[2]-center->x[2] << " ]" << endl;
     
    217225};
    218226
    219 ostream & operator << (ostream &ost, const ParticleInfo &a)
    220 {
    221   ost << "[" << a.Name << "|" << &a << "]";
    222   return ost;
    223 };
    224 
    225 ostream & ParticleInfo::operator << (ostream &ost)
    226 {
    227   ost << "[" << Name << "|" << this << "]";
    228   return ost;
    229 };
    230 
    231227/** Compares the indices of \a this atom with a given \a ptr.
    232228 * \param ptr atom to compare index against
    233229 * \return true - this one's is smaller, false - not
    234230 */
    235 bool atom::Compare(const atom &ptr)
     231bool atom::Compare(const atom &ptr) const
    236232{
    237233  if (nr < ptr.nr)
     
    245241 * \return distance squared
    246242 */
    247 double atom::DistanceSquaredToVector(Vector &origin)
     243double atom::DistanceSquaredToVector(const Vector &origin) const
    248244{
    249245  return origin.DistanceSquared(&x);
     
    254250 * \return distance
    255251 */
    256 double atom::DistanceToVector(Vector &origin)
     252double atom::DistanceToVector(const Vector &origin) const
    257253{
    258254  return origin.Distance(&x);
Note: See TracChangeset for help on using the changeset viewer.