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

#include <export.h>

Public Member Functions

 p2p1x1_1D (const Grid_Info &_G)
 
 p2p1x1_1D (const p2p1x1_1D &other)
 
 ~p2p1x1_1D ()
 
Array2D< float > operator() (DistFunc1D &df, size_t x0, size_t s)
 
size_t Species () const
 
size_t Nl (size_t s) const
 
size_t Nm (size_t s) const
 
size_t Npx (size_t s) const
 
size_t Npy (size_t s) const
 
float Pmin (size_t s) const
 
float Pmax (size_t s) const
 
PLegendre2D PL (size_t s) const
 
Array2D< float > p2p1_x1 (size_t s) const
 
Array2D< float > prad (size_t s) const
 
Array2D< size_t > npcell (size_t s) const
 
Array2D< float > dcell (size_t s) const
 

Private Attributes

vector< float > pmin
 
vector< float > pmax
 
vector< size_t > numl
 
vector< size_t > numm
 
vector< PLegendre2DPl
 
vector< Array2D< float > > pr
 
vector< Array2D< size_t > > nextpcell
 
vector< Array2D< float > > distancetothatcell
 
vector< Array2D< float > > p2p1x1
 

Detailed Description

Definition at line 327 of file export.h.

Constructor & Destructor Documentation

◆ p2p1x1_1D() [1/2]

Output_Data::p2p1x1_1D::p2p1x1_1D ( const Grid_Info _G)

Definition at line 1156 of file export.cpp.

References Grid_Info::axis, Grid_Info::l0, Grid_Info::m0, Algorithms::MakeAxis(), Algorithms::AxisBundle< T >::Np(), Algorithms::AxisBundle< T >::Npx(), Algorithms::AxisBundle< T >::Npy(), Algorithms::AxisBundle< T >::pdim(), Algorithms::AxisBundle< T >::pmax(), and Algorithms::AxisBundle< T >::pmin().

1156  {
1157 
1158 // Generate the required structures
1159  for (size_t s(0); s < _G.axis.pdim(); ++s) {
1160  pmax.push_back( static_cast<float>(_G.axis.pmax(s)) );
1161  pmin.push_back( static_cast<float>(_G.axis.pmin(s)) );
1162  numl.push_back( _G.l0[s]);
1163  numm.push_back( _G.m0[s]);
1164 
1165  Pl.push_back( PLegendre2D( _G.l0[s], _G.m0[s], _G.axis.Np(s), static_cast<float>(_G.axis.pmin(s)),
1166  static_cast<float>(_G.axis.pmax(s)), _G.axis.Npx(s), _G.axis.Npy(s) ) );
1167  pr.push_back( Array2D<float>( _G.axis.Npx(s),_G.axis.Npy(s)));
1168 
1169 
1170  nextpcell.push_back( Array2D<size_t>( _G.axis.Npx(s),_G.axis.Npy(s)));
1171  distancetothatcell.push_back( Array2D<float>( _G.axis.Npx(s),_G.axis.Npy(s)));
1172 
1173 
1174  p2p1x1.push_back( Array2D<float>( _G.axis.Npx(s),_G.axis.Npy(s)) );
1175  }
1176 
1177  size_t k(0);
1178  // Calculate a 2D array for the pr for each px and py
1179  for (size_t s(0); s < _G.axis.pdim(); ++s) {
1180 
1181  valarray<float> p( Algorithms::MakeAxis( pmin[s], pmax[s], _G.axis.Np(s) )),
1182  px(Algorithms::MakeAxis( float(-1.0)* pmax[s], pmax[s], _G.axis.Npx(s) )),
1183  py(Algorithms::MakeAxis( float(-1.0)* pmax[s], pmax[s], _G.axis.Npy(s) ));
1184 // --->
1185  for (size_t i(0); i < _G.axis.Npx(s); ++i){
1186  for (size_t j(0); j < _G.axis.Npy(s); ++j){
1187  pr[s](i,j) = sqrt(px[i]*px[i]+py[j]*py[j]);
1188 
1189  while ((pr[s](i,j) > p[k]) && (k < _G.axis.Np(s))) ++k;
1190  if (k == 0) ++k;
1191  nextpcell[s](i,j) = k-1;
1192  distancetothatcell[s](i,j) = (p[k] - pr[s](i,j))/(p[1]-p[0]);
1193  // std::cout << "\n\n (px,py,pr,p[k],nextpcell(i,j)) = " << px[i]
1194  // << ", " << py[j]
1195  // << ", " << pr[s](i,j)
1196  // << ", " << p[k]
1197  // << ", " << nextpcell[s](i,j);
1198 
1199  k = 0;
1200 
1201  }
1202  }
1203 // <---
1204  }
1205 
1206 
1207 // f0x1 = new valarray<float>(Npx);
1208 }
vector< float > pmin
Definition: export.h:357
T pmin(size_t i) const
const vector< size_t > l0
Definition: setup.h:39
size_t Npy(size_t i) const
vector< Array2D< float > > distancetothatcell
Definition: export.h:362
const vector< size_t > m0
Definition: setup.h:42
vector< float > pmax
Definition: export.h:357
vector< Array2D< float > > pr
Definition: export.h:360
size_t Np(size_t i) const
valarray< T > MakeAxis(const T min, const T max, const size_t N)
vector< size_t > numm
Definition: export.h:358
vector< PLegendre2D > Pl
Definition: export.h:359
const Algorithms::AxisBundle< double > axis
Definition: setup.h:47
vector< Array2D< float > > p2p1x1
Definition: export.h:364
size_t Npx(size_t i) const
T pmax(size_t i) const
vector< Array2D< size_t > > nextpcell
Definition: export.h:361
vector< size_t > numl
Definition: export.h:358
Here is the call graph for this function:

