Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.4
   Version 1.0.4dev
      Class Index
      File List
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads

convergence.hpp

Go to the documentation of this file.
00001 
00005 /* Copyright (c) 2011 Taneli Kalvas. All rights reserved.
00006  *
00007  * You can redistribute this software and/or modify it under the terms
00008  * of the GNU General Public License as published by the Free Software
00009  * Foundation; either version 2 of the License, or (at your option)
00010  * any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this library (file "COPYING" included in the package);
00019  * if not, write to the Free Software Foundation, Inc., 51 Franklin
00020  * Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  * 
00022  * If you have questions about your rights to use or distribute this
00023  * software, please contact Berkeley Lab's Technology Transfer
00024  * Department at TTD@lbl.gov. Other questions, comments and bug
00025  * reports should be sent directly to the author via email at
00026  * taneli.kalvas@jyu.fi.
00027  * 
00028  * NOTICE. This software was developed under partial funding from the
00029  * U.S.  Department of Energy.  As such, the U.S. Government has been
00030  * granted for itself and others acting on its behalf a paid-up,
00031  * nonexclusive, irrevocable, worldwide license in the Software to
00032  * reproduce, prepare derivative works, and perform publicly and
00033  * display publicly.  Beginning five (5) years after the date
00034  * permission to assert copyright is obtained from the U.S. Department
00035  * of Energy, and subject to any subsequent five (5) year renewals,
00036  * the U.S. Government is granted for itself and others acting on its
00037  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
00038  * the Software to reproduce, prepare derivative works, distribute
00039  * copies to the public, perform publicly and display publicly, and to
00040  * permit others to do so.
00041  */
00042 
00043 #ifndef CONVERGENCE_HPP
00044 #define CONVERGENCE_HPP 1
00045 
00046 
00047 #include <iostream>
00048 #include <stdint.h>
00049 #include <vector>
00050 #include "scalarfield.hpp"
00051 #include "trajectorydiagnostics.hpp"
00052 #include "particledatabase.hpp"
00053 
00054 
00057 class Convergence {
00058 
00059     int32_t                 _iter;              
00061     std::vector<double>     _epot_hist;         
00062     double                  _epot_lim;          
00063     double                  _epot_absf;         
00064     double                  _epot_relf;         
00065     ScalarField            *_epot_old;          
00066     const ScalarField      *_epot;              
00068     std::vector<double>     _scharge_hist;      
00069     double                  _scharge_lim;       
00070     double                  _scharge_absf;      
00071     double                  _scharge_relf;      
00072     ScalarField            *_scharge_old;       
00073     const ScalarField      *_scharge;           
00075     struct EmitPoint {
00076         double              _epsilon;           
00077         double              _alpha;             
00078         double              _beta;              
00079         double              _xave;              
00080         double              _xpave;             
00082         EmitPoint();
00083         EmitPoint( double x );
00084         EmitPoint( const Emittance &emit );
00085 
00086         double &operator[]( int i );
00087     };
00088 
00089     std::vector<double>     _emit_hist[2];      
00090     double                  _emit_lim;          
00091     double                  _emit_absf;         
00092     double                  _emit_relf;         
00093     EmitPoint               _emit_old[2];       
00094     const ParticleDataBase *_emit_pdb;          
00095     coordinate_axis_e       _emit_axis;         
00096     double                  _emit_val;          
00097     const Emittance        *_emit[2];           
00099 public:
00100 
00103     Convergence();
00104 
00107     ~Convergence();
00108 
00117     bool evaluate_iteration( void );
00118 
00121     void print_history( std::ostream &os ) const;
00122 
00125     void add_epot( const ScalarField &epot, double absf, double relf, double lim );
00126 
00129     void add_scharge( const ScalarField &scharge, double absf, double relf, double lim );
00130 
00133     void add_tdiag( const ParticleDataBase &pdb, coordinate_axis_e axis,
00134                     double val, double absf, double relf, double lim );
00135 
00138     void add_tdiag( const Emittance *emit1, double absf, double relf, double lim ) {
00139         add_tdiag( emit1, NULL, absf, relf, lim );
00140     }
00141 
00144     void add_tdiag( const Emittance *emit1, const Emittance *emit2, 
00145                     double absf, double relf, double lim );
00146 
00149     void set_emittance( const Emittance *emit1, const Emittance *emit2 = NULL );
00150 
00151 };
00152 
00153 
00154 #endif


Reference manual for Ion Beam Simulator 1.0.4dev
Generated by Doxygen 1.7.1 on Wed May 18 2011 23:03:47.