ikarus-project / ikarus

Ikarus is a C++-based library that uses DUNE modules to solve partial differential equations with the finite element method and more.
https://ikarus-project.github.io/
Other
6 stars 3 forks source link

Error should be thrown if the requested result is not implemented for all FE #173

Closed tarun-mitruka closed 1 year ago

tarun-mitruka commented 1 year ago

Example:

 using ElementType = Ikarus::EnhancedAssumedStrains<Ikarus::LinearElastic<decltype(basis)>>;
  std::vector<ElementType> fes;
  using GridView = decltype(gridView);
  Dune::VtkWriter<GridView> vtkWriter2(gridView);
  auto resReq = Ikarus::ResultRequirements()
                .insertGlobalSolution(Ikarus::FESolutions::displacement, D_Glob)
                .insertParameter(Ikarus::FEParameter::loadfactor, lambdaLoad)
                .addResultRequest(ResultType::PK2Stress);

  auto resultFunction = std::make_shared<ResultFunction<ElementType>>(&fes, resReq);
  vtkWriter2.addPointData(Dune::Vtk::Function<GridView>(resultFunction));

Asking for ResultType::PK2Stress for the EAS element here leads to the following run-time error:

terminate called after throwing an instance of 'Dune::RangeError'
  what():  Dune::RangeError [getSingleResult:/tmp/Ikarus/ikarus/finiteElements/feRequirements.hh:199]: getSingleResult can only be called when a single result was inserted

But this error should convey that the chosen element doesn't compute ResultType::PK2Stress as a requested result