Magnetostatics and electrostatic problems in inhomogeneous anisotropic media with irregular boundary and mixed boundary conditions