Subroutine USER_QUANTITY

Gives an access to data in named user quantities.

A user quantity is a set of double precision values indexed by integer labels that is given a name and stored in memory. These labels can be element or node IDs, or an arbitrary set of non-negative integers. The data stays in memory until it is modified at a later point of the run, by another user_quantity call in the USER1 subroutine, or a similar call from user-written plugin in expression functions. Such named entities can be used for storing data from one user subroutine call to another, and/or for communicating data between user subroutine calls and user-plugin function calls. The first time a given label is used for a given user quantity name, the memory will be automatically allocated for its required storage.

Calling convention:

call user_quantity(code, name, label, value, ierr)
Arguments Data type Input/Output Description
code Character(*) Call Determines the type of data operation. Character variable value is set to:
  • 'SET': A value of the variable is assigned to the label for a given user quantity name variable.
  • 'GET': Returns value for given variables label and name inputs.
  • 'FREE': Clears all data for user quantity name variable.
  • 'ATFIRST' or 'NEXT':

These values are used in combination to iterate over all existing label-value pairs in a given user quantity.

To perform this operation, one must first call user_quantity with code = 'ATFIRST'.

Keep calling user_quantity with code = 'NEXT' to get the next label-value pair in label and value variables, until a non-zero value of variable ierr is returned.

name Character(*) Call The user quantity name.
label Integer Both The input value when code is ’SET’ or ‘GET’, and output value when the codeis ’NEXT’. It is not used for other code values.
value Double Precision Both User quantity value corresponding to the given label. The input value when code is ’SET’ and output value when thecodeis ’GET’ or ‘NEXT’. It is not used for other code values.
ierr Integer Return

The error code of the operation.

  • ierr = 0 if success.
  • ierr = 1 if the label is not set in a call with code = ’GET’.