Extend DataOut to complex-valued vectors #1894

bangerth opened this Issue Nov 21, 2015 · 1 comment

2 participants


The problem with DataOut and complex valued solution vectors is that (i) it somehow needs to rip real and imaginary parts apart, given that output formats all only support outputting real data; (ii) that DataOut stores the solution vectors it is supposed to output in opaque types that hide whether they are deal.II, PETSc or Trilinos vectors, and whether their elements are floats, doubles, or complex-valued.

To address this, here are three necessary steps:

  • The opaque data types that store data vectors need to be able to tell whether they store a real or complex-valued vector. To this end, let's add a virtual function is_complex_valued() to class internal::DataOut::DataEntryBase that returns whether a data vector is complex-valued.
  • Let's add a boolean argument to the various internal::DataOut::DataEntryBase::get_* functions that indicates whether we are asking for the real or imaginary parts.
  • In DataOut::build_one_patch, where we call this, we need to ask whether the vector is complex-valued or not (using the function introduced above) and if so, treat real and imaginary parts separately, using the mechanism outlined in part 2 above.

I should add that all of the work above is necessary because we have to separate real and imaginary parts of complex numbers once we want to create graphical output -- no graphical output file I know of understands complex numbers, so we will have to output them as a pair of real values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment