You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the returned array could contain inconsistent values if LIST%NUMBER_IN_LIST /= LIST%SIZE I added the line
LIST_VALUES(:)=LIST_VALUES(1:NUMBER_IN_LIST)
or
LIST_VALUES(:,:)=LIST_VALUES(:,1:NUMBER_IN_LIST)
after the CALL MOVE_ALLOC(...).
The text was updated successfully, but these errors were encountered:
I'm not sure what the above is trying to do? In general the LIST_VALUES size will be larger than the number in the list. Thus it maybe that the above lines result in an error as the left and right sides don't conform? It will also involve a copy of all the data to itself? When the list is returned the user should only access the 1:numberInList elements?
First of all, my bad, the correct lines are without (:) or (:,:):
LIST_VALUES=LIST_VALUES(1:NUMBER_IN_LIST)
I found this trick in my Fortran tutorial under "adjusting an allocatable array" (picture attached).
If the returned array is larger than numberInList, then it could be possible to access elements that have no meaning. As you wrote, one should be very careful to access only the 1:numberInList elements. A workaround that I see at some places is:
CALL LIST_DETACH_AND_DESTROY(BoundaryPlaneNodesList,NumberBoundaryPlaneNodes,IntegerArray,&
& ERR,ERROR,*999)
BoundaryPlaneNodes = IntegerArray(1:NumberBoundaryPlaneNodes)
DEALLOCATE(IntegerArray)
But that requires these two additional lines at every call, and an additional array.
Since the returned array could contain inconsistent values if LIST%NUMBER_IN_LIST /= LIST%SIZE I added the line
LIST_VALUES(:)=LIST_VALUES(1:NUMBER_IN_LIST)
or
LIST_VALUES(:,:)=LIST_VALUES(:,1:NUMBER_IN_LIST)
after the CALL MOVE_ALLOC(...).
The text was updated successfully, but these errors were encountered: