// Author: Egon Pavlica <http://www.ses-ng.si/~pavlica/>

#include "LMiki.h"
#include <iostream>

//________________________________________
//  This class is the motion controler of 
//  particle e in a space LSpace
//  you must first create LSpace with
//  particles and than bind this class
//  with them
//
//
// Logs:
//
//  $Log: LMiki.cc,v $
//  Revision 1.3  2003/06/26 11:24:25  cvs
//  modified particle moving with LMiki and faster LDisorder operations
//
//  Revision 1.2  2003/06/26 09:27:11  cvs
//  added log fields...
//
ClassImp(LMiki)

 LMiki::LMiki(LSpace* space){
  //with this constructor we link LMiki class
  //with LSpace and LParticle
  if (fverbose) std::cout<<"class LMiki createdn";
  fspace=space;
  fe=space->GetParticle();
  if (fverbose) std::cout<<"class LMiki linked to spacen";
  //  fmonitor=0;
}

 LMiki::~LMiki(){
  //Default destructor
  //  fmonitor=0;
  fe=0;
  fspace=0;
  if (fverbose) std::cout<<"class LMiki destructedn";
}

//void LMiki::MonitorEnergy(TCanvas* c2){
  //energy is monitored
//  fmonitor->Energy(fe,c2);
//}

//void LMiki::MonitorPosition(TCanvas* c1){
  //monitor position 
//  fmonitor->Position(fe,c1);
//}

//void LMiki::AddMonitor(LMonitor* monitor){
  //link monitor, no update during simulation until Monitor*() is used
//  fmonitor=monitor;
  //  fmonitor->SetParticle(fe);
//  if (fverbose) std::cout<<"Monitor Linkedn";
//}

 int LMiki::Move(const int i,const int j,const int k){
  //move particle e to coordinate i,j,k and set its energy
  //if it is successful, returns 1 else if the particle exited space returns 0

  fe->i=i;fe->j=j;fe->k=k; 
  fe->SetEnergy(fspace->GetEnergy(fe->i,fe->j,fe->k));
  return fspace->IsInside(fe);
}

 int LMiki::MoveTo(const int i,const int j,const int k){
  //move particle e relative to current coordinate by i,j,k and set its energy
  //if it is successful, returns 1 else if the particle exited space returns 0

  //if (!e) Lattice::Start(i,j,k); 
  /*
  int max=2;
  if (i>max) cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  if (i<-max) cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  if (j>max) cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  if (j<-max)cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  if (k>max) cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  if (k<-max) cerr<<"Error moveto "<<i<<","<<j<<","<<k<<"n";
  */
  //if (fe) fe->i+=i;fe->j+=j;fe->k+=k; 
  fe->i+=i;fe->j+=j;fe->k+=k; //simple
  fe->SetEnergy(fspace->GetEnergy(fe->i,fe->j,fe->k));
  return fspace->IsInside(fe);
}



























ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.