Effect of a submerged or a surface piercing porous barrier on structure-coupled gravity waves