]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Output complex-valued data for cell data.
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 8 Nov 2017 04:17:03 +0000 (21:17 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 8 Nov 2017 04:17:03 +0000 (21:17 -0700)
source/numerics/data_out.cc

index f8a3a827ae2af1aaa60fa6b4a9e2775710a26dd0..aa5270ebeb4e6958385d2fa1641c3d21333e7e4e 100644 (file)
@@ -286,13 +286,26 @@ build_one_patch
 
           for (unsigned int dataset=0; dataset<this->cell_data.size(); ++dataset)
             {
-              const double value
-                = this->cell_data[dataset]->get_cell_data_value (cell_and_index->second,
-                                                                 internal::DataOut::ComponentExtractor::real_part);
-              for (unsigned int q=0; q<n_q_points; ++q)
-                patch.data(offset,q) = value;
+              // as above, first output the real part
+              {
+                const double value
+                  = this->cell_data[dataset]->get_cell_data_value (cell_and_index->second,
+                                                                   internal::DataOut::ComponentExtractor::real_part);
+                for (unsigned int q=0; q<n_q_points; ++q)
+                  patch.data(offset,q) = value;
+              }
+
+              // and if there is one, also output the imaginary part
+              if (this->cell_data[dataset]->is_complex_valued() == true)
+                {
+                  const double value
+                    = this->cell_data[dataset]->get_cell_data_value (cell_and_index->second,
+                                                                     internal::DataOut::ComponentExtractor::imaginary_part);
+                  for (unsigned int q=0; q<n_q_points; ++q)
+                    patch.data(offset+1,q) = value;
+                }
 
-              offset += (this->dof_data[dataset]->is_complex_valued() ? 2 : 1);
+              offset += (this->cell_data[dataset]->is_complex_valued() ? 2 : 1);
             }
         }
     }

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.