Skip to content

[BUG] oRSF output operator does bitwise copy for ints into float buffer #265

Open
@kzhuang1

Description

@kzhuang1

🐛 Bug report

Description of the bug

When using the << operator to output to oRSF class, an int array will be bitwise copied into the float buffer turning a 1 into 1.401e-45 in the output file.

To Reproduce

Steps to reproduce the behavior:

  1. create oRSF object e.g. "oRSF outmask("mask.rsf");"
  2. have int type array filled with int values like 1s and 0s e.g. "std::vector<int> mMask(myNk);"
  3. send int type array to oRSF object using operator << e.g. "outmask << (kernel->mMask);"
  4. See error in output file where 1s (and probably all other values are incorrect), e.g. sfdisfil < mask.rsf

Expected behavior

output should be 0s and 1s for mask

Additional context

Most likely cause is just an template that takes any class as input and uses a bitwise memcpy for output in the oRSF class, most likely needs an overload operator that uses proper type conversion rather than bitwise copy.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions