getCompartments function

Detect all compartments names from the code records. Only for model instantiation. Not exported.