Line data Source code
1 : /*
2 : * Copyright (c) 2020: 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 : #ifndef UG_BASE_LIB_ALGEBRA_ORDERING_STRATEGIES_ALGORITHMS_IORDERINGALGORITHM_H
34 : #define UG_BASE_LIB_ALGEBRA_ORDERING_STRATEGIES_ALGORITHMS_IORDERINGALGORITHM_H
35 :
36 : #include "common/util/smart_pointer.h"
37 :
38 : namespace ug{
39 :
40 : /*
41 : Interface for ordering algorithms. O_t denotes the ordering container type.
42 : Ordering algorithms have to implement
43 : compute() - triggers computation of an ordering
44 : as well as
45 : ordering() - returns a reference to an ordering of type O_t
46 : O_t usually is a std::vector<size_t>
47 : G_t (not required here) denotes the underlying graph type, e.g.,
48 : a boost graph
49 : */
50 :
51 : template <typename TAlgebra, typename O_t=std::vector<size_t> >
52 : class IOrderingAlgorithm{
53 : public:
54 : typedef typename TAlgebra::matrix_type M_t;
55 : typedef typename TAlgebra::vector_type V_t;
56 :
57 0 : IOrderingAlgorithm(){}
58 : virtual ~IOrderingAlgorithm(){}
59 :
60 : virtual void compute() = 0;
61 : virtual void check() = 0;
62 :
63 : virtual O_t& ordering() = 0;
64 :
65 : //lib_algebra only
66 : virtual void init(M_t*) = 0;
67 : //lib_disc
68 : virtual void init(M_t*, const V_t&) = 0;
69 : //lib_algebra only, induced matrix
70 : virtual void init(M_t*, const std::vector<size_t>&) = 0;
71 : //lib_disc, induced matrix
72 : virtual void init(M_t*, const V_t&, const std::vector<size_t>&) = 0;
73 :
74 : virtual SmartPtr<IOrderingAlgorithm<TAlgebra, O_t> > clone() = 0;
75 :
76 : virtual const char* name() const = 0;
77 : };
78 :
79 : }
80 :
81 : #endif
|