]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Grant access to internal parts of a function.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 3 May 2001 15:21:19 +0000 (15:21 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 3 May 2001 15:21:19 +0000 (15:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@4531 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_tools.h
deal.II/deal.II/source/dofs/dof_tools.cc

index f20b26ee456bce226ca70c3c56aedd9966edec8b..8d5222cfeae22c7a6483ca5a3dc7e9f4e6d9813b 100644 (file)
@@ -807,6 +807,7 @@ class DoFTools
                                      * only need one object of this
                                      * type.
                                      */
+//TODO:[WB] document last argument    
     template <int dim>
     static void
     compute_intergrid_constraints (const DoFHandler<dim>              &coarse_grid,
@@ -814,7 +815,8 @@ class DoFTools
                                   const DoFHandler<dim>              &fine_grid,
                                   const unsigned int                  fine_component,
                                   const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
-                                  ConstraintMatrix                   &constraints);
+                                  ConstraintMatrix                   &constraints,
+                                  std::vector<std::map<unsigned int, float> > *transfer_representation = 0);
 
                                     /**
                                      * Create a mapping from degree
index c6e3a3f77de465a34300eed98aa605ff922d03c4..d41c0ea1a6d5311b129ae122830fe4f1a4441b39 100644 (file)
@@ -1170,7 +1170,8 @@ DoFTools::compute_intergrid_constraints (const DoFHandler<dim>              &coa
                                         const DoFHandler<dim>              &fine_grid,
                                         const unsigned int                  fine_component,
                                         const InterGridMap<DoFHandler,dim> &coarse_to_fine_grid_map,
-                                        ConstraintMatrix                   &constraints)
+                                        ConstraintMatrix                   &constraints,
+                                        std::vector<std::map<unsigned int, float> > *transfer_representation)
 {
                                   // aliases to the finite elements
                                   // used by the dof handlers:
@@ -1333,7 +1334,7 @@ DoFTools::compute_intergrid_constraints (const DoFHandler<dim>              &coa
                                   // the weights array was actually
                                   // of FullMatrix<double> type. this
                                   // wasted huge amounts of memory,
-                                  // but was fast. nontheless, since
+                                  // but was fast. nonetheless, since
                                   // the memory consumption was
                                   // quadratic in the number of
                                   // degrees of freedom, this was not
@@ -1439,7 +1440,49 @@ DoFTools::compute_intergrid_constraints (const DoFHandler<dim>              &coa
     };
 #endif
 
+                                  // if the user wants to have a
+                                  // representation of the transfer
+                                  // matrix, the provide it
+  if (transfer_representation != 0)
+    {
+      transfer_representation->clear ();
+      transfer_representation->resize (weights.size());
+
+      const unsigned int n_global_parm_dofs
+       = std::count_if (weight_mapping.begin(), weight_mapping.end(),
+                        std::bind2nd (std::not_equal_to<int> (), -1));
+      
+                                      // first construct the inverse
+                                      // mapping of weight_mapping
+      std::vector<unsigned int> inverse_weight_mapping (n_global_parm_dofs,
+                                                       DoFHandler<dim>::invalid_dof_index);
+      for (unsigned int i=0; i<weight_mapping.size(); ++i)
+       {
+         const unsigned int parameter_dof = weight_mapping[i];
+                                          // if this global dof is a
+                                          // parameter
+         if (parameter_dof != static_cast<unsigned int>(-1))
+           {
+             Assert (parameter_dof < n_global_parm_dofs, ExcInternalError());
+             Assert (inverse_weight_mapping[parameter_dof] == DoFHandler<dim>::invalid_dof_index,
+                     ExcInternalError());
+             
+             inverse_weight_mapping[parameter_dof] = i;
+           };
+       };
+
+                                      // next copy over weights array
+                                      // and replace respective
+                                      // numbers
+      for (unsigned int i=0; i<n_coarse_dofs; ++i)
+       {
+         std::map<unsigned int, float>::const_iterator j = weights[i].begin();
+         for (; j!=weights[i].end(); ++j)
+           (*transfer_representation)[i][inverse_weight_mapping[j->first]] = j->second;
+       };
+    };
 
+  
                                   // now we know that the weights in
                                   // each row constitute a
                                   // constraint. enter this into the
@@ -2076,7 +2119,8 @@ DoFTools::compute_intergrid_constraints (const DoFHandler<deal_II_dimension> &,
                                         const DoFHandler<deal_II_dimension> &,
                                         const unsigned int                   ,
                                         const InterGridMap<DoFHandler,deal_II_dimension> &,
-                                        ConstraintMatrix                    &);
+                                        ConstraintMatrix                    &,
+                                        std::vector<std::map<unsigned int, float> > *);
 
 
 

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.