// Scalar_Helmholtz_xfem - A linear solver for the scalar helmholtz equation using X-FEM
// Copyright (C) 2012-2026 Eric Bechet
//
// See the LICENSE file for license information.
// Please report all bugs and problems to <bechet@cadxfem.org>.


#include "GmshGlobal.h"
#if defined(HAVE_POST)
#include "PView.h"
#include "PViewData.h"
#endif
#include "helmholtz_multlag.h"

int main (int argc, char* argv[])
{
  if (argc != 2)
  {
    printf("usage : scalar_helmholtz_xfem input_file_name\n");
    return -1;
  }

  GmshInitialize(argc, argv);

  // instanciate a solver
  HelmholtzMultLagSolver mySolver;

  // read the input file
  mySolver.readInputFile(argv[1]);

  // solve the problem
  mySolver.solve();
  
  // post process the results
  mySolver.erreur();
 
 
#if defined(HAVE_POST)
  PView *pv;
  pv = mySolver.buildViewAna("Ana");
  pv->getData()->writeMSH("primal_ana.msh",3);
  delete pv;
  pv = mySolver.buildViewDiff("Diff");
  pv->getData()->writeMSH("primal_diff.msh",3);
  delete pv;
  pv = mySolver.buildViewNum("Num");
  pv->getData()->writeMSH("primal_num.msh",3);
  delete pv;
//   pv = mySolver.buildViewIm("Imag");
//   pv->getData()->writeMSH("primal_imag.msh", 3);
//   delete pv;
//   pv = mySolver.buildViewAbs("Abs");
//   pv->getData()->writeMSH("primal_abs.msh", 3);
//   delete pv;
//   pv = mySolver.buildViewArg("Arg");
//   pv->getData()->writeMSH("primal_arg.msh", 3);
//   delete pv;
#endif
  // stop gmsh
  GmshFinalize();
}
