Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
io_sorted_grid_function_ordering.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2022: G-CSC, Goethe University Frankfurt
3 * Author: Lukas Larisch
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33
34#include "lib_disc/domain.h"
36
38
39namespace ug{
40
41template <typename TDomain, typename TAlgebra>
43{
46
47 typedef std::vector<size_t> ordering_container_type;
49
50 typedef typename TGridFunction::template traits<Vertex>::const_iterator VertexConstIterator;
51
52public:
54 {
55 m_u = spGridFct->clone_without_values();
56 m_name = name;
57 ordering_container_type &o = spOrdAlgo->ordering();
58
59 std::vector<DoFIndex> ind(1);
60 size_t k = 0;
61 for(VertexConstIterator iter = m_u->template begin<Vertex>(); iter != m_u->template end<Vertex>(); ++iter)
62 {
63 // get vertex
64 Vertex* vrt = *iter;
65
66 // get vector holding all indices on the vertex
67 m_u->inner_dof_indices(vrt, 0, ind);
68 DoFRef(*m_u, ind[0]) = o[k++];
69 }
70 }
71
75
76private:
78 const char* m_name;
79};
80
81} //namespace
location name
Definition checkpoint_util.lua:128
Definition smart_pointer.h:108
represents numerical solutions on a grid using an algebraic vector
Definition grid_function.h:121
Definition grid_function_user_data.h:68
Definition IOrderingAlgorithm.h:52
Definition io_sorted_grid_function_ordering.cpp:43
std::vector< size_t > ordering_container_type
Definition io_sorted_grid_function_ordering.cpp:47
SmartPtr< TGridFunction > m_u
Definition io_sorted_grid_function_ordering.cpp:77
const char * m_name
Definition io_sorted_grid_function_ordering.cpp:78
SortedGridFunctionOrdering(SmartPtr< TGridFunction > spGridFct, SmartPtr< ordering_algo_type > spOrdAlgo, const char *name)
Definition io_sorted_grid_function_ordering.cpp:53
GridFunction< TDomain, TAlgebra > TGridFunction
Definition io_sorted_grid_function_ordering.cpp:44
IOrderingAlgorithm< TAlgebra, ordering_container_type > ordering_algo_type
Definition io_sorted_grid_function_ordering.cpp:48
GridFunctionNumberData< GridFunction< TDomain, TAlgebra > > TGridFunctionNumberData
Definition io_sorted_grid_function_ordering.cpp:45
TGridFunction::template traits< Vertex >::const_iterator VertexConstIterator
Definition io_sorted_grid_function_ordering.cpp:50
SmartPtr< TGridFunctionNumberData > get()
Definition io_sorted_grid_function_ordering.cpp:72
Base-class for all vertex-types.
Definition grid_base_objects.h:231
the ug namespace
number & DoFRef(TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
Definition multi_index.h:276