Self-adaptive weighting and sampling for physics-informed neural networks