Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fermiqcd_fermi_field.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00024 class fermi_field: public mdp_complex_field {
00025  public:
00026   int    nspin, nc;
00027   fermi_field() {
00028     reset_field();
00029   }
00030   fermi_field(mdp_lattice &a, int nc_, int nspin_=4) {
00031     reset_field();
00032     nc=nc_;
00033     nspin=nspin_;
00034     allocate_field(a, nspin*nc);
00035   }  
00036   fermi_field(fermi_field &psi) {
00037     reset_field();
00038     nc=psi.nc;
00039     nspin=psi.nspin;
00040     allocate_field(psi.lattice(), nspin*nc);
00041   }  
00042   void allocate_fermi_field(mdp_lattice &a, int nc_, int nspin_=4) {
00043     deallocate_field();
00044     nc=nc_;
00045     nspin=nspin_;
00046     allocate_field(a, nspin*nc);
00047   }  
00048   fermi_field(const fermi_field &chi) : mdp_complex_field() {
00049     nc=chi.nc;
00050     nspin=chi.nspin;
00051     mdp_complex_field::operator=(chi);
00052   }
00053   void operator=(const fermi_field &chi) {
00054     nc=chi.nc;
00055     nspin=chi.nspin;
00056     mdp_complex_field::operator=(chi);
00057   }
00058   inline mdp_matrix operator() (site x) {
00059     return mdp_matrix(address(x),nspin,nc);
00060   }
00061   inline mdp_matrix operator() (site x, int a) {
00062     return mdp_matrix(address(x,a*nc),nc,1);
00063   }
00064   inline mdp_complex& operator() (site x, int a, int i) {
00065     return *(address(x,a*nc+i));
00066   }
00067   inline const mdp_complex& operator() (site x, int a, int i) const {
00068     return *(address(x,a*nc+i));
00069   }
00070   
00071   void operator= (mdp_complex a) {
00072     for(long i=0; i<size; i++) m[i]=a;
00073   }
00074  
00075 };
00076 
00077 
00078 
00079 // //////////////////////////////////////////////////////////////////////
00080 // function to print a quark field by components. It prompts for a site //
00081 // similar to the CANOPY one. I used this to test the converter        //
00083 
00084 void print_fermi_field(fermi_field &psi) {
00085   begin_function("print_fermi_field");
00086   int x0,x1,x2,x3;
00087   site x(psi.lattice());
00088   int do_exit=FALSE;
00089   do {
00090     mdp << "\nCheck point!\n";
00091     mdp << "Here you called the function to print the propagator\n";
00092     mdp << "Enter the coordinates (x0,x1,x2,x3 or 'quit' to end): ";
00093     if(ME==0) {
00094       string stringa;
00095       cin >> stringa;
00096       if(stringa=="quit") do_exit=TRUE;
00097       else sscanf(stringa.c_str(),"%i,%i,%i,%i", &x0,&x1,&x2,&x3);
00098     }
00099     mpi.broadcast(do_exit,0);
00100     if(do_exit==TRUE) {
00101       mdp << '\n';
00102       break;
00103     }
00104     mpi.broadcast(x0,0);
00105     mpi.broadcast(x1,0);
00106     mpi.broadcast(x2,0);
00107     mpi.broadcast(x3,0);
00108     if(on_which_process(psi.lattice(),x0,x1,x2,x3)==ME) {
00109       x.set(x0,x1,x2,x3);
00110       mdp << psi(x);
00111     }
00112   } while(1);
00113   end_function("print_fermi_field");
00114 }
00115 

Generated on Sun Feb 27 15:12:18 2005 by  doxygen 1.4.1