26 #include <sys/types.h> 53 mode_t _permissions(S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
57 const char* foldername = _name.data();
64 int status(mkdir(foldername,_permissions));
79 if (
Makefolder(
"RESTART") != 0) cout <<
"Warning: Folder 'RESTART' exists" << endl;
81 if (
Makefolder(
"OUTPUT") != 0) cout <<
"Warning: Folder 'OUTPUT' exists" << endl;
84 if (
Makefolder(
"OUTPUT/NUM") != 0) cout <<
"Warning: Folder 'OUTPUT/NUM' exists" << endl;
90 cout<<
"Warning: Folder 'OUTPUT/FLD' exists" << endl;
94 cout<<
"Warning: Folder 'OUTPUT/FLD/EX' exists" << endl;
98 cout<<
"Warning: Folder 'OUTPUT/FLD/EY' exists" << endl;
102 cout<<
"Warning: Folder 'OUTPUT/FLD/EZ' exists" << endl;
106 cout<<
"Warning: Folder 'OUTPUT/FLD/BX' exists" << endl;
110 cout<<
"Warning: Folder 'OUTPUT/FLD/BY' exists" << endl;
114 cout<<
"Warning: Folder 'OUTPUT/FLD/BZ' exists" << endl;
131 cout<<
"Warning: Folder 'OUTPUT/MOM' exists" << endl;
137 cout<<
"Warning: Folder 'OUTPUT/MOM/N' exists" << endl;
141 cout<<
"Warning: Folder 'OUTPUT/MOM/Pth' exists" << endl;
145 cout<<
"Warning: Folder 'OUTPUT/MOM/Gam' exists" << endl;
149 cout<<
"Warning: Folder 'OUTPUT/MOM/Px' exists" << endl;
153 cout<<
"Warning: Folder 'OUTPUT/MOM/PxPx' exists" << endl;
157 cout<<
"Warning: Folder 'OUTPUT/MOM/Py' exists" << endl;
161 cout<<
"Warning: Folder 'OUTPUT/MOM/PxPy' exists" << endl;
165 cout<<
"Warning: Folder 'OUTPUT/MOM/PyPy' exists" << endl;
169 cout<<
"Warning: Folder 'OUTPUT/MOM/Pz' exists" << endl;
173 cout<<
"Warning: Folder 'OUTPUT/MOM/PxPz' exists" << endl;
177 cout<<
"Warning: Folder 'OUTPUT/MOM/PyPz' exists" << endl;
181 cout<<
"Warning: Folder 'OUTPUT/MOM/PzPz' exists" << endl;
188 cout<<
"Warning: Folder 'OUTPUT/MOM/Jx' exists" << endl;
192 cout<<
"Warning: Folder 'OUTPUT/MOM/Jy' exists" << endl;
196 cout<<
"Warning: Folder 'OUTPUT/MOM/Jz' exists" << endl;
204 cout<<
"Warning: Folder 'OUTPUT/MOM/Vx' exists" << endl;
208 cout<<
"Warning: Folder 'OUTPUT/MOM/VxVx' exists" << endl;
212 cout<<
"Warning: Folder 'OUTPUT/MOM/Vy' exists" << endl;
216 cout<<
"Warning: Folder 'OUTPUT/MOM/VxVy' exists" << endl;
220 cout<<
"Warning: Folder 'OUTPUT/MOM/VyVy' exists" << endl;
224 cout<<
"Warning: Folder 'OUTPUT/MOM/VxVz' exists" << endl;
228 cout<<
"Warning: Folder 'OUTPUT/MOM/VyVz' exists" << endl;
232 cout<<
"Warning: Folder 'OUTPUT/MOM/VzVz' exists" << endl;
236 cout<<
"Warning: Folder 'OUTPUT/MOM/Vsq' exists" << endl;
242 cout<<
"Warning: Folder 'OUTPUT/MOM/T' exists" << endl;
246 cout<<
"Warning: Folder 'OUTPUT/MOM/P_Mbar' exists" << endl;
250 cout<<
"Warning: Folder 'OUTPUT/MOM/ND' exists" << endl;
254 cout<<
"Warning: Folder 'OUTPUT/MOM/Nu' exists" << endl;
258 cout<<
"Warning: Folder 'OUTPUT/MOM/Qx' exists" << endl;
262 cout<<
"Warning: Folder 'OUTPUT/MOM/Qy' exists" << endl;
266 cout<<
"Warning: Folder 'OUTPUT/MOM/Qz' exists" << endl;
270 cout<<
"Warning: Folder 'OUTPUT/MOM/vNx' exists" << endl;
274 cout<<
"Warning: Folder 'OUTPUT/MOM/vNy' exists" << endl;
278 cout<<
"Warning: Folder 'OUTPUT/MOM/vNz' exists" << endl;
282 cout<<
"Warning: Folder 'OUTPUT/MOM/Ux' exists" << endl;
286 cout<<
"Warning: Folder 'OUTPUT/MOM/Uy' exists" << endl;
290 cout<<
"Warning: Folder 'OUTPUT/MOM/Ux' exists" << endl;
294 cout<<
"Warning: Folder 'OUTPUT/MOM/Z' exists" << endl;
298 cout<<
"Warning: Folder 'OUTPUT/MOM/ni' exists" << endl;
302 cout<<
"Warning: Folder 'OUTPUT/MOM/Ti' exists" << endl;
319 cout<<
"Warning: Folder 'OUTPUT/DISTR' exists" << endl;
339 time.push_back(
"Time_cgs");
340 time.push_back(
"Time_si" );
341 time.push_back(
"Time_fs" );
342 time.push_back(
"Time_ps" );
343 time.push_back(
"Time" );
346 space.push_back(
"Space_cgs");
347 space.push_back(
"Space_si" );
348 space.push_back(
"Space");
351 fld.push_back(
"Ex" );
352 fld.push_back(
"Ex_cgs" );
353 fld.push_back(
"Ex_si" );
354 fld.push_back(
"Ey" );
355 fld.push_back(
"Ey_cgs" );
356 fld.push_back(
"Ey_si" );
357 fld.push_back(
"Ez" );
358 fld.push_back(
"Ez_cgs" );
359 fld.push_back(
"Ez_si" );
360 fld.push_back(
"Bx" );
361 fld.push_back(
"Bx_cgs" );
362 fld.push_back(
"Bx_si" );
363 fld.push_back(
"By" );
364 fld.push_back(
"By_cgs" );
365 fld.push_back(
"By_si" );
366 fld.push_back(
"Bz" );
367 fld.push_back(
"Bz_cgs" );
368 fld.push_back(
"Bz_si" );
371 mom.push_back(
"P" );
372 mom.push_back(
"P_cgs" );
373 mom.push_back(
"P_si" );
374 mom.push_back(
"P_Mbar" );
375 mom.push_back(
"T" );
376 mom.push_back(
"T_cgs" );
377 mom.push_back(
"T_si" );
378 mom.push_back(
"T_eV" );
379 mom.push_back(
"n" );
380 mom.push_back(
"n_cgs" );
381 mom.push_back(
"n_si" );
382 mom.push_back(
"Qx" );
383 mom.push_back(
"Qy" );
384 mom.push_back(
"Qz" );
385 mom.push_back(
"vNx" );
386 mom.push_back(
"vNy" );
387 mom.push_back(
"vNz" );
388 mom.push_back(
"Jx" );
389 mom.push_back(
"Jx_cgs" );
390 mom.push_back(
"Jx_si" );
391 mom.push_back(
"Jy" );
392 mom.push_back(
"Jy_cgs" );
393 mom.push_back(
"Jy_si" );
394 mom.push_back(
"Jz" );
395 mom.push_back(
"Jz_cgs" );
396 mom.push_back(
"Jz_si" );
398 mom.push_back(
"Ux" );
399 mom.push_back(
"Uy" );
400 mom.push_back(
"Uz" );
401 mom.push_back(
"Z" );
402 mom.push_back(
"ni" );
403 mom.push_back(
"Ti" );
409 for (
size_t s(0); s < species; ++s) {
410 pvsx.push_back(
"px-x");
411 pvsx.push_back(
"py-x");
412 pvsx.push_back(
"pz-x");
416 for (
size_t s(0); s < species; ++s) {
417 fvsx.push_back(
"f0-x");
418 fvsx.push_back(
"f10-x");
419 fvsx.push_back(
"f11-x");
420 fvsx.push_back(
"f20-x");
421 fvsx.push_back(
"fl0-x");
425 for (
size_t s(0); s < species; ++s) {
460 string _Ql,
float _Qc,
461 string _tl,
string _tu,
float _tc,
463 : title(_Ql), titleC(_Qc),
464 time(_tl), timeU(_tu), timeC(_tc),
471 string _Ql,
float _Qc,
472 string _tl,
string _tu,
float _tc,
483 string _Ql,
float _Qc,
484 string _tl,
string _tu,
float _tc,
496 string _Ql,
float _Qc,
497 string _tl,
string _tu,
float _tc,
531 const vector< string > oTags,
534 size_t species(_axis.
pdim());
537 vector< oAxis > xyz, pxyz, imre, pr;
540 for (
size_t s(0); s < species; ++s) {
549 while ( ( tloc < dTags.time.size()-1 ) &&
550 ( find(oTags.begin(),oTags.end(), dTags.time[tloc]) == oTags.end() ) ) {
559 while ( ( xloc < dTags.space.size()-1 ) &&
560 ( find(oTags.begin(),oTags.end(), dTags.space[xloc]) == oTags.end() ) ) {
572 for (
size_t i(0); i < species; ++i) {
574 pr[i].units =
"m_e c";
576 pxyz[i].label =
"px[mc]";
577 pxyz[i].units =
"m_e c";
579 pxyz[1+i].label =
"py[mc]";
580 pxyz[1+i].units =
"m_e c";
582 pxyz[2+i].label =
"pz[mc]";
583 pxyz[2+i].units =
"m_e c";
590 for (
size_t i(0); i < dTags.fld.size(); ++i) {
593 if ( find(oTags.begin(),oTags.end(), dTags.fld[i]) != oTags.end() ) {
595 string nounits = dTags.fld[i].substr(0, dTags.fld[i].find(
"_"));
596 string folder = homedir +
"OUTPUT/FLD/" + nounits +
"/";
598 Hdr[dTags.fld[i]] =
Header(xyz,
599 nounits+
"["+
formulary().Label(dTags.fld[i])+
"]",
601 tlabel, tunits, tconv, folder);
606 for (
size_t i(0); i < dTags.mom.size(); ++i) {
609 if ( find(oTags.begin(),oTags.end(), dTags.mom[i]) != oTags.end() ) {
611 string nounits = dTags.mom[i].substr(0, dTags.mom[i].find(
"_"));
612 string folder = homedir +
"OUTPUT/MOM/" + nounits +
"/";
614 Hdr[dTags.mom[i]] =
Header(xyz,
615 nounits+
"["+
formulary().Label(dTags.mom[i])+
"]",
617 tlabel, tunits, tconv, folder);
622 for (
size_t i(0); i < dTags.pvsx.size(); ++i) {
628 if ( find(oTags.begin(),oTags.end(), dTags.pvsx[i]) != oTags.end() ) {
630 string folder = homedir +
"OUTPUT/DISTR/" + dTags.pvsx[i] +
"/";
636 Hdr[dTags.pvsx[i]] =
Header( pr[i/3], xyz[0],
637 "f"+
stringify(i/3), 1.0, tlabel, tunits, tconv, folder);
644 for (
size_t i(0); i < dTags.fvsx.size(); ++i) {
647 if ( find(oTags.begin(),oTags.end(), dTags.fvsx[i]) != oTags.end() ) {
649 string folder = homedir +
"OUTPUT/DISTR/" + dTags.fvsx[i] +
"/";
653 Hdr[dTags.fvsx[i]] =
Header( pr[i/5], xyz[0], imre[0],
654 "f", 1.0, tlabel, tunits, tconv, folder);
660 for (
size_t i(0); i < dTags.pvspvsx.size(); ++i) {
663 if ( find(oTags.begin(),oTags.end(), dTags.pvspvsx[i]) != oTags.end() ) {
665 string folder = homedir +
"OUTPUT/DISTR/" + dTags.pvspvsx[i] +
"/";
669 Hdr[dTags.pvspvsx[i]] =
Header( pxyz[i/1+species],pxyz[(i+1)/1+species], xyz[0],
670 "f"+
stringify(i/1), 1.0, tlabel, tunits, tconv, folder);
685 stringstream sFilename;
687 if(species >= 0) sFilename <<
"_s" << species;
693 while (Nzeros-- > 0) {
699 return sFilename.str();
721 string filename(hdir+
"RESTART/re_1D_");
722 filename.append(rFextension(rank,re_step));
725 ifstream fin(filename.c_str(), ios::binary);
730 for(
size_t s(0); s < Y.
Species(); ++s) {
731 for(
size_t nh(0); nh < Y.
DF(s).
dim(); ++nh) {
732 for(
size_t i(0); i < (Y.
DF(s))(nh).dim(); ++i) {
733 fin.read((
char *)&(Y.
DF(s))(nh)(i),
sizeof((Y.
DF(s))(nh)(i)));
740 if (!rank) std::cout <<
"\n\n ERROR :: No files to read! \n\n";
746 for(
size_t i(0); i < Y.
EMF().
Ex().
numx(); ++i){
747 fin.read((
char *)(&Y.
EMF().
Ex()(i)),
sizeof(Y.
EMF().
Ex()(i)));
759 string filename(hdir+
"RESTART/re_1D_");
760 filename.append(rFextension(rank,re_step));
763 ofstream fout(filename.c_str(), ios::binary);
766 for(
size_t s(0); s < Y.
Species(); ++s) {
767 for (
size_t s(0); s < Y.
Species(); ++s) {
768 for (
size_t nh(0); nh < Y.
DF(s).
dim(); ++nh) {
769 for (
size_t i(0); i < (Y.
DF(s))(nh).dim(); ++i) {
770 fout.write((
char *) &(Y.
DF(s))(nh)(i),
sizeof((Y.
DF(s))(nh)(i)));
777 for(
size_t i(0); i < Y.
EMF().
Ex().
numx(); ++i) {
778 fout.write((
char *)(&Y.
EMF().
Ex()(i)),
sizeof(Y.
EMF().
Ex()(i)));
790 stringstream sFilename;
794 while (Nzeros-- > 0) {
798 sFilename << rank <<
"_";
802 while (Nzeros-- > 0) {
808 return sFilename.str();
817 float pmin,
float pmax,
size_t Npx ) {
825 sz = ((Nm+1)*(2*Nl-Nm+2))/2;
827 plegendre =
new vector< Array2D<float>>(sz,
Array2D<float>(Npx,Np)) ;
836 for (
size_t j(0); j < p.size(); ++j) {
837 float invp(1.0/p[j]);
838 for (
size_t i(0); i < px.size(); ++i) {
848 for (
size_t l(0); l < Nl+1; ++l){
849 for (
size_t m=0; m<((Nm<l)?Nm:l)+1; ++m){
851 k = ((l < Nm+1)?((l*(l+1))/2+m):(l*(Nm+1)-(Nm*(Nm+1))/2 + m));
853 (*plegendre)[k](i,j) = vL(l,m);
855 std::cout <<
"\n LP(" << l <<
"," << m <<
"," << k <<
") = " << vL(l,m);
871 plegendre =
new vector< Array2D<float> > ;
872 for (
size_t i(0); i < other.
dim(); ++i) {
873 (*plegendre).push_back( other(i) );
887 float pmin,
float pmax,
size_t Npx,
size_t Npy ) {
896 sz = ((Nm+1)*(2*Nl-Nm+2))/2;
898 plegendre =
new vector< Array2D<float>>(sz,
Array2D<float>(Npx,Npy)) ;
908 for (
size_t j(0); j < py.size(); ++j) {
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;
924 for (
size_t l(0); l < Nl+1; ++l){
925 for (
size_t m(0); m<((Nm<l)?Nm:l)+1; ++m){
927 k = ((l < Nm+1)?((l*(l+1))/2+m):(l*(Nm+1)-(Nm*(Nm+1))/2 + m));
929 (*plegendre)[k](i,j) = vL(l,m);
947 plegendre =
new vector< Array2D<float> > ;
948 for (
size_t i(0); i < other.
dim(); ++i) {
949 (*plegendre).push_back( other(i) );
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)) );
973 p1x1.push_back( valarray<float>( _G.
axis.
Npx(s)) );
1002 for (
size_t s(0); s < other.
Species(); ++s) {
1003 pmin.push_back( other.
Pmin(s) );
1004 pmax.push_back( other.
Pmax(s) );
1007 p1x1.push_back( other.
p1_x1(s) );
1023 vector<complex<double> > dummyvec;
1065 size_t midpoint,ipxp,ipxm;
1067 for (
size_t i(0); i < df.
dim(); ++i)
1069 dummyvec = df(i).xVec(x0);
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)
1075 ipxm = midpoint - 1 - ip;
1076 ipxp = midpoint + 1 + ip;
1078 (p1x1[s])[ipxm] += (
float) (sgn*(dummyvec[ip]).real());
1079 (p1x1[s])[ipxp] += (
float) ((dummyvec[ip]).real());
1096 for (
size_t s(0); s < _G.
axis.
pdim(); ++s) {
1097 pmax.push_back( static_cast<float>(_G.
axis.
pmax(s)) );
1098 pmin.push_back( static_cast<float>(_G.
axis.
pmin(s)) );
1099 nump.push_back( static_cast<float>(_G.
axis.
Np(s)));
1108 for (
size_t s(0); s < other.
Species(); ++s) {
1109 pmin.push_back( other.
Pmin(s) );
1110 pmax.push_back( other.
Pmax(s) );
1111 nump.push_back( other.
Np(s));
1129 for (
size_t ip(0); ip < Np(s); ++ip) {
1140 fx1(ip,0) = (float( (df(l,m))(ip,x0).real() ));
1141 fx1(ip,1) = (float( (df(l,m))(ip,x0).imag() ));
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]);
1179 for (
size_t s(0); s < _G.
axis.
pdim(); ++s) {
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]);
1189 while ((pr[s](i,j) > p[k]) && (k < _G.
axis.
Np(s))) ++k;
1191 nextpcell[s](i,j) = k-1;
1192 distancetothatcell[s](i,j) = (p[k] - pr[s](i,j))/(p[1]-p[0]);
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) );
1238 size_t i(0), temploc(0);
1239 float tempdist(0.0);
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){
1246 i = ((l < Nm(s)+1)?((l*(l+1))/2+m):(l*(Nm(s)+1)-(Nm(s)*(Nm(s)+1))/2 + m));
1248 for (
size_t ipy(0); ipy < Npy(s); ++ipy) {
1249 for (
size_t ipx(0); ipx < Npx(s); ++ipx) {
1251 if (nextpcell[s](ipx,ipy) == 0)
1258 temploc = nextpcell[s](ipx,ipy);
1259 tempdist = distancetothatcell[s](ipx,ipy);
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)));
1281 Ex( Y, grid, tout, PE );
1285 Ey( Y, grid, tout, PE );
1289 Ez( Y, grid, tout, PE );
1293 Bx( Y, grid, tout, PE );
1297 By( Y, grid, tout, PE );
1301 Bz( Y, grid, tout, PE );
1305 n( Y, grid, tout, PE );
1309 T( Y, grid, tout, PE );
1313 Jx( Y, grid, tout, PE );
1317 Jy( Y, grid, tout, PE );
1321 Jz( Y, grid, tout, PE );
1325 Qx( Y, grid, tout, PE );
1329 Qy( Y, grid, tout, PE );
1333 Qz( Y, grid, tout, PE );
1336 vNx( Y, grid, tout, PE );
1339 vNy( Y, grid, tout, PE );
1342 vNz( Y, grid, tout, PE );
1362 Ux( Y, grid, tout, PE );
1366 Uy( Y, grid, tout, PE );
1370 Uz( Y, grid, tout, PE );
1374 Z( Y, grid, tout, PE );
1378 ni( Y, grid, tout, PE );
1382 Ti( Y, grid, tout, PE );
1393 px( Y, grid, tout, PE );
1396 f0( Y, grid, tout, PE );
1399 f10( Y, grid, tout, PE );
1402 f11( Y, grid, tout, PE );
1405 f20( Y, grid, tout, PE );
1408 fl0( Y, grid, tout, PE );
1426 size_t st(0), bi(0);
1427 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1428 size_t outNxGlobal(grid.
axis.
Nxg(0));
1430 int msg_sz(outNxLocal);
1431 float* Exbuf =
new float[msg_sz];
1432 valarray<float> ExGlobal(outNxGlobal);
1434 for(
size_t i(0); i < msg_sz; ++i) {
1435 Exbuf[i] =
static_cast<float>( Y.
EMF().
Ex()(Nbc+i).real() );
1438 if (PE.
NODES() > 1) {
1440 MPI_Send(Exbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1444 for(
size_t i(0); i < outNxLocal; i++) {
1445 ExGlobal[i] = Exbuf[i];
1448 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1449 MPI_Recv(Exbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1450 for(
size_t i(0); i < outNxLocal; i++) {
1451 ExGlobal[i + outNxLocal*rr] = Exbuf[i];
1458 for(
size_t i(0); i < outNxGlobal; i++) {
1459 ExGlobal[i] = Exbuf[i];
1463 if (PE.
RANK() == 0) expo.Export_h5(
"Ex", ExGlobal, tout);
1476 size_t st(0), bi(0);
1477 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1478 size_t outNxGlobal(grid.
axis.
Nxg(0));
1480 int msg_sz(outNxLocal);
1481 float* Eybuf =
new float[msg_sz];
1482 valarray<float> EyGlobal(outNxGlobal);
1484 for(
size_t i(0); i < msg_sz; ++i) {
1485 Eybuf[i] =
static_cast<float>( Y.
EMF().
Ey()(Nbc+i).real() );
1488 if (PE.
NODES() > 1) {
1490 MPI_Send(Eybuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1494 for(
size_t i(0); i < outNxLocal; i++) {
1495 EyGlobal[i] = Eybuf[i];
1498 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1499 MPI_Recv(Eybuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1500 for(
size_t i(0); i < outNxLocal; i++) {
1501 EyGlobal[i + outNxLocal*rr] = Eybuf[i];
1508 for(
size_t i(0); i < outNxGlobal; i++) {
1509 EyGlobal[i] = Eybuf[i];
1513 if (PE.
RANK() == 0) expo.Export_h5(
"Ey", EyGlobal, tout);
1526 size_t st(0), bi(0);
1527 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1528 size_t outNxGlobal(grid.
axis.
Nxg(0));
1530 int msg_sz(outNxLocal);
1531 float* Ezbuf =
new float[msg_sz];
1532 valarray<float> EzGlobal(outNxGlobal);
1534 for(
size_t i(0); i < msg_sz; ++i) {
1535 Ezbuf[i] =
static_cast<float>( Y.
EMF().
Ez()(Nbc+i).real() );
1538 if (PE.
NODES() > 1) {
1540 MPI_Send(Ezbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1544 for(
size_t i(0); i < outNxLocal; i++) {
1545 EzGlobal[i] = Ezbuf[i];
1548 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1549 MPI_Recv(Ezbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1550 for(
size_t i(0); i < outNxLocal; i++) {
1551 EzGlobal[i + outNxLocal*rr] = Ezbuf[i];
1558 for(
size_t i(0); i < outNxGlobal; i++) {
1559 EzGlobal[i] = Ezbuf[i];
1563 if (PE.
RANK() == 0) expo.Export_h5(
"Ez", EzGlobal, tout);
1576 size_t st(0), bi(0);
1577 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1578 size_t outNxGlobal(grid.
axis.
Nxg(0));
1580 int msg_sz(outNxLocal);
1581 float* Bxbuf =
new float[msg_sz];
1582 valarray<float> BxGlobal(outNxGlobal);
1584 for(
size_t i(0); i < msg_sz; ++i) {
1585 Bxbuf[i] =
static_cast<float>( Y.
EMF().
Bx()(Nbc+i).real() );
1588 if (PE.
NODES() > 1) {
1590 MPI_Send(Bxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1594 for(
size_t i(0); i < outNxLocal; i++) {
1595 BxGlobal[i] = Bxbuf[i];
1598 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1599 MPI_Recv(Bxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1600 for(
size_t i(0); i < outNxLocal; i++) {
1601 BxGlobal[i + outNxLocal*rr] = Bxbuf[i];
1608 for(
size_t i(0); i < outNxGlobal; i++) {
1609 BxGlobal[i] = Bxbuf[i];
1613 if (PE.
RANK() == 0) expo.Export_h5(
"Bx", BxGlobal, tout);
1626 size_t st(0), bi(0);
1627 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1628 size_t outNxGlobal(grid.
axis.
Nxg(0));
1630 int msg_sz(outNxLocal);
1631 float* Bybuf =
new float[msg_sz];
1632 valarray<float> ByGlobal(outNxGlobal);
1634 for(
size_t i(0); i < msg_sz; ++i) {
1635 Bybuf[i] =
static_cast<float>( Y.
EMF().
By()(Nbc+i).real() );
1638 if (PE.
NODES() > 1) {
1640 MPI_Send(Bybuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1644 for(
size_t i(0); i < outNxLocal; i++) {
1645 ByGlobal[i] = Bybuf[i];
1648 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1649 MPI_Recv(Bybuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1650 for(
size_t i(0); i < outNxLocal; i++) {
1651 ByGlobal[i + outNxLocal*rr] = Bybuf[i];
1658 for(
size_t i(0); i < outNxGlobal; i++) {
1659 ByGlobal[i] = Bybuf[i];
1663 if (PE.
RANK() == 0) expo.Export_h5(
"By", ByGlobal, tout);
1676 size_t st(0), bi(0);
1677 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1678 size_t outNxGlobal(grid.
axis.
Nxg(0));
1680 int msg_sz(outNxLocal);
1681 float* Bzbuf =
new float[msg_sz];
1682 valarray<float> BzGlobal(outNxGlobal);
1684 for(
size_t i(0); i < msg_sz; ++i) {
1685 Bzbuf[i] =
static_cast<float>( Y.
EMF().
Bz()(Nbc+i).real() );
1688 if (PE.
NODES() > 1) {
1690 MPI_Send(Bzbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1694 for(
size_t i(0); i < outNxLocal; i++) {
1695 BzGlobal[i] = Bzbuf[i];
1698 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1699 MPI_Recv(Bzbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1700 for(
size_t i(0); i < outNxLocal; i++) {
1701 BzGlobal[i + outNxLocal*rr] = Bzbuf[i];
1708 for(
size_t i(0); i < outNxGlobal; i++) {
1709 BzGlobal[i] = Bzbuf[i];
1713 if (PE.
RANK() == 0) expo.Export_h5(
"Bz", BzGlobal, tout);
1725 size_t st(0), bi(0);
1726 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1727 size_t outNxGlobal(grid.
axis.
Nxg(0));
1731 for(
int s(0); s < Y.
Species(); ++s) {
1732 size_t Npx(2*f_x.Np(s)+1);
1733 int msg_sz(outNxLocal*Npx);
1735 float* pxbuf =
new float[Npx*outNxLocal];
1737 for (
size_t i(0); i < outNxLocal; ++i) {
1739 valarray<float> data1D = px_x( Y.
DF(s), i+Nbc, s);
1741 for (
size_t j(0); j < Npx; ++j) {
1742 pxbuf[j+i*Npx]=data1D[j];
1746 if (PE.
NODES() > 1) {
1748 MPI_Send(pxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1752 for(
size_t i(0); i < outNxLocal; i++) {
1753 for (
size_t j(0); j < Npx; ++j) {
1754 p1x1Global(j,i) = pxbuf[j+i*Npx];
1758 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1759 MPI_Recv(pxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1760 for(
size_t i(0); i < outNxLocal; i++) {
1761 for (
size_t j(0); j < Npx; ++j) {
1762 p1x1Global(j,i + outNxLocal*rr) = pxbuf[j+i*Npx];
1769 for(
size_t i(0); i < outNxGlobal; i++) {
1770 for (
size_t j(0); j < Npx; ++j) {
1771 p1x1Global(j,i) = pxbuf[j+i*Npx];
1776 if (PE.
RANK() == 0) expo.Export_h5(
"px-x", p1x1Global, tout, s);
1868 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
1869 size_t outNxGlobal(grid.
axis.
Nxg(0));
1871 for(
int s(0); s < Y.
Species(); ++s) {
1873 int msg_sz(2*outNxLocal*f_x.Np(s));
1875 float* f0xbuf =
new float[msg_sz];
1877 for (
size_t i(0); i < outNxLocal; ++i) {
1881 for (
size_t j(0); j < f_x.Np(s); ++j) {
1883 f0xbuf[2*j+ 2*i*f_x.Np(s)]=data2D(j,0);
1885 f0xbuf[2*j+1+ 2*i*f_x.Np(s)]=data2D(j,1);
1889 if (PE.
NODES() > 1) {
1891 MPI_Send(f0xbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
1895 for(
size_t i(0); i < outNxLocal; i++) {
1897 for (
size_t j(0); j < f_x.Np(s); ++j) {
1898 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
1899 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
1903 for (
int rr = 1; rr < PE.
NODES(); ++rr){
1904 MPI_Recv(f0xbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
1906 for(
size_t i(0); i < outNxLocal; i++) {
1907 for (
size_t j(0); j < f_x.Np(s); ++j) {
1908 f0x1Global(j,i + outNxLocal*rr,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
1909 f0x1Global(j,i + outNxLocal*rr,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
1916 for(
size_t i(0); i < outNxGlobal; i++) {
1918 for (
size_t j(0); j < f_x.Np(s); ++j) {
1919 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
1920 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
1925 if (PE.
RANK() == 0) expo.Export_h5(
"f0-x", f0x1Global, tout, s);
2003 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2004 size_t outNxGlobal(grid.
axis.
Nxg(0));
2006 for(
int s(0); s < Y.
Species(); ++s) {
2008 int msg_sz(2*outNxLocal*f_x.Np(s));
2010 float* f0xbuf =
new float[msg_sz];
2012 for (
size_t i(0); i < outNxLocal; ++i) {
2016 for (
size_t j(0); j < f_x.Np(s); ++j) {
2018 f0xbuf[2*j+ 2*i*f_x.Np(s)]=data2D(j,0);
2020 f0xbuf[2*j+1+ 2*i*f_x.Np(s)]=data2D(j,1);
2024 if (PE.
NODES() > 1) {
2026 MPI_Send(f0xbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2030 for(
size_t i(0); i < outNxLocal; i++) {
2032 for (
size_t j(0); j < f_x.Np(s); ++j) {
2033 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2034 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2038 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2039 MPI_Recv(f0xbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2041 for(
size_t i(0); i < outNxLocal; i++) {
2042 for (
size_t j(0); j < f_x.Np(s); ++j) {
2043 f0x1Global(j,i + outNxLocal*rr,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2044 f0x1Global(j,i + outNxLocal*rr,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2051 for(
size_t i(0); i < outNxGlobal; i++) {
2053 for (
size_t j(0); j < f_x.Np(s); ++j) {
2054 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2055 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2060 if (PE.
RANK() == 0) expo.Export_h5(
"f10-x", f0x1Global, tout, s);
2074 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2075 size_t outNxGlobal(grid.
axis.
Nxg(0));
2077 for(
int s(0); s < Y.
Species(); ++s) {
2079 int msg_sz(2*outNxLocal*f_x.Np(s));
2081 float* f0xbuf =
new float[msg_sz];
2083 for (
size_t i(0); i < outNxLocal; ++i) {
2087 for (
size_t j(0); j < f_x.Np(s); ++j) {
2089 f0xbuf[2*j+ 2*i*f_x.Np(s)]=data2D(j,0);
2091 f0xbuf[2*j+1+ 2*i*f_x.Np(s)]=data2D(j,1);
2095 if (PE.
NODES() > 1) {
2097 MPI_Send(f0xbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2101 for(
size_t i(0); i < outNxLocal; i++) {
2103 for (
size_t j(0); j < f_x.Np(s); ++j) {
2104 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2105 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2109 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2110 MPI_Recv(f0xbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2112 for(
size_t i(0); i < outNxLocal; i++) {
2113 for (
size_t j(0); j < f_x.Np(s); ++j) {
2114 f0x1Global(j,i + outNxLocal*rr,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2115 f0x1Global(j,i + outNxLocal*rr,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2122 for(
size_t i(0); i < outNxGlobal; i++) {
2124 for (
size_t j(0); j < f_x.Np(s); ++j) {
2125 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2126 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2131 if (PE.
RANK() == 0) expo.Export_h5(
"f11-x", f0x1Global, tout, s);
2146 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2147 size_t outNxGlobal(grid.
axis.
Nxg(0));
2149 for(
int s(0); s < Y.
Species(); ++s) {
2151 int msg_sz(2*outNxLocal*f_x.Np(s));
2153 float* f0xbuf =
new float[msg_sz];
2155 for (
size_t i(0); i < outNxLocal; ++i) {
2159 for (
size_t j(0); j < f_x.Np(s); ++j) {
2161 f0xbuf[2*j+ 2*i*f_x.Np(s)]=data2D(j,0);
2163 f0xbuf[2*j+1+ 2*i*f_x.Np(s)]=data2D(j,1);
2167 if (PE.
NODES() > 1) {
2169 MPI_Send(f0xbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2173 for(
size_t i(0); i < outNxLocal; i++) {
2175 for (
size_t j(0); j < f_x.Np(s); ++j) {
2176 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2177 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2181 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2182 MPI_Recv(f0xbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2184 for(
size_t i(0); i < outNxLocal; i++) {
2185 for (
size_t j(0); j < f_x.Np(s); ++j) {
2186 f0x1Global(j,i + outNxLocal*rr,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2187 f0x1Global(j,i + outNxLocal*rr,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2194 for(
size_t i(0); i < outNxGlobal; i++) {
2196 for (
size_t j(0); j < f_x.Np(s); ++j) {
2197 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2198 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2203 if (PE.
RANK() == 0) expo.Export_h5(
"f20-x", f0x1Global, tout, s);
2218 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2219 size_t outNxGlobal(grid.
axis.
Nxg(0));
2221 for(
int s(0); s < Y.
Species(); ++s) {
2223 int msg_sz(2*outNxLocal*f_x.Np(s));
2225 float* f0xbuf =
new float[msg_sz];
2227 for (
size_t i(0); i < outNxLocal; ++i) {
2231 for (
size_t j(0); j < f_x.Np(s); ++j) {
2233 f0xbuf[2*j+ 2*i*f_x.Np(s)]=data2D(j,0);
2235 f0xbuf[2*j+1+ 2*i*f_x.Np(s)]=data2D(j,1);
2239 if (PE.
NODES() > 1) {
2241 MPI_Send(f0xbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2245 for(
size_t i(0); i < outNxLocal; i++) {
2247 for (
size_t j(0); j < f_x.Np(s); ++j) {
2248 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2249 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2253 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2254 MPI_Recv(f0xbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2256 for(
size_t i(0); i < outNxLocal; i++) {
2257 for (
size_t j(0); j < f_x.Np(s); ++j) {
2258 f0x1Global(j,i + outNxLocal*rr,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2259 f0x1Global(j,i + outNxLocal*rr,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2266 for(
size_t i(0); i < outNxGlobal; i++) {
2268 for (
size_t j(0); j < f_x.Np(s); ++j) {
2269 f0x1Global(j,i,0) = f0xbuf[2*j+ 2*i*f_x.Np(s)];
2270 f0x1Global(j,i,1) = f0xbuf[2*j+1+ 2*i*f_x.Np(s)];
2275 if (PE.
RANK() == 0) expo.Export_h5(
"fl0-x", f0x1Global, tout, s);
2291 size_t st(0), bi(0);
2292 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2293 size_t outNxGlobal(grid.
axis.
Nxg(0));
2295 int msg_sz(outNxLocal);
2296 float* nbuf =
new float[msg_sz];
2297 valarray<float> nGlobal(outNxGlobal);
2299 for(
int s(0); s < Y.
Species(); ++s) {
2304 for(
size_t i(0); i < msg_sz; ++i) {
2311 if (PE.
NODES() > 1) {
2313 MPI_Send(nbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2317 for(
size_t i(0); i < outNxLocal; i++) {
2318 nGlobal[i] = nbuf[i];
2321 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2322 MPI_Recv(nbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2323 for(
size_t i(0); i < outNxLocal; i++) {
2324 nGlobal[i + outNxLocal*rr] = nbuf[i];
2331 for(
size_t i(0); i < outNxGlobal; i++) {
2332 nGlobal[i] = nbuf[i];
2336 if (PE.
RANK() == 0) expo.Export_h5(
"n", nGlobal, tout, s);
2352 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2353 size_t outNxGlobal(grid.
axis.
Nxg(0));
2355 int msg_sz(outNxLocal);
2357 float* tbuf =
new float[msg_sz];
2358 valarray<float> tGlobal(outNxGlobal);
2360 double convert_factor = (2.99792458e8)*(2.99792458e8)*(9.1093829e-31)/(1.602176565e-19);
2362 for(
int s(0); s < Y.
Species(); ++s) {
2369 for(
size_t i(0); i < msg_sz; ++i) {
2375 tbuf[i] *= 1.0/Y.
DF(s).
mass();
2398 if (PE.
NODES() > 1) {
2400 MPI_Send(tbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2404 for(
size_t i(0); i < outNxLocal; i++) {
2405 tGlobal[i] = tbuf[i];
2408 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2409 MPI_Recv(tbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2410 for(
size_t i(0); i < outNxLocal; i++) {
2411 tGlobal[i + outNxLocal*rr] = tbuf[i];
2418 for(
size_t i(0); i < outNxGlobal; i++) {
2419 tGlobal[i] = tbuf[i];
2423 if (PE.
RANK() == 0) expo.Export_h5(
"T", tGlobal, tout, s);
2441 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2442 size_t outNxGlobal(grid.
axis.
Nxg(0));
2444 int msg_sz(outNxLocal);
2445 float* Jxbuf =
new float[msg_sz];
2446 valarray<float> JxGlobal(outNxGlobal);
2448 for(
int s(0); s < Y.
Species(); ++s) {
2453 for(
size_t i(0); i < msg_sz; ++i) {
2457 if (PE.
NODES() > 1) {
2459 MPI_Send(Jxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2463 for(
size_t i(0); i < outNxLocal; i++) {
2464 JxGlobal[i] = Jxbuf[i];
2467 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2468 MPI_Recv(Jxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2469 for(
size_t i(0); i < outNxLocal; i++) {
2470 JxGlobal[i + outNxLocal*rr] = Jxbuf[i];
2477 for(
size_t i(0); i < outNxGlobal; i++) {
2478 JxGlobal[i] = Jxbuf[i];
2482 if (PE.
RANK() == 0) expo.Export_h5(
"Jx", JxGlobal, tout, s);
2500 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2501 size_t outNxGlobal(grid.
axis.
Nxg(0));
2503 int msg_sz(outNxLocal);
2504 float* Jybuf =
new float[msg_sz];
2505 valarray<float> JyGlobal(outNxGlobal);
2507 for(
int s(0); s < Y.
Species(); ++s) {
2512 for(
size_t i(0); i < msg_sz; ++i) {
2516 if (PE.
NODES() > 1) {
2518 MPI_Send(Jybuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2522 for(
size_t i(0); i < outNxLocal; i++) {
2523 JyGlobal[i] = Jybuf[i];
2526 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2527 MPI_Recv(Jybuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2528 for(
size_t i(0); i < outNxLocal; i++) {
2529 JyGlobal[i + outNxLocal*rr] = Jybuf[i];
2536 for(
size_t i(0); i < outNxGlobal; i++) {
2537 JyGlobal[i] = Jybuf[i];
2541 if (PE.
RANK() == 0) expo.Export_h5(
"Jy", JyGlobal, tout, s);
2558 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2559 size_t outNxGlobal(grid.
axis.
Nxg(0));
2561 int msg_sz(outNxLocal);
2562 float* Jzbuf =
new float[msg_sz];
2563 valarray<float> JzGlobal(outNxGlobal);
2565 for(
int s(0); s < Y.
Species(); ++s) {
2569 for(
size_t i(0); i < msg_sz; ++i) {
2573 if (PE.
NODES() > 1) {
2575 MPI_Send(Jzbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2579 for(
size_t i(0); i < outNxLocal; i++) {
2580 JzGlobal[i] = Jzbuf[i];
2583 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2584 MPI_Recv(Jzbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2585 for(
size_t i(0); i < outNxLocal; i++) {
2586 JzGlobal[i + outNxLocal*rr] = Jzbuf[i];
2593 for(
size_t i(0); i < outNxGlobal; i++) {
2594 JzGlobal[i] = Jzbuf[i];
2598 if (PE.
RANK() == 0) expo.Export_h5(
"Jz", JzGlobal, tout, s);
2614 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2615 size_t outNxGlobal(grid.
axis.
Nxg(0));
2617 int msg_sz(outNxLocal);
2631 float* Qxbuf =
new float[msg_sz];
2632 valarray<float> QxGlobal(outNxGlobal);
2634 for(
int s(0); s < Y.
Species(); ++s) {
2638 for(
size_t i(0); i < msg_sz; ++i) {
2678 if (PE.
NODES() > 1) {
2680 MPI_Send(Qxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2684 for(
size_t i(0); i < outNxLocal; i++) {
2685 QxGlobal[i] = Qxbuf[i];
2688 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2689 MPI_Recv(Qxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2690 for(
size_t i(0); i < outNxLocal; i++) {
2691 QxGlobal[i + outNxLocal*rr] = Qxbuf[i];
2698 for(
size_t i(0); i < outNxGlobal; i++) {
2699 QxGlobal[i] = Qxbuf[i];
2703 if (PE.
RANK() == 0) expo.Export_h5(
"Qx", QxGlobal, tout, s);
2720 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2721 size_t outNxGlobal(grid.
axis.
Nxg(0));
2723 int msg_sz(outNxLocal);
2737 float* Qxbuf =
new float[msg_sz];
2738 valarray<float> QxGlobal(outNxGlobal);
2740 for(
int s(0); s < Y.
Species(); ++s) {
2744 for(
size_t i(0); i < msg_sz; ++i) {
2784 if (PE.
NODES() > 1) {
2786 MPI_Send(Qxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2790 for(
size_t i(0); i < outNxLocal; i++) {
2791 QxGlobal[i] = Qxbuf[i];
2794 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2795 MPI_Recv(Qxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2796 for(
size_t i(0); i < outNxLocal; i++) {
2797 QxGlobal[i + outNxLocal*rr] = Qxbuf[i];
2804 for(
size_t i(0); i < outNxGlobal; i++) {
2805 QxGlobal[i] = Qxbuf[i];
2809 if (PE.
RANK() == 0) expo.Export_h5(
"Qy", QxGlobal, tout, s);
2826 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2827 size_t outNxGlobal(grid.
axis.
Nxg(0));
2829 int msg_sz(outNxLocal);
2843 float* Qxbuf =
new float[msg_sz];
2844 valarray<float> QxGlobal(outNxGlobal);
2846 for(
int s(0); s < Y.
Species(); ++s) {
2850 for(
size_t i(0); i < msg_sz; ++i) {
2890 if (PE.
NODES() > 1) {
2892 MPI_Send(Qxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2896 for(
size_t i(0); i < outNxLocal; i++) {
2897 QxGlobal[i] = Qxbuf[i];
2900 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2901 MPI_Recv(Qxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2902 for(
size_t i(0); i < outNxLocal; i++) {
2903 QxGlobal[i + outNxLocal*rr] = Qxbuf[i];
2910 for(
size_t i(0); i < outNxGlobal; i++) {
2911 QxGlobal[i] = Qxbuf[i];
2915 if (PE.
RANK() == 0) expo.Export_h5(
"Qz", QxGlobal, tout, s);
2933 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2934 size_t outNxGlobal(grid.
axis.
Nxg(0));
2936 int msg_sz(outNxLocal);
2937 float* vNxbuf =
new float[msg_sz];
2938 valarray<float> vNxGlobal(outNxGlobal);
2940 for(
int s(0); s < Y.
Species(); ++s) {
2946 for(
size_t i(0); i < msg_sz; ++i) {
2951 if (PE.
NODES() > 1) {
2953 MPI_Send(vNxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
2957 for(
size_t i(0); i < outNxLocal; i++) {
2958 vNxGlobal[i] = vNxbuf[i];
2961 for (
int rr = 1; rr < PE.
NODES(); ++rr){
2962 MPI_Recv(vNxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
2963 for(
size_t i(0); i < outNxLocal; i++) {
2964 vNxGlobal[i + outNxLocal*rr] = vNxbuf[i];
2971 for(
size_t i(0); i < outNxGlobal; i++) {
2972 vNxGlobal[i] = vNxbuf[i];
2976 if (PE.
RANK() == 0) expo.Export_h5(
"vNx", vNxGlobal, tout, 0);
2991 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
2992 size_t outNxGlobal(grid.
axis.
Nxg(0));
2994 int msg_sz(outNxLocal);
2995 float* vNxbuf =
new float[msg_sz];
2996 valarray<float> vNxGlobal(outNxGlobal);
2998 for(
int s(0); s < Y.
Species(); ++s) {
3002 for(
size_t i(0); i < msg_sz; ++i) {
3006 if (PE.
NODES() > 1) {
3008 MPI_Send(vNxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3012 for(
size_t i(0); i < outNxLocal; i++) {
3013 vNxGlobal[i] = vNxbuf[i];
3016 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3017 MPI_Recv(vNxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3018 for(
size_t i(0); i < outNxLocal; i++) {
3019 vNxGlobal[i + outNxLocal*rr] = vNxbuf[i];
3026 for(
size_t i(0); i < outNxGlobal; i++) {
3027 vNxGlobal[i] = vNxbuf[i];
3030 if (PE.
RANK() == 0) expo.Export_h5(
"vNy", vNxGlobal, tout, 0);
3043 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3044 size_t outNxGlobal(grid.
axis.
Nxg(0));
3046 int msg_sz(outNxLocal);
3047 float* vNxbuf =
new float[msg_sz];
3048 valarray<float> vNxGlobal(outNxGlobal);
3050 for(
int s(0); s < Y.
Species(); ++s) {
3055 for(
size_t i(0); i < msg_sz; ++i) {
3059 if (PE.
NODES() > 1) {
3061 MPI_Send(vNxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3065 for(
size_t i(0); i < outNxLocal; i++) {
3066 vNxGlobal[i] = vNxbuf[i];
3069 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3070 MPI_Recv(vNxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3071 for(
size_t i(0); i < outNxLocal; i++) {
3072 vNxGlobal[i + outNxLocal*rr] = vNxbuf[i];
3079 for(
size_t i(0); i < outNxGlobal; i++) {
3080 vNxGlobal[i] = vNxbuf[i];
3083 if (PE.
RANK() == 0) expo.Export_h5(
"vNz", vNxGlobal, tout, 0);
3099 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3100 size_t outNxGlobal(grid.
axis.
Nxg(0));
3102 int msg_sz(outNxLocal);
3103 float* Uxbuf =
new float[msg_sz];
3104 valarray<float> UxGlobal(outNxGlobal);
3106 for(
size_t i(0); i < msg_sz; ++i) {
3107 Uxbuf[i] =
static_cast<float>(Y.
HYDRO().
vx(i+Nbc));
3110 if (PE.
NODES() > 1) {
3112 MPI_Send(Uxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3116 for(
size_t i(0); i < outNxLocal; i++) {
3117 UxGlobal[i] = Uxbuf[i];
3120 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3121 MPI_Recv(Uxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3122 for(
size_t i(0); i < outNxLocal; i++) {
3123 UxGlobal[i + outNxLocal*rr] = Uxbuf[i];
3130 for(
size_t i(0); i < outNxGlobal; i++) {
3131 UxGlobal[i] = Uxbuf[i];
3135 if (PE.
RANK() == 0) expo.Export_h5(
"Ux", UxGlobal, tout, 0);
3151 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3152 size_t outNxGlobal(grid.
axis.
Nxg(0));
3154 int msg_sz(outNxLocal);
3155 float* Uxbuf =
new float[msg_sz];
3156 valarray<float> UxGlobal(outNxGlobal);
3158 for(
size_t i(0); i < msg_sz; ++i) {
3159 Uxbuf[i] =
static_cast<float>(Y.
HYDRO().
vy(i+Nbc));
3162 if (PE.
NODES() > 1) {
3164 MPI_Send(Uxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3168 for(
size_t i(0); i < outNxLocal; i++) {
3169 UxGlobal[i] = Uxbuf[i];
3172 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3173 MPI_Recv(Uxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3174 for(
size_t i(0); i < outNxLocal; i++) {
3175 UxGlobal[i + outNxLocal*rr] = Uxbuf[i];
3182 for(
size_t i(0); i < outNxGlobal; i++) {
3183 UxGlobal[i] = Uxbuf[i];
3187 if (PE.
RANK() == 0) expo.Export_h5(
"Uy", UxGlobal, tout, 0);
3203 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3204 size_t outNxGlobal(grid.
axis.
Nxg(0));
3206 int msg_sz(outNxLocal);
3207 float* Uxbuf =
new float[msg_sz];
3208 valarray<float> UxGlobal(outNxGlobal);
3211 for(
size_t i(0); i < msg_sz; ++i) {
3212 Uxbuf[i] =
static_cast<float>(Y.
HYDRO().
vz(i+Nbc));
3215 if (PE.
NODES() > 1) {
3217 MPI_Send(Uxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3221 for(
size_t i(0); i < outNxLocal; i++) {
3222 UxGlobal[i] = Uxbuf[i];
3225 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3226 MPI_Recv(Uxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3227 for(
size_t i(0); i < outNxLocal; i++) {
3228 UxGlobal[i + outNxLocal*rr] = Uxbuf[i];
3235 for(
size_t i(0); i < outNxGlobal; i++) {
3236 UxGlobal[i] = Uxbuf[i];
3240 if (PE.
RANK() == 0) expo.Export_h5(
"Uz", UxGlobal, tout, 0);
3256 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3257 size_t outNxGlobal(grid.
axis.
Nxg(0));
3259 int msg_sz(outNxLocal);
3260 float* Uxbuf =
new float[msg_sz];
3261 valarray<float> UxGlobal(outNxGlobal);
3264 for(
size_t i(0); i < msg_sz; ++i) {
3265 Uxbuf[i] =
static_cast<float>(Y.
HYDRO().
Z(i+Nbc));
3268 if (PE.
NODES() > 1) {
3270 MPI_Send(Uxbuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3274 for(
size_t i(0); i < outNxLocal; i++) {
3275 UxGlobal[i] = Uxbuf[i];
3278 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3279 MPI_Recv(Uxbuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3280 for(
size_t i(0); i < outNxLocal; i++) {
3281 UxGlobal[i + outNxLocal*rr] = Uxbuf[i];
3288 for(
size_t i(0); i < outNxGlobal; i++) {
3289 UxGlobal[i] = Uxbuf[i];
3293 if (PE.
RANK() == 0) expo.Export_h5(
"Z", UxGlobal, tout, 0);
3312 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3313 size_t outNxGlobal(grid.
axis.
Nxg(0));
3315 int msg_sz(outNxLocal);
3316 float* nibuf =
new float[msg_sz];
3317 valarray<float> niGlobal(outNxGlobal);
3319 for(
size_t i(0); i < msg_sz; ++i) {
3320 nibuf[i] =
static_cast<float>(Y.
HYDRO().
density(i+Nbc));
3323 if (PE.
NODES() > 1) {
3325 MPI_Send(nibuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3329 for(
size_t i(0); i < outNxLocal; i++) {
3330 niGlobal[i] = nibuf[i];
3333 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3334 MPI_Recv(nibuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3335 for(
size_t i(0); i < outNxLocal; i++) {
3336 niGlobal[i + outNxLocal*rr] = nibuf[i];
3343 for(
size_t i(0); i < outNxGlobal; i++) {
3344 niGlobal[i] = nibuf[i];
3348 if (PE.
RANK() == 0) expo.Export_h5(
"ni", niGlobal, tout, 0);
3367 size_t outNxLocal(grid.
axis.
Nx(0) - 2*Nbc);
3368 size_t outNxGlobal(grid.
axis.
Nxg(0));
3370 int msg_sz(outNxLocal);
3371 float* Thydrobuf =
new float[msg_sz];
3372 valarray<float> ThydroGlobal(outNxGlobal);
3374 for(
size_t i(0); i < msg_sz; ++i) {
3375 Thydrobuf[i] =
static_cast<float>(511000.0/3.0*Y.
HYDRO().
temperature(i+Nbc));
3378 if (PE.
NODES() > 1) {
3380 MPI_Send(Thydrobuf, msg_sz, MPI_FLOAT, 0, PE.
RANK(), MPI_COMM_WORLD);
3384 for(
size_t i(0); i < outNxLocal; i++) {
3385 ThydroGlobal[i] = Thydrobuf[i];
3388 for (
int rr = 1; rr < PE.
NODES(); ++rr){
3389 MPI_Recv(Thydrobuf, msg_sz, MPI_FLOAT, rr, rr, MPI_COMM_WORLD, &status);
3390 for(
size_t i(0); i < outNxLocal; i++) {
3391 ThydroGlobal[i + outNxLocal*rr] = Thydrobuf[i];
3398 for(
size_t i(0); i < outNxGlobal; i++) {
3399 ThydroGlobal[i] = Thydrobuf[i];
3403 if (PE.
RANK() == 0) expo.Export_h5(
"Ti", ThydroGlobal, tout, 0);
3417 std::valarray<float> data,
3427 if (Hdr[tag].
dim() != 1) {
3428 cout <<
"ERROR "<< tag <<
" : " << Hdr[tag].dim() <<
" dimensions != 1D structure\n";
3433 filename.append(tag).append(oH5Fextension(step,spec));
3434 H5::H5File file = hmake_file(filename);
3436 hsize_t dimsf[1] = {data.size()};
3437 H5::DataSpace dataspace( 1, dimsf );
3438 H5::DataSet dataset = file.createDataSet( tag, H5::PredType::NATIVE_FLOAT, dataspace );
3440 float xmin = {
static_cast<float>( Hdr[tag].min(0)) };
3441 float xmax = {
static_cast<float>( Hdr[tag].max(0)) };
3443 hinit_attr(file, tag, step, xmax, xmin);
3445 H5::Group group = file.createGroup(
"/AXIS");
3447 std::size_t pos = Hdr[tag].label(0).find(
"[");
3449 string axismainname =
"AXIS1";
3451 axisrange[0] = xmin;
3452 axisrange[1] = xmax;
3453 string axislongname = Hdr[tag].label(0).substr(0,pos);
3454 string axisname = Hdr[tag].label(0).substr(0,pos);
3455 string axistype =
"linear";
3456 string axisunits = Hdr[tag].units(0);
3458 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3462 dataset.write( &(data[0]) , H5::PredType::NATIVE_FLOAT );
3463 hfile_add_attr_todataset(dataset,
"LONG_NAME", tag);
3464 hfile_add_attr_todataset(dataset,
"UNITS",
formulary().Label(tag));
3486 if (Hdr[tag].
dim() != 2) {
3487 cout <<
"ERROR "<< tag <<
" : " << Hdr[tag].dim() <<
" dimensions != 2D structure\n";
3492 filename.append(tag).append(oH5Fextension(step,spec));
3493 H5::H5File file = hmake_file(filename);
3495 hsize_t dimsf[2] = { data.
dim2(), data.
dim1() };
3496 H5::DataSpace dataspace( 2, dimsf );
3497 H5::DataSet dataset = file.createDataSet( tag, H5::PredType::NATIVE_FLOAT, dataspace );
3499 float xmin[2] = {
static_cast<float>( Hdr[tag].min(0)),
3500 static_cast<float>( Hdr[tag].
min(1)) };
3502 float xmax[2] = {
static_cast<float>( Hdr[tag].max(0)),
3503 static_cast<float>( Hdr[tag].
max(1)) };
3505 hinit_attr2(file, tag, step, xmax, xmin);
3507 H5::Group group = file.createGroup(
"/AXIS");
3509 std::size_t pos = Hdr[tag].label(1).find(
"[");
3511 string axismainname =
"AXIS1";
3513 axisrange[0] = xmin[1];
3514 axisrange[1] = xmax[1];
3515 string axislongname = Hdr[tag].label(1).substr(0,pos);
3516 string axisname = Hdr[tag].label(1).substr(0,pos);
3517 string axistype =
"linear";
3518 string axisunits = Hdr[tag].units(1);
3520 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3522 pos = Hdr[tag].label(0).find(
"[");
3524 axismainname =
"AXIS2";
3525 axisrange[0] = xmin[0];
3526 axisrange[1] = xmax[0];
3527 axislongname = Hdr[tag].label(0).substr(0,pos);
3528 axisname = Hdr[tag].label(0).substr(0,pos);
3529 axisunits = Hdr[tag].units(0);
3531 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3535 dataset.write( &(data.
array())[0] , H5::PredType::NATIVE_FLOAT );
3536 hfile_add_attr_todataset(dataset,
"LONG_NAME", tag);
3537 hfile_add_attr_todataset(dataset,
"UNITS",
formulary().Label(tag));
3559 if (Hdr[tag].
dim() != 3) {
3560 cout <<
"ERROR "<< tag <<
" : " << Hdr[tag].dim() <<
" dimensions != 3D structure\n";
3565 filename.append(tag).append(oH5Fextension(step,spec));
3566 H5::H5File file = hmake_file(filename);
3568 hsize_t dimsf[3] = { data.
dim3(), data.
dim2(), data.
dim1() };
3569 H5::DataSpace dataspace( 3, dimsf );
3570 H5::DataSet dataset = file.createDataSet( tag, H5::PredType::NATIVE_FLOAT, dataspace );
3572 float xmin[3] = {
static_cast<float>( Hdr[tag].min(0)),
3573 static_cast<float>( Hdr[tag].
min(1)),
3574 static_cast<float>( Hdr[tag].
min(2))};
3575 float xmax[3] = {
static_cast<float>( Hdr[tag].max(0)),
3576 static_cast<float>( Hdr[tag].
max(1)),
3577 static_cast<float>( Hdr[tag].
max(2))};
3579 hinit_attr2(file, tag, step, xmax, xmin);
3581 H5::Group group = file.createGroup(
"/AXIS");
3583 std::size_t pos = Hdr[tag].label(1).find(
"[");
3585 string axismainname =
"AXIS1";
3587 axisrange[0] = xmin[1];
3588 axisrange[1] = xmax[1];
3589 string axislongname = Hdr[tag].label(1).substr(0,pos);
3590 string axisname = Hdr[tag].label(1).substr(0,pos);
3591 string axistype =
"linear";
3592 string axisunits = Hdr[tag].units(1);
3594 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3596 pos = Hdr[tag].label(0).find(
"[");
3598 axismainname =
"AXIS2";
3599 axisrange[0] = xmin[0];
3600 axisrange[1] = xmax[0];
3601 axislongname = Hdr[tag].label(0).substr(0,pos);
3602 axisname = Hdr[tag].label(0).substr(0,pos);
3603 axisunits = Hdr[tag].units(0);
3605 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3607 pos = Hdr[tag].label(2).find(
"[");
3609 axismainname =
"AXIS3";
3610 axisrange[0] = xmin[2];
3611 axisrange[1] = xmax[2];
3612 axislongname = Hdr[tag].label(2).substr(0,pos);
3613 axisname = Hdr[tag].label(2).substr(0,pos);
3614 axisunits = Hdr[tag].units(2);
3616 haxis(group, axismainname, axisrange, axislongname, axisname, axistype, axisunits);
3620 dataset.write( &(data.
array())[0] , H5::PredType::NATIVE_FLOAT );
3621 hfile_add_attr_todataset(dataset,
"LONG_NAME", tag);
3622 hfile_add_attr_todataset(dataset,
"UNITS",
formulary().Label(tag));
3637 const H5std_string FILE_NAME( ofilename );
3638 H5::H5File file( FILE_NAME, H5F_ACC_TRUNC );
3660 float xmax,
float xmin) {
3669 float dt = {
static_cast<float>(
3670 dt_out/
static_cast<double>(
3671 size_t(static_cast<int>(dt_out
3675 hfile_add_attr(hfilehandle,
"DT", dt);
3677 float time = {
static_cast<float>(dt_out*step) };
3678 hfile_add_attr(hfilehandle,
"TIME", time);
3680 hfile_add_attr(hfilehandle,
"NAME", tag);
3685 string timeunits =
"1/\\omega_p";
3686 hfile_add_attr(hfilehandle,
"TIME UNITS", timeunits);
3688 string typegrid =
"grid";
3689 hfile_add_attr(hfilehandle,
"TYPE", typegrid);
3691 hfile_add_attr(hfilehandle,
"XMAX", xmax);
3693 hfile_add_attr(hfilehandle,
"XMIN", xmin);
3700 float xmax[],
float xmin[]) {
3709 float dt = {
static_cast<float>(
3710 dt_out/
static_cast<double>(
3711 size_t(static_cast<int>(dt_out
3714 hfile_add_attr(hfilehandle,
"DT", dt);
3716 float time = {
static_cast<float>(dt_out*step) };
3717 hfile_add_attr(hfilehandle,
"TIME", time);
3719 hfile_add_attr(hfilehandle,
"NAME", tag);
3721 string timeunits =
"1/\\omega_p";
3722 hfile_add_attr(hfilehandle,
"TIME UNITS", timeunits);
3724 string typegrid =
"grid";
3725 hfile_add_attr(hfilehandle,
"TYPE", typegrid);
3727 hfile_add_attr2(hfilehandle,
"XMAX", xmax);
3729 hfile_add_attr2(hfilehandle,
"XMIN", xmin);
3737 string axislongname,
string axisname,
3738 string axistype,
string axisunits) {
3743 hsize_t dims2[1] = { 2 };
3744 H5::DataSpace dataspaceg1( 1, dims2 );
3745 H5::DataSet datasetg1 = hgrouphandle.createDataSet(axismainname, H5::PredType::NATIVE_FLOAT,
3747 datasetg1.write( axisrange, H5::PredType::NATIVE_FLOAT );
3748 hfile_add_attr_todataset(datasetg1,
"LONG_NAME", axislongname);
3749 hfile_add_attr_todataset(datasetg1,
"NAME", axisname);
3750 hfile_add_attr_todataset(datasetg1,
"TYPE", axistype);
3751 hfile_add_attr_todataset(datasetg1,
"UNITS", axisunits);
3753 dataspaceg1.close();
3767 hsize_t dims1[1] = { 1 };
3768 H5::DataSpace attr_dataspace_1 = H5::DataSpace (1, dims1 );
3769 H5::Attribute attribute_int = hfilehandle.createAttribute( attrname, H5::PredType::NATIVE_INT,
3771 attribute_int.write( H5::PredType::NATIVE_INT, &attrdata);
3772 attr_dataspace_1.close();
3773 attribute_int.close();
3787 hsize_t dims1[1] = { 2 };
3788 H5::DataSpace attr_dataspace_2 = H5::DataSpace (1, dims1 );
3789 H5::Attribute attribute_int = hfilehandle.createAttribute( attrname, H5::PredType::NATIVE_INT,
3791 attribute_int.write( H5::PredType::NATIVE_INT, attrdata);
3792 attr_dataspace_2.close();
3793 attribute_int.close();
3807 hsize_t dims1[1] = { 1 };
3808 H5::DataSpace attr_dataspace_1 = H5::DataSpace (1, dims1 );
3809 H5::Attribute attribute_float = hfilehandle.createAttribute( attrname, H5::PredType::NATIVE_FLOAT,
3811 attribute_float.write( H5::PredType::NATIVE_FLOAT, &attrdata);
3812 attr_dataspace_1.close();
3813 attribute_float.close();
3822 float attrdata[2]) {
3827 hsize_t dims1[1] = { 2 };
3828 H5::DataSpace attr_dataspace_2 = H5::DataSpace (1, dims1 );
3829 H5::Attribute attribute_float = hfilehandle.createAttribute( attrname, H5::PredType::NATIVE_FLOAT,
3831 attribute_float.write( H5::PredType::NATIVE_FLOAT, attrdata);
3832 attr_dataspace_2.close();
3833 attribute_float.close();
3847 hsize_t dims1[1] = { 1 };
3848 H5::DataSpace attr_dataspace_1 = H5::DataSpace (1, dims1 );
3849 H5::StrType strdatatype(H5::PredType::C_S1, 256);
3850 H5std_string strwritebuf ( attrdata );
3851 H5::Attribute attribute_string = hfilehandle.createAttribute( attrname, strdatatype, attr_dataspace_1);
3852 attribute_string.write(strdatatype, strwritebuf);
3853 attr_dataspace_1.close();
3854 attribute_string.close();
3868 hsize_t dims1[1] = { 1 };
3869 H5::DataSpace attr_dataspace_1 = H5::DataSpace (1, dims1 );
3870 H5::StrType strdatatype(H5::PredType::C_S1, 256);
3871 H5std_string strwritebuf ( attrdata );
3872 H5::Attribute attribute_string = hdatasethandle.createAttribute( attrname, strdatatype, attr_dataspace_1);
3873 attribute_string.write(strdatatype, strwritebuf);
3874 attr_dataspace_1.close();
3875 attribute_string.close();
Array2D< float > dcell(size_t s) const
float Pmin(size_t s) const
void f10(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
float Pmax(size_t s) const
valarray< T > & array() const
int Makefolder(string _name)
float Pmax(size_t s) const
void Qx(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
vector< float > vfloat_complex(const vector< complex< double > > vDouble)
std::string stringify(T const &x)
void hfile_add_attr(H5::H5File &hfilehandle, string attrname, int attrdata)
void hinit_attr2(H5::H5File &hfilehandle, const std::string tag, size_t step, float xmax[], float xmin[])
void Bx(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
Underlying data structures.
valarray< float > vfloat(const valarray< double > &vDouble)
const vector< size_t > l0
float Pmin(size_t s) const
void Jy(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
valarray< T > Legendre(const T x, const size_t Nl)
Export Files - Declarations.
void Read(const int rank, const size_t re_step, State1D &Y)
void Uy(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
size_t Npy(size_t i) const
void Qy(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
Restart_Facility(const int rank, string homedir="")
void f0(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void hinit_attr(H5::H5File &hfilehandle, const std::string tag, size_t step, float xmax, float xmin)
valarray< float > operator()(DistFunc1D &df, size_t x0, size_t s)
void Jz(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void vNx(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
float Pmax(size_t s) const
void hfile_add_attr2(H5::H5File &hfilehandle, string attrname, int attrdata[2])
void Qz(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
size_t Np(size_t s) const
const vector< size_t > m0
PLegendre2D(size_t Nl, size_t Nm, size_t Np, float pmin, float pmax, size_t Npx, size_t Npy)
fx1_1D(const Grid_Info &_G)
H5::H5File hmake_file(string ofilename)
void Uz(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void Ex(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void f20(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void vNy(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void fl0(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void distdump(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void T(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
valarray< T > & array() const
double & temperature(size_t i)
size_t Np(size_t i) const
void f11(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void px(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
valarray< T > MakeAxis(const T min, const T max, const size_t N)
void operator()(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void hclose_file(H5::H5File &file)
Xport(const Algorithms::AxisBundle< double > &_axis, const vector< string > oTags, string homedir="")
DistFunc1D & DF(size_t s)
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Grid Setup - Declaration.
void Write(const int rank, const size_t re_step, State1D &Y)
Fields, Distributions, Harmonics, States - Declarations.
void haxis(H5::Group &hgrouphandle, string axismainname, float axisrange[2], string axislongname, string axisname, string axistype, string axisunits)
p2p1x1_1D(const Grid_Info &_G)
void Ux(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
string rFextension(const int rank, const size_t rstep)
void Ez(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
const Algorithms::AxisBundle< double > axis
PLegendre2D PL(size_t s) const
Array2D< float > operator()(DistFunc1D &df, size_t l, size_t m, size_t x0, size_t s)
void n(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
Array2D< size_t > npcell(size_t s) const
Array2D< float > prad(size_t s) const
size_t Npx(size_t i) const
valarray< T > MakeCAxis(const T min, const T max, const size_t N)
void hfile_add_attr_todataset(H5::DataSet &hdatasethandle, string attrname, string attrdata)
double & density(size_t i)
size_t Npz(size_t i) const
float Pmin(size_t s) const
string oH5Fextension(size_t step, int species=-1)
void vNz(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void Ti(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
p1x1_1D(const Grid_Info &_G)
Array2D< float > p2p1_x1(size_t s) const
size_t Nx(size_t i) const
PLegendre1D(size_t Nl, size_t Nm, size_t Np, float pmin, float pmax, size_t Npx)
void Z(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
size_t Nxg(size_t i) const
void Export_h5(const std::string tag, std::valarray< float > ex, const size_t &step, const int spec=-1)
Array2D< float > operator()(DistFunc1D &df, size_t x0, size_t s)
void By(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
const string h5file_extension
void ni(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
void Jx(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
size_t Nm(size_t s) const
void Ey(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
size_t Nl(size_t s) const
The 1D distribution function is the container for all SHarmonic1D per species.
T moment(const vector< T > q, const vector< T > x, const int p)
valarray< float > p1_x1(size_t s) const
void Bz(const State1D &Y, const Grid_Info &grid, const size_t tout, const Parallel_Environment_1D &PE)
const string rfile_extension
Numerical Methods - Declarations.