1#ifndef VIENNASHE_IO_GNUPLOT_WRITER_EDF_HPP
2#define VIENNASHE_IO_GNUPLOT_WRITER_EDF_HPP
25#include "viennagrid/mesh/mesh.hpp"
26#include "viennagrid/algorithm/centroid.hpp"
54 template <
typename DeviceType,
typename EDFWrapperT >
56 EDFWrapperT
const & edf,
57 const double coordinate_x,
58 const std::string filename)
const
60 typedef typename DeviceType::mesh_type MeshType;
61 typedef typename viennagrid::result_of::const_cell_range<MeshType> ::type CellContainer;
62 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
63 typedef typename EDFWrapperT::she_quantity_type she_quantity_type;
65 she_quantity_type
const & quan = edf.quan();
68 std::map<std::pair<double, double>,
double > values;
69 std::ofstream writer(filename.c_str());
76 for ( CellIterator cit = cells.begin();
80 if ( viennagrid::centroid(*cit)[0] != coordinate_x )
83 for ( std::size_t index_H = 1; index_H < quan.get_value_H_size() - 1; ++index_H )
85 const long index = quan.get_unknown_index(*cit, index_H);
86 const double eps = quan.get_kinetic_energy(*cit, index_H);
88 values[std::make_pair(viennagrid::centroid(*cit)[1], eps)] = edf(*cit, eps, index_H);
95 for ( std::map<std::pair<double, double>,
double >::iterator it = values.begin();
99 double x_coord = it->first.first;
100 if ( x_coord < last_x || x_coord > last_x )
105 writer << it->first.first <<
" " << it->first.second <<
" " << it->second << std::endl;
117 template <
typename DeviceType,
118 typename CellFilterType,
119 typename EDFWrapperT>
121 CellFilterType
const & cell_filter,
122 EDFWrapperT
const & edf,
123 const std::string filename)
125 typedef typename DeviceType::mesh_type MeshType;
127 typedef typename viennagrid::result_of::point<MeshType>::type PointType;
128 typedef typename viennagrid::result_of::const_cell_range<MeshType> ::type CellContainer;
129 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
131 typedef typename EDFWrapperT::dispersion_relation_type dispersion_relation_type;
132 typedef typename EDFWrapperT::she_quantity_type she_quantity_type;
134 she_quantity_type
const & quan = edf.quan();
135 dispersion_relation_type
const & dispersion = edf.dispersion_relation();
137 std::ofstream writer(filename.c_str());
145 for ( CellIterator cit = cells.begin();
150 if ( !cell_filter(*cit) )
continue;
153 for ( std::size_t index_H = 1;
154 index_H < quan.get_value_H_size() - 1;
158 const long index = quan.get_unknown_index(*cit, index_H);
159 const double energy = quan.get_kinetic_energy(*cit, index_H);
160 if ( index > -1 && energy > 0 )
162 for (std::size_t i = 0; i < static_cast<std::size_t>(PointType::dim); ++i) writer << viennagrid::centroid(*cit)[i] <<
" ";
164 << edf(*cit, energy, index_H) <<
" "
165 << dispersion.density_of_states(energy)
169 writer << std::endl << std::endl;
MeshT const & mesh() const
Returns the underlying mesh.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Exception which is thrown if a file cannot be opened.
The SHE configuration class is defined here.
Contains forward declarations and definition of small classes that must be defined at an early stage.
All the exceptions used within the viennashe::io namespace.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Provides a number of fundamental constants. All constants in SI units.
Writes the energy distribution function to a file which can be processed by Gnuplot....
void operator()(DeviceType const &device, EDFWrapperT const &edf, const double coordinate_x, const std::string filename) const
Triggers the write process.
void operator()(DeviceType const &device, CellFilterType const &cell_filter, EDFWrapperT const &edf, const std::string filename)
Helper function for writing the energy distribution function at a particular points to a plain text f...
static const double q
Elementary charge.