Skip to content
Snippets Groups Projects
Commit 660eba5c authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Put position inside ParticleInfo

parent 43d07a93
No related branches found
No related tags found
No related merge requests found
......@@ -38,14 +38,14 @@ public:
virtual ParticleInfo *clone() const
{
return new ParticleInfo(
mP_particle->clone(), m_depth, m_abundance);
mP_particle->clone(), getDepth(), m_abundance);
}
//! Returns a clone with inverted magnetic fields
virtual ParticleInfo *cloneInvertB() const
{
return new ParticleInfo(
mP_particle->cloneInvertB(), m_depth, m_abundance);
mP_particle->cloneInvertB(), getDepth(), m_abundance);
}
//! calls the ISampleVisitor's visit method
......@@ -55,10 +55,10 @@ public:
const IParticle *getParticle() const { return mP_particle.get(); }
//! Returns depth.
double getDepth() const { return m_depth; }
double getDepth() const { return -m_position.z(); }
//! Sets depth.
void setDepth(double depth) { m_depth = depth; }
void setDepth(double depth) { m_position.setZ(-depth); }
//! Returns abundance.
double getAbundance() const { return m_abundance; }
......@@ -77,7 +77,7 @@ protected:
virtual void print(std::ostream& ostr) const;
std::auto_ptr<IParticle> mP_particle;
double m_depth;
kvector_t m_position;
double m_abundance;
};
......
......@@ -43,7 +43,7 @@ public:
//! Returns particle position, including depth.
kvector_t getPosition() const
{ return kvector_t(m_pos_x, m_pos_y, -m_depth); }
{ return kvector_t(m_pos_x, m_pos_y, m_position.z()); }
//! Sets particle position, including depth.
void setPosition(kvector_t position);
......
......@@ -21,11 +21,11 @@ ParticleInfo::ParticleInfo(
double depth,
double abundance)
: mP_particle(p_particle)
, m_depth(depth)
, m_abundance(abundance)
{
setName("ParticleInfo");
registerChild(mP_particle.get());
m_position = kvector_t(0.0, 0.0, -depth);
init_parameters();
}
......@@ -34,26 +34,24 @@ ParticleInfo::ParticleInfo(
double depth,
double abundance)
: mP_particle(p_particle.clone())
, m_depth(depth)
, m_abundance(abundance)
{
setName("ParticleInfo");
registerChild(mP_particle.get());
m_position = kvector_t(0.0, 0.0, -depth);
init_parameters();
}
void ParticleInfo::init_parameters()
{
clearParameterPool();
registerParameter("depth", &m_depth);
registerParameter("abundance", &m_abundance);
}
void ParticleInfo::print(std::ostream& ostr) const
{
ostr << "ParticleInfo:" << getName() << "<" << this << "> : {" <<
" depth=" << m_depth <<
" position=" << m_position <<
", abundance=" << m_abundance;
ostr << " }";
}
......
......@@ -38,7 +38,7 @@ PositionParticleInfo::PositionParticleInfo(
PositionParticleInfo* PositionParticleInfo::clone() const
{
kvector_t position(m_pos_x, m_pos_y, -m_depth);
kvector_t position(m_pos_x, m_pos_y, m_position.z());
return new PositionParticleInfo(
mP_particle->clone(), position, m_abundance);
}
......@@ -47,7 +47,7 @@ void PositionParticleInfo::setPosition(kvector_t position)
{
m_pos_x = position.x();
m_pos_y = position.y();
m_depth = position.z();
m_position.setZ(position.z());
}
void PositionParticleInfo::init_parameters()
......@@ -55,7 +55,6 @@ void PositionParticleInfo::init_parameters()
clearParameterPool();
registerParameter("x_position", &m_pos_x);
registerParameter("y_position", &m_pos_y);
registerParameter("z_position", &m_depth);
registerParameter("abundance", &m_abundance);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment