Changeset b3075a for src/units


Ignore:
Timestamp:
Apr 9, 2013, 8:44:51 PM (13 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
6e10f33
Parents:
866ac4
Message:

Add VMG::Particle::Particle output method.

Location:
src/units/particle
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/units/particle/particle.hpp

    r866ac4 rb3075a  
    2828#ifndef PARTICLE_HPP_
    2929#define PARTICLE_HPP_
     30
     31#include <sstream>
     32#include <string>
    3033
    3134#include "base/vector.hpp"
     
    113116  }
    114117
     118  std::string ToString() const
     119  {
     120    std::stringstream str;
     121
     122    str << "VMG::Particle::Particle {" << std::endl
     123        << "  Pos:       " << x_ << std::endl
     124        << "  Charge:    " << q_ << std::endl
     125        << "  Potential: " << p_ << std::endl
     126        << "  Field:     " << f_ << std::endl
     127        << "}";
     128
     129    return str.str();
     130  }
     131
    115132private:
    116133  Vector x_, f_;
     
    120137};
    121138
     139std::ostream& operator<<(std::ostream& out, const VMG::Particle::Particle& particle);
     140
    122141}
    123142
Note: See TracChangeset for help on using the changeset viewer.