Bipolar-switching model of RRAM by field- and temperature-activated ion migration