SCIRun icon indicating copy to clipboard operation
SCIRun copied to clipboard

SetFieldData doesn't produce error when matrix/field doesn't match up

Open dcwhite opened this issue 9 years ago • 23 comments

It just outputs a null field instead.

dcwhite avatar Jul 23 '15 17:07 dcwhite

When the matrix has too few matrix values (rows), an error is produced but it's the wrong message: Internal error (data not tensor). When there are too many rows, the data is all set to zero. Both cases should be tested and fixed.

dcwhite avatar Aug 18 '15 21:08 dcwhite

Found out more about what's going on: algo is falling into a case where it's trying to match a single tensor in a matrix (i.e. 1x9 or 1x6) to all node values, but the field isn't set to accept tensors. These cases should be cleared up somehow.

dcwhite avatar Aug 19 '15 17:08 dcwhite

It doesn't give an error when data is a sparse matrix. ReportFieldInfo produces an error of 'Input data required on port InputField' afterwards though. I thought this error is also related to SetFieldData not properly creating the new field.

SeyhmusGuler avatar Feb 12 '16 17:02 SeyhmusGuler

@jessdtate Could you enumerate the various combinations of valid inputs and sizes, and test each one to see if they behave as expected? This task would be good to delegate to another student. Just @ them here and I'll assign it.

dcwhite avatar Jun 10 '16 16:06 dcwhite

What a poorly written issue. I will go back and test this again. SCIrun has a thing where if there is an error in the module, it will disappear if there is an execute command, but no execution (no change in inputs). It could have been a normal error that I didn't see.

jessdtate avatar Jun 13 '16 21:06 jessdtate

So the possible combinations are: num nodes x 1 -- scalar on nodes num elem x 1 -- scalar on elems num nodes x 3 -- vectors on nodes num elem x 3 -- vectors on elems num nodes x 6 -- tensors on nodes num elem x 6 -- tensors on elems num nodes x 9 -- tensors on nodes num elem x 9 -- tensors on elems

jessdtate avatar Jun 29 '16 17:06 jessdtate

I have tried all those combos on a few fields, and I cannot replicate the error. However, I noticed that when trying to set tensors, the data doesn't set properly (tensor of zeros). should I make a new issue for that or post the example here?

jessdtate avatar Jun 29 '16 17:06 jessdtate

Set field data is producing error messages when the fields didn't match. in every case that I tried.

jessdtate avatar Jun 29 '16 17:06 jessdtate

There are also cases in the code where if a single value (scalar/vector/tensor) is readable, it's applied to all nodes/elems. We could remove that case. Also, what happens if num nodes == num elems?

dcwhite avatar Jun 29 '16 18:06 dcwhite

And yes, just post the example here.

dcwhite avatar Jun 29 '16 18:06 dcwhite

Here is the example net that will show the tensor from setfielddata (set to zero) and the correct mapping using ConvertIndicesToFieldData. test_setfielddata.srn5.zip

jessdtate avatar Jun 29 '16 18:06 jessdtate

I forgot about a single value. That should stay, and the data location should be the previously assigned locations (if no definition, I think nodes is default). The case of num nodes==num elems is very rare, so It's harder to make a test case, but I think it would do the same. I will try to make a test case for that.

jessdtate avatar Jun 29 '16 18:06 jessdtate

for num nodes == num elem, it looks like the code checks for the existing field basis, and uses node centering if not found. I still need to test it.

jessdtate avatar Jul 04 '16 06:07 jessdtate

SetFieldData also seems to only return a null field when the input is a sparse matrix though the dimension of field and matrix are fitting. It worked after I added a ConvertMatrixType before. I would assume this behavior is not intentional, since in most cases explicit conversions aren't necessary?

Tested on v5.0-beta.C, opensuse.

johaenns avatar Jul 08 '16 22:07 johaenns

After some testing, especially at IBBM, I agree that the error message only returns null without an error when the matrix is sparse. There should be an exception added, even if it is planned to support sparse matrices in the future.

jessdtate avatar Jul 21 '16 15:07 jessdtate

@darrellswenson Please update this issue with your specific problem. @jessdtate can help.

dcwhite avatar Aug 22 '16 18:08 dcwhite

SelectSubMatrix has a similar problem, in that it will return a null output without showing an error. I don't think it is related to sparse matrices though. I will make another issue when I have time.

jessdtate avatar Sep 29 '16 19:09 jessdtate

@jessdtate will clarify what needs to be fixed with a checklist

dcwhite avatar Dec 04 '17 20:12 dcwhite

Stale issue message

github-actions[bot] avatar Oct 20 '19 00:10 github-actions[bot]

@jessdtate will clarify what needs to be fixed with a checklist

dcwhite avatar Oct 21 '19 18:10 dcwhite

This issue is stale because it has been open 240 days with no activity. Remove the stale label or comment, or this will be closed in 60 days.

github-actions[bot] avatar Apr 13 '21 00:04 github-actions[bot]

  • [ ] produce error when data do not match node or elem size
  • [ ] enable single tensor value (1x6 or 1x9 or transpose)
  • [ ] make sure vectors as above
  • [ ] handle sparse matrix or pass error

jessdtate avatar May 21 '21 20:05 jessdtate

This issue is stale because it has been open 240 days with no activity. Remove the stale label or comment, or this will be closed in 60 days.

github-actions[bot] avatar Jan 17 '22 00:01 github-actions[bot]