// GenFem - A high-level finite element library
// Copyright (C) 2010-2026 Eric Bechet
//
// See the LICENSE file for license information and contributions.
// Please report all bugs and problems to <bechet@cadxfem.org>.

#ifndef _INTERFACE_XFEM_SOLVER_H_
#define _INTERFACE_XFEM_SOLVER_H_

#include <memory>
#include "dofManager.h"
#include "genTerm.h"
#include "genSolver.h"
#include "interfaceXfemDomain.h"
#include "genCache.h"
#include "savedGenTermManager.h"
#include "genFSpace.h"

//#define VECT_SPACE

class InterfaceXfemSolver : public genSolver
{
protected :
  dofManager<double>* pAssembler;

  // function spaces
#ifdef VECT_SPACE
  genFSpace<genTensor1<double> >::Handle FSpace;
#else
  genFSpace<genTensor0<double> >::Handle FSpace;
#endif
  // supports for stableLagMult
  std::vector<InterfaceDomain*> IDomains;

  // model name
  std::string modelname;

public :
  InterfaceXfemSolver() : genSolver(), pAssembler(0) {}
  virtual ~InterfaceXfemSolver();
  //read data file
  virtual void readInputFile(const std::string &fileName);
  // builds local supports
  virtual void CheckProperties();
  // build the problem function spaces
  virtual void CreateFunctionSpaces();
  virtual void BuildFunctionSpaces();
  // assemble the problem
  virtual void AssembleRHS();
  virtual void AssembleLHS();
  virtual void BuildLinearSystem();
  // solve the problem
  virtual void solve();
  // export K.txt b.txt in file
  virtual void exportKb();
  // post-processing
  virtual PView* buildView(const std::string &postFileName);
  virtual PView* buildViewG(const std::string &postFileName);
};


#endif // _INTERFACE_XFEM_SOLVER_H_
