OSHUN  beta
Arbitrary Order Spherical-Harmonic 1D-3P Vlasov-Fokker-Planck-Maxwell code
Output_Data::p1x1_1D Class Reference

#include <export.h>

Public Member Functions

 p1x1_1D (const Grid_Info &_G)
 
 p1x1_1D (const p1x1_1D &other)
 
 ~p1x1_1D ()
 
valarray< float > operator() (DistFunc1D &df, size_t x0, size_t s)
 
size_t Species () const
 
float Pmin (size_t s) const
 
float Pmax (size_t s) const
 
valarray< float > p1_x1 (size_t s) const
 

Private Attributes

vector< valarray< float > > p1x1
 
vector< float > pmin
 
vector< float > pmax
 

Detailed Description

Definition at line 290 of file export.h.

Constructor & Destructor Documentation

◆ p1x1_1D() [1/2]

Output_Data::p1x1_1D::p1x1_1D ( const Grid_Info _G)

Definition at line 962 of file export.cpp.

References Grid_Info::axis, Algorithms::AxisBundle< T >::Npx(), Algorithms::AxisBundle< T >::pdim(), and Algorithms::AxisBundle< T >::pmax().

962  {
963 
964 // Generate the required structures
965  for (size_t s(0); s < _G.axis.pdim(); ++s) {
966  pmax.push_back( static_cast<float>(_G.axis.pmax(s)) );
967  pmin.push_back( static_cast<float>(-1.0*_G.axis.pmax(s)) );
968 // Pl.push_back( PLegendre1D( _G.l0[s], _G.m0[s], _G.axis.Np(s), static_cast<float>(_G.axis.pmin(s)),
969 // static_cast<float>(_G.axis.pmax(s)), _G.axis.Npx(s) ) );
970 //
971 // polarR.push_back( Array2D<float>( _G.axis.Npx(s), _G.axis.Np(s) ) );
972 
973  p1x1.push_back( valarray<float>( _G.axis.Npx(s)) );
974 
975  }
976 
977 /*// Calculate a 2D array for the polar radius for each px and pr
978  for (size_t s(0); s < _G.axis.pdim(); ++s) {
979  valarray<float> p( Algorithms::MakeAxis( pmin[s], pmax[s], _G.axis.Np(s) )),
980  px(Algorithms::MakeAxis( float(-1.0)* pmax[s], pmax[s], _G.axis.Npx(s) ));
981 // --->
982  for (size_t i(0); i < _G.axis.Npx(s); ++i){
983  for (size_t j(0); j < _G.axis.Np(s); ++j){
984  float polarR_sq = p[j] * p[j] - px[i] * px[i];
985  if (polarR_sq < 0.0) {
986  polarR[s](i,j) = -1.0;
987  }
988  else {
989  polarR[s](i,j) = sqrt(abs(polarR_sq));
990  }
991  // std::cout << "\n polarR[s](" << px[i] << ',' << p[j] << ") = " << polarR[s](i,j) << "\n";
992  }
993  }
994 // <---
995  }*/
996 // p1x1 = new valarray<float>(Npx);
997 }
vector< float > pmin
Definition: export.h:319
vector< valarray< float > > p1x1
Definition: export.h:318
vector< float > pmax
Definition: export.h:319
const Algorithms::AxisBundle< double > axis
Definition: setup.h:47
size_t Npx(size_t i) const
T pmax(size_t i) const
Here is the call graph for this function:

◆ p1x1_1D() [2/2]

Output_Data::p1x1_1D::p1x1_1D ( const p1x1_1D other)

Definition at line 1000 of file export.cpp.

References p1_x1(), Pmax(), Pmin(), and Species().

1000  {
1001 
1002  for (size_t s(0); s < other.Species(); ++s) {
1003  pmin.push_back( other.Pmin(s) );
1004  pmax.push_back( other.Pmax(s) );
1005 // Pl.push_back( other.PL(s) );
1006 // polarR.push_back( other.PolarR(s) );
1007  p1x1.push_back( other.p1_x1(s) );
1008  }
1009 }
vector< float > pmin
Definition: export.h:319
vector< valarray< float > > p1x1
Definition: export.h:318
vector< float > pmax
Definition: export.h:319
Here is the call graph for this function:

◆ ~p1x1_1D()

Output_Data::p1x1_1D::~p1x1_1D ( )

Definition at line 1012 of file export.cpp.

1012  {
1013  // delete p1x1;
1014 }

Member Function Documentation

◆ operator()()

valarray< float > Output_Data::p1x1_1D::operator() ( DistFunc1D df,
size_t  x0,
size_t  s 
)

Definition at line 1020 of file export.cpp.

References DistFunc1D::dim().

