Semiparametric functional data analysis for longitudinal/clustered data: theory and application