From bc2410a6fa0b6857037522a0fe34c30740766963 Mon Sep 17 00:00:00 2001
From: Simon Praetorius <simon.praetorius@tu-dresden.de>
Date: Mon, 21 Jan 2013 15:22:15 +0000
Subject: [PATCH] demo directory cleaned up

---
 demo/CMakeLists.txt                      |  88 ------------
 demo/src/cahn_hilliard.cc                |  99 -------------
 demo/src/chns/CahnHilliardNavierStokes.h | 175 -----------------------
 demo/src/chns/drivenCavity.cc            |  84 -----------
 demo/src/elliptBaseProblem.cc            | 107 --------------
 demo/src/elliptImplicit.cc               |  99 -------------
 demo/src/linearElasticity.cc             | 148 -------------------
 demo/src/navierStokes.cc                 | 109 --------------
 demo/src/pfc.cc                          | 102 -------------
 demo/src/torus.cc                        |   4 +-
 10 files changed, 1 insertion(+), 1014 deletions(-)
 delete mode 100644 demo/src/cahn_hilliard.cc
 delete mode 100644 demo/src/chns/CahnHilliardNavierStokes.h
 delete mode 100644 demo/src/chns/drivenCavity.cc
 delete mode 100644 demo/src/elliptBaseProblem.cc
 delete mode 100644 demo/src/elliptImplicit.cc
 delete mode 100644 demo/src/linearElasticity.cc
 delete mode 100644 demo/src/navierStokes.cc
 delete mode 100644 demo/src/pfc.cc

diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt
index 58c28d22..2be60092 100644
--- a/demo/CMakeLists.txt
+++ b/demo/CMakeLists.txt
@@ -14,7 +14,6 @@ set(ball src/ball.cc)
 set(bunny src/bunny.cc)
 set(ellipt src/ellipt.cc)
 set(heat src/heat.cc)
-set(navierStokes src/navierStokes.cc)
 set(neumann src/neumann.cc)
 set(nonlin src/nonlin.cc)
 set(parametric src/parametric.cc)
@@ -40,10 +39,6 @@ add_executable("heat" ${heat})
 target_link_libraries("heat" ${BASIS_LIBS})
 install(TARGETS heat RUNTIME DESTINATION bin)
 
-add_executable("navierStokes" ${navierStokes})
-target_link_libraries("navierStokes" ${BASIS_LIBS})
-install(TARGETS navierStokes RUNTIME DESTINATION bin)
-
 add_executable("neumann" ${neumann})
 target_link_libraries("neumann" ${BASIS_LIBS})
 install(TARGETS neumann RUNTIME DESTINATION bin)
@@ -76,88 +71,5 @@ add_executable("vecheat" ${vecheat})
 target_link_libraries("vecheat" ${BASIS_LIBS})
 install(TARGETS vecheat RUNTIME DESTINATION bin)
 