◆ p2p1x1_1D() [2/2]

Output_Data::p2p1x1_1D::p2p1x1_1D ( const p2p1x1_1D other)

Definition at line 1211 of file export.cpp.

References dcell(), Nl(), Nm(), npcell(), p2p1_x1(), PL(), Pmax(), Pmin(), prad(), and Species().

1211  {
1212 
1213  for (size_t s(0); s < other.Species(); ++s) {
1214  pmin.push_back( other.Pmin(s) );
1215  pmax.push_back( other.Pmax(s) );
1216  numl.push_back( other.Nl(s));
1217  numm.push_back( other.Nm(s));
1218  Pl.push_back(other.PL(s));
1219  pr.push_back(other.prad(s));
1220  nextpcell.push_back(other.npcell(s));
1221  distancetothatcell.push_back(other.dcell(s));
1222  p2p1x1.push_back( other.p2p1_x1(s) );
1223  }
1224 }
vector< float > pmin
Definition: export.h:357
vector< Array2D< float > > distancetothatcell
Definition: export.h:362
vector< float > pmax
Definition: export.h:357
vector< Array2D< float > > pr
Definition: export.h:360
vector< size_t > numm
Definition: export.h:358
vector< PLegendre2D > Pl
Definition: export.h:359
vector< Array2D< float > > p2p1x1
Definition: export.h:364
vector< Array2D< size_t > > nextpcell
Definition: export.h:361
vector< size_t > numl
Definition: export.h:358
Here is the call graph for this function:

◆ ~p2p1x1_1D()

Output_Data::p2p1x1_1D::~p2p1x1_1D ( )

Definition at line 1227 of file export.cpp.

1227  {
1228 
1229 }

Member Function Documentation

◆ dcell()

Array2D<float> Output_Data::p2p1x1_1D::dcell ( size_t  s) const
inline

Definition at line 354 of file export.h.

Referenced by p2p1x1_1D().

354 {return distancetothatcell[s];}
vector< Array2D< float > > distancetothatcell
Definition: export.h:362
Here is the caller graph for this function:

◆ Nl()

size_t Output_Data::p2p1x1_1D::Nl ( size_t  s) const
inline

Definition at line 341 of file export.h.

Referenced by p2p1x1_1D().

341 { return numl[s]; }
vector< size_t > numl
Definition: export.h:358
Here is the caller graph for this function:

◆ Nm()

size_t Output_Data::p2p1x1_1D::Nm ( size_t  s) const
inline

Definition at line 342 of file export.h.

Referenced by p2p1x1_1D().

342 { return numm[s]; }
vector< size_t > numm
Definition: export.h:358
Here is the caller graph for this function:

◆ npcell()

Array2D<size_t> Output_Data::p2p1x1_1D::npcell ( size_t  s) const
inline

Definition at line 353 of file export.h.

Referenced by p2p1x1_1D().

353 {return nextpcell[s];}
vector< Array2D< size_t > > nextpcell
Definition: export.h:361
Here is the caller graph for this function:

◆ Npx()

size_t Output_Data::p2p1x1_1D::Npx ( size_t  s) const
inline

Definition at line 343 of file export.h.

343 { return Pl[s](0).dim1(); }
vector< PLegendre2D > Pl
Definition: export.h:359

◆ Npy()

size_t Output_Data::p2p1x1_1D::Npy ( size_t  s) const
inline

Definition at line 344 of file export.h.

344 { return Pl[s](0).dim2(); }
vector< PLegendre2D > Pl
Definition: export.h:359

◆ operator()()

Array2D< float > Output_Data::p2p1x1_1D::operator() ( DistFunc1D df,
size_t  x0,
size_t  s 
)

Definition at line 1234 of file export.cpp.

