From d27ffdee9a745f3e9d60824844b1480a97546f9b Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Tue, 23 Jun 2009 10:52:52 +0000
Subject: [PATCH] TimeObject added.

---
 AMDiS/src/AMDiS.h       |  1 +
 AMDiS/src/DOFMatrix.h   | 27 ++++++++++++++----
 AMDiS/src/PeriodicBC.cc | 17 +++++++----
 AMDiS/src/TimedObject.h | 63 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 97 insertions(+), 11 deletions(-)
 create mode 100644 AMDiS/src/TimedObject.h

diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h
index 633961e1..5d76e3ee 100644
--- a/AMDiS/src/AMDiS.h
+++ b/AMDiS/src/AMDiS.h
@@ -84,6 +84,7 @@
 #include "SystemVector.h"
 #include "TecPlotWriter.h"
 #include "Tetrahedron.h"
+#include "TimedObject.h"
 #include "Traverse.h"
 #include "Triangle.h"
 #include "ValueWriter.h"
diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h
index a2a11428..0515b6b2 100644
--- a/AMDiS/src/DOFMatrix.h
+++ b/AMDiS/src/DOFMatrix.h
@@ -32,7 +32,6 @@
 #include "Flag.h"
 #include "RCNeighbourList.h"
 #include "DOFAdmin.h"
-#include "DOFIterator.h"
 #include "DOFIndexed.h"
 #include "Boundary.h"
 #include "Serializable.h"
@@ -99,12 +98,30 @@ namespace AMDiS {
     }
 
     // Only to get rid of the abstract functions, I hope they are not used
-    std::vector<bool>::iterator begin() {ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; return v.begin();}
-    std::vector<bool>::iterator end() {ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; return v.end();}
+    std::vector<bool>::iterator begin() 
+    {
+      ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; 
+      return v.begin();
+    }
+    
+    std::vector<bool>::iterator end() 
+    {
+      ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; 
+      return v.end();
+    }
     
     bool dummy; // Must be deleted later
-    bool& operator[](int i) {ERROR_EXIT("Shouldn't be used, only fake."); return dummy;}
-    const bool& operator[](int i) const {ERROR_EXIT("Shouldn't be used, only fake."); return dummy;}
+    bool& operator[](int i) 
+    {
+      ERROR_EXIT("Shouldn't be used, only fake."); 
+      return dummy;
+    }
+
+    const bool& operator[](int i) const 
+    {
+      ERROR_EXIT("Shouldn't be used, only fake."); 
+      return dummy;
+    }
  
     /// DOFMatrix does not need to be compressed before assembling, when using MTL4.
     void compressDOFIndexed(int first, int last, std::vector<DegreeOfFreedom> &newDOF) {}
diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc
index 65b49e67..f63282ef 100644
--- a/AMDiS/src/PeriodicBC.cc
+++ b/AMDiS/src/PeriodicBC.cc
@@ -205,15 +205,20 @@ namespace AMDiS {
       masterMatrix_ = NULL;
     }
 
+    matrix->print();
+
     using namespace mtl;
 
-    std::cout << "ASSOC = " << std::endl;
-    for (int i = 0; i < 10; i++) 
-      std::cout << i << " = " << (*associated)[i] << std::endl;
+    DOFAdmin* admin = rowFESpace->getAdmin();
+    std::vector<int> dofMap(admin->getUsedSize());
+    for (int i = 0; i < admin->getUsedSize(); i++) {
+      dofMap[i] = (*associated)[i];
+      std::cout << "map " << i << " to " << dofMap[i] << std::endl;
+    }
 
     // Compute reorder matrix (newRow and newCol yields transposed!!!)
-    matrix::traits::reorder<>::type       R= matrix::reorder(*associated);
-    DOFMatrix::base_matrix_type           &A= matrix->getBaseMatrix(), B, D, E, TR;
+    matrix::traits::reorder<>::type R= matrix::reorder(dofMap);
+    DOFMatrix::base_matrix_type &A= matrix->getBaseMatrix(), B, D, E, TR;
 
     A*= 0.5;
     // Half of entries with decreased row index + half of the strict lower origing
@@ -225,7 +230,7 @@ namespace AMDiS {
     D= bands(TR, 0, 1);
     E= A * strict_lower(R) + lower(A);
     B+= D * E;
-    swap(A, B);   
+    swap(A, B);  
   }
 
   void PeriodicBC::exitVector(DOFVectorBase<double>* vector)
diff --git a/AMDiS/src/TimedObject.h b/AMDiS/src/TimedObject.h
new file mode 100644
index 00000000..df73b4f4
--- /dev/null
+++ b/AMDiS/src/TimedObject.h
@@ -0,0 +1,63 @@
+// ============================================================================
+// ==                                                                        ==
+// == AMDiS - Adaptive multidimensional simulations                          ==
+// ==                                                                        ==
+// ============================================================================
+// ==                                                                        ==
+// ==  crystal growth group                                                  ==
+// ==                                                                        ==
+// ==  Stiftung caesar                                                       ==
+// ==  Ludwig-Erhard-Allee 2                                                 ==
+// ==  53175 Bonn                                                            ==
+// ==  germany                                                               ==
+// ==                                                                        ==
+// ============================================================================
+// ==                                                                        ==
+// ==  http://www.caesar.de/cg/AMDiS                                         ==
+// ==                                                                        ==
+// ============================================================================
+
+/** \file TimedObject.h */
+
+#ifndef AMDIS_TIMEDOBJECT_H
+#define AMDIS_TIMEDOBJECT_H
+
+namespace AMDiS {
+
+  // ===========================================================================
+  // ===== class TimedObject ===================================================
+  // ===========================================================================
+
+  /** \brief
+   * This class can be used as base class for time dependent objects where
+   * different objects refer to the same time. Herefore a pointer to
+   * a double value is stored, pointing to a time value, which can be
+   * managed in one central object, maybe the problem class.
+   */
+  class TimedObject
+  {
+  public:
+    /** \brief
+     * Constructor.
+     */
+    TimedObject() : timePtr(NULL) {};
+
+    /** \brief
+     * Sets the time pointer.
+     */
+    inline void setTimePtr(double *timePtr_) { timePtr = timePtr_; };
+
+    /** \brief
+     * Returns the time pointer.
+     */
+    inline double *getTimePtr() { return timePtr; };
+  protected:
+    /** \brief
+     * Pointer to the externally managed time value.
+     */
+    double *timePtr;
+  };
+
+}
+
+#endif // AMDIS_TIMEDOBJECT_H
-- 
GitLab