From 16e8fce8c35b4d7e10989c8fb45fff143b1d03a5 Mon Sep 17 00:00:00 2001
From: Mario Ohlberger <mario@dune-project.org>
Date: Wed, 30 Mar 2005 12:50:21 +0000
Subject: [PATCH] Addapted files to new grid interface.

[[Imported from SVN: r1776]]
---
 fem/common/localoperator.hh |  2 ++
 fem/discretefeopimp.hh      | 35 +++++++++++++++++------------------
 fem/feop.hh                 | 31 +++++++++++++++++--------------
 3 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/fem/common/localoperator.hh b/fem/common/localoperator.hh
index dd19dd66f..0624809ea 100644
--- a/fem/common/localoperator.hh
+++ b/fem/common/localoperator.hh
@@ -3,6 +3,8 @@
 #ifndef __DUNE_LOCALOPERATORS_HH__
 #define __DUNE_LOCALOPERATORS_HH__
 
+#include "objpointer.hh"
+
 namespace Dune
 {
 
diff --git a/fem/discretefeopimp.hh b/fem/discretefeopimp.hh
index 204d41863..ab599193b 100644
--- a/fem/discretefeopimp.hh
+++ b/fem/discretefeopimp.hh
@@ -29,25 +29,24 @@ namespace Dune {
   /** \brief Base class for discrete finite element operators
    * Base class for local operators in a finite elment discretization
    */
-  template <class DiscreteFunctionType, class LocalOperatorImp >
+
+  template <class LocalOperatorImp, class DFDomainType, class DFRangeType = DFDomainType >
   class DiscreteFEOp
-    : public DiscreteOperatorDefault <DiscreteFunctionType, DiscreteFunctionType >
+    : public DiscreteOperatorDefault < LocalOperatorImp , DFDomainType, DFRangeType , DiscreteFEOp >
   {
-    typedef typename DiscreteFunctionType::FunctionSpaceType::
-    RangeField RangeFieldType;
-    typedef DiscreteFEOp<DiscreteFunctionType,LocalOperatorImp> MyType;
+
 
     typedef ScaledLocalOperator < LocalOperatorImp,
-        typename  DiscreteFunctionType::RangeFieldType > ScalOperatorType;
-    typedef DiscreteFEOp<DiscreteFunctionType,ScalOperatorType> ScalDiscrType;
+        typename  DFDomainType::RangeFieldType > ScalOperatorType;
+    typedef DiscreteFEOp<ScalOperatorType, DFDomainType> ScalDiscrType;
+
 
-    typedef DiscreteOperatorDefault <DiscreteFunctionType, DiscreteFunctionType >
-    DiscOpDefType;
+    typedef typename DFDomainType::FunctionSpaceType::RangeField RangeFieldType;
 
-    typedef typename DiscOpDefType::DomainType DomainType;
-    typedef typename DiscOpDefType::RangeType RangeType;
-    typedef typename DiscOpDefType::DomainFieldType DFieldType;
-    typedef typename DiscOpDefType::RangeFieldType RFieldType;
+    typedef typename DFDomainType::DomainType DomainType;
+    typedef typename DFDomainType::RangeType RangeType;
+    typedef typename DFDomainType::DomainFieldType DFieldType;
+    typedef typename DFDomainType::RangeFieldType RFieldType;
 
     //! remember what type this class has
     typedef Mapping<DFieldType,RFieldType,DomainType,RangeType> MappingType;
@@ -68,16 +67,16 @@ namespace Dune {
        called are deleted too.
      */
     template <class LocalOperatorType>
-    DiscreteFEOp<DiscreteFunctionType,
+    DiscreteFEOp<DFDomainType,
         CombinedLocalOperator<LocalOperatorImp,LocalOperatorType> > &
-    operator + (const DiscreteFEOp<DiscreteFunctionType,LocalOperatorType> &op)
+    operator + (const DiscreteFEOp<DFDomainType,LocalOperatorType> &op)
     {
-      typedef DiscreteFEOp<DiscreteFunctionType,LocalOperatorType> CopyType;
+      typedef DiscreteFEOp<DFDomainType,LocalOperatorType> CopyType;
       typedef CombinedLocalOperator <LocalOperatorImp,LocalOperatorType> COType;
 
       COType *locOp =
         new COType ( localOp_ , const_cast<CopyType &> (op).getLocalOp ());
-      typedef DiscreteFEOp< DiscreteFunctionType , COType > OPType;
+      typedef DiscreteFEOp< DFDomainType , COType > OPType;
 
       OPType *discrOp = new OPType ( *locOp, leaf_, printMsg_ );
 
@@ -131,7 +130,7 @@ namespace Dune {
       }
 
       // useful typedefs
-      typedef typename DiscreteFunctionType::FunctionSpace FunctionSpaceType;
+      typedef typename DFDomainType::FunctionSpace FunctionSpaceType;
       typedef typename FunctionSpaceType::GridType GridType;
       // the corresponding grid
       FunctionSpaceType & functionSpace_= dest.getFunctionSpace();
diff --git a/fem/feop.hh b/fem/feop.hh
index 3ed6a9e78..b86a3fff4 100644
--- a/fem/feop.hh
+++ b/fem/feop.hh
@@ -3,6 +3,8 @@
 #ifndef __DUNE_FEOPERATOR_HH__
 #define __DUNE_FEOPERATOR_HH__
 
+#include <dune/common/operator.hh>
+#include <dune/common/fmatrix.hh>
 #include <dune/fem/common/localoperator.hh>
 #include <dune/fem/feop/spmatrix.hh>
 
@@ -46,7 +48,8 @@ namespace Dune {
                public LocalOperatorDefault <DiscFunctionType,DiscFunctionType, typename
                    DiscFunctionType::RangeFieldType , FEOpImp  >
   {
-    typedef typename SparseRowMatrix<double> MatrixType;
+
+    typedef SparseRowMatrix<double> MatrixType;
 
   public:
     enum OpMode { ON_THE_FLY, ASSEMBLED };
@@ -103,7 +106,7 @@ namespace Dune {
       arg_  = &Arg.argument();
       dest_ = &Dest.destination();
       assert(arg_ != NULL); assert(dest_ != NULL);
-      dest.clear();
+      dest_.clear();
     };
 
     //! set argument and dest to NULL
@@ -143,7 +146,7 @@ namespace Dune {
       int numOfBaseFct = baseSet.getNumberOfBaseFunctions();
       enum {maxnumOfBaseFct = 10};
 
-      Mat<maxnumOfBaseFct,maxnumOfBaseFct , double> mat;
+      FieldMatrix<double, maxnumOfBaseFct, maxnumOfBaseFct> mat;
 
       getLocalMatrix( en, numOfBaseFct, mat);
 
@@ -158,7 +161,7 @@ namespace Dune {
 
             // scalar comes from LocalOperatorDefault, if operator is scaled,
             // i.e. with timestepsize
-            dest_it[ row ] += arg_it[ col ] * mat(i,j);
+            dest_it[ row ] += arg_it[ col ] * mat[i][j];
           }
         }
       }
@@ -173,7 +176,7 @@ namespace Dune {
 
             // scalar comes from LocalOperatorDefault, if operator is scaled,
             // i.e. with timestepsize
-            double val = (this->scalar_) * mat(i, j );
+            double val = (this->scalar_) * mat[i][j];
 
             dest_it[ row ] += arg_it[ col ] * val;
           }
@@ -211,11 +214,11 @@ namespace Dune {
 
         if(nit.boundary())
         {
-          BoundaryEntityType & bEl = nit.boundaryEntity();
+          const BoundaryEntityType & bEl = nit.boundaryEntity();
 
           if( functionSpace_.boundaryType( bEl.id() ) == Dirichlet )
           {
-            int neigh = nit.number_in_self();
+            int neigh = nit.numberInSelf();
 
             if(en.geometry().type() == triangle)
             {
@@ -287,9 +290,9 @@ namespace Dune {
     {
       typedef typename DiscFunctionType::FunctionSpaceType::GridType GridType;
       enum { dim = GridType::dimension };
-      return new MatrixType( this->functionSpace_.size ( this->functionSpace_.getGrid().maxlevel() ) ,
-                             this->functionSpace_.size ( this->functionSpace_.getGrid().maxlevel() ) ,
-                             15 * (dim-1) , 0.0 );
+      return new MatrixType( this->functionSpace_.size ( ) ,
+                             this->functionSpace_.size ( ) ,
+                             15 * (dim-1));
     };
 
     //! \todo Please doc me!
@@ -309,7 +312,7 @@ namespace Dune {
       {
         enum {maxnumOfBaseFct = 10};
 
-        Mat<maxnumOfBaseFct,maxnumOfBaseFct , double> mat;
+        FieldMatrix<double, maxnumOfBaseFct, maxnumOfBaseFct> mat;
 
         if (leaf_) {
           LeafIterator it = grid.leafbegin( grid.maxlevel() );
@@ -361,7 +364,7 @@ namespace Dune {
           for (int j=0; j<numOfBaseFct; j++ )
           {
             int col = functionSpace_.mapToGlobal( *it , j );
-            matrix_->add( row , col , mat(i,j));
+            matrix_->add( row , col , mat[i][j]);
           }
         }
       }
@@ -388,11 +391,11 @@ namespace Dune {
 
           if(nit.boundary())
           {
-            BoundaryEntityType & bEl = nit.boundaryEntity();
+            const BoundaryEntityType & bEl = nit.boundaryEntity();
 
             if( functionSpace_.boundaryType (bEl.id()) == Dirichlet )
             {
-              int neigh = nit.number_in_self();
+              int neigh = nit.numberInSelf();
 
               if((*it).geometry().type() == triangle)
               {
-- 
GitLab