1234  {
1235 
1236  p2p1x1[s] = 0.0; // this is a Array2D<float>
1237  // std::cout << "\n\n x0 = " << x0 << " \n";
1238  size_t i(0), temploc(0);
1239  float tempdist(0.0);
1240 
1241  // valarray<float> p( Algorithms::MakeAxis(pmin, pmax, Np));
1242 
1243  for (size_t l(0); l < Nl(s)+1; ++l){
1244  for (size_t m(0); m<((Nm(s)<l)?Nm(s):l)+1; ++m){
1245 
1246  i = ((l < Nm(s)+1)?((l*(l+1))/2+m):(l*(Nm(s)+1)-(Nm(s)*(Nm(s)+1))/2 + m));
1247 
1248  for (size_t ipy(0); ipy < Npy(s); ++ipy) {
1249  for (size_t ipx(0); ipx < Npx(s); ++ipx) {
1250  // At each location in px,py
1251  if (nextpcell[s](ipx,ipy) == 0)
1252  {
1253  temploc = 1;
1254  tempdist = 1.0;
1255  }
1256  else
1257  {
1258  temploc = nextpcell[s](ipx,ipy);
1259  tempdist = distancetothatcell[s](ipx,ipy);
1260  }
1261 
1262  p2p1x1[s](ipx,ipy) += Pl[s](i)(ipx, ipy) *
1263  ((float((df(i))(temploc ,x0).real())*(1.0-tempdist))+
1264  (float((df(i))(temploc-1,x0).real())*( tempdist)));
1265  }
1266  }
1267  }
1268  }
1269  return p2p1x1[s];
1270 }
vector< Array2D< float > > distancetothatcell
Definition: export.h:362
size_t Npx(size_t s) const
Definition: export.h:343
vector< PLegendre2D > Pl
Definition: export.h:359
vector< Array2D< float > > p2p1x1
Definition: export.h:364
size_t Npy(size_t s) const
Definition: export.h:344
vector< Array2D< size_t > > nextpcell
Definition: export.h:361
size_t Nm(size_t s) const
Definition: export.h:342
size_t Nl(size_t s) const
Definition: export.h:341

◆ p2p1_x1()

Array2D<float> Output_Data::p2p1x1_1D::p2p1_x1 ( size_t  s) const
inline

Definition at line 351 of file export.h.

Referenced by p2p1x1_1D().

351 { return p2p1x1[s]; }
vector< Array2D< float > > p2p1x1
Definition: export.h:364
Here is the caller graph for this function:

◆ PL()

PLegendre2D Output_Data::p2p1x1_1D::PL ( size_t  s) const
inline

Definition at line 350 of file export.h.

Referenced by p2p1x1_1D().

350 { return Pl[s]; }
vector< PLegendre2D > Pl
Definition: export.h:359
Here is the caller graph for this function:

◆ Pmax()

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

Definition at line 347 of file export.h.

Referenced by p2p1x1_1D().

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

◆ Pmin()

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

Definition at line 346 of file export.h.

Referenced by p2p1x1_1D().

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

◆ prad()

Array2D<float> Output_Data::p2p1x1_1D::prad ( size_t  s) const
inline

Definition at line 352 of file export.h.

Referenced by p2p1x1_1D().

352 { return pr[s]; }
vector< Array2D< float > > pr
Definition: export.h:360
Here is the caller graph for this function:

◆ Species()

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

Definition at line 340 of file export.h.

Referenced by p2p1x1_1D().

340 { return p2p1x1.size(); }
vector< Array2D< float > > p2p1x1
Definition: export.h:364
Here is the caller graph for this function:

Field Documentation

◆ distancetothatcell

vector< Array2D<float> > Output_Data::p2p1x1_1D::distancetothatcell
private

Definition at line 362 of file export.h.

◆ nextpcell

vector< Array2D<size_t> > Output_Data::p2p1x1_1D::nextpcell
private

Definition at line 361 of file export.h.

◆ numl

vector<size_t> Output_Data::p2p1x1_1D::numl
private

Definition at line 358 of file export.h.

◆ numm

vector<size_t> Output_Data::p2p1x1_1D::numm
private

Definition at line 358 of file export.h.

◆ p2p1x1

vector< Array2D<float> > Output_Data::p2p1x1_1D::p2p1x1
private

Definition at line 364 of file export.h.

◆ Pl

vector< PLegendre2D > Output_Data::p2p1x1_1D::Pl
private

Definition at line 359 of file export.h.

◆ pmax

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

Definition at line 357 of file export.h.

◆ pmin

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

Definition at line 357 of file export.h.

◆ pr

vector< Array2D<float> > Output_Data::p2p1x1_1D::pr
private

Definition at line 360 of file export.h.


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