@@ -55,7 +55,7 @@ namespace BasisClasses
5555
5656 // Allocate coefficient storage
5757 //
58- nfld = p.size () + 1 ;
58+ nfld = p.size () + 1 ; // Add the density to the phase-space return
5959 allocateStore ();
6060
6161 // Okay to register
@@ -287,7 +287,7 @@ namespace BasisClasses
287287 // Sanity test dimensions
288288 if (nfld!=p->nfld || lmax!=p->mmax || nmax!=p->nmax ) {
289289 std::ostringstream serr;
290- serr << " FieldBasis::set_coefs: dimension error! "
290+ serr << " FieldBasis::set_coefs: dimension error for dof=2 ! "
291291 << " nfld [" << nfld << " != " << p->nfld << " ]"
292292 << " mmax [" << lmax << " != " << p->mmax << " ]"
293293 << " nmax [" << nmax << " != " << p->nmax << " ]" ;
@@ -302,7 +302,7 @@ namespace BasisClasses
302302 // Sanity test dimensions
303303 if (nfld!=p->nfld || lmax!=p->lmax || nmax!=p->nmax ) {
304304 std::ostringstream serr;
305- serr << " FieldBasis::set_coefs: dimension error! "
305+ serr << " FieldBasis::set_coefs: dimension error for dof=3 ! "
306306 << " nfld [" << nfld << " != " << p->nfld << " ]"
307307 << " lmax [" << lmax << " != " << p->lmax << " ]"
308308 << " nmax [" << nmax << " != " << p->nmax << " ]" ;
@@ -421,14 +421,10 @@ namespace BasisClasses
421421 //
422422 if (dof==2 ) {
423423 auto p = dynamic_pointer_cast<CoefClasses::CylFldStruct>(coefret);
424- int rows = lmax + 1 ;
425- int cols = nmax;
426- p->assign (store[0 ], nfld, rows, cols);
424+ p->assign (store[0 ], nfld, lmax, nmax);
427425 } else {
428426 auto p = dynamic_pointer_cast<CoefClasses::SphFldStruct>(coefret);
429- int rows = (lmax+1 )*(lmax+2 )/2 ;
430- int cols = nmax;
431- p->assign (store[0 ], nfld, rows, cols);
427+ p->assign (store[0 ], nfld, lmax, nmax);
432428 }
433429 }
434430
@@ -439,13 +435,11 @@ namespace BasisClasses
439435 auto cstr = std::make_shared<CoefClasses::CylFldStruct>();
440436 int rows = lmax + 1 ;
441437 int cols = nmax;
442- cstr->assign (store[0 ], nfld, rows, cols );
438+ cstr->assign (store[0 ], nfld, lmax, nmax );
443439 return cstr;
444440 } else {
445441 auto cstr = std::make_shared<CoefClasses::SphFldStruct>();
446- int rows = (lmax+1 )*(lmax+2 )/2 ;
447- int cols = nmax;
448- cstr->assign (store[0 ], nfld, rows, cols);
442+ cstr->assign (store[0 ], nfld, lmax, nmax);
449443 return cstr;
450444 }
451445 }
0 commit comments