#include "parser.h" #ifdef IWAVE_USE_MPI #include "mpigridpp.hh" #else #include "gridpp.hh" #endif #include "gridops.hh" using RVL::valparse; using RVL::RVLException; using RVL::Vector; using RVL::LinearOp; using RVL::AssignFilename; using TSOpt::GridDerivOp; #ifdef IWAVE_USE_MPI using TSOpt::MPIGridSpace; typedef TSOpt::MPIGridSpace gsp; #else using TSOpt::GridSpace; typedef TSOpt::GridSpace gsp; #endif int xargc; char **xargv; int main(int argc, char ** argv) { try { #ifdef IWAVE_USE_MPI int ts=0; MPI_Init_thread(&argc,&argv,MPI_THREAD_FUNNELED,&ts); storeGlobalComm(MPI_COMM_WORLD); #endif PARARRAY * pars = ps_new(); if (ps_createargs(pars,argc-1,&(argv[1]))) { RVLException e; e<<"ERROR: GridDerivOp from ps_creatargs \n"; e<<" called with args:\n"; e<<" argc = "<(*pars,"in"); string outp = valparse(*pars,"out"); int axis = valparse(*pars,"axis"); gsp sp(inp,"notype",true #ifdef IWAVE_USE_MPI , retrieveGlobalComm() #endif ); GridDerivOp op(sp,axis); Vector invec(sp); Vector outvec(sp); AssignFilename afin(inp); AssignFilename afout(outp); invec.eval(afin); outvec.eval(afout); if (valparse(*pars,"adjoint")) { op.applyAdjOp(invec,outvec); } else { op.applyOp(invec,outvec); } ps_delete(&pars); #ifdef IWAVE_USE_MPI MPI_Finalize(); #endif } catch (RVLException & e) { e.write(cerr); #ifdef IWAVE_USE_MPI MPI_Abort(MPI_COMM_WORLD,0); #endif exit(1); } }