-# find tools-directory
-find_path(TOOLS_DIR NAMES "baseProblem/BaseProblem.h" "misc/Helpers.h" DOC "Path to tools directory in AMDiS-trunk dir" )
-if (TOOLS_DIR)
-  if (NOT EXISTS ${TOOLS_DIR}/misc/Helpers.h OR NOT EXISTS ${TOOLS_DIR}/baseProblems/BaseProblem.h)
-    message(WARNING "Wrong tools directory! Directory must contain the subdirectories 'diffuseDomain' and 'baseProblems'")
-  else()
-
-    include_directories(${TOOLS_DIR}/diffuseDomain)
-    include_directories(${TOOLS_DIR}/baseProblems)
-    include_directories(${TOOLS_DIR}/misc)
-
-    set(elliptBase src/elliptBaseProblem.cc)
-    add_executable("elliptBase" ${elliptBase})
-    target_link_libraries("elliptBase" ${BASIS_LIBS})
-
-    set(elliptImplicit src/elliptImplicit.cc)
-    add_executable("elliptImplicit" ${elliptImplicit})
-    target_link_libraries("elliptImplicit" ${BASIS_LIBS})
-
-    set(cahn_hilliard src/cahn_hilliard.cc ${TOOLS_DIR}/baseProblems/CahnHilliard.cc)
-    add_executable("cahn_hilliard" ${cahn_hilliard})
-    target_link_libraries("cahn_hilliard" ${BASIS_LIBS})
-
-    set(pfc src/pfc.cc ${TOOLS_DIR}/baseProblems/PhaseFieldCrystal_Base.cc  ${TOOLS_DIR}/misc/Helpers.cc)
-    add_executable("pfc" ${pfc})
-    target_link_libraries("pfc" ${BASIS_LIBS})
-
-    set(drivenCavity ${TOOLS_DIR}/diffuseDomain/POperators.cc
-		    ${TOOLS_DIR}/baseProblems/CahnHilliard.cc
-		    ${TOOLS_DIR}/baseProblems/NavierStokes_TaylorHood.cc
-		    src/chns/drivenCavity.cc)
-    add_executable("drivenCavity" ${drivenCavity})
-    target_link_libraries("drivenCavity" ${BASIS_LIBS})
-
-    include_directories(/home/spraetor/projects/src/common)
-    set(navierStokes ${TOOLS_DIR}/diffuseDomain/POperators.cc
-# 		    ${TOOLS_DIR}/baseProblems/NavierStokes_TaylorHood.cc
-		    ${TOOLS_DIR}/baseProblems/NavierStokes_TaylorHood_RB.cc
-		    ${TOOLS_DIR}/baseProblems/time/ExtendedRosenbrockStationary.cc
-		    /home/spraetor/projects/src/common/GeometryTools.cc
-		    src/navierStokes.cc)
-    add_executable("navierStokes" ${navierStokes})
-    target_link_libraries("navierStokes" ${BASIS_LIBS})
-
-    set(navierStokesDd ${TOOLS_DIR}/diffuseDomain/POperators.cc
-		    ${TOOLS_DIR}/baseProblems/NavierStokes_TaylorHood.cc
-		    ${TOOLS_DIR}/baseProblems/NavierStokesPhase_TaylorHood.cc
-		    ${TOOLS_DIR}/misc/Helpers.cc
-		    /home/spraetor/projects/src/common/GeometryTools.cc
-		    src/navierStokes_diffuseDomain.cc)
-    add_executable("navierStokesDd" ${navierStokesDd})
-    target_link_libraries("navierStokesDd" ${BASIS_LIBS})
-
-    set(linearElasticityDd ${TOOLS_DIR}/baseProblems/LinearElasticityPhase.cc
-			${TOOLS_DIR}/diffuseDomain/POperators.cc
-		    /home/spraetor/projects/src/common/GeometryTools.cc
-		    src/linearElasticity.cc)
-    add_executable("linearElasticityDd" ${linearElasticityDd})
-    target_link_libraries("linearElasticityDd" ${BASIS_LIBS})
-
-    set(fsi ${TOOLS_DIR}/baseProblems/LinearElasticityPhase.cc
-	      ${TOOLS_DIR}/baseProblems/NavierStokes_TaylorHood.cc
-	      ${TOOLS_DIR}/baseProblems/NavierStokesPhase_TaylorHood.cc
-	      ${TOOLS_DIR}/misc/Helpers.cc
-	      ${TOOLS_DIR}/diffuseDomain/POperators.cc
-	      /home/spraetor/projects/src/common/GeometryTools.cc
-	      src/fsi/fluidStructureInteraction.cc)
-    add_executable("fsi" ${fsi})
-    target_link_libraries("fsi" ${BASIS_LIBS})
-
-    set(ddFsi ${TOOLS_DIR}/baseProblems/DiffuseDomainFsi.cc
-	      ${TOOLS_DIR}/misc/Helpers.cc
-	      ${TOOLS_DIR}/diffuseDomain/POperators.cc
-	      /home/spraetor/projects/src/common/GeometryTools.cc
-	      src/diffuseDomainFsi.cc)
-    add_executable("ddFsi" ${ddFsi})
-    target_link_libraries("ddFsi" ${BASIS_LIBS})
-    
-  endif()
-else()
-    message(WARNING "No tools directory specified! Some demos will not be build.")
-endif(TOOLS_DIR)
-
 #create the output dir
 # file(MAKE_DIRECTORY output)
