pelahi / VELOCIraptor-STF

Galaxy/(sub)Halo finder for N-body simulations
MIT License
19 stars 26 forks source link

Updated BoxSize reader to account for vector types in SWIFT #40

Closed JBorrow closed 5 years ago

JBorrow commented 5 years ago

Fixes #39 by replacing the BoxSize reader with one that handles the fact that SWIFT uses a vector of BoxSizes. In the GADGET standard, this value is just a double; in SWIFT the boxes can be non-cubic and so we store a value for all three dimensions.

As far as I can tell, this was returning a pointer to VR when accessing, which then of course caused many problems.

MatthieuSchaller commented 5 years ago

Isn't it better to check for the presence of the Header/Code == SWIFT in the HDF5 file such that it will work also in the cases where we don't use the SWIFTEAGLE names? e.g. in DMONLY runs?

JBorrow commented 5 years ago

I thought the SWIFT/EAGLE names was turned on for ...NAMING_CONVENTION=6 which should be turned on irrespective of whether or not it's a DMOnly?

MatthieuSchaller commented 5 years ago

I suppose both are redundant at the moment since the only SWIFT names we have are all SWIFTEAGLE.

JBorrow commented 5 years ago

The way I've done this is consistent with the below,

            if (opt.ihdfnameconvention==HDFSWIFTEAGLENAMES) {
                vlongbuff = read_attribute_v<long long>(Fhdf[i], hdf_header_info[i].names[hdf_header_info[i].INuminFile]);
                for (k=0;k<NHDFTYPE;k++) hdf_header_info[i].npart[k]=vlongbuff[k];
            }
            else{
                vuintbuff = read_attribute_v<unsigned int>(Fhdf[i], hdf_header_info[i].names[hdf_header_info[i].INuminFile]);
                for (k=0;k<NHDFTYPE;k++) hdf_header_info[i].npart[k]=vuintbuff[k];
            }
rtobar commented 5 years ago

Looks good. I merged, and then put an additional commit on top to adjust spacing/indentation to keep consistency.