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

#ifndef _SCALAR_HELMHOLTZ_H_
#define _SCALAR_HELMHOLTZ_H_

#include <complex>

#include "genFSpace.h"
#include "genSolver.h"
#include "dofManager.h"

#include "scalar_helmholtz_domain.h"


class ScalarHelmholtzSolver : public genSolver
{
protected :
  // structure storing the degrees of freedom
  dofManager<std::complex<double> >* pAssembler;
  // function spaces
  genFSpace<genTensor0<std::complex<double> > >::Handle FSpace; // functional space
  // supports
  std::vector<ScalarHelmholtzDomain*> IDomains;

  double testval;

public :
  ScalarHelmholtzSolver() : genSolver(), pAssembler(0) { }
  virtual ~ScalarHelmholtzSolver();
  //read data file
  virtual void readInputFile(const std::string &fileName);
  // builds local supports
  virtual void CheckProperties();
  // build the problem function spaces
  virtual void CreateFunctionSpace();
  virtual void BuildFunctionSpaces();
  // assemble the problem
  virtual void AssembleRHS();
  virtual void AssembleLHS();
  virtual void BuildLinearSystem();
  // export matrix K.txt in file
  virtual void exportK();
  // export rhs b.txt in file
  virtual void exportb();
  // export soln in x.txt in file
  virtual void exportx();
  virtual void solve();
  virtual double test();
  virtual double gettestval() {return testval;}
  virtual PView* buildViewRe(const std::string &postFileName);
  virtual PView* buildViewIm(const std::string &postFileName);
  virtual PView* buildViewArg(const std::string &postFileName);
  virtual PView* buildViewAbs(const std::string &postFileName);
};

#endif //_SCALAR_HELMHOTZ_H_
