Line data Source code
1 : /*
2 : * Copyright (c) 2014-2019: G-CSC, Goethe University Frankfurt
3 : * Author: Martin Stepniewski
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 __H__LIB_GRID__GLOBAL_SUBDIVISION_MULTI_GRID_REFINER__
34 : #define __H__LIB_GRID__GLOBAL_SUBDIVISION_MULTI_GRID_REFINER__
35 :
36 : #include "lib_grid/lg_base.h"
37 : #include "lib_grid/multi_grid.h"
38 : #include "global_multi_grid_refiner.h"
39 : #include "lib_grid/algorithms/subdivision/subdivision_volumes.h"
40 :
41 : namespace ug
42 : {
43 :
44 : /// \addtogroup lib_grid_algorithms_refinement
45 : /// @{
46 :
47 : /// Specialization of the GlobalMultiGridRefiner class to incorporate subdivision refinement
48 : /** Each step of global refinement is subsequently followed by
49 : * a vertex smoothing pass determined by a user-specified subdivision scheme.
50 : *
51 : * Currently this only works in 2d and 3d.
52 : */
53 : template <class TAPosition>
54 : class GlobalSubdivisionMultiGridRefiner : public GlobalMultiGridRefiner
55 : {
56 : public:
57 : GlobalSubdivisionMultiGridRefiner(SPRefinementProjector projector = SPNULL);
58 :
59 : GlobalSubdivisionMultiGridRefiner(MultiGrid& mg, SPRefinementProjector projector = SPNULL);
60 :
61 : GlobalSubdivisionMultiGridRefiner(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& sh,
62 : MGSubsetHandler& markSH, SPRefinementProjector projector = SPNULL);
63 :
64 : virtual ~GlobalSubdivisionMultiGridRefiner();
65 :
66 : /// sets the manifold subsets which shall be linearly refined
67 : void set_linear_manifold_subsets(MGSubsetHandler& linearManifoldSH, const char* linearManifoldSubsets);
68 :
69 : /// sets the default SubsetHandler
70 0 : void assign_subset_handler(MGSubsetHandler* sh) {m_pSH = sh;}
71 0 : void assign_subset_handler(MGSubsetHandler& sh) {m_pSH = &sh;}
72 :
73 : /// sets the SubsetHandler designated for obligatory marked manifold elements
74 0 : void assign_mark_subset_handler(MGSubsetHandler* markSH) {m_pMarkSH = markSH;}
75 0 : void assign_mark_subset_handler(MGSubsetHandler& markSH) {m_pMarkSH = &markSH;}
76 :
77 : /// sets the position attachment depending on the world dimension
78 : void assign_position_attachment(TAPosition* aPos);
79 : void assign_position_attachment(TAPosition& aPos);
80 :
81 : /// sets constrained subdivision volumes scheme
82 0 : void set_constrained_subdivision(bool constrained) {m_bConstrained = constrained;}
83 :
84 : /// projection of the vertices of all levels to their smooth subdivision limit positions to ensure node nested hierarchy
85 : void nest_hierarchy();
86 :
87 : protected:
88 : /// performs subdivision smoothing on the marked elements after base class regular refinement
89 : void smooth();
90 :
91 : /// wrapper for smooth() method in parallel case (see class ParallelGlobalSubdivisionRefiner)
92 : virtual void refinement_step_ends();
93 :
94 : protected:
95 : MGSubsetHandler* m_pSH;
96 : MGSubsetHandler* m_pMarkSH;
97 : MGSubsetHandler* m_spLinearManifoldSH;
98 : // SmartPtr<MGSubsetHandler> m_spLinearManifoldSH;
99 : TAPosition* m_pAPos;
100 : bool m_bConstrained;
101 : };
102 :
103 : /// @}
104 : }// end of namespace
105 :
106 : #endif
|