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

#include <export.h>

Public Member Functions

 PLegendre2D (size_t Nl, size_t Nm, size_t Np, float pmin, float pmax, size_t Npx, size_t Npy)
 
 PLegendre2D (const PLegendre2D &other)
 
 ~PLegendre2D ()
 
size_t dim () const
 
Array2D< float > & operator() (size_t i)
 
Array2D< float > operator() (size_t i) const
 

Private Attributes

vector< Array2D< float > > * plegendre
 
size_t lmax
 

Detailed Description

Definition at line 266 of file export.h.

Constructor & Destructor Documentation

◆ PLegendre2D() [1/2]

Output_Data::PLegendre2D::PLegendre2D ( size_t  Nl,
size_t  Nm,
size_t  Np,
float  pmin,
float  pmax,
size_t  Npx,
size_t  Npy 
)

Definition at line 886 of file export.cpp.

References Algorithms::Legendre(), and Algorithms::MakeAxis().

887  {
888 
889  size_t sz(0);
890 
891  valarray<float> p( Algorithms::MakeAxis(pmin, pmax, Np)),
892  px(Algorithms::MakeAxis(float(-1.0)*pmax, pmax, Npx)),
893  py(Algorithms::MakeAxis(float(-1.0)*pmax, pmax, Npy));
894 
895 // Generate the structure to save the polynomials
896  sz = ((Nm+1)*(2*Nl-Nm+2))/2;
897 //
898  plegendre = new vector< Array2D<float>>(sz,Array2D<float>(Npx,Npy)) ;
899  // for (size_t m(0); m < Nm+1; ++m) {
900  // for (size_t l(m); l < Nl+1; ++l) {
901  // (*plegendre).push_back( Array2D<float>(Npx,Np) );
902  // ++sz;
903  // }
904  // }
905  size_t k(0);
906  // float invpmax(1.0/pmax);
907 // Generate the polynomial values for each cos(theta) = px/p
908  for (size_t j(0); j < py.size(); ++j) {
909 
910  for (size_t i(0); i < px.size(); ++i) {
911  float invp(sqrt(py[j]*py[j]+px[i]+px[i]));
912  if (invp > 0.0 ) invp=1.0/invp;
913  else if (invp > pmax) invp *= 2;
914  else invp = 0.0;
915 // For given px/p generate all the polynomial values ...
916 // valarray<float> vL( Algorithms::Legendre( px[i]*invp, Nl, Nm ) );
917 
918  Array2D<float> vL( Algorithms::Legendre( px[i]*invp, Nl, Nm ) );
919  // std::cout << "\n x = " << px[i]*invp << ", sqrt(1-x^2) = " << sqrt(1.0-px[i]*invp*px[i]*invp) ;
920  // ... and save them
921  // std::cout << "dim = " << vL.dim() << "\n";
922  // std::cout << "dim1:" << vL.dim1() << "\n";
923  // std::cout << "dim2:" << vL.dim1() << "\n\n";
924  for (size_t l(0); l < Nl+1; ++l){
925  for (size_t m(0); m<((Nm<l)?Nm:l)+1; ++m){
926  // for (size_t k(0); k < sz; ++k) {
927  k = ((l < Nm+1)?((l*(l+1))/2+m):(l*(Nm+1)-(Nm*(Nm+1))/2 + m));
928 
929  (*plegendre)[k](i,j) = vL(l,m);
930  // if (invp == 0.0) (*plegendre)[k](i,j) = 0.0;
931 
932  // std::cout << "\n LP(" << l << "," << m << "," << k << ") = " << vL(l,m);
933 
934  }
935  // (*plegendre)[k](i,j) = vL(k);
936  }
937  }
938  // exit(1);
939  }
940 
941 }
valarray< T > Legendre(const T x, const size_t Nl)
vector< Array2D< float > > * plegendre
Definition: export.h:280
valarray< T > MakeAxis(const T min, const T max, const size_t N)
Here is the call graph for this function:

◆ PLegendre2D() [2/2]

Output_Data::PLegendre2D::PLegendre2D ( const PLegendre2D other)

Definition at line 944 of file export.cpp.

References dim().

944  {
945 
946 // Generate the structure to save the polynomials
947  plegendre = new vector< Array2D<float> > ;
948  for (size_t i(0); i < other.dim(); ++i) {
949  (*plegendre).push_back( other(i) );
950  }
951 }
vector< Array2D< float > > * plegendre
Definition: export.h:280
Here is the call graph for this function:

◆ ~PLegendre2D()

Output_Data::PLegendre2D::~PLegendre2D ( )

Definition at line 954 of file export.cpp.

954  {
955  delete plegendre;
956 }
vector< Array2D< float > > * plegendre
Definition: export.h:280

Member Function Documentation

◆ dim()

size_t Output_Data::PLegendre2D::dim ( ) const
inline

Definition at line 275 of file export.h.

Referenced by PLegendre2D().

275 { return (*plegendre).size(); }
Here is the caller graph for this function:

◆ operator()() [1/2]

Array2D<float>& Output_Data::PLegendre2D::operator() ( size_t  i)
inline

Definition at line 276 of file export.h.

276 { return (*plegendre)[i]; }
vector< Array2D< float > > * plegendre
Definition: export.h:280

◆ operator()() [2/2]

Array2D<float> Output_Data::PLegendre2D::operator() ( size_t  i) const
inline

Definition at line 277 of file export.h.

277 { return (*plegendre)[i]; }
vector< Array2D< float > > * plegendre
Definition: export.h:280

Field Documentation

◆ lmax

size_t Output_Data::PLegendre2D::lmax
private

Definition at line 281 of file export.h.

◆ plegendre

vector< Array2D<float> >* Output_Data::PLegendre2D::plegendre
private

Definition at line 280 of file export.h.


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