ug4
global_fractured_media_refiner.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-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 #ifndef __H__LIB_GRID__GLOBAL_FRACTURED_MEDIA_REFINER__
34 #define __H__LIB_GRID__GLOBAL_FRACTURED_MEDIA_REFINER__
35 
36 #include <vector>
37 #include "lib_grid/lg_base.h"
38 #include "lib_grid/multi_grid.h"
41 
42 
43 namespace ug
44 {
45 
46 class ISubsetHandler;
47 
51 
60 //template <class TAPosition>
62 {
63  public:
67 
69 
70  virtual void grid_to_be_destroyed(Grid* grid);
71 
72  void assign_grid(MultiGrid& mg);
73  void assign_grid(MultiGrid* mg);
74 
77 
79 
82  //void set_position_attachment(TAPosition& aPos) {m_aPos = aPos;}
83 
85 
91  void mark_as_fracture(int subInd, bool isFracture);
92 
94  bool is_fracture(int subInd);
95 
96 
97  virtual Grid* get_associated_grid() {return m_pMG;}
98  virtual Grid* grid() {return m_pMG;}
99  virtual MultiGrid* multi_grid() {return m_pMG;}
100 
101  virtual bool adaptivity_supported() const {return false;}
102  virtual bool coarsening_supported() const {return false;}
103 
104  virtual bool save_marks_to_file(const char* filename);
105 
106  protected:
108  virtual void num_marked_edges_local(std::vector<int>& numMarkedEdgesOut);
110  virtual void num_marked_faces_local(std::vector<int>& numMarkedFacesOut);
112  virtual void num_marked_volumes_local(std::vector<int>& numMarkedVolsOut);
113 
114  template <class TElem>
115  void num_marked_elems(std::vector<int>& numMarkedElemsOut);
116 
119  virtual void perform_refinement();
120 
122 
126  virtual void adjust_marks();
127 
129 
132  virtual void communicate_marks(BoolMarker& marker) {}
133 
135 
136  template <class TElem>
138 
140  template <class TElem>
142 
144  template <class TElem>
145  size_t num_marked(const std::vector<TElem*>& elems) const;
146 
148  virtual bool refinement_is_allowed(Vertex* elem) {return true;}
150  virtual bool refinement_is_allowed(Edge* elem) {return true;}
152  virtual bool refinement_is_allowed(Face* elem) {return true;}
154  virtual bool refinement_is_allowed(Volume* elem) {return true;}
155 
157 
160  virtual void refinement_step_begins() {};
161 
163 
168  virtual void refinement_step_ends() {};
169 
171 
173  template <class TElem>
175 
176  protected:
178  std::vector<bool> m_subsetIsFracture;
179  //TAPosition m_aPos;
182 };
183 
185 }// end of namespace
186 
187 #endif
Allows to mark elements.
Definition: bool_marker.h:64
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Definition: global_fractured_media_refiner.h:62
virtual MultiGrid * multi_grid()
Definition: global_fractured_media_refiner.h:99
virtual void refinement_step_begins()
this method helps derived classes to perform operations directly before actual element refinment is p...
Definition: global_fractured_media_refiner.h:160
virtual void num_marked_edges_local(std::vector< int > &numMarkedEdgesOut)
returns the number of (globally) marked edges on this level of the hierarchy
Definition: global_fractured_media_refiner.cpp:159
virtual void perform_refinement()
performs refinement on the marked elements.
Definition: global_fractured_media_refiner.cpp:192
ISubsetHandler * m_pSH
Definition: global_fractured_media_refiner.h:181
virtual void num_marked_volumes_local(std::vector< int > &numMarkedVolsOut)
returns the number of (globally) marked volumes on this level of the hierarchy
Definition: global_fractured_media_refiner.cpp:171
virtual bool refinement_is_allowed(Edge *elem)
a callback that allows to deny refinement of special edges
Definition: global_fractured_media_refiner.h:150
bool is_fracture_element(TElem *e)
returns true if the specified element is a fracture element.
Definition: global_fractured_media_refiner.h:174
size_t num_marked(const std::vector< TElem * > &elems) const
returns the number of marked entries
Definition: global_fractured_media_refiner.cpp:995
virtual Grid * get_associated_grid()
DEPRECIATED! Use grid(). Has to return the associated grid. Pure virtual.
Definition: global_fractured_media_refiner.h:97
void assign_elem_and_side_marks()
performs the actual marking
Definition: global_fractured_media_refiner.cpp:701
MultiGrid * m_pMG
Definition: global_fractured_media_refiner.h:180
void assign_grid(MultiGrid &mg)
Definition: global_fractured_media_refiner.cpp:107
virtual bool save_marks_to_file(const char *filename)
Writes the associated grid and marks to a file. Pure virtual.
Definition: global_fractured_media_refiner.cpp:939
virtual bool refinement_is_allowed(Vertex *elem)
a callback that allows to deny refinement of special vertices
Definition: global_fractured_media_refiner.h:148
void mark_sides_of_marked_top_level_elements()
recursively marks sides of all marked top level elements of the given type
Definition: global_fractured_media_refiner.cpp:880
virtual void refinement_step_ends()
this method helps derived classes to perform operations directly after actual element refinment took ...
Definition: global_fractured_media_refiner.h:168
void set_subset_handler(ISubsetHandler &sh)
Definition: global_fractured_media_refiner.h:76
virtual bool refinement_is_allowed(Face *elem)
a callback that allows to deny refinement of special faces
Definition: global_fractured_media_refiner.h:152
virtual Grid * grid()
Returns the grid associated with the refiner.
Definition: global_fractured_media_refiner.h:98
virtual bool adaptivity_supported() const
returns whether the refiner is able to perform adaptive refinement
Definition: global_fractured_media_refiner.h:101
BoolMarker m_marker
Definition: global_fractured_media_refiner.h:177
virtual void grid_to_be_destroyed(Grid *grid)
Definition: global_fractured_media_refiner.cpp:98
virtual ~GlobalFracturedMediaRefiner()
Definition: global_fractured_media_refiner.cpp:88
virtual bool coarsening_supported() const
returns true, if the refiner supports coarsening.
Definition: global_fractured_media_refiner.h:102
virtual void communicate_marks(BoolMarker &marker)
Called by adjust_marks. Default implementation does nothing.
Definition: global_fractured_media_refiner.h:132
virtual void num_marked_faces_local(std::vector< int > &numMarkedFacesOut)
returns the number of (globally) marked faces on this level of the hierarchy
Definition: global_fractured_media_refiner.cpp:165
std::vector< bool > m_subsetIsFracture
Definition: global_fractured_media_refiner.h:178
GlobalFracturedMediaRefiner(SPRefinementProjector projector=SPNULL)
Definition: global_fractured_media_refiner.cpp:61
virtual void adjust_marks()
called by perform_refinement to adjust the marks
Definition: global_fractured_media_refiner.cpp:918
virtual bool refinement_is_allowed(Volume *elem)
a callback that allows to deny refinement of special volumes
Definition: global_fractured_media_refiner.h:154
bool is_fracture(int subInd)
returns whether the specified subset is regarded as a fracture.
Definition: global_fractured_media_refiner.cpp:151
void mark_as_fracture(int subInd, bool isFracture)
sets the position attachment
Definition: global_fractured_media_refiner.cpp:135
void set_subset_handler(ISubsetHandler *sh)
Definition: global_fractured_media_refiner.h:75
void num_marked_elems(std::vector< int > &numMarkedElemsOut)
Definition: global_fractured_media_refiner.cpp:179
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
Definition: grid_observer.h:80
The refiner interface allows to mark elements for refinement and to call refine.
Definition: refiner_interface.h:67
SPRefinementProjector projector()
Definition: refiner_interface.h:78
Definition: subset_handler_interface.h:223
int get_subset_index(GridObject *elem) const
Definition: subset_handler_interface.cpp:560
Definition: multi_grid.h:72
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
the ug namespace