ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
initial_guess_writer.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_IO_INITIALGUESS_WRITER_HPP
2#define VIENNASHE_IO_INITIALGUESS_WRITER_HPP
3
4/* ============================================================================
5 Copyright (c) 2011-2022, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8
9 -----------------
10 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
11 -----------------
12
13 http://viennashe.sourceforge.net/
14
15 License: MIT (X11), see file LICENSE in the base directory
16=============================================================================== */
17
18
23#include <vector>
24#include "viennagrid/accessor.hpp"
25#include "viennagrid/io/vtk_writer.hpp"
26
27namespace viennashe
28{
29 namespace io
30 {
31
38 template<typename MeshT, typename QuanAssembler>
39 void write_initial_guess(MeshT const& mesh, std::string const& key, QuanAssembler qas)
40 {
41 typedef typename viennagrid::result_of::vertex<MeshT>::type VertexType;
42 typedef typename viennagrid::result_of::const_vertex_range<MeshT>::type VertexContainer;
43 typedef typename viennagrid::result_of::iterator<VertexContainer>::type VertexIterator;
44
45 VertexContainer vertices(mesh);
46 std::vector<double> vtk_data(vertices.size());
47 for(VertexIterator vit = vertices.begin(); vit != vertices.end(); vit++)
48 {
49 vtk_data[vit->id().get()] = qas.current_guess_at(*vit);
50 }
51
52 viennagrid::io::vtk_writer<MeshT> my_vtk_writer;
53 my_vtk_writer.add_scalar_data_on_vertices(viennagrid::make_accessor<VertexType>(vtk_data), key);
54 my_vtk_writer(mesh, key);
55 }
56
57 } // io
58} // viennashe
59
60
61#endif
62
void write_initial_guess(MeshT const &mesh, std::string const &key, QuanAssembler qas)
Writes the inital guess to a VTK file.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40