Validate configuration parameters
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(config_type), | intent(in) | :: | config | |||
logical, | intent(out) | :: | is_valid | |||
character(len=*), | intent(out) | :: | error_msg |
SUBROUTINE validate_config(config, is_valid, error_msg) TYPE(config_type), INTENT(IN) :: config LOGICAL, INTENT(OUT) :: is_valid CHARACTER(LEN=*), INTENT(OUT) :: error_msg is_valid = .TRUE. error_msg = "" ! Check tolerances IF (config%pivot_tolerance <= 0.0_dp) THEN is_valid = .FALSE. error_msg = "Pivot tolerance must be positive" RETURN END IF IF (config%convergence_tolerance <= 0.0_dp) THEN is_valid = .FALSE. error_msg = "Convergence tolerance must be positive" RETURN END IF ! Check iteration limits IF (config%max_iterations <= 0) THEN is_valid = .FALSE. error_msg = "Maximum iterations must be positive" RETURN END IF ! Check block size IF (config%block_size <= 0) THEN is_valid = .FALSE. error_msg = "Block size must be positive" RETURN END IF END SUBROUTINE validate_config