diff --git a/AMDiS/src/DOFIndexed.h b/AMDiS/src/DOFIndexed.h
index 4a209e4adc74b32d9d9ad5ece2683ea516875087..26e4e9a925f30974ee98b6f10a78633758fa8923 100644
--- a/AMDiS/src/DOFIndexed.h
+++ b/AMDiS/src/DOFIndexed.h
@@ -22,6 +22,7 @@
 #ifndef AMDIS_DOFINDEXED_H
 #define AMDIS_DOFINDEXED_H
 
+#include <cassert>
 #include <vector>
 #include "Global.h"
 #include "DOFIterator.h"
@@ -46,6 +47,14 @@ namespace AMDiS {
     /// Resizes the object to size. Must be overriden by sub classes
     virtual void resize(int size) = 0;
 
+    /// Check that object's size is equal to \p size or 0.  If object's size is 0 change it to \p size.
+    virtual void checked_change_dim(int size)
+    {
+	assert(getSize() == 0 || getSize() == size); 
+	if (getSize() == 0)
+	    resize(size);
+    }
+
     /// Used by DOFAdmin::compress. Must be overriden by sub classes
     virtual void compressDOFIndexed(int first, int last, 
 				    std::vector<DegreeOfFreedom> &newDOF) = 0;