1#ifndef VIENNASHE_IO_SHE_VTK_WRITER_HPP
2#define VIENNASHE_IO_SHE_VTK_WRITER_HPP
26#include "viennagrid/forwards.hpp"
27#include "viennagrid/mesh/mesh.hpp"
28#include "viennagrid/io/vtk_writer.hpp"
70 typedef typename T::ERROR_NO_SHE_VTK_WRITER_FOR_THIS_ELEMENT_TYPE_AVAILABLE
error_type;
107 template <
typename SHEDeviceType,
108 typename CoordSystem =
typename viennagrid::result_of::coordinate_system<typename viennagrid::result_of::point<typename SHEDeviceType::mesh_type>::type>::type >
113 typedef typename SHEDeviceType::mesh_type
MeshType;
115 typedef typename viennagrid::result_of::cell_tag<MeshType>::type
CellTag;
117 typedef typename viennagrid::result_of::point<MeshType>::type
PointType;
118 typedef typename viennagrid::result_of::vertex<MeshType>::type
VertexType;
119 typedef typename viennagrid::result_of::cell<MeshType>::type
CellType;
122 template <
typename DeviceType,
typename SHEQuantity,
typename CellType>
135 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
138 typedef typename viennagrid::result_of::const_vertex_range<SegmentType>::type VertexContainer;
139 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
141 typedef typename viennagrid::result_of::const_cell_range<SegmentType>::type CellContainer;
142 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
144 typedef typename viennagrid::result_of::const_vertex_range<CellType>::type VertexOnCellContainer;
145 typedef typename viennagrid::result_of::iterator<VertexOnCellContainer>::type VertexOnCellIterator;
147 long total_cell_num = 0;
152 VertexContainer vertices(segment);
153 vertex_write_mask_.resize(viennagrid::vertices(
device.
mesh()).size());
154 for (VertexIterator vit = vertices.begin();
155 vit != vertices.end();
158 vertex_write_mask_[
static_cast<std::size_t
>(vit->id().get())].resize(quan.get_value_H_size());
159 for (std::size_t index_H = 0; index_H < quan.get_value_H_size(); ++index_H)
161 vertex_write_mask_[
static_cast<std::size_t
>(vit->id().get())].at(index_H) = -1;
168 CellContainer cells(segment);
169 for (CellIterator cit = cells.begin();
174 for (std::size_t index_H = 0; index_H < quan.get_value_H_size()-1; ++index_H)
181 VertexOnCellContainer vertices_on_cell(*cit);
182 for (VertexOnCellIterator vocit = vertices_on_cell.begin();
183 vocit != vertices_on_cell.end();
186 vertex_write_mask_[
static_cast<std::size_t
>(vocit->id().get())].at(index_H) = 0;
187 vertex_write_mask_[
static_cast<std::size_t
>(vocit->id().get())].at(index_H+1) = 0;
193 return total_cell_num;
197 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
200 typedef typename viennagrid::result_of::const_vertex_range<SegmentType>::type VertexContainer;
201 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
206 VertexContainer vertices(segment);
207 for (VertexIterator vit = vertices.begin();
208 vit != vertices.end();
211 for (std::size_t index_H = 0; index_H < quan.get_value_H_size(); ++index_H)
213 if (vertex_write_mask_[
static_cast<std::size_t
>(vit->id().get())].at(index_H) >= 0)
215 vertex_write_mask_[
static_cast<std::size_t
>(vit->id().get())].at(index_H) = point_num;
229 writer <<
"<?xml version=\"1.0\"?>" << std::endl;
230 writer <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << std::endl;
231 writer <<
" <UnstructuredGrid>" << std::endl;
235 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
236 void writePoints(DeviceType
const &
device, SegmentType
const & segment, SHEQuantity
const & quan, std::ofstream & writer)
238 typedef typename viennagrid::result_of::const_vertex_range<SegmentType>::type VertexContainer;
239 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
242 writer <<
" <Points>" << std::endl;
243 writer <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">" << std::endl;
245 VertexContainer vertices(segment);
246 for (VertexIterator vit = vertices.begin();
247 vit != vertices.end();
250 for (std::size_t index_H = 0; index_H < quan.get_value_H_size(); ++index_H)
252 if (vertex_write_mask_[
static_cast<std::size_t
>(vit->id().get())].at(index_H) >= 0)
254 writer << viennagrid::point(*vit)[0] <<
" ";
255 if (viennagrid::point(*vit).size() == 1)
258 writer << viennagrid::point(*vit)[1] <<
" ";
259 writer << quan.get_value_H(index_H) <<
" ";
265 writer <<
" </DataArray>" << std::endl;
266 writer <<
" </Points> " << std::endl;
270 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
271 void writeCells(DeviceType
const &
device, SegmentType
const & segment, SHEQuantity
const & quan, std::ofstream & writer)
273 typedef typename viennagrid::result_of::const_cell_range<SegmentType>::type CellContainer;
274 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
276 typedef typename viennagrid::result_of::const_vertex_range<CellType>::type VertexOnCellContainer;
277 typedef typename viennagrid::result_of::iterator<VertexOnCellContainer>::type VertexOnCellIterator;
279 writer <<
" <Cells> " << std::endl;
280 writer <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">" << std::endl;
281 CellContainer cells(segment);
285 for (std::size_t index_H = 0; index_H < quan.get_value_H_size() - 1; ++index_H)
287 std::size_t index_H_other = index_H + 1;
289 for (CellIterator cit = cells.begin();
296 VertexOnCellContainer vertices_on_cell(*cit);
298 if (vertices_on_cell.size() == 2)
300 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[0].
id().get())].at(index_H) <<
" ";
301 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[1].
id().get())].at(index_H) <<
" ";
303 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[1].
id().get())].at(index_H_other) <<
" ";
304 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[0].
id().get())].at(index_H_other) <<
" ";
307 else if (vertices_on_cell.size() == 4)
309 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[0].
id().get())].at(index_H) <<
" ";
310 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[1].
id().get())].at(index_H) <<
" ";
311 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[3].
id().get())].at(index_H) <<
" ";
312 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[2].
id().get())].at(index_H) <<
" ";
314 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[0].
id().get())].at(index_H_other) <<
" ";
315 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[1].
id().get())].at(index_H_other) <<
" ";
316 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[3].
id().get())].at(index_H_other) <<
" ";
317 writer << vertex_write_mask_[static_cast<std::size_t>(vertices_on_cell[2].
id().get())].at(index_H_other) <<
" ";
322 for (VertexOnCellIterator vocit = vertices_on_cell.begin();
323 vocit != vertices_on_cell.end();
326 writer << vertex_write_mask_[static_cast<std::size_t>(vocit->id().get())].at(index_H) <<
" ";
329 for (VertexOnCellIterator vocit = vertices_on_cell.begin();
330 vocit != vertices_on_cell.end();
333 writer << vertex_write_mask_[static_cast<std::size_t>(vocit->id().get())].at(index_H_other) <<
" ";
343 writer <<
" </DataArray>" << std::endl;
345 writer <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">" << std::endl;
346 for (std::size_t offsets = 1;
350 writer << (offsets * viennagrid::boundary_elements<CellTag, viennagrid::vertex_tag>::num * 2) <<
" ";
353 writer <<
" </DataArray>" << std::endl;
355 writer <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">" << std::endl;
356 for (std::size_t offsets = 1;
360 writer << result_of::she_vtk_type<CellTag>::value <<
" ";
363 writer <<
" </DataArray>" << std::endl;
364 writer <<
" </Cells>" << std::endl;
368 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
370 SegmentType
const & segment,
371 SHEQuantity
const & quan,
372 std::ofstream & writer, std::string name_in_file =
"result")
374 typedef typename viennagrid::result_of::const_vertex_range<SegmentType>::type VertexContainer;
375 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
378 writer <<
" <PointData Scalars=\"scalars\">" << std::endl;
379 writer <<
" <DataArray type=\"Float64\" Name=\"" << name_in_file <<
"\" format=\"ascii\">" << std::endl;
381 VertexContainer vertices(segment);
382 for (VertexIterator vit = vertices.begin();
383 vit != vertices.end();
386 for (
size_t index_H = 0; index_H < quan.get_value_H_size(); ++index_H)
388 if (vertex_write_mask_[vit->id().get()].at(index_H) >= 0)
390 writer << quan.get_values(*vit, index_H)[0] <<
" ";
396 writer <<
" </DataArray>" << std::endl;
397 writer <<
" </PointData>" << std::endl;
415 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
417 SegmentType
const & segment,
419 SHEQuantity
const & quan,
420 std::ofstream & writer,
423 typedef typename viennagrid::result_of::const_cell_range<SegmentType>::type CellContainer;
424 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
426 std::string quantity_name = quan.get_name();
438 default:
throw std::runtime_error(
"Internal error: Unknown quan_id in she_vtk_writer::writeCellDataArray()");
443 writer <<
" <DataArray type=\"Float64\" Name=\"Generalized " << quantity_name <<
"\" format=\"ascii\">" << std::endl;
445 CellContainer cells(segment);
448 for (std::size_t index_H = 0; index_H < quan.get_value_H_size() - 1; ++index_H)
453 for (CellIterator cit = cells.begin();
467 value = quan.get_values(*cit, index_H)[0] * dos;
470 value = quan.get_values(*cit, index_H)[0];
479 value = quan.get_values(*cit, index_H)[0];
483 value = (dos > 0) ? quan.get_values(*cit, index_H)[0] / dos : 0;
494 default:
throw std::runtime_error(
"Internal error: Unknown quan_id in she_vtk_writer::writeCellDataArray()");
497 writer << value <<
" ";
501 writer <<
" </DataArray>" << std::endl;
505 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantity>
507 SegmentType
const & segment,
509 SHEQuantity
const & quan,
510 std::ofstream & writer)
512 writer <<
" <CellData Scalars=\"scalars\">" << std::endl;
527 writer <<
" </CellData>" << std::endl;
532 writer <<
" </UnstructuredGrid>" << std::endl;
533 writer <<
"</VTKFile>" << std::endl;
536 template <
typename DeviceType,
typename SegmentType>
539 typedef typename viennagrid::result_of::const_cell_range<SegmentType>::type CellSegmentContainer;
540 typedef typename viennagrid::result_of::iterator<CellSegmentContainer>::type CellSegmentIterator;
542 CellSegmentContainer cells(segment);
543 for (CellSegmentIterator cit = cells.begin();
553 template <
typename DeviceType,
typename SegmentType,
typename SHEQuantityT>
555 SegmentType
const & segment,
557 SHEQuantityT
const & quan,
558 std::string filename)
560 std::ofstream writer(filename.c_str());
570 writer <<
" <Piece NumberOfPoints=\""
572 <<
"\" NumberOfCells=\""
574 <<
"\">" << std::endl;
582 writer <<
" </Piece>" << std::endl;
599 template <
typename DeviceType,
typename SHEQuantityT>
602 SHEQuantityT
const & quan,
603 std::string
const & filename)
605 typedef typename viennagrid::result_of::segmentation<MeshType>::type SegmentationType;
606 typedef typename SegmentationType::segment_handle_type SegmentHandleType;
613 std::stringstream ss;
614 ss << filename <<
"_main.pvd";
615 std::ofstream writer(ss.str().c_str());
617 std::string short_filename = filename;
618 std::string::size_type pos = filename.rfind(
"/");
619 if (pos == std::string::npos)
620 pos = filename.rfind(
"\\");
622 if (pos != std::string::npos)
623 short_filename = filename.substr(pos+1, filename.size());
625 writer <<
"<?xml version=\"1.0\"?>" << std::endl;
626 writer <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\" compressor=\"vtkZLibDataCompressor\">" << std::endl;
627 writer <<
"<Collection>" << std::endl;
631 SegmentHandleType
const & seg = *it;
632 writer <<
" <DataSet part=\"" << seg.id() <<
"\" file=\"" << short_filename <<
"_" << seg.id() <<
".vtu\" name=\"Segment_" << seg.id() <<
"\"/>" << std::endl;
635 writer <<
" </Collection>" << std::endl;
636 writer <<
"</VTKFile>" << std::endl;
644 SegmentHandleType
const & seg = *it;
647 ss << filename <<
"_" << seg.id() <<
".vtu";
668 std::vector<viennashe::she_index_vector_type> vertex_write_mask_;
669 bool write_segments_;
670 bool with_debug_quantities_;
679 template <
typename DeviceType >
683 template <
typename DataType>
685 DataType
const & data,
686 std::string
const & filename, std::string name_in_file =
"result")
688 (void)
device; (void)data; (void)filename; (void)name_in_file;
689 log::warning() <<
"* she_vtk_writer::operator(): Cannot write distribution function for 3d devices. Skipping..." << std::endl;
700 template <
typename QuantityType,
703 DeviceType
const &
device,
704 std::string filename,
705 std::string name_in_file =
"viennashe_quantity")
707 typedef typename DeviceType::mesh_type MeshType;
709 typedef typename viennagrid::result_of::vertex<MeshType>::type VertexType;
710 typedef typename viennagrid::result_of::const_vertex_range<MeshType>::type VertexContainer;
711 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
715 VertexContainer vertices(mesh);
716 std::vector<double> vtk_data(vertices.size());
717 for (VertexIterator vit = vertices.begin();
718 vit != vertices.end();
721 vtk_data[vit->id().get()] = quantity(*vit);
724 log::info<log_she_vtk_writer>() <<
"* write_quantity_to_VTK_file(): Writing data to '"
726 <<
"' (can be viewed with e.g. ParaView)" << std::endl;
728 viennagrid::io::vtk_writer<MeshType> my_vtk_writer;
729 my_vtk_writer.add_scalar_data_on_vertices(viennagrid::make_accessor<VertexType>(vtk_data), name_in_file);
741 template <
typename QuantityType,
744 DeviceType
const &
device,
745 std::string filename,
746 std::string name_in_file =
"viennashe_quantity")
748 typedef typename DeviceType::mesh_type MeshType;
750 typedef typename viennagrid::result_of::cell<MeshType>::type CellType;
751 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
752 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
756 CellContainer cells(mesh);
757 std::vector<double> vtk_data(cells.size());
758 for (CellIterator cit = cells.begin();
762 vtk_data[
static_cast<std::size_t
>(cit->id().get())] = quantity(*cit);
765 log::info<log_she_vtk_writer>() <<
"* write_quantity_to_VTK_file(): Writing data to '"
767 <<
"' (can be viewed with e.g. ParaView)" << std::endl;
769 viennagrid::io::vtk_writer<MeshType> my_vtk_writer;
770 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(vtk_data), name_in_file);
777 template <
typename T>
780 typedef viennagrid::vertex_tag
type;
783 template <
typename DeviceType,
typename TagT>
794 template <
typename QuantityType,
797 DeviceType
const &
device,
798 std::string filename,
799 std::string name_in_file,
800 viennagrid::vertex_tag)
805 template <
typename QuantityType,
809 DeviceType
const &
device,
810 std::string filename,
811 std::string name_in_file,
822 template <
typename QuantityType,
825 DeviceType
const &
device,
826 std::string filename,
827 std::string name_in_file =
"viennashe_quantity")
836 template <
typename ContainerType,
typename KeyType,
typename ValueType>
844 value_type const &
operator()(KeyType
const & key)
const { cached_value_ = container_.at(
static_cast<std::size_t
>(key.id().get()));
return cached_value_; }
845 value_type const &
operator[](KeyType
const & key)
const { cached_value_ = container_.at(
static_cast<std::size_t
>(key.id().get()));
return cached_value_; }
846 value_type const &
at(KeyType
const & key)
const { cached_value_ = container_.at(
static_cast<std::size_t
>(key.id().get()));
return cached_value_; }
854 ContainerType
const & container_;
858 template <
typename KeyType,
typename ValueType,
typename ContainerType>
867 template <
typename DeviceType>
869 std::string filename,
870 bool include_debug_information =
false)
873 typedef typename DeviceType::mesh_type MeshType;
874 typedef typename viennagrid::result_of::cell<MeshType>::type CellType;
876 typedef typename SimulatorType::unknown_quantity_type UnknownQuantityType;
880 viennagrid::io::vtk_writer<MeshType> my_vtk_writer;
882 std::deque<std::vector<double> > electric_field(viennagrid::cells(
device.
mesh()).size(), std::vector<double>(3));
883 std::deque<std::vector<double> > current_n(viennagrid::cells(
device.
mesh()).size(), std::vector<double>(3));
884 std::deque<std::vector<double> > current_p(viennagrid::cells(
device.
mesh()).size(), std::vector<double>(3));
885 std::deque<std::vector<double> > carrier_velocity_n(viennagrid::cells(
device.
mesh()).size(), std::vector<double>(3));
886 std::deque<std::vector<double> > carrier_velocity_p(viennagrid::cells(
device.
mesh()).size(), std::vector<double>(3));
887 std::deque<double> pwr_density_container(viennagrid::cells(
device.
mesh()).size());
888 std::deque<double> avg_energy_n(viennagrid::cells(
device.
mesh()).size());
889 std::deque<double> avg_energy_p(viennagrid::cells(
device.
mesh()).size());
890 std::deque<double> avg_trap_occupancy(viennagrid::cells(
device.
mesh()).size());
895 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(
device.
doping_n()),
"Donator Doping");
896 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(
device.
doping_p()),
"Acceptor Doping");
897 my_vtk_writer.add_scalar_data_on_cells( detail::make_accessor<CellType, double>(
device.
material()),
"Material IDs");
905 for (std::size_t quan_index = 0; quan_index < unknown_quans.size(); ++quan_index)
907 UnknownQuantityType
const & quan = unknown_quans.at(quan_index);
909 bool quantity_is_from_she =
false;
917 my_vtk_writer.add_vector_data_on_cells(viennagrid::make_accessor<CellType>(electric_field),
"Electric Field");
925 quantity_is_from_she =
true;
934 my_vtk_writer.add_vector_data_on_cells(viennagrid::make_accessor<CellType>(carrier_velocity_n),
"Electron avg. carrier drift velocity");
939 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(avg_energy_n),
"Electron avg. energy");
949 my_vtk_writer.add_vector_data_on_cells(viennagrid::make_accessor<CellType>(current_n),
"Electron current density");
957 quantity_is_from_she =
true;
966 my_vtk_writer.add_vector_data_on_cells(viennagrid::make_accessor<CellType>(carrier_velocity_p),
"Hole avg. carrier drift velocity");
971 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(avg_energy_p),
"Hole avg. energy");
981 my_vtk_writer.add_vector_data_on_cells(viennagrid::make_accessor<CellType>(current_p),
"Hole current density");
988 typedef typename SimulatorType::SHETimeStepQuantitiesT QuantitiesType;
991 PowerDensityAccessorType pdacc(
device,
997 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(pwr_density_container),
"Joule heating power density");
1001 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(quan.values()), quan.get_name());
1002 if (!quantity_is_from_she && include_debug_information)
1004 my_vtk_writer.add_scalar_data_on_cells(detail::make_accessor<CellType, double>(quan.boundary_types()), quan.get_name() +
" boundary types");
1005 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(quan.boundary_values()), quan.get_name() +
" boundary values");
1006 my_vtk_writer.add_scalar_data_on_cells(detail::make_accessor<CellType, double>(quan.defined_but_unknown_mask()), quan.get_name() +
" mask");
1007 my_vtk_writer.add_scalar_data_on_cells(detail::make_accessor<CellType, double>(quan.unknowns_indices()), quan.get_name() +
" indices");
1014 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
1015 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
1018 for (CellIterator cit = cells.begin();
1022 avg_trap_occupancy[
static_cast<std::size_t
>(cit->id().get())] = 0;
1028 if (num_traps == 0)
continue;
1030 for (std::size_t i = 0; i < num_traps; ++i)
1035 ft = ft / num_traps;
1036 avg_trap_occupancy[
static_cast<std::size_t
>(cit->id().get())] = ft;
1039 my_vtk_writer.add_scalar_data_on_cells(viennagrid::make_accessor<CellType>(avg_trap_occupancy),
"Average trap occupancy");
The main SHE configuration class. To be adjusted by the user for his/her needs.
viennashe::physics::dispersion_proxy dispersion_relation(viennashe::carrier_type_id ctype) const
Returns the dispersion relation for electrons.
equation_id get_electron_equation() const
equation_id get_hole_equation() const
bool with_traps() const
Returns true if traps are considered in the simulation.
she_discretization_type_id she_discretization_type() const
segmentation_type const & segmentation() const
long get_material(cell_type const &elem) const
Returns the material id of the provided cell.
std::vector< double > const & doping_p() const
std::vector< material_id_type > const & material() const
MeshT const & mesh() const
Returns the underlying mesh.
std::vector< double > const & doping_n() const
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Power density accessor. Used to get the power density in the assembly of the heat diffusion equation.
Exception which is thrown if a file cannot be opened.
value_type const & at(KeyType const &key) const
value_type const & operator[](KeyType const &key) const
container_accessor(ContainerType const &container)
value_type const & operator()(KeyType const &key) const
value_type const * find(KeyType const &) const
void operator()(DeviceType const &device, DataType const &data, std::string const &filename, std::string name_in_file="result")
void with_debug_quantities(bool b)
void operator()(DeviceType const &device, viennashe::config const &conf, SHEQuantityT const &quan, std::string const &filename)
Triggers the write process.
void writePointData(DeviceType const &device, SegmentType const &segment, SHEQuantity const &quan, std::ofstream &writer, std::string name_in_file="result")
Implementation for writing the data (that is usually the energy distribution function) to the vertice...
void write_segments(bool b)
long get_cell_num(DeviceType const &device, SegmentType const &segment, SHEQuantity const &quan)
Determines the number of cells in the output mesh in (x, H)-space.
viennagrid::result_of::point< MeshType >::type PointType
@ VIENNASHE_SHE_VTK_QUAN_UNKNOWN_NUM
@ VIENNASHE_SHE_VTK_QUAN_GROUP_VELOCITY
@ VIENNASHE_SHE_VTK_QUAN_UNKNOWN_INDEX
@ VIENNASHE_SHE_VTK_QUAN_DENSITY_OF_STATES
@ VIENNASHE_SHE_VTK_QUAN_KINETIC_ENERGY
@ VIENNASHE_SHE_VTK_QUAN_INVALID
@ VIENNASHE_SHE_VTK_QUAN_UNKNOWN_MASK
@ VIENNASHE_SHE_VTK_QUAN_DISTRIBUTION_FUNCTION
@ VIENNASHE_SHE_VTK_QUAN_GENERALIZED_DISTRIBUTION_FUNCTION
@ VIENNASHE_SHE_VTK_QUAN_EXPANSION_ORDER
@ VIENNASHE_SHE_VTK_QUAN_EXPANSION_ADAPTION
void writeCellDataArray(DeviceType const &device, SegmentType const &segment, viennashe::config const &conf, SHEQuantity const &quan, std::ofstream &writer, quantity_ids quan_id)
Writes data defined on cells to file.
void writeCells(DeviceType const &device, SegmentType const &segment, SHEQuantity const &quan, std::ofstream &writer)
Implementation for writing the cells in (x, H)-space (derived from a mesh in x-space)
viennagrid::result_of::cell< MeshType >::type CellType
void writeFooter(std::ofstream &writer)
bool with_debug_quantities() const
SHEDeviceType::mesh_type MeshType
void writeCellData(DeviceType const &device, SegmentType const &segment, viennashe::config const &conf, SHEQuantity const &quan, std::ofstream &writer)
Writes data defined on cells to file.
viennagrid::result_of::vertex< MeshType >::type VertexType
void writePoints(DeviceType const &device, SegmentType const &segment, SHEQuantity const &quan, std::ofstream &writer)
Implementation for writing the vertex coordinates in (x, H)-space.
void write_segment(DeviceType const &device, SegmentType const &segment, viennashe::config const &conf, SHEQuantityT const &quan, std::string filename)
void writeHeader(std::ofstream &writer)
Writes the VTK XML file header for the unstructured grid file format.
bool segment_is_semiconductor_only(DeviceType const &device, SegmentType const &segment)
bool write_segments() const
viennagrid::result_of::cell_tag< MeshType >::type CellTag
bool is_valid(DeviceType const &device, SHEQuantity const &quan, CellType const &cell, std::size_t index_H)
Checks whether a certain cell in x-space is inside the conduction band or the valence band at total e...
long get_point_num(DeviceType const &device, SegmentType const &segment, SHEQuantity const &quan)
Determines the number of vertices of the output mesh in (x, H)-space.
A proxy object for a dispersion relation. Does NOT take ownership of the provided pointer!
double density_of_states(double ekin, double theta=0, double phi=0) const
Returns the density of states as a function of kinetic energy (and angles, eventually)
double velocity(double ekin, double theta=0, double phi=0) const
Returns the velocity as a function of kinetic energy (and angles, eventually)
UnknownSHEQuantityType const & electron_distribution_function() const
ResultQuantityType potential() const
UnknownSHEQuantityType const & hole_distribution_function() const
std::deque< UnknownQuantityType > & unknown_quantities()
double trap_occupancy(CellType const &c, std::size_t inner_index) const
std::size_t num_trap_unknown_indices(CellType const &c) const
Returns the number of inner unknown indices (aka. degree of freedom - dof) for traps associated with ...
Class for self-consistent SHE simulations.
viennashe::config const & config() const
Returns the config object used by the simulator controller.
SHETimeStepQuantitiesT const & quantity_history(std::size_t index) const
Returns a wrapper for the trap occupancy, which can be evaluated in every vertex of the mesh.
DeviceType const & device() const
SHETimeStepQuantitiesT const & quantities() const
Returns the controller object. Const version.
potential_type potential() const
Returns a wrapper for the potential, which can be evaluated in every vertex of the mesh.
A functor-style wrapper for a spatial quantity (typically potential, electron density or hole density...
The SHE configuration class is defined here.
Computes the electric field from a potential.
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.
A logging facility providing fine-grained control over logging in ViennaSHE.
A very simple material database. Needs to be replaced by something more versatile soon.
container_accessor< ContainerType, KeyType, ValueType > make_accessor(ContainerType const &c)
void write_quantity_to_VTK_file(QuantityType const &quantity, DeviceType const &device, std::string filename, std::string name_in_file, viennagrid::vertex_tag)
void write_vertex_quantity_to_VTK_file(QuantityType const &quantity, DeviceType const &device, std::string filename, std::string name_in_file="viennashe_quantity")
Convenience routine for writing a single macroscopic quantity to a VTK file.
void write_quantities_to_VTK_file(viennashe::simulator< DeviceType > const &simulator_obj, std::string filename, bool include_debug_information=false)
Generic interface function for writing simulated quantities to a VTK file.
void write_cell_quantity_to_VTK_file(QuantityType const &quantity, DeviceType const &device, std::string filename, std::string name_in_file="viennashe_quantity")
Convenience routine for writing a single macroscopic quantity to a VTK file.
void write_quantity_to_VTK_file(QuantityType const &quantity, DeviceType const &device, std::string filename, std::string name_in_file="viennashe_quantity")
Generic interface function for writing a quantity to a VTK file. Automatically dispatches between ver...
logger< true > warning()
Used to log warnings. The logging level is logWARNING.
bool is_semiconductor(long material_id)
Convenience function for checking whether the supplied material ID refers to a semiconductor.
viennashe::models::dd::mobility< DeviceType > create_constant_mobility_model(DeviceType const &device, double mu)
Returns a mobility model, which always yields the same mobility.
std::string lattice_temperature()
std::string hole_density()
std::string electron_density()
double averaged_density_of_states(SHEQuantity const &quan, viennashe::config::dispersion_relation_type const &dispersion, CellFacetType const &cell_facet, std::size_t index_H)
Returns the density of states around a vertex or an edge at total energy specified by index_H....
void write_kinetic_carrier_energy_to_container(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, ContainerType &container)
Convenience function for writing the average kinetic carrier energy to the container provided.
void write_current_density_to_container(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, ContainerType &container)
Convenience function for writing the current density to the container provided.
void write_carrier_velocity_to_container(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, ContainerType &container)
Convenience function for writing the average expansion order to the container provided.
The main ViennaSHE namespace. All functionality resides inside this namespace.
void write_current_density_to_container(DeviceType const &device, PotentialQuantityType const &potential, CarrierQuantityType const &carrier, viennashe::carrier_type_id ctype, MobilityModel const &mobility_model, ContainerType &container)
Convenience function for writing the electric field to a container.
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_GENERALIZED_DF
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_DF
void write_electric_field_to_container(DeviceType const &device, PotentialAccessor const &potential, ContainerType &container)
Convenience function for writing the electric field to a container.
void write_macroscopic_quantity_to_container(DeviceType const &device, MacroscopicQuantityAccessor const &quantity, ContainerType &quantity_container)
Writes the provided macroscopic quantity to the container provided.
Provides a number of fundamental constants. All constants in SI units.
Computes the current density (both Jn and Jp) after using a drift diffusion solution.
Convenience header, which includes all postprocessing quantities available.
Defines a generic simulator quantity for use within the solvers of ViennaSHE.
Meta function which translates element tags to VTK type identifiers (taking extra energy coordinate i...
T::ERROR_NO_SHE_VTK_WRITER_FOR_THIS_ELEMENT_TYPE_AVAILABLE error_type
Helper routine for extracting the ViennaGrid topology tag from a quantity wrapper....
viennagrid::vertex_tag type
Defines the log keys used within the viennashe::io namespace.