Commit ce96f449 authored by Francois Gygi's avatar Francois Gygi
Browse files

update for use of Basis without Context


git-svn-id: http://qboxcode.org/svn/qb/trunk@1348 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 8331cfc8
......@@ -18,7 +18,6 @@
#include <iomanip>
using namespace std;
#include "Context.h"
#include "Basis.h"
#include "FourierTransform.h"
#include "Timer.h"
......@@ -41,8 +40,6 @@ int main(int argc, char **argv)
#if USE_APC
ApcInit();
#endif
// extra scope to ensure that Context objects get destructed before
// the MPI_Finalize call
{
#if USE_MPI
......@@ -53,8 +50,8 @@ int main(int argc, char **argv)
const char* processor_name = "serial";
#endif
Context ctxt_global;
int mype = ctxt_global.mype();
int mype;
MPI_Comm_rank(MPI_COMM_WORLD,&mype);
cout << " Process " << mype << " on " << processor_name << endl;
D3vector a,b,c,kpoint;
......@@ -89,17 +86,11 @@ int main(int argc, char **argv)
UnitCell cell(a,b,c);
const double omega = cell.volume();
//cout << " ctxt_global: " << ctxt_global;
//cout << " ctxt_global.comm(): " << ctxt_global.comm() << endl;
Context ctxt(ctxt_global.size(),1);
//cout << " ctxt: " << ctxt;
//cout << " ctxt.comm(): " << ctxt.comm() << endl;
// start scope of wf-v transforms
{
// transform and interpolate as for wavefunctions
Basis basis(ctxt,kpoint);
Basis basis(MPI_COMM_WORLD,kpoint);
basis.resize(cell,cell,ecut);
FourierTransform ft(basis,basis.np(0),basis.np(1),basis.np(2));
FourierTransform ft2(basis,2*basis.np(0),2*basis.np(1),2*basis.np(2));
......@@ -112,7 +103,7 @@ int main(int argc, char **argv)
double flops = 2*basis.nrod_loc() * fft_flops(ft2.np2()) +
ft2.np1()/2 * ft2.np2() * fft_flops(ft2.np0()) +
ft2.np0() * ft2.np2() * fft_flops(ft2.np1());
if ( ctxt.onpe0() )
if ( mype == 0 )
{
cout << " wfbasis.size() = " << basis.size() << endl;
cout << " wfbasis.np() = " << basis.np(0) << " " << basis.np(1)
......@@ -143,13 +134,13 @@ int main(int argc, char **argv)
#endif
// test ft (small grid)
cout << ctxt.mype() << ": ft.np2_loc(): " << ft.np2_loc() << endl;
cout << mype << ": ft.np2_loc(): " << ft.np2_loc() << endl;
cout << " test ft: ";
ft.forward(&f1[0],&x[0]);
cout << " forward done ";
ft.backward(&x[0],&f1[0]);
cout << " backward done " << endl;
ctxt.barrier();
MPI_Barrier(MPI_COMM_WORLD);
#if 0
......@@ -328,7 +319,7 @@ int main(int argc, char **argv)
#if 1
////////////////////////////////////////////////////////////
// v(g)->vgrid
Basis vbasis(ctxt,kpoint);
Basis vbasis(MPI_COMM_WORLD,kpoint);
vbasis.resize(cell,cell,4.0*ecut);
cout << " vbasis.np() = " << vbasis.np(0) << " " << vbasis.np(1)
<< " " << vbasis.np(2) << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment