diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da3b93e96a3156389bdb1ab0ecc2c632b3fc9a8..f2a796a06690058f5b02c63d168cff2541a7a9b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,18 +55,20 @@ dune:git clang: - *before script: duneci-standard-test -dune:git parmg gcc: +dune:git parmg dune-vtk gcc: image: registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17 before_script: - *patch-dune-common - *before - duneci-install-module https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mn.tu-dresden.de/paraphase/dune-parmg.git + - duneci-install-module https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mn.tu-dresden.de/spraetor/dune-vtk.git script: duneci-standard-test -dune:git parmg clang: +dune:git parmg dune-vtk clang: image: registry.dune-project.org/docker/ci/dune:git-ubuntu-20.04-clang-10-20 before_script: - *patch-dune-common - *before - duneci-install-module https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mn.tu-dresden.de/paraphase/dune-parmg.git + - duneci-install-module https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.mn.tu-dresden.de/spraetor/dune-vtk.git script: duneci-standard-test diff --git a/dune.module b/dune.module index e22cda06d446d2df33e6e2422b9c903c266961f2..56463f4474639305ed2a8d06248dcc186a64df8f 100644 --- a/dune.module +++ b/dune.module @@ -8,4 +8,4 @@ Version: svn Maintainer: oliver.sander@tu-dresden.de #depending on Depends: dune-grid dune-uggrid dune-istl dune-localfunctions dune-functions dune-solvers dune-fufem dune-elasticity -Suggests: dune-foamgrid dune-parmg +Suggests: dune-foamgrid dune-parmg dune-vtk diff --git a/dune/gfe/vtkreader.hh b/dune/gfe/vtkreader.hh deleted file mode 100644 index 1279a655e0233f591cd881ff1aaf0e04bb903447..0000000000000000000000000000000000000000 --- a/dune/gfe/vtkreader.hh +++ /dev/null @@ -1,51 +0,0 @@ -// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -// vi: set et ts=4 sw=2 sts=2: -#ifndef DUNE_GFE_VTKREADER_HH -#define DUNE_GFE_VTKREADER_HH - -#include <memory> - -#include <dune/gfe/vtkfile.hh> - -/** \brief Read a grid from a VTK file - */ -template <class GridType> -class VTKReader -{ -public: - - /** \brief Read a grid from a VTK file */ - static std::unique_ptr<GridType> read(std::string filename) - { - constexpr auto dimworld = GridType::dimensionworld; - - Dune::GFE::VTKFile vtkFile; - - // Read test file from disk - vtkFile.read(filename); - - Dune::GridFactory<GridType> factory; - - for (const auto& v : vtkFile.points_) - { - // use the first dimworld components as vertex coordinate; discard the rest - Dune::FieldVector<typename GridType::ctype, dimworld> pos; - for (int i=0; i<dimworld; i++) - pos[i] = v[i]; - factory.insertVertex(pos); - } - - for (size_t i=0; i<vtkFile.cellConnectivity_.size(); i+=3) - { - factory.insertElement(Dune::GeometryTypes::triangle, {vtkFile.cellConnectivity_[i], - vtkFile.cellConnectivity_[i+1], - vtkFile.cellConnectivity_[i+2]}); - - } - - return std::unique_ptr<GridType>(factory.createGrid()); - } - -}; - -#endif diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc index 6d1719cf94d6fd103862869df0eb20bebbbea207..122c7f44021af786cdc273a8a1d5bc1cb690f6c2 100644 --- a/src/cosserat-continuum.cc +++ b/src/cosserat-continuum.cc @@ -46,7 +46,6 @@ #include <dune/gfe/nonplanarcosseratshellenergy.hh> #include <dune/gfe/cosseratvtkwriter.hh> #include <dune/gfe/cosseratvtkreader.hh> -#include <dune/gfe/vtkreader.hh> #include <dune/gfe/geodesicfeassembler.hh> #include <dune/gfe/riemanniantrsolver.hh> #include <dune/gfe/vertexnormals.hh> @@ -54,6 +53,10 @@ #include <dune/gfe/mixedgfeassembler.hh> #include <dune/gfe/mixedriemanniantrsolver.hh> +#if HAVE_DUNE_VTK +#include <dune/vtk/vtkreader.hh> +#endif + // grid dimension const int dim = 2; const int dimworld = 2; @@ -203,7 +206,11 @@ int main (int argc, char *argv[]) try if (suffix == ".msh") grid = std::shared_ptr<GridType>(GmshReader<GridType>::read(path + "/" + gridFile)); else if (suffix == ".vtu" or suffix == ".vtp") - grid = VTKReader<GridType>::read(path + "/" + gridFile); +#if HAVE_DUNE_VTK + grid = VtkReader<GridType>::createGridFromFile(path + "/" + gridFile); +#else + DUNE_THROW(NotImplemented, "Please install dune-vtk for VTK reading support!"); +#endif } grid->globalRefine(numLevels-1);