From c1e8f31d2cccd06db0371dd7d0e604397975b4e1 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Sat, 29 Sep 2018 21:52:45 +0200
Subject: [PATCH] Move linelast.cc into the 'src' directory

This is where such files should reside nowadays.
---
 CMakeLists.txt                          |  2 +-
 src/CMakeLists.txt                      |  4 +++-
 linelast.cc => src/linear-elasticity.cc | 16 ++++++++++++++++
 3 files changed, 20 insertions(+), 2 deletions(-)
 rename linelast.cc => src/linear-elasticity.cc (97%)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22f67f5..711292f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ add_subdirectory("dune")
 add_subdirectory("src")
 
 if(HAVE_AMIRAMESH AND HAVE_IPOPT AND HAVE_PSURFACE AND HAVE_UG)
-  set(programs linelast viscoelast nonlinelast)
+  set(programs viscoelast nonlinelast)
   foreach(_program ${programs})
     add_executable(${_program} ${_program}.cc)
     add_dune_amiramesh_flags(${_program})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d25f294..1d124fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,7 @@
 if(ADOLC_FOUND AND IPOPT_FOUND AND PYTHONLIBS_FOUND AND dune-uggrid_FOUND)
-  set(programs finite-strain-elasticity)
+  set(programs finite-strain-elasticity
+               linear-elasticity)
+
   foreach(_program ${programs})
     add_executable(${_program} ${_program}.cc)
     add_dune_adolc_flags(${_program})
diff --git a/linelast.cc b/src/linear-elasticity.cc
similarity index 97%
rename from linelast.cc
rename to src/linear-elasticity.cc
index ae858f4..126114b 100644
--- a/linelast.cc
+++ b/src/linear-elasticity.cc
@@ -89,24 +89,36 @@ int main (int argc, char *argv[]) try
     GridType* grid= new GridType;
     grid->setRefinementType(GridType::COPY);
 
+#if HAVE_AMIRAMESH
     if (paramBoundaries)
         grid = AmiraMeshReader<GridType>::read(path + gridFile, PSurfaceBoundary<dim-1>::read(path + parFile));
     else
         grid = AmiraMeshReader<GridType>::read(path + gridFile);
+#else
+#warning You need libamiramesh for this code!
+#endif
 
     LevelBoundaryPatch coarseDirichletBoundary;
     coarseDirichletBoundary.setup(grid->levelGridView(0));
     readBoundaryPatch<GridType>(coarseDirichletBoundary, path + dirichletFile);
 
     VectorType coarseDirichletValues(grid->size(0, dim));
+#if HAVE_AMIRAMESH
     AmiraMeshReader<GridType>::readFunction(coarseDirichletValues, path + dirichletValuesFile);
+#else
+#warning You need libamiramesh for this code!
+#endif
 
     LevelBoundaryPatch coarseNeumannBoundary;
     coarseNeumannBoundary.setup(grid->levelGridView(0));
     readBoundaryPatch<GridType>(coarseNeumannBoundary, path + neumannFile);
 
     VectorType coarseNeumannValues(grid->size(0, dim));
+#if HAVE_AMIRAMESH
     AmiraMeshReader<GridType>::readFunction(coarseNeumannValues, path + neumannValuesFile);
+#else
+#warning You need libamiramesh for this code!
+#endif
     P1NodalBasis<GridType::LevelGridView> coarseBasis(grid->levelGridView(0));
 
     auto coarseDir = ::Functions::makeFunction(coarseBasis,coarseDirichletValues);
@@ -284,10 +296,14 @@ int main (int argc, char *argv[]) try
     }
 
   // Output result
+#if HAVE_AMIRAMESH
   LeafAmiraMeshWriter<GridType> amiramesh;
   amiramesh.addLeafGrid(*grid,true);
   amiramesh.addVertexData(x, grid->leafGridView(),true);
   amiramesh.write("resultGrid",1);
+#else
+#warning You need libamiramesh for this code!
+#endif
 
  } catch (Exception e) {
 
-- 
GitLab