Barcelona Trains
Sometimes it is cheaper to get singles there and singles back, and sometimes it isn’t. It may also be cheaper to take a less direct route to your destination. Strongly consider mixing up your journey with a train and buses, and do plenty of research into return journeys because they are typically (but not always) 20% cheaper than single tickets. There are sometimes travel discounts for advanced booking, so it may be worth doing your research sooner rather than leaving it until you arrive in Spain.
Spain doesn’t run a rail system that allows for an easy hop-on hop-off adventure. Many train journeys require that you book or reserve a seat prior to getting on the train. It will say on the train schedule if a seat booking is required. Even with a rail pass, you may still be required to book a seat on the train. Many seats may be booked 60 days in advance, so make sure you know exactly what time you wish to depart, and make sure you are at the station at the right time.
Trains probably shouldn’t be your first choice for transport if you are only planning to tour Barcelona. However, if you are planning to visit the rest of Spain, France, Portugal and/or Italy, the train may be just what you need. The service within Spain and between these countries is highly integrated and easy to use once you become accustom with how it works. There are many cheaper, easier and more frequent travel options if you are only visiting and/or touring Barcelona.