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