From 3a7156a4f76ff4f5648b6b407cc2841fd55e9122 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Mon, 25 May 2009 11:41:20 +0000
Subject: [PATCH] Adapted demos to new AMDiS (DELETE/delete and dirichlet
 boundary conditions).

---
 demo/src/couple.cc |  2 --
 demo/src/torus.cc  | 31 ++++++++++++++-----------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/demo/src/couple.cc b/demo/src/couple.cc
index 9556ad72..68be9f3c 100644
--- a/demo/src/couple.cc
+++ b/demo/src/couple.cc
@@ -107,8 +107,6 @@ private:
 class Identity : public AbstractFunction<double, double>
 {
 public:
-  MEMORY_MANAGED(Identity);
-
   Identity(int degree) : AbstractFunction<double, double>(degree) {}
 
   double operator()(const double& x) const 
diff --git a/demo/src/torus.cc b/demo/src/torus.cc
index 580fb7ef..739152ef 100644
--- a/demo/src/torus.cc
+++ b/demo/src/torus.cc
@@ -142,7 +142,6 @@ int main(int argc, char* argv[])
 
 
   double rotation = M_PI/3.0;
-  int i, j;
   int dim = torus.getMesh()->getDim();
   int dow = Global::getGeo(WORLD);
 
@@ -152,30 +151,28 @@ int main(int argc, char* argv[])
   const FiniteElemSpace *feSpace = torus.getFESpace();
   const BasisFunction *basFcts = feSpace->getBasisFcts();
   int numBasFcts = basFcts->getNumber();
-  DegreeOfFreedom *localIndices = GET_MEMORY(DegreeOfFreedom, numBasFcts);
+  DegreeOfFreedom *localIndices = new DegreeOfFreedom[numBasFcts];
   DOFAdmin *admin = feSpace->getAdmin();
  
   WorldVector<DOFVector<double>*> parametricCoords;
-  for(i = 0; i < dow; i++) {
-    parametricCoords[i] = new DOFVector<double>(feSpace, 
-						"parametric coords");
-  }
+  for (int i = 0; i < dow; i++)
+    parametricCoords[i] = new DOFVector<double>(feSpace, "parametric coords");
 
   std::map<DegreeOfFreedom, bool> visited;
 
   TraverseStack stack;
   ElInfo *elInfo = stack.traverseFirst(torus.getMesh(), -1, 
 				       Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
-  while(elInfo) {
+  while (elInfo) {
     basFcts->getLocalIndices(elInfo->getElement(), admin, localIndices);
-    for(i = 0; i < dim + 1; i++) {
+    for (int i = 0; i < dim + 1; i++) {
       dof = localIndices[i];
       x = elInfo->getCoord(i);
       YRotation::rotate(x, rotation);
-      if(!visited[dof]) {
-	for(j = 0; j < dow; j++) {
+      if (!visited[dof]) {
+	for (int j = 0; j < dow; j++)
 	  (*(parametricCoords[j]))[dof] = x[j];
-	}
+
 	visited[dof] = true;
       }
     }
@@ -192,16 +189,16 @@ int main(int argc, char* argv[])
   visited.clear();
   elInfo = stack.traverseFirst(torus.getMesh(), -1, 
 			       Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
-  while(elInfo) {
+  while (elInfo) {
     basFcts->getLocalIndices(elInfo->getElement(), admin, localIndices);
-    for(i = 0; i < dim + 1; i++) {
+    for (int i = 0; i < dim + 1; i++) {
       dof = localIndices[i];
       x = elInfo->getCoord(i);
       YRotation::rotate(x, rotation);
-      if(!visited[dof]) {
-	for(j = 0; j < dow; j++) {
+      if (!visited[dof]) {
+	for (int j = 0; j < dow; j++)
 	  (*(parametricCoords[j]))[dof] = x[j];
-	}
+
 	visited[dof] = true;
       }
     }
@@ -214,7 +211,7 @@ int main(int argc, char* argv[])
 
   for(i = 0; i < dow; i++)
     delete parametricCoords[i];
-  FREE_MEMORY(localIndices, DegreeOfFreedom, numBasFcts);
+  delete [] localIndices;
 }
 
 
-- 
GitLab