A novel cosine network for pricing European and barrier options under stochastic volatility models