Line data Source code
1 : /*
2 : * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Sebastian Reiter
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 : #include "grid_objects_1d.h"
34 :
35 : namespace ug{
36 :
37 : ////////////////////////////////////////////////////////////////////////
38 : // RegularEdge
39 0 : bool RegularEdge::refine(std::vector<Edge*>& vNewEdgesOut, Vertex* newVertex,
40 : Vertex** pSubstituteVrts)
41 : {
42 : vNewEdgesOut.clear();
43 0 : if(pSubstituteVrts)
44 : {
45 0 : vNewEdgesOut.push_back(new RegularEdge(pSubstituteVrts[0], newVertex));
46 0 : vNewEdgesOut.push_back(new RegularEdge(newVertex, pSubstituteVrts[1]));
47 : }
48 : else
49 : {
50 0 : vNewEdgesOut.push_back(new RegularEdge(vertex(0), newVertex));
51 0 : vNewEdgesOut.push_back(new RegularEdge(newVertex, vertex(1)));
52 : }
53 0 : return true;
54 : }
55 :
56 0 : bool RegularEdge::refine(std::vector<RegularEdge*>& vNewEdgesOut, Vertex* newVertex,
57 : Vertex** pSubstituteVrts)
58 : {
59 0 : return refine(reinterpret_cast<std::vector<Edge*>&>(vNewEdgesOut),
60 0 : newVertex, pSubstituteVrts);
61 : }
62 :
63 : ////////////////////////////////////////////////////////////////////////
64 : // ConstrainedEdge
65 0 : bool ConstrainedEdge::refine(std::vector<Edge*>& vNewEdgesOut, Vertex* newVertex,
66 : Vertex** pSubstituteVrts)
67 : {
68 : vNewEdgesOut.clear();
69 0 : if(pSubstituteVrts)
70 : {
71 0 : vNewEdgesOut.push_back(new ConstrainedEdge(pSubstituteVrts[0], newVertex));
72 0 : vNewEdgesOut.push_back(new ConstrainedEdge(newVertex, pSubstituteVrts[1]));
73 : }
74 : else
75 : {
76 0 : vNewEdgesOut.push_back(new ConstrainedEdge(vertex(0), newVertex));
77 0 : vNewEdgesOut.push_back(new ConstrainedEdge(newVertex, vertex(1)));
78 : }
79 0 : return true;
80 : }
81 :
82 0 : bool ConstrainedEdge::refine(std::vector<ConstrainedEdge*>& vNewEdgesOut, Vertex* newVertex,
83 : Vertex** pSubstituteVrts)
84 : {
85 0 : return refine(reinterpret_cast<std::vector<Edge*>&>(vNewEdgesOut),
86 0 : newVertex, pSubstituteVrts);
87 : }
88 :
89 : ////////////////////////////////////////////////////////////////////////
90 : // ConstrainingEdge
91 0 : bool ConstrainingEdge::refine(std::vector<Edge*>& vNewEdgesOut, Vertex* newVertex,
92 : Vertex** pSubstituteVrts)
93 : {
94 : vNewEdgesOut.clear();
95 0 : if(pSubstituteVrts)
96 : {
97 0 : vNewEdgesOut.push_back(new ConstrainingEdge(pSubstituteVrts[0], newVertex));
98 0 : vNewEdgesOut.push_back(new ConstrainingEdge(newVertex, pSubstituteVrts[1]));
99 : }
100 : else
101 : {
102 0 : vNewEdgesOut.push_back(new ConstrainingEdge(vertex(0), newVertex));
103 0 : vNewEdgesOut.push_back(new ConstrainingEdge(newVertex, vertex(1)));
104 : }
105 0 : return true;
106 : }
107 :
108 0 : bool ConstrainingEdge::refine(std::vector<ConstrainingEdge*>& vNewEdgesOut, Vertex* newVertex,
109 : Vertex** pSubstituteVrts)
110 : {
111 0 : return refine(reinterpret_cast<std::vector<Edge*>&>(vNewEdgesOut),
112 0 : newVertex, pSubstituteVrts);
113 : }
114 :
115 : template <> size_t
116 0 : ConstrainingEdge::
117 : num_constrained<Vertex>() const
118 : {
119 0 : return num_constrained_vertices();
120 : }
121 :
122 : template <> size_t
123 0 : ConstrainingEdge::
124 : num_constrained<Edge>() const
125 : {
126 0 : return num_constrained_edges();
127 : }
128 :
129 : template <> Vertex*
130 0 : ConstrainingEdge::
131 : constrained<Vertex>(size_t ind) const
132 : {
133 0 : return constrained_vertex(ind);
134 : }
135 :
136 : template <> Edge*
137 0 : ConstrainingEdge::
138 : constrained<Edge>(size_t ind) const
139 : {
140 0 : return constrained_edge(ind);
141 : }
142 :
143 : }// end of namespace
|