Adaptive Finite Element Method in Nanophotonic Simulations