// elastic_genTerm - A linear solver for elastic problems using FEM
// 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>.

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


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

  // instanciate a solver
  ElastodynamicSolver mySolver;

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

  // solve the problem
  mySolver.solve();

  // post process the results
  //mySolver.error_norm_L2();

#if defined(HAVE_POST)
 
  PView *pv;


  pv = mySolver.buildViewDispNum_x("dispNum");
  pv->getData()->writeMSH("dispNum.msh", 3);
  delete pv;
 
/*
  pv = mySolver.buildViewDispAna_x("dispAna");
  pv->getData()->writeMSH("dispAna.msh", 3);
  delete pv;
    
/*
  pv = mySolver.buildViewDispDiff_x("dispDiff");
  pv->getData()->writeMSH("dispDiff.msh", 3);
  delete pv;



  pv = mySolver.buildViewDispInc_x("dispInc");
  pv->getData()->writeMSH("dispInc.msh", 3);
  delete pv;
/*
  pv = mySolver.buildDisplacementView("dispNum");
  pv->getData()->writeMSH("disp.msh", 3);
  delete pv;
  pv = mySolver.buildStressView("stress");
  pv->getData()->writeMSH("stress.msh", 3);
  delete pv;
  pv = mySolver.buildStrainView("strain");
  pv->getData()->writeMSH("strain.msh", 3);
  delete pv;
    */
#endif

  // stop gmsh
  GmshFinalize();
}