1020  {
1021 
1022  p1x1[s] = 0.0; // this is a valarray<float>
1023  vector<complex<double> > dummyvec;
1024 
1025 /* float p_im1(0.0), p_ip1(0.0);
1026  float integrant_low(0.0),
1027  integrant_high(0.0);
1028 
1029 // Calculate the integral for each harmonic separately
1030 // for (size_t l(0); l < Nl(s); ++l) {
1031  for (size_t i(0); i < (Pl[s]).dim(); ++i) {
1032 
1033  valarray<float> InPx( Npx(s) );
1034  for (size_t ipx(0); ipx < Npx(s)-1; ++ipx) { // at each location in px
1035 
1036 // // At each location in |p|
1037  size_t ip(0);
1038  while (polarR[s](ipx,ip) < 0 ) { ++ip; }
1039 
1040  p_ip1 = polarR[s](ipx,ip);
1041  integrant_high =(float( (df(i))(ip,x0).real() ))*Pl[s](i)(ipx, ip) ;
1042 
1043 
1044 
1045  InPx[ipx] += p_ip1 * (0.5*p_ip1) * integrant_high;
1046  ++ip;
1047  while ( (ip < Np(s) ) && (polarR[s](ipx,ip) > 0) ) {
1048  p_im1 = p_ip1;
1049  integrant_low = integrant_high;
1050 
1051  p_ip1 = polarR[s](ipx,ip);
1052  integrant_high =(float( (df(i))(ip,x0).real() )) * Pl[s](i)(ipx, ip);
1053 
1054  InPx[ipx] += p_im1 * (0.5*(p_ip1-p_im1)) * integrant_low;
1055  InPx[ipx] += p_ip1 * (0.5*(p_ip1-p_im1)) * integrant_high;
1056 
1057  ++ip;
1058  }
1059  // if (i==3) std::cout << "\n p1x1[s](" << ipx << ',' << ip << ") = " << InPx[ipx] << "\n";
1060  (p1x1[s])[ipx] = integrant_high;
1061  }
1062  }*/
1063 
1064  int sgn(1);
1065  size_t midpoint,ipxp,ipxm;
1066 
1067  for (size_t i(0); i < df.dim(); ++i)
1068  {
1069  dummyvec = df(i).xVec(x0);
1070 
1071  midpoint = df(0,0).nump();
1072  p1x1[s][midpoint] = (float) ((dummyvec[0]).real());
1073  for (size_t ip(0); ip < df(0,0).nump(); ++ip)
1074  {
1075  ipxm = midpoint - 1 - ip;
1076  ipxp = midpoint + 1 + ip;
1077 
1078  (p1x1[s])[ipxm] += (float) (sgn*(dummyvec[ip]).real());
1079  (p1x1[s])[ipxp] += (float) ((dummyvec[ip]).real());
1080  }
1081  sgn *= -1;
1082  }
1083 
1084 // p1x1[s] *= 2.0 * M_PI;
1085  // exit(1);
1086  return p1x1[s];
1087 }
vector< valarray< float > > p1x1
Definition: export.h:318
size_t dim() const
Definition: state.h:395
Here is the call graph for this function:

◆ p1_x1()

valarray<float> Output_Data::p1x1_1D::p1_x1 ( size_t  s) const
inline

Definition at line 311 of file export.h.

Referenced by p1x1_1D().

311 { return p1x1[s]; }
vector< valarray< float > > p1x1
Definition: export.h:318
Here is the caller graph for this function:

◆ Pmax()

float Output_Data::p1x1_1D::Pmax ( size_t  s) const
inline

Definition at line 308 of file export.h.

Referenced by p1x1_1D().

308 { return pmax[s]; }
vector< float > pmax
Definition: export.h:319
Here is the caller graph for this function:

◆ Pmin()

float Output_Data::p1x1_1D::Pmin ( size_t  s) const
inline

Definition at line 307 of file export.h.

Referenced by p1x1_1D().

307 { return pmin[s]; }
vector< float > pmin
Definition: export.h:319
Here is the caller graph for this function:

◆ Species()

size_t Output_Data::p1x1_1D::Species ( ) const
inline

Definition at line 303 of file export.h.

Referenced by p1x1_1D().

303 { return p1x1.size(); }
vector< valarray< float > > p1x1
Definition: export.h:318
Here is the caller graph for this function:

Field Documentation

◆ p1x1

vector< valarray<float> > Output_Data::p1x1_1D::p1x1
private

Definition at line 318 of file export.h.

◆ pmax

vector<float> Output_Data::p1x1_1D::pmax
private

Definition at line 319 of file export.h.

◆ pmin

vector<float> Output_Data::p1x1_1D::pmin
private

Definition at line 319 of file export.h.


The documentation for this class was generated from the following files: