Line data Source code
1 : /*
2 : * Copyright (c) 2014-2015: 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 :
34 : #ifndef __H_MANIFOLD_ASSEMBLE_UTIL__
35 : #define __H_MANIFOLD_ASSEMBLE_UTIL__
36 :
37 : #include "bindings/lua/lua_user_data.h"
38 : #include "common/util/smart_pointer.h"
39 : #include "lib_disc/spatial_disc/domain_disc.h"
40 :
41 : // other ug4 modules
42 : #include "common/common.h"
43 : #include "lib_grid/tools/subset_group.h"
44 : #include "lib_disc/common/function_group.h"
45 : #include "lib_disc/common/groups_util.h"
46 : #include "lib_disc/spatial_disc/elem_disc/elem_disc_interface.h"
47 :
48 :
49 : namespace ug {
50 :
51 :
52 : /**
53 : * This function marks all grid elements of type TElem for assembly BUT H-slaves in a BoolMarker.
54 : *
55 : * \param[out] grid Grid
56 : * \param[out] bMarker BoolMarker containing all marked elements of type TElem
57 : * BUT H-slaves
58 : */
59 : template <typename TElem>
60 : static void MarkAllElemsForAssemblyButHSlaves(Grid& grid, BoolMarker& bMarker)
61 : {
62 : typedef typename Grid::traits<TElem>::iterator ElemIter;
63 :
64 : // Loop all elements and unmark H slaves
65 : for(ElemIter eIter = grid.begin<TElem>(); eIter != grid.end<TElem>(); ++eIter)
66 : {
67 : TElem* e = *eIter;
68 : if(grid.distributed_grid_manager()->contains_status(e, ES_H_SLAVE))
69 : bMarker.unmark(e);
70 : else
71 : bMarker.mark(e);
72 : }
73 : }
74 :
75 : /**
76 : * This function marks all elements for assembly BUT H-slaves in a BoolMarker and sets it
77 : * in the assemble tuner of the given assemble object. Necessary to avoid multiple assembly
78 : * of manifold elements when using inner_boundary discretization in parallel mode.
79 : *
80 : * \param[out] grid Smart pointer to assemble object with assemble tuner as member
81 : * \param[out] ass Grid
82 : */
83 : template <typename TAlgebra>
84 0 : static void MarkAllElemsForAssemblyButHSlaves(SmartPtr<IAssemble<TAlgebra> > ass, Grid& grid)
85 : {
86 : // TODO: encapsulate BoolMarker in SmartPtr in ass_tuner.h
87 :
88 : #ifdef UG_PARALLEL
89 : BoolMarker* p_bMarker = new BoolMarker(grid);
90 :
91 : // Unmark H slaves in all element types
92 : MarkAllElemsForAssemblyButHSlaves<Vertex>(grid, *p_bMarker);
93 : MarkAllElemsForAssemblyButHSlaves<Edge>(grid, *p_bMarker);
94 : MarkAllElemsForAssemblyButHSlaves<Face>(grid, *p_bMarker);
95 : MarkAllElemsForAssemblyButHSlaves<Volume>(grid, *p_bMarker);
96 :
97 : // Set marker in assembly tuner
98 : ass->ass_tuner()->set_marker(p_bMarker);
99 : #endif
100 0 : }
101 :
102 : } // end namespace ug
103 :
104 : #endif /*__H_MANIFOLD_ASSEMBLE_UTIL__*/
|