Tfizz,
I didn't attach my foam to the boat or deck at all. I have a mod v, and I did have to build up the foam in sections, as the hull of the boat is 4" below the top of the ribs in the middle, and 2" below at the sides; ribs are flat all the way across. I used double sided tape to hold the pieces together. Then I just laid them in the boat and covered them with the flooring.
If you ever need to take the flooring out for repair or anything, the foam can just be lifted out. Makes it much easier to deal with, and it won't go anywhere with the floor covering it.