]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix one bug in SolutionTransfer in which we first computed the size of the output...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Oct 2003 22:49:41 +0000 (22:49 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Oct 2003 22:49:41 +0000 (22:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@8133 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/solution_transfer.h
deal.II/deal.II/source/numerics/solution_transfer.cc
deal.II/doc/news/c-4-0.html
tests/results/i686-pc-linux-gnu+gcc2.95/bits/solution_transfer_1.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/solution_transfer_1.output [new file with mode: 0644]
tests/results/sparc-sun-solaris2.7+gcc2.95/bits/solution_transfer_1.output [new file with mode: 0644]

index 762c3eb9ba08385142e0f729d178fcca2f57141d..2d43a7c1698750a5b870186b41831432cdb25a3f 100644 (file)
@@ -266,6 +266,12 @@ class SolutionTransfer
                                      * NOT allowed. Interpolating
                                      * several functions can be
                                      * performed in one step.
+                                     *
+                                     * If the number of output
+                                     * vectors is different from the
+                                     * number of input vectors, or if
+                                     * their sizes are not correct,
+                                     * then this is corrected.
                                      */
     void interpolate (const std::vector<Vector<number> >&all_in,
                      std::vector<Vector<number> >      &all_out) const;
index 0ee34b14fbee66bfa959c3be2b9fd5b54d8d95d9..99b15d2f9aa073b0fb27a19fbda1da6eaf9a9105 100644 (file)
@@ -287,13 +287,12 @@ interpolate (const std::vector<Vector<number> > &all_in,
            ExcWrongVectorSize(all_in[i].size(), n_dofs_old));
 
   
-  const unsigned int out_size=all_out.size();
-  const unsigned int in_size=all_in.size();
+  const unsigned int in_size = all_in.size();
 
-                                  // resize the output vector
-  if (out_size != in_size)
-    all_out=std::vector<Vector<number> >(
-      in_size, Vector<number>(dof_handler->n_dofs()));
+                                  // resize the output vector if
+                                  // necessary
+  if (all_out.size() != in_size)
+    all_out.resize (in_size, Vector<number>(dof_handler->n_dofs()));
   else
     for (unsigned int i=0; i<in_size; ++i)
       if (all_out[i].size() != dof_handler->n_dofs())
@@ -336,7 +335,7 @@ interpolate (const std::vector<Vector<number> > &all_in,
                                               // data vectors on this
                                               // cell and prolong it
                                               // to its children
-             for (unsigned int j=0; j<out_size; ++j)
+             for (unsigned int j=0; j<in_size; ++j)
                {
                  for (unsigned int i=0; i<dofs_per_cell; ++i)
                    local_values(i)=all_in[j](indexptr->operator[](i));
@@ -359,7 +358,7 @@ interpolate (const std::vector<Vector<number> > &all_in,
                                               // distribute the
                                               // stored data to the
                                               // new vectors
-             for (unsigned int j=0; j<out_size; ++j)
+             for (unsigned int j=0; j<in_size; ++j)
                for (unsigned int i=0; i<dofs_per_cell; ++i)
                  all_out[j](dofs[i])=valuesptr->operator[](j)(i);
            }
index ef24f875786b47ae2ca07222c239cc9bf6756ef5..bf5916b4be76fdbc3c57219ce8d1c9a4a0e2da27 100644 (file)
@@ -256,6 +256,17 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       Fixed: The <code
+       class="member">SolutionTransfer::interpolate</code>
+       function did not compute all output vectors if the number of
+       output vectors was different from the number of output
+       vectors. This was due to the fact that it stored the number of
+       output vectors before resizing that array. This is now fixed.
+       <br>
+       (Brent Bailey, WB 2003/10/22)
+       </p>
+
   <li> <p>
        Fixed: The <code
        class="member">FEFaceValuesBase::boundary_form</code>
diff --git a/tests/results/i686-pc-linux-gnu+gcc2.95/bits/solution_transfer_1.output b/tests/results/i686-pc-linux-gnu+gcc2.95/bits/solution_transfer_1.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/solution_transfer_1.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/solution_transfer_1.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/sparc-sun-solaris2.7+gcc2.95/bits/solution_transfer_1.output b/tests/results/sparc-sun-solaris2.7+gcc2.95/bits/solution_transfer_1.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.