]> https://gitweb.dealii.org/ - dealii.git/commitdiff
constraints used in Residual
authorBaerbel Jannsen <baerbel.janssen@gmail.com>
Mon, 22 Mar 2010 18:46:03 +0000 (18:46 +0000)
committerBaerbel Jannsen <baerbel.janssen@gmail.com>
Mon, 22 Mar 2010 18:46:03 +0000 (18:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@20881 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/mesh_worker_assembler.h

index cfbe78e1a677c0868d0c4500a90365ef8403cb93..abd9c729e118789baeea3dc0c6333f2573579ced 100644 (file)
@@ -340,6 +340,10 @@ namespace MeshWorker
                                          */
        void initialize(const BlockInfo* block_info,
                        NamedData<VECTOR*>& residuals);
+                                        /**
+                                         * Initialize the constraints. 
+                                         */
+        void initialize(const ConstraintMatrix& constraints);
                                         /**
                                          * Initialize the local data
                                          * in the
@@ -396,6 +400,10 @@ namespace MeshWorker
        * A pointer to the object containing the block structure.
        */
       SmartPointer<const BlockInfo> block_info;
+      /**
+       * A pointer to the object containing constraints.
+       */
+      SmartPointer<const ConstraintMatrix, VECTOR> constraints;
    };
 
 
@@ -1154,6 +1162,14 @@ namespace MeshWorker
       residuals = m;      
     }
 
+    template <class VECTOR>
+    inline void
+    ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(
+      const ConstraintMatrix& c)
+    {
+      constraints = &c;
+    }
+
 
     template <class VECTOR>
     template <int dim>
@@ -1171,6 +1187,8 @@ namespace MeshWorker
       const BlockVector<double>& local,
       const std::vector<unsigned int>& dof)
     {
+        if(constraints == 0)
+        {
       for (unsigned int b=0;b<local.n_blocks();++b)
        for (unsigned int j=0;j<local.block(b).size();++j)
          {
@@ -1185,6 +1203,9 @@ namespace MeshWorker
            const unsigned int jcell = this->block_info->local().local_to_global(b, j);
            global(dof[jcell]) += local.block(b)(j);
          }
+        }
+        else
+          constraints->distribute_local_to_global(local, dof, global);
     }
 
     

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.