What indicates a capacitor being charged or discharge in a circuit
For the positive cycle:

Opamp output voltage is at negative saturation (positive voltage at inverting input). Hence we can remove the opamp from the circuit if we want to analysis the positive cycle.

Addtionolen you should notice that the signal period is:

\$t = \frac{1}{1\textrm{kHz}}=1\textrm{ms} \$ 

And this time is much less than the RC time constant

\$t = RC = 2\textrm{k}\Omega \cdot 470\mu\textrm{F} = 940\textrm{ms}\$ 

So, Vin won't affect the capacitor voltage much. We can say that this voltage is unchanged.  

For example, if we have 1V across the capacitor and we set the Vin voltage at 0V

The capacitor will start to discharge with the time constant \$t = RC = 940\textrm{ms} \$. 

And the current will flow in this path:

Upper capacitor plate ---> R1--->R2--->gnd--->lower capacitor plate. 

And the opamp will don't have any influence in this process. 
Because the D1 diode is reversed biased due to the fact that the voltage at (-) input is positive (0.5V at the beginning of a discharge process) and opamp output at negative situation voltage. 

And at the end of a discharging process when the capacitor voltage is almost 0V (after 5*RC). 
The opamp output will rise up to 0.7V. To forward based the D1 diode and kept the output voltage at 0V. 

For the negative cycle, 

The voltage at (-) input will now be negative. So the output will go into the positive direction and this will further forward biased the D1 diode. 

And the capacitor will be quickly charged to this new voltage in the path: 

Vcc--->opamp_internal transistor--->D1--->C1-->gnd.  

The opamp will also provide a current for R1 and R2 resistors. 

But now if you change the input voltage to -0.5V we encounter an interesting situation. 
The capacitor voltage is at +1V but the input signal is at -0.5V
So, the opamp (-) input we see the positive voltage 

(+1V - (-0.5V))* R1/R1+R2 + (-0.5V) = 1.5V/2 - 0.5V = 0.25V.  

Therefore at this moment of time, the opamp output will go into negative saturation voltage and turn-off the diode.  

And our capacitor will begin the discharge process in this path: 

Upper capacitor plate--->R2-->R1-->Input signal source--->Gnd--->lower capacitor plate. 

And we can find the discharge time

$$t = RC \cdot ln \left(\frac{V_{\infty} - V_{start}}{V_{\infty} - V_{end}} \right)$$

$$t = 940\textrm{ms} \cdot ln \left(\frac{-0.5V-1V}{-0.5V - 0.5V} \right) = 940\textrm{ms} \cdot 0.405 \approx 380\textrm{ms} $$

And once again as discharge process ends the op amps kicks-in into action. 
And ensures that Vout = 0.5V