<s>[INST] Solutions to a quadratic diophantine equation $x^2 + xy + y^2 = 3r^2$. Let $k,i,r \in\Bbb Z$, $r$ constant. How to compute the number of solutions to $3(k^2+ki+i^2)=r^2$, perhaps by generating all of them?
 [/INST] There are infinitely many solutions to this Diophantine equation.
I change your variables. We have the Diophantine equation$$3(a^2+ab+b^2)=c^2$$Let's assume $c$ is not constant and find all possible solutions! $c=0$ gives $a=b=0$. W.L.O.G. suppose $c>0$. It's easy to see that $c=3d$ for some positive integer $d$. Equation becomes$$a^2+ab+b^2=3d^2$$For $a=b$ we get $a=b=\pm d$. W.L.O.G. suppose that $a>b$. Notice that$$a^2+ab+b^2 \equiv 0 \pmod 3$$It follows that $a^3 \equiv b^3 \pmod 3$ and $a \equiv b \pmod 3$. Let $a-b=3e$ for some positive integer $e$. Equation turns into$$b^2+3be+3e^2=d^2$$In order to get integer values for $b$ discriminant of this quadratic must be a perfect square, that is$$\Delta_{b}=-3e^2+4d^2=f^2$$For some integer $f$. 
$f=0$ gives $\sqrt{3}=2\frac{d}{e}$, which is impossible. W.L.O.G. suppose that $f>0$. Therefore, we need to solve$$f^2+3e^2=4d^2$$In positive integers. Now this is of the form of extended Pythagorean equation $Ax^2+By^2=Cz^2$, which is widely studied. Even there are some questions here and here, which exactly discuss your particular case!
Once you find parametric forms of $f$, $e$ and $d$, you can substitute backwards and find parametric form of your original variables $a$, $b$ and $c$.  
</s>