A general theory for bandgap estimation in locally resonant metastructures