idefix-code / idefix

A fast finite volume code designed to run on many architectures, such as GPU, CPU and manycores, using Kokkos.
https://idefix.readthedocs.io/
Other
28 stars 19 forks source link

[FIX] xdmf datatype agnostic dump #261

Closed dutta-alankar closed 1 month ago

dutta-alankar commented 1 month ago

On running cmake with cmake $IDEFIX_DIR -DIdefix_HDF5=ON -DCMAKE_CXX_FLAGS="-DXDMF_DOUBLE", the following compilation error is generated:

idefix/src/output/xdmf.cpp:168:18: error: incompatible pointer types assigning to 'double *' from 'float *'
  this->vect3D = new float[nx1loc*nx2loc*nx3loc];
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

This is because it works well for the default option float but when the dumping datatype is changed to double, the code complains as the right hand side of this expression is still float which must be changed to double. Therefore, to make this dump datatype agnostic, one needs to change float on the right hand side of this expression to DUMP_DATATYPE macro.