3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/test/triqs/gf/pb_affichage.cpp
Olivier Parcollet 7847b71552 [API BREAK] gf : mesh_pt into []
- All access to grid is now using the [] operator.
() always returns const, and is an evaluation over the domain.

- Now :
 * () is always a call to evaluator (or a lazy expression).
 * mesh_pt accepted by [] , both const and non const,
and not by ().

- Ported the libs (fourier et al.) but this break API.
2013-07-29 11:52:53 +02:00

40 lines
896 B
C++

#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/utility/first_include.hpp>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <triqs/gf/gf.hpp>
#include <triqs/gf/two_real_times.hpp>
#include <complex>
using namespace triqs::gfs;
using namespace std;
using triqs::arrays::make_shape;
int main(){
double dt=0.001;
double tmax=0.005;
int nt=tmax/dt;
auto R= make_gf<two_real_times> (tmax,nt,make_shape(1,1));//results
for(auto point:R.mesh()) R[point]=0;
const auto rg = on_mesh(R);
R.on_mesh(1,1) = 10;
std::cout << rg (1,1)<< std::endl ;
std::cout << R.on_mesh(1,1)<< std::endl ;
std::cout << R(0.001,0.001)<< std::endl ;
auto R2 = R;
//on_mesh(R2)(1,1) = on_mesh(R)(1,1) * on_mesh(R)(1,1);
on_mesh(R2)(1,1)() = on_mesh(R)(1,1) * on_mesh(R)(1,1);
std::cout << on_mesh(R2)(1,1)<< std::endl;
return 0;
};