Anisotropic yield function based on stress invariants for BCC and FCC metals and its extension to ductile fracture criterion