## Storing distributions for local coordinate systems

In CalculiX distributions can be used to define local coordinate systems in an elementwise fashion. The corresponding keyword is *DISTRIBUTION. Since this option is strongly related to the *ORIENTATION keyword, the latter's data structure is used to cover distributions as well.

An orientation i is described by its name in orname(i), the coordinates of its defining points a and b in orab(1..6,i) and a flag defining whether the local coordinate system is rectangular (value 1.) or cylindrical (value -1.) in orab(7,i). For each layer j of element k the entry ielorien(j,k) points to the local orientation (default: 0, i.e. no local system).

The *DISTRIBUTION cards in an input deck are always treated before any *ORIENTATION cards (independent of the order in which the user has set up his input deck; the key routine taking care of this is keystart.f). As soon as a *DISTRIBUTION card is encountered, as may orientations are created as there are lines underneath the *DISTRIBUTION card. For each of these orientations i the distribution name (let us call this distname) is stored in orname(i) and the defining points a and b in orab(1..6,i). The entry orab(7,i) takes the default zero. For each element k in which a distribution is defined (first entry in all lines underneath the *DISTRIBUTION card except the first one, which defines the default) ielorien(1,k) is set to the appropriate orientation i containing the correct distribution for this element, preceded by a minus sign, i.e. ielorien(1,k)=-i. The minus sign indicates that this orientation is optional and not yet active. It can only be activated by the correct combination of an *ORIENTATION and *SOLID SECTION card.

As soon as an *ORIENTATION card (e.g. with name ornam) is encountered using this distribution all orientations i are checked on whether their name coincides with the name of the distribution, i.e. whether orname(i)=distname. If so:

• the name of the orientation is replaced by ornam, i.e. orname(i)=ornam.
• orab(7,i) is set to the kind of local system defined on the *ORIENTATION card
• If an additional rotation angle about a local axis is defined on the *ORIENTATION card, orab(1..6,i) is modified appropriately

Notice that distname and ornam may be identical. The only way in which to detect that orname(i) points to an orientation and not just a distribution is by checking orab(7,i). If this is zero it is a distribution, else it is an orientation.

As soon as a *SOLID SECTION card is encountered pointing to an orientation (e.g. OR) the following steps are undertaken:

• In a loop over all orientations i the first occurrence of the orientation name on the *SOLID SECTION card (i.e. OR) is checked for. This orientation is the default one (if the *ORIENTATION was defined by a distribution it corresponds to the first line underneath a *DISTRIBUTION card).
• For all elements k belonging to the element set on the *SOLID SECTION card: if m=ielorien(1,k) is negative AND orname(-m)=OR AND orab(7,-m) is nonzero then ielorien(1,k) is set to -m. Else it is set to the default orientation.