Пример #1
0
/****************** Member functions ******************************************/
void em1d::advance_a_step(const int _n)
{ 
    /**************************************************************************/
    // Update E-field
    update_E();
    apply_boundary_E();
    update_source_for_E(_n);
  
    /**************************************************************************/
    // update the material response
    update_polarization(Ex,ncell);
    
    /**************************************************************************/
    // Update H-field
    update_H();
    apply_boundary_H();
    update_source_for_H(_n);
    
    /**************************************************************************/
    // Outputs the progress of the calculation on screen
    if(_n%screenout==0) printf("Progress = %d/%d\n",_n,nsteps);
    
    /**************************************************************************/
    // Writing fields to file                
    if(_n%fileout==0) write_field_to_file(_n,Ex,Hy);
    
    /**************************************************************************/
    flush_output_buffers();
}
Пример #2
0
int CParticle::set_mass(double mass_)
{
	mass = mass_;
	update_E();
	
	return 0;
	
}
Пример #3
0
int CParticle::set_momentum(double px_, double py_, double pz_)
{
	
	EM.set_x(px_);
	EM.set_y(py_);
	EM.set_z(pz_);
	
	// set E
	update_E();
		
	return 0;
	
}