Skip to content
  • Alvarez, Gonzalo's avatar
    IoNgSerializer: real or complex on disk to complex · 7a6ee8e7
    Alvarez, Gonzalo authored
    We're reading from disk, so we go from type in disk to type in destination
    The type of destination is SomeVectorType
    The underlying type of destination is SomeVectorType::value_type
    Therefore, we have underlying type in disk and underlying type in destination
    Let's call floating the set {double, float}
    underlying type ut_disk in disk is in {floating, complex, other}
    underlying type ut_dest in destination is also in {floating, complex, other}
    if ut_disk == ut_dest all is good
    if ut_disk != ut_dest we throw unless
    ut_disk == floating and ut_dest is std::complex<floating> so
    that we can go from floating to complex<floating>
    
    I won't talk too much about implementation because it might change.
    Note the complication of taking Real<SomeVectorType::value_type>::Type
    which is not discussed here because
    "The source is fully true." (Gonzalo, 2021)
    
    As far as disk is concerned, a name + "ComplexOrRealType" single char set
    is written to the hd5 file only if
    vector<floating>, with content 'R'
    vector<std::complex<floating> >, with content 'C'
    all other vectors aren't prepended at all and
    a read for name + "ComplexOrRealType" set in the hd5 file will fail.
    7a6ee8e7