diff --git a/demo/src/cahn_hilliard.cc b/demo/src/cahn_hilliard.cc
deleted file mode 100644
index bb66191c..00000000
--- a/demo/src/cahn_hilliard.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "AMDiS.h"
-#include "CouplingTimeInterface.h"
-#include "Refinement.h"
-#include "MeshFunction_Level.h"
-#include "CahnHilliard.h"
-#include "Views.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-class RefinementTimeInterface : public CouplingTimeInterface
-{
-public:
-
-  RefinementTimeInterface(CahnHilliard *chProb_) :
-    chProb(chProb_),
-    refFunction(NULL),
-    refinement(NULL)
-  {
-    addTimeInterface(chProb);
-  }
-
-  ~RefinementTimeInterface()
-  {
-    if (refFunction)
-      delete refFunction;
-    if (refinement)
-      delete refinement;
-  }
-
-  virtual void initTimeInterface()
-  {
-    chProb->initTimeInterface();
-  }
-
-  /// Called at the end of each timestep.
-  virtual void closeTimestep(AdaptInfo *adaptInfo)
-  {
-    CouplingTimeInterface::closeTimestep(adaptInfo);
-
-    refinement->refine(2);
-  }
-
-  /// Set initial condition and perform initial refinement
-  virtual void solveInitialProblem(AdaptInfo *adaptInfo)
-  {
-    refFunction= new PhaseFieldRefinement(chProb->getMesh());
-    refinement= new RefinementLevelDOF(
-      chProb->getProblem(0)->getFeSpace(),
-      refFunction,
-      new PhaseDOFView<double>(chProb->getProblem(0)->getSolution()->getDOFVector(0)));
-
-    // initial refinement
-    refinement->refine(0);
-
-    // refine until interfaces is solved
-    for (int i = 0; i < 3; ++i) {
-      chProb->solveInitialProblem(adaptInfo);
-      refinement->refine((i < 4 ? 4 : 10));
-    }
-
-    CouplingTimeInterface::solveInitialProblem(adaptInfo);
-  }
-
-protected:
-
-  CahnHilliard *chProb;
-  PhaseFieldRefinement* refFunction;
-  RefinementLevelDOF *refinement;
-};
-
-
-int main(int argc, char** argv)
-{ FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  CahnHilliard chProb("ch");
-  chProb.initialize(INIT_ALL);
-
-  RefinementTimeInterface timeInterface(&chProb);
-
-  // Adapt-Infos
-  AdaptInfo adaptInfo("adapt", chProb.getNumComponents());
-  AdaptInstationary adaptInstat("adapt", chProb, adaptInfo, timeInterface, adaptInfo);
-
-  ptime start_time = microsec_clock::local_time();
-  timeInterface.initTimeInterface(); // fill operators and BC
-  int error_code = adaptInstat.adapt(); 
-  time_duration td = microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %d sec\n", td.total_seconds());
-
-  AMDiS::finalize();
-
-  return error_code;
-};
diff --git a/demo/src/chns/CahnHilliardNavierStokes.h b/demo/src/chns/CahnHilliardNavierStokes.h
deleted file mode 100644
index 0caa2e2b..00000000
--- a/demo/src/chns/CahnHilliardNavierStokes.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/** \file CahnHilliardNavierStokes.h */
-
-#ifndef CAHN_HILLIARD_NAVIER_STOKES_H
-#define CAHN_HILLIARD_NAVIER_STOKES_H
-
-// coupling structures
-#include "CouplingIterationInterface.h"
-#include "CouplingTimeInterface.h"
-#include "CouplingProblemStat.h"
-
-// structures for local refinement
-#include "Refinement.h"
-#include "MeshFunction_Level.h"
-
-#include "POperators.h"
-
-using namespace AMDiS;
-
-/**
-  * \ingroup Problem 
-  *
-  * \brief
-  */
-template<typename CH_Type = CahnHilliard,
-	 typename NS_Type = NavierStokes_TaylorHood>
-class CahnHilliardNavierStokes : public CouplingIterationInterface,
-                                 public CouplingTimeInterface,
-                                 public CouplingProblemStat
-{
-public:
-
-  CahnHilliardNavierStokes(std::string name_, CH_Type *chProb_, NS_Type *nsProb_)
-  : CouplingProblemStat(name_),
-    chProb(chProb_),
-    nsProb(nsProb_),
-    refFunction(NULL),
-    refinement(NULL),
-    sigma(0.0),
-    surfaceTension(0.0)
-  {
-    dow = Global::getGeo(WORLD);
-
-    Parameters::get(name + "->sigma", sigma);
-    surfaceTension = sigma/chProb->getEpsilon();
-  }
-
-
-  ~CahnHilliardNavierStokes() {
-    if (refFunction != NULL)
-      delete refFunction;
-    if (refinement != NULL)
-      delete refinement;
-  }
-
-
-  /**
-   * Add the problems to the iterationInterface, timeInterface and couplingProblemStat.
-   * As a consequence all problem can be initialized one after another and in the
-   * adaption loop they are solved in rotation.
-   * At the end the problems are filled with operators and coupling operators as well as
-   * boundary conditions are added.
-   *
-   * In the adaption loop the problems are solved the same order as they are added to the
-   * iterationInterface in this method. This order can be changed manually in the oneIteration
-   * method.
-   **/
-  void initialize(AdaptInfo *adaptInfo)
-  {
-    for (size_t i = 0; i < chProb->getNumProblems(); i++)
-      addProblem(chProb->getProblem(i));
-    for (size_t i = 0; i < nsProb->getNumProblems(); i++)
-      addProblem(nsProb->getProblem(i));
-    
-    addIterationInterface(chProb);
-    addIterationInterface(nsProb);
-
-    addTimeInterface(chProb);
-    addTimeInterface(nsProb);
-
-    CouplingProblemStat::initialize(INIT_ALL);
-    dim = getMesh()->getDim();
-
-    fillCouplingOperators();
-    // fillOperators and fillBoundaryConditions for chProb and nsProb
-    nsProb->initTimeInterface();
-    chProb->initTimeInterface();
-//     fillCouplingBoundaryConditions();
-  }
-
-
-  /**
-   * In this method the operators responsible for the coupling of all problems are defined
-   * and added to the problem. The access to the problems is through the baseBroblem->getProblem()
-   * method. All baseProblem provide FiniteElemSpaces and solution vectors.
-   **/
-  void fillCouplingOperators()
-  { FUNCNAME("CahnHilliardNavierStokes::fillCouplingOperators()");
-    MSG("CahnHilliardNavierStokes::fillCouplingOperators()");
-
-    for (size_t i = 0; i < dow; i++) {
-      // < nu * d_i(c) , theta >
-      Operator *opNuGradC = new Operator(nsProb->getFeSpace(i), chProb->getFeSpace(0));
-      opNuGradC->addTerm(new VecAndPartialDerivative_ZOT(chProb->getSolution()->getDOFVector(1), chProb->getSolution()->getDOFVector(0), i));
-      nsProb->getProblem(0)->addVectorOperator(opNuGradC, i, &surfaceTension, &surfaceTension);
-    }
-
-    // < v * grad(c) , theta >
-    Operator *opVGradC = new Operator(chProb->getFeSpace(0), chProb->getFeSpace(0));
-    opVGradC->addTerm(new WorldVector_FOT(nsProb->getVelocity(), -1.0), GRD_PSI);
-    chProb->getProblem()->addMatrixOperator(opVGradC, 0, 0);
-  }
-  
-
-  /**
-   * Solves the initial problems.Before this is done the mesh is refined by the Refinement-class
-   * This provides local refinement functions for phaseField-refinement or signed-distance-refinement.
-   * See MeshFunction_Level.h for some details.
-   **/ 
-  void solveInitialProblem(AdaptInfo *adaptInfo)
-  {
-    // meshFunction for klocal refinement around the interface of the phasefield-DOFVector
-    refFunction = new PhaseFieldRefinement(chProb->getMesh());
-
-    if (chProb->getDoubleWellType() == 0) {
-      refinement = new RefinementLevelDOF(
-	chProb->getFeSpace(),
-	refFunction,
-	chProb->getSolution()->getDOFVector(0)); // phaseField-DOFVector in [0,1]
-    } else {
-      refinement = new RefinementLevelDOF(
-	chProb->getFeSpace(),
-	refFunction,
-	new PhaseDOFView<double>(chProb->getSolution()->getDOFVector(0))); // phaseField-DOFVector in [-1,1]
-    }
-
-    // initial refinement
-    refinement->refine(0);
-
-    for (int i = 0; i < 3; i++) {
-      chProb->solveInitialProblem(adaptInfo); 	// update phaseField-DOFVector
-      refinement->refine((i < 4 ? 4 : 10));	// do k steps of local refinement
-    }
-
-    // solve all initial problems of the problems added to the CouplingTimeInterface
-    CouplingTimeInterface::solveInitialProblem(adaptInfo);
-  }
-
-
-  /**
-   * Called at the end of each timestep.
-   * If the phase-field has changed the mesh is updated by the refinement-method
-   **/
-  void closeTimestep(AdaptInfo *adaptInfo)
-  {
-    CouplingTimeInterface::closeTimestep(adaptInfo);
-
-    refinement->refine(2);
-  }
-
-protected:
-
-  CH_Type *chProb;	// CahnHilliard baseProblem
-  NS_Type *nsProb;	// Navier-Stokes baseProblem
-
-  PhaseFieldRefinement* refFunction;
-  RefinementLevelDOF *refinement;
-
-  unsigned dim;		// dimension of the mesh
-  unsigned dow;		// dimension of the world
-
-  double sigma;		// coupling parameter to calculate the surface tension
-  double surfaceTension;// := sigma/epsilon
-};
-
-#endif // CAHN_HILLIARD_NAVIER_STOKES_H
diff --git a/demo/src/chns/drivenCavity.cc b/demo/src/chns/drivenCavity.cc
deleted file mode 100644
index 8a70118f..00000000
--- a/demo/src/chns/drivenCavity.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "AMDiS.h"
-#include "CahnHilliard.h"
-#include "NavierStokes_TaylorHood.h"
-#include "CahnHilliardNavierStokes.h"
-#include "SignedDistFunctors.h"
-#include "PhaseFieldConvert.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-struct DrivenCavityBC : AbstractFunction<double, WorldVector<double> >
-{
-  double operator()(const WorldVector<double> &x) const {
-    return std::max(0.0, 1.0 - 4.0 * sqr(x[0] - 0.5));
-  }
-};
-
-
-class CH_DrivenCavity : public CahnHilliard
-{
-public:
-  CH_DrivenCavity(std::string name_) : CahnHilliard(name_) {}
-  
-protected:  
-  void fillBoundaryConditions()
-  { FUNCNAME("CH_DrivenCavity::fillBoundaryConditions()");
-    // homogeneouse neumann conditions
-  }
-};
-
-
-class NS_DrivenCavity : public NavierStokes_TaylorHood
-{
-public:
-  NS_DrivenCavity(std::string name_) : NavierStokes_TaylorHood(name_) {}
-  
-protected:
-  void fillBoundaryConditions()
-  { FUNCNAME("NS_DrivenCavity::fillBoundaryConditions()");
-    
-    DOFVector<double> *zeroDOF = new DOFVector<double>(getFeSpace(0), "zero");
-    zeroDOF->set(0.0);
-    size_t dow = Global::getGeo(WORLD);
-
-    /// at rigid wall: no-slip boundary condition
-    for (size_t i = 0; i < dow; i++)
-      getProblem(0)->addDirichletBC(1, i, i, zeroDOF);
-
-    /// at upper wall: prescribed velocity
-    getProblem(0)->addDirichletBC(2, 0, 0, new DrivenCavityBC);
-    getProblem(0)->addDirichletBC(2, 1, 1, zeroDOF);
-  }
-};
-
-
-int main(int argc, char** argv)
-{ FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  CH_DrivenCavity chProb("ch");
-  NS_DrivenCavity nsProb("ns");
-
-  CahnHilliardNavierStokes<CH_DrivenCavity,NS_DrivenCavity> mainProb("main", &chProb, &nsProb);
-
-  // Adapt-Infos
-  AdaptInfo adaptInfo("adapt", mainProb.getNumComponents());
-  mainProb.initialize(&adaptInfo);
-
-  // adaption loop - solve ch-prob and ns-prob
-  AdaptInstationary adaptInstat("adapt", mainProb, adaptInfo, mainProb, adaptInfo);
-
-  ptime start_time = microsec_clock::local_time();
-  int error_code = adaptInstat.adapt(); 
-  time_duration td = microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %d sec\n", td.total_seconds());
-
-  AMDiS::finalize();
-
-  return error_code;
-};
diff --git a/demo/src/elliptBaseProblem.cc b/demo/src/elliptBaseProblem.cc
deleted file mode 100644
index a5d5974e..00000000
--- a/demo/src/elliptBaseProblem.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-#include "AMDiS.h"
-#include "BaseProblem.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-// ===========================================================================
-// ===== function definitions ================================================
-// ===========================================================================
-
-/// Dirichlet boundary function
-class G : public AbstractFunction<double, WorldVector<double> >
-{
-public:
-
-  /// Implementation of AbstractFunction::operator().
-  double operator()(const WorldVector<double>& x) const 
-  {
-    return exp(-10.0 * (x * x));
-  }
-};
-
-/// RHS function
-class F : public AbstractFunction<double, WorldVector<double> >
-{
-public:
-
-  F(int degree) : AbstractFunction<double, WorldVector<double> >(degree) {}
-
-  /// Implementation of AbstractFunction::operator().
-  double operator()(const WorldVector<double>& x) const 
-  {
-    int dow = Global::getGeo(WORLD);
-    double r2 = (x * x);
-    double ux = exp(-10.0 * r2);
-    return -(400.0 * r2 - 20.0 * dow) * ux;
-  }
-};
-
-class ElliptBase : public StandardBaseProblem
-{
-public:
-  typedef StandardBaseProblem super;
-
-public:
-  ElliptBase(std::string name_) : super(name_) {}
-
-protected:
-  void fillOperators()
-  {
-    // ===== create matrix operator =====
-    Operator *matrixOperator = new Operator(getFeSpace());
-    matrixOperator->addTerm(new Simple_SOT);
-    prob->addMatrixOperator(matrixOperator, 0, 0);
-
-
-    // ===== create rhs operator =====
-    int degree = getFeSpace()->getBasisFcts()->getDegree();
-    Operator *rhsOperator = new Operator(getFeSpace());
-    rhsOperator->addTerm(new CoordsAtQP_ZOT(new F(degree)));
-    prob->addVectorOperator(rhsOperator, 0);
-  }
-
-  void fillBoundaryCondition()
-  {
-    // ===== add boundary conditions =====
-    prob->addDirichletBC(1, 0, 0, new G);
-  }
-};
-
-// ===========================================================================
-// ===== main program ========================================================
-// ===========================================================================
-
-int main(int argc, char* argv[])
-{
-  FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  // ===== create and init the scalar problem ===== 
-  ElliptBase ellipt("ellipt");
-  ellipt.initialize(INIT_ALL);
-
-
-  // === create adapt info ===
-  AdaptInfo adaptInfo("ellipt->adapt", ellipt.getNumComponents());
-
-
-  // === create adapt ===
-  AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
-
-
-  // ===== start adaption loop =====
-  ptime start_time= microsec_clock::local_time();
-  ellipt.initTimeInterface(); // fillOperators() and fillBoundaryCondition()
-  adapt.adapt();
-  time_duration td= microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %f msec\n", td.total_milliseconds()/1000.0);
-
-  ellipt.writeFiles(&adaptInfo, true);
-
-  AMDiS::finalize();
-}
diff --git a/demo/src/elliptImplicit.cc b/demo/src/elliptImplicit.cc
deleted file mode 100644
index 7f663217..00000000
--- a/demo/src/elliptImplicit.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "AMDiS.h"
-#include "SignedDistFunctors.h"
-#include "ExtendedProblemStat.h"
-#include "Refinement.h"
-#include "MeshFunction_Level.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-/**
- * solve poisson-equation in domain defined by signed-dist function, using
- * dirichlet boundary condition on the implicit boundary (zero level set of
- * signed-dist function) and an algebraic equation in the outer domain (sign
- * of the signed-dist function poisitive).
- **/
-
-
-// ===========================================================================
-// ===== function definitions ================================================
-// ===========================================================================
-
-/// Dirichlet boundary function
-class G : public AbstractFunction<double, WorldVector<double> >
-{
-public:
-
-  /// Implementation of AbstractFunction::operator().
-  double operator()(const WorldVector<double>& x) const 
-  {
-    return 0.0;
-  }
-};
-
-// ===========================================================================
-// ===== main program ========================================================
-// ===========================================================================
-
-int main(int argc, char* argv[])
-{
-  FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  // ===== create and init the scalar problem ===== 
-  ExtendedProblemStat ellipt("ellipt");
-  ellipt.initialize(INIT_ALL);
-
-
-  // === create adapt info ===
-  AdaptInfo adaptInfo("ellipt->adapt", ellipt.getNumComponents());
-
-  // === create adapt ===
-  AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
-
-  // ===== signedDist function that describes the geometry =====
-  AbstractFunction<double, WorldVector<double> > *signedDistFct = new InverseCircle(1.0);
-
-  // ===== refine mesh at interface =====
-  SignedDistRefinement refFunction(ellipt.getMesh());
-  RefinementLevelCoords2 refinement(
-    ellipt.getFeSpace(),
-    &refFunction,
-    signedDistFct);
-  refinement.refine(9);
-  
-  // ===== create matrix operator =====
-  Operator matrixOperator(ellipt.getFeSpace());
-  matrixOperator.addTerm(new Simple_SOT);
-  ellipt.addMatrixOperator(matrixOperator, 0, 0);
-
-  // ===== create rhs operator =====
-  Operator rhsOperator(ellipt.getFeSpace());
-  rhsOperator.addTerm(new Simple_ZOT(1.0));
-  ellipt.addVectorOperator(rhsOperator, 0);
-
-  // ===== add boundary conditions =====
-  DOFVector<double> G_dof(ellipt.getFeSpace(), "G");
-  G_dof.interpol(new G);
-
-  DOFVector<double> signedDist_dof(ellipt.getFeSpace(), "signedDist");
-  signedDist_dof.interpol(signedDistFct);
-  
-  ellipt.addImplicitDirichletBC(signedDist_dof, 0, 0, G_dof);
-
-  // ===== start adaption loop =====
-  ptime start_time= microsec_clock::local_time();
-  adapt.adapt();
-  time_duration td= microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %f msec\n", td.total_milliseconds()/1000.0);
-
-  ellipt.writeFiles(adaptInfo, true);
-
-  AMDiS::finalize();
-}
-
-
diff --git a/demo/src/linearElasticity.cc b/demo/src/linearElasticity.cc
deleted file mode 100644
index 56ce0f50..00000000
--- a/demo/src/linearElasticity.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "AMDiS.h"
-#include "LinearElasticityPhase.h"
-#include "navierStokes.h"
-#include "Refinement.h"
-#include "MeshFunction_Level.h"
-#include "PhaseFieldConvert.h"
-#include "Helpers.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-struct BoundaryStress : AbstractFunction<double, WorldVector<double> >
-{
-  BoundaryStress(int comp_, 
-		 WorldVector<double> center_, 
-		 AbstractFunction<double, WorldVector<double> >* phaseFct_, 
-		 double factor_)
-  : comp(comp_),
-    center(center_),
-    phaseFct(phaseFct_),
-    factor(factor_) {}
-   
-  double operator()(const WorldVector<double>& x) const
-  {
-    return factor*(x[comp]-center[comp])*(*phaseFct)(x);
-  }
-  
-private:
-  int comp;
-  WorldVector<double> center;
-  AbstractFunction<double, WorldVector<double> >* phaseFct;
-  double factor;
-};
-
-
-class ElasticityDemo : public LinearElasticityPhase
-{
-public:
-  typedef LinearElasticityPhase super;
-  
-public:
-  ElasticityDemo(std::string name_) : super(name_) {}
-  
-  void initData()
-  {
-    super::initData();
-    
-    phaseField = new DOFVector<double>(getFeSpace(0), "phase");
-    super::setPhase(phaseField);
-    
-    for (int i = 0; i < dow; i++) {
-      boundaryDOFs[i] = new DOFVector<double>(getFeSpace(i), "boundary" + Helpers::toString(i));
-    }
-  }
-  
-  void solveInitialProblem(AdaptInfo *adaptInfo) 
-  {
-    super::solveInitialProblem(adaptInfo);
-    
-    size_t nVertices = 0;
-    WorldVector<double> x;
-    Parameters::get("beam->num vertices",nVertices);
-    std::vector<WorldVector<double> > v(nVertices,x);
-    for (size_t i = 0; i < nVertices; i++)
-      Parameters::get("beam->vertex["+boost::lexical_cast<std::string>(i)+"]",v[i]);
-    v.push_back(v[0]);
-    
-    SignedDistRefinement refFunction(getMesh());
-    RefinementLevelCoords2 refinement(
-      getFeSpace(),
-      &refFunction,
-      new Polygon(v));
-
-    // initial refinement
-    refinement.refine(10);
-    
-    phaseField->interpol(new SignedDistFctToPhaseField(getEpsilon(), new Polygon(v), 3.0));
-    VtkWriter::writeFile(phaseField, "phaseField.vtu");
-    transformDOF(phaseField, 1.e-5, phaseField, new AMDiS::Max<double>);
-    
-    
-    nVertices = 0;
-    Parameters::get("boundary->num vertices",nVertices);
-    std::vector<WorldVector<double> > v2(nVertices,x);
-    for (size_t i = 0; i < nVertices; i++)
-      Parameters::get("boundary->vertex["+boost::lexical_cast<std::string>(i)+"]",v2[i]);
-    v2.push_back(v2[0]);
-    
-    DOFVector<double> boundaryPhase(getFeSpace(0), "boundaryPhase");
-    boundaryPhase.interpol(new SignedDistFctToPhaseField(getEpsilon(), new Polygon(v2), 3.0));
-    VtkWriter::writeFile(&boundaryPhase, "boundaryPhase.vtu");
-    
-    WorldVector<double> center; center.set(0.5);
-    Parameters::get("beam->center", center);
-    double factor = 1.0;
-    Parameters::get("boundary->factor", factor);
-    boundaryDOFs[0]->interpol(new BoundaryStress(1, center, new SignedDistFctToPhaseField(getEpsilon(), new Polygon(v2), 3.0), factor));
-    boundaryDOFs[1]->interpol(new BoundaryStress(0, center, new SignedDistFctToPhaseField(getEpsilon(), new Polygon(v2), -3.0), factor));
-    VtkWriter::writeFile(boundaryDOFs[0], "boundaryDOF0.vtu");
-  }
-
-protected:
-  void fillBoundaryConditions()
-  { FUNCNAME("NS_DrivenCavity::fillBoundaryConditions()");
-  
-    for (int i = 0; i < dow; i++)
-      super::setBcDOF(boundaryDOFs[i],i);
-    
-    super::fillBoundaryConditions();
-  
-    WorldVector<double> center; center.set(0.5);
-    Parameters::get("beam->center", center);
-    AbstractFunction<double, WorldVector<double> > *zero = new AMDiS::Const<double, WorldVector<double> >(0.0);
-    prob->addSingularDirichletBC(center, 1, 1, *zero);
-    
-  }
-  
-  DOFVector<double>* phaseField;
-  WorldVector<DOFVector<double>*> boundaryDOFs;
-};
-
-int main(int argc, char** argv)
-{ FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  ElasticityDemo elastProb("elasticity");
-  elastProb.initialize(INIT_ALL);
-
-  // Adapt-Infos
-  AdaptInfo adaptInfo("adapt", elastProb.getNumComponents());
-
-  // adaption loop
-  AdaptInstationary adaptInstat("adapt", elastProb, adaptInfo, elastProb, adaptInfo);
-
-  ptime start_time = microsec_clock::local_time();
-  elastProb.initTimeInterface();
-  int error_code = adaptInstat.adapt(); 
-  time_duration td = microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %d sec\n", td.total_seconds());
-
-  AMDiS::finalize();
-
-  return error_code;
-};
diff --git a/demo/src/navierStokes.cc b/demo/src/navierStokes.cc
deleted file mode 100644
index 867e9cd1..00000000
--- a/demo/src/navierStokes.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "AMDiS.h"
-#include "NavierStokes_TaylorHood_RB.h"
-#include "navierStokes.h"
-#include "time/ExtendedRosenbrockAdaptInstationary.h"
-#include "Refinement.h"
-#include "MeshFunction_Level.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-
-
-class NS_Channel : public NavierStokes_TaylorHood_RB
-{
-public:
-  NS_Channel(std::string name_) : NavierStokes_TaylorHood_RB(name_) {}
-
-  void solveInitialProblem(AdaptInfo *adaptInfo)
-  {
-    super::solveInitialProblem(adaptInfo);
-
-    size_t nVertices = 0;
-    WorldVector<double> x;
-    Parameters::get("obstacle->num vertices",nVertices);
-    std::vector<WorldVector<double> > v(nVertices,x);
-    for (size_t i = 0; i < nVertices; i++)
-      Parameters::get("obstacle->vertex["+boost::lexical_cast<std::string>(i)+"]",v[i]);
-    v.push_back(v[0]);
-
-    SignedDistRefinement refFunction(getMesh());
-    RefinementLevelCoords2 refinement(
-      getFeSpace(),
-      &refFunction,
-      new Polygon(v));
-
-    // initial refinement
-    refinement.refine(10);
-  }
-protected:
-  void fillBoundaryConditions()
-  { FUNCNAME("NS_DrivenCavity::fillBoundaryConditions()");
-    
-    AbstractFunction<double, WorldVector<double> > *zero = new AMDiS::Const<double, WorldVector<double> >(0.0);
-    size_t dow = Global::getGeo(WORLD);
-
-    // +------ 5 ------+
-    // |               |
-    // 2   # <--1      3
-    // |               |
-    // +------ 4 ------+
-
-
-//     x[0] = 2.0;
-//     x[1] = 2.0;
-#if DEBUG != 0
-  DOFVector<double>* polygon = new DOFVector<double>(getFeSpace(0), "polygon");
-  polygon->interpol(new Polygon(v));
-  VtkWriter::writeFile(polygon, "polygon.vtu");
-#endif
-    
-    /// at rigid wall: no-slip boundary condition
-    for (size_t i = 0; i < dow; i++) {
-//       getProblem(0)->addImplicitDirichletBC(*(new Polygon(v)), i, i, *zero);
-//       getProblem(0)->addSingularDirichletBC(x, i, i, *zero);
-      getProblem(0)->addDirichletBC(1, i, i, zero);
-      getProblem(0)->addDirichletBC(4, i, i, zero);
-      getProblem(0)->addDirichletBC(5, i, i, zero);
-    }
-
-    double H = 4.1;
-    double Um = 1.5;
-    Parameters::get("mesh->H",H);
-    Parameters::get("ns->Um",Um);
-
-    /// at left wall: prescribed velocity
-    getProblem(0)->addDirichletBC(2, 0, 0, new InflowBC(H,Um));
-    getProblem(0)->addDirichletBC(2, 1, 1, zero);
-  }
-};
-
-
-int main(int argc, char** argv)
-{ FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  NS_Channel nsProb("ns");
-  nsProb.initialize(INIT_ALL | INIT_EXACT_SOLUTION);
-
-  // Adapt-Infos
-  AdaptInfo adaptInfo("adapt", nsProb.getNumComponents());
-
-  // adaption loop - solve ch-prob and ns-prob
-//   AdaptInstationary adaptInstat("adapt", nsProb, adaptInfo, nsProb, adaptInfo);
-  ExtendedRosenbrockAdaptInstationary<NS_Channel> adaptInstat("adapt", nsProb, adaptInfo, nsProb, adaptInfo);
-
-  ptime start_time = microsec_clock::local_time();
-  nsProb.initTimeInterface();
-  int error_code = adaptInstat.adapt(); 
-  time_duration td = microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %d sec\n", td.total_seconds());
-
-  AMDiS::finalize();
-
-  return error_code;
-};
diff --git a/demo/src/pfc.cc b/demo/src/pfc.cc
deleted file mode 100644
index 74cfeaee..00000000
--- a/demo/src/pfc.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-#include "AMDiS.h"
-#include "PhaseFieldCrystal_Base.h"
-#include "Helpers.h"
-#include "getMaxima.h"
-
-#include "boost/date_time/posix_time/posix_time.hpp"
-
-using namespace AMDiS;
-using namespace boost::posix_time;
-
-/// Functor that gives random values for each coordinate argument
-struct RandomValues : public AbstractFunction<double, WorldVector<double> >
-{
-  RandomValues(double mean_, double amplitude_) : mean(mean_), amplitude(amplitude_)
-  {
-    std::srand(time(NULL));
-  }
-  
-  double operator()(const WorldVector<double> &x) const
-  {
-    return mean + amplitude * (std::rand() / static_cast<double>(RAND_MAX-0.5));
-  }
-  
-private:
-  double mean;
-  double amplitude;
-};
-
-/// derived class from BaseProblem->PhaseFieldCrystal
-struct PFC_Demo : public PhaseFieldCrystal
-{
-  PFC_Demo(const std::string &name_) : PhaseFieldCrystal(name_) {}
-
-  // generate initial solution for evolution equation
-  void solveInitialProblem(AdaptInfo *adaptInfo)
-  { FUNCNAME("PFC_Demo::solveInitialProblem()");
-
-    Flag initFlag = initDataFromFile(adaptInfo);
-    if (initFlag.isSet(DATA_ADOPTED))
-      return;
-
-    double amplitude = 0.1;
-    Parameters::get(name + "->density amplitude",amplitude);
-
-    // random data
-    prob->getSolution()->getDOFVector(0)->interpol(new RandomValues(density, amplitude));
-    
-    
-    std::cout << "Number of degrees of freedom: "
-	      << prob->getSolution()->getDOFVector(0)->getUsedSize()
-	      << std::endl;
-  }
-
-  // add periodic boundary condition on all boundaries
-  void fillBoundaryConditions()
-  {
-//     for (size_t i = 0; i < prob->getNumComponents(); i++) {
-//     for (size_t j = 0; j < prob->getNumComponents(); j++) {
-//       prob->addPeriodicBC(-1, i, j);
-//       prob->addPeriodicBC(-2, i, j);
-//     }
-//     }
-  }
-};
-
-
-int main(int argc, char** argv)
-{ FUNCNAME("main");
-
-  AMDiS::init(argc, argv);
-
-  PFC_Demo pfcProb("pfc");
-  pfcProb.initialize(INIT_ALL);
-
-  // Adapt-Infos
-  AdaptInfo adaptInfo("adapt", pfcProb.getNumComponents());
-  // adaption loop - solve problems up to stationary solution
-  AdaptInstationary adaptInstat("adapt", pfcProb, adaptInfo, pfcProb, adaptInfo);
-
-  // Scale Mesh
-  bool scaleMesh = false;
-  Initfile::get("mesh->scale mesh",scaleMesh);
-  if (scaleMesh) {
-    WorldVector<double> scale; scale.set(1.0);
-    Initfile::get("mesh->dimension",scale);
-    Helpers::scaleMesh(pfcProb.getMesh(), scale);
-  }
-
-  ptime start_time = microsec_clock::local_time();
-  pfcProb.initTimeInterface(); // fill operators and BC
-  int error_code = adaptInstat.adapt(); 
-  time_duration td = microsec_clock::local_time()-start_time;
-
-  MSG("elapsed time= %d sec\n", td.total_seconds());
-
-  // calc maxima
-  getMaxima(&adaptInfo, pfcProb.getProblem(), "output");
-
-  AMDiS::finalize();
-
-  return error_code;
-};
diff --git a/demo/src/torus.cc b/demo/src/torus.cc
index 9bb74be0..5222133a 100644
--- a/demo/src/torus.cc
+++ b/demo/src/torus.cc
@@ -142,7 +142,7 @@ int main(int argc, char* argv[])
   const FiniteElemSpace *feSpace = torus.getFeSpace();
   const BasisFunction *basFcts = feSpace->getBasisFcts();
   int numBasFcts = basFcts->getNumber();
-  DegreeOfFreedom *localIndices = new DegreeOfFreedom[numBasFcts];
+  std::vector<DegreeOfFreedom> localIndices(numBasFcts);
   DOFAdmin *admin = feSpace->getAdmin();
  
   WorldVector<DOFVector<double>*> parametricCoords;
@@ -205,8 +205,6 @@ int main(int argc, char* argv[])
   for (int i = 0; i < dow; i++)
     delete parametricCoords[i];
 
-  delete [] localIndices;
-
   AMDiS::finalize();
 }
 
-- 
GitLab