It isn't entirely clear what you are asking for here, so I'll take my best shot. The way that you define your thread group and dispatch dimensions is usually intended to model your dataset that is being processed. Generally, if the data set is a 2D texture, then your dispatch and thread groups are sized accordingly to address chunks of the 2D region (and your z coordinates will be 1). Alternatively, if you are processing a 1D buffer of data, then you would just use the x-coordinate for addressing.
The linear index for a complete dispatch is available in the SV_GroupIndex, which includes all thread groups together. This is good when you are processing a linearly stored data set. Otherwise you can choose one of the other System Value semantics (SV_GroupID, SV_GroupThreadID, or SV_DispatchThreadID) to get a better addressing for your problem.
The group shared memory is intended for sharing intermediate results among the threads in a thread group. So typically you would use the SV_GroupThreadID system value to address it, since it is local to the thread group. If you wanted a linear index for your group shared, then you can either choose a 1D thread group shape, or you can flatten your indices manually based on the shape of the thread group. However, I would highly recommend to just choose your thread group shape according to the data you are processing so that you can skip any additional math in your shader.
Does that help clarify the issue?