getCompartmentIndex function

Get the compartment index for the specified compartment name.