Convert feature collections to individual features (for backward compatibility)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(feature_config_t), | intent(out), | allocatable | :: | features(:) |
Features array to populate (backward compatible) |
|
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
subroutine get_default_features_as_features(features, error) !> Features array to populate (backward compatible) type(feature_config_t), allocatable, intent(out) :: features(:) !> Error handling type(error_t), allocatable, intent(out) :: error type(feature_collection_t), allocatable :: collections(:) integer :: total_features, ifeature, icol, ivar ! Get the feature collections call get_default_features(collections, error) if (allocated(error)) return ! Count total features needed total_features = 0 do icol = 1, size(collections) total_features = total_features + 1 ! base feature if (allocated(collections(icol)%variants)) then total_features = total_features + size(collections(icol)%variants) end if end do ! Allocate features array allocate(features(total_features)) ! Copy features from collections ifeature = 1 do icol = 1, size(collections) ! Add base feature features(ifeature) = collections(icol)%base ifeature = ifeature + 1 ! Add variants if (allocated(collections(icol)%variants)) then do ivar = 1, size(collections(icol)%variants) features(ifeature) = collections(icol)%variants(ivar) ifeature = ifeature + 1 end do end if end do end subroutine get_default_features_as_features