ARWavefunction.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Daniel Scully ( d.i.scully \at warwick.ac.uk)
8  University of Warwick
9 
10 */
11 //____________________________________________________________________________
12 
13 #include <iostream>
14 #include <sstream>
15 #include <string>
16 #include <complex>
17 #include <vector>
18 
20 
21 namespace genie
22 {
23 namespace alvarezruso
24 {
25 
26 ARWavefunction::ARWavefunction(unsigned int sampling_in, bool debug)
27  : debug_(debug),
28  sampling_(2*sampling_in),
29  wavefunction_(sampling_, std::vector<std::complex<double> >(sampling_, std::complex<double> (0.0,0.0)) )
30 {
31  if(debug_) std::cerr << "WF@ Constructor" << std::endl;
32 }
33 
35 
37 {
38  std::ostringstream oss;
39  oss << "{";
40  for(unsigned int i = 0; i != sampling_; ++i)
41  {
42  oss << "[";
43  for(unsigned int j = 0; j != sampling_; ++j)
44  {
45  oss << ((*this)[i][j]);
46  if( j != (sampling_ - 1) ) oss << ", ";
47  }
48  oss << "]";
49  }
50  oss << "}";
51  return oss.str();
52 }
53 
54 const std::vector<std::complex<double> >& ARWavefunction::operator[] (unsigned int i) const
55 {
56  return wavefunction_[i];
57 }
58 
59 const std::complex<double> & ARWavefunction::operator() (unsigned int i, unsigned int j) const
60 {
61  return wavefunction_[i][j];
62 }
63 
64 std::complex<double> ARWavefunction::get(unsigned int i, unsigned int j) const
65 {
66  return wavefunction_[i][j];
67 }
68 
69 void ARWavefunction::set(unsigned int i, unsigned int j, const std::complex<double> & value)
70 {
71  wavefunction_[i][j] = value;
72 }
73 
74 unsigned int ARWavefunction::sampling() const { return sampling_; }
75 
76 } //namespace alvarezruso
77 } //namespace genie
78 
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
const std::complex< double > & operator()(unsigned int i, unsigned int j) const
OStream cerr
Definition: OStream.cxx:7
std::vector< std::vector< std::complex< double > > > wavefunction_
std::complex< double > get(unsigned int i, unsigned int j) const
const std::vector< std::complex< double > > & operator[](unsigned int i) const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const double j
Definition: BetheBloch.cxx:29
void set(unsigned int i, unsigned int j, const std::complex< double > &value)
ARWavefunction(unsigned int sampling_in, bool debug=false)
enum BeamMode string