3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00
dft_tools/pytriqs/gf/local/mesh_two_real_times.pyx
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

35 lines
1.2 KiB
Cython

cdef class MeshTwoRealTime:
cdef mesh_two_real_times _c
def __init__(self, double tmax, double n_time_slices) :
self._c = make_mesh_two_real_times(tmax,n_time_slices)
property t_min:
def __get__(self): return get_1d_mesh_from_2times_mesh(self._c).x_min()
property t_max:
def __get__(self): return get_1d_mesh_from_2times_mesh(self._c).x_max()
#property kind:
# def __get__(self): return self._c.kind()
def __len__ (self) : return self._c.size()
#def __iter__(self) : # I use the C++ generator !
# cdef mesh_pt_generator[mesh_two_real_times] g = mesh_pt_generator[mesh_two_real_times](&self._c)
# while not g.at_end() :
# yield g.to_point()
# g.increment()
def __richcmp__(MeshTwoRealTime self, MeshTwoRealTime other, int op) :
if op ==2 : # ==
return self._c == other._c
def __reduce__(self):
return self.__class__, (self.t_min, self.t_max, len(self)) #, self.kind)
# C -> Python
cdef inline make_MeshTwoRealTime (mesh_two_real_times x) :
return MeshTwoRealTime(get_1d_mesh_from_2times_mesh(x).x_max(), get_1d_mesh_from_2times_mesh(x).size() )