mirror of
https://github.com/triqs/dft_tools
synced 2024-12-26 06:14:14 +01:00
39edb2f846
- Make more general constructors for the gf.
gf( mesh, target_shape_t)
- remove the old make_gf for the basic gf.
- 2 var non generic gf removed.
- clean evaluator
- add tensor_valued
- add a simple vertex test.
- clean specialisation
- Fix bug introduced in 1906dc3
- forgot to resize the gf in new version of operator =
- Fix make_singularity in gf.hpp
- clean resize in operator =
- update h5 read/write for block gf
- changed a bit the general trait to save *all* the gf.
- allows a more general specialization, then a correct for blocks
- NOT FINISHED : need to save the block indice for python.
How to reread ?
Currently it read the blocks names and reconstitute the mesh from it.
Is it sufficient ?
- clean block constructors
- block constructors simplest possible : an int for the number of blocks
- rest in free factories.
- fixed the generic constructor from GfType for the regular type :
only enable iif GfType is ImmutableGreenFunction
- multivar. fix linear index in C, and h5 format
- linear index now correctly flatten in C mode
(was in fortran mode), using a simple reverse of the tuple in the folding.
- fix the h5 read write of the multivar fonctions
in order to write an array on dimension # variables + dim_target
i.e. without flattening the indices of the meshes.
Easier for later data analysis, e.g. in Python.
- merge matrix/tensor_valued. improve factories
- matrix_valued now = tensor_valued<2>
(simplifies generic code for h5).
- factories_one_var -> factories : this is the generic case ...
only a few specialization, code is simpler.
- clef expression call with rvalue for *this
- generalize matrix_proxy to tensor and clean
- clean exception catch in tests
- exception catching catch in need in test
because the silly OS X does not print anything, just "exception occurred".
Very convenient for the developer...
- BUT, one MUST add return 1, or the make test will *pass* !!
- --> systematically replace the catch by a macro TRIQS_CATCH_AND_ABORT
which return a non zero error code.
- exception : curry_and_fourier which does not work at this stage
(mesh incompatible).
- gf: clean draft of gf 2 times
- comment the python interface for the moment.
- rm useless tests
103 lines
3.7 KiB
C++
103 lines
3.7 KiB
C++
/*******************************************************************************
|
|
*
|
|
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
|
|
*
|
|
* Copyright (C) 2012 by M. Ferrero, O. Parcollet
|
|
*
|
|
* TRIQS is free software: you can redistribute it and/or modify it under the
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
* Foundation, either version 3 of the License, or (at your option) any later
|
|
* version.
|
|
*
|
|
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* TRIQS. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
******************************************************************************/
|
|
#ifndef TRIQS_GF_MESH_DISCRETE_H
|
|
#define TRIQS_GF_MESH_DISCRETE_H
|
|
#include "./mesh_tools.hpp"
|
|
#include "../domains/discrete.hpp"
|
|
|
|
namespace triqs { namespace gfs {
|
|
|
|
template<typename Domain>
|
|
struct discrete_mesh {
|
|
|
|
typedef Domain domain_t;
|
|
typedef size_t index_t;
|
|
|
|
discrete_mesh (domain_t && dom) : _dom(dom){}
|
|
discrete_mesh (domain_t const & dom) : _dom(dom){} //icc has a bug
|
|
discrete_mesh () : _dom(){}
|
|
|
|
domain_t const & domain() const { return _dom;}
|
|
size_t size() const {return _dom.size();}
|
|
|
|
/// Conversions point <-> index <-> discrete_index
|
|
size_t index_to_point (index_t ind) const {return ind;}
|
|
size_t index_to_linear(index_t ind) const {return ind;}
|
|
|
|
/// The wrapper for the mesh point
|
|
class mesh_point_t : tag::mesh_point,public arith_ops_by_cast<mesh_point_t, size_t> {
|
|
discrete_mesh const * m;
|
|
index_t _index;
|
|
public:
|
|
mesh_point_t( discrete_mesh const & mesh, index_t const & index_): m(&mesh), _index(index_) {}
|
|
void advance() { ++_index;}
|
|
typedef size_t cast_t;
|
|
operator cast_t() const { return m->index_to_point(_index);}
|
|
size_t linear_index() const { return _index;}
|
|
size_t index() const { return _index;}
|
|
bool at_end() const { return (_index == m->size());}
|
|
void reset() {_index =0;}
|
|
};
|
|
|
|
/// Accessing a point of the mesh
|
|
mesh_point_t operator[](index_t i) const { return mesh_point_t (*this,i);}
|
|
mesh_point_t operator[](std::string const & s) const { return mesh_point_t (*this,_dom.index_from_name(s));}
|
|
|
|
/// Iterating on all the points...
|
|
typedef mesh_pt_generator<discrete_mesh> const_iterator;
|
|
const_iterator begin() const { return const_iterator (this);}
|
|
const_iterator end() const { return const_iterator (this, true);}
|
|
const_iterator cbegin() const { return const_iterator (this);}
|
|
const_iterator cend() const { return const_iterator (this, true);}
|
|
|
|
/// Mesh comparison
|
|
bool operator == (discrete_mesh const & M) const { return (_dom == M._dom) ;}
|
|
|
|
/// Write into HDF5
|
|
friend void h5_write (h5::group fg, std::string subgroup_name, discrete_mesh const & m) {
|
|
h5::group gr = fg.create_group(subgroup_name);
|
|
h5_write(gr,"domain",m.domain());
|
|
}
|
|
|
|
/// Read from HDF5
|
|
friend void h5_read (h5::group fg, std::string subgroup_name, discrete_mesh & m){
|
|
h5::group gr = fg.open_group(subgroup_name);
|
|
typename discrete_mesh::domain_t dom;
|
|
h5_read(gr,"domain",dom);
|
|
m = discrete_mesh(std::move(dom));
|
|
}
|
|
|
|
// BOOST Serialization
|
|
friend class boost::serialization::access;
|
|
template<class Archive>
|
|
void serialize(Archive & ar, const unsigned int version) {
|
|
ar & boost::serialization::make_nvp("domain",_dom);
|
|
}
|
|
|
|
friend std::ostream &operator <<(std::ostream &sout, discrete_mesh const & m){return sout << "Discrete Mesh"; }
|
|
|
|
private:
|
|
domain_t _dom;
|
|
};
|
|
}}
|
|
#endif
|
|
|