ug4
subdivision_projector.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016: 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__UG_subdivision_projector
34 #define __H__UG_subdivision_projector
35 
36 #include <algorithm>
37 #include <vector>
38 #include "refinement_projector.h"
41 
42 namespace ug{
43 
45 
51 public:
53  m_cbIsCrease (Grid::edge_traits::callback(ConsiderNone())),
55  {}
56 
58  m_cbIsCrease (cbIsCrease),
60  {}
61 
65  m_cbIsCrease (Grid::edge_traits::callback(ConsiderNone())),
67  {}
68 
71  Grid::edge_traits::callback cbIsCrease) :
73  m_cbIsCrease (cbIsCrease),
75  {}
76 
78  {
83  }
84  }
85 
87  {
90  }
91 
92  virtual bool refinement_begins_requires_subgrid () const {return true;}
93 
94  virtual void refinement_begins(const ISubGrid* sg);
95  virtual void refinement_ends();
96 
97  virtual number new_vertex(Vertex* vrt, Edge* parent);
98  // virtual number new_vertex(Vertex* vrt, Face* parent);
99  // virtual number new_vertex(Vertex* vrt, Volume* parent);
100 
102  {
103  m_cbIsCrease = cbIsCrease;
104  }
105 
106 protected:
107  size_t nbr_crease_edges (Vertex* vrt,
108  Grid::edge_traits::secure_container* assEdges = NULL,
109  Edge* creaseEdgesOut[2] = NULL);
110 
111  size_t concerned_nbr_faces (Edge* edge,
112  Grid::face_traits::secure_container* assFaces = NULL,
113  Face* facesOut[2] = NULL);
114 
115 private:
117 
118  template <class Archive>
119  void serialize( Archive& ar, const unsigned int version)
120  {
122  }
123 
124 
125  typedef std::vector<std::pair<Vertex*, vector3> > new_pos_vec_t;
126 
130 };
131 
132 }// end of namespace
133 
134 #endif //__H__UG_subdivision_projector
#define UG_EMPTY_BASE_CLASS_SERIALIZATION(clsDerived, clsBase)
Definition: boost_serialization.h:51
callback that always returns false
Definition: basic_callbacks.h:59
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
Instances represent a part of a grid.
Definition: sub_grid.h:44
Definition: topology_callbacks.h:85
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
Adjusts vertex coordinates during refinement.
Definition: refinement_projector.h:55
virtual void set_concerned_elements(SPElementCallback cb)
Definition: refinement_projector.h:84
virtual void set_geometry(SPIGeometry3d geometry)
Definition: refinement_projector.h:76
virtual SPIGeometry3d geometry() const
Definition: refinement_projector.h:81
Applies piecewise smooth loop subdivision rules.
Definition: subdivision_projector.h:50
virtual void set_crease_callback(Grid::edge_traits::callback cbIsCrease)
Definition: subdivision_projector.h:101
virtual void refinement_ends()
called when refinement is done
Definition: subdivision_projector.cpp:102
Grid::edge_traits::callback m_cbIsCrease
Definition: subdivision_projector.h:127
virtual void set_concerned_elements(SPElementCallback cb)
Definition: subdivision_projector.h:86
bool m_customConcernedElementsCallbackUsed
Definition: subdivision_projector.h:129
SubdivisionProjector()
Definition: subdivision_projector.h:52
virtual void refinement_begins(const ISubGrid *sg)
called before refinement begins
Definition: subdivision_projector.cpp:41
SubdivisionProjector(Grid::edge_traits::callback cbIsCrease)
Definition: subdivision_projector.h:57
size_t concerned_nbr_faces(Edge *edge, Grid::face_traits::secure_container *assFaces=NULL, Face *facesOut[2]=NULL)
Definition: subdivision_projector.cpp:256
std::vector< std::pair< Vertex *, vector3 > > new_pos_vec_t
Definition: subdivision_projector.h:125
void serialize(Archive &ar, const unsigned int version)
Definition: subdivision_projector.h:119
new_pos_vec_t m_newPositions
Definition: subdivision_projector.h:128
friend class boost::serialization::access
Definition: subdivision_projector.h:116
virtual void set_geometry(SPIGeometry3d geometry)
Definition: subdivision_projector.h:77
size_t nbr_crease_edges(Vertex *vrt, Grid::edge_traits::secure_container *assEdges=NULL, Edge *creaseEdgesOut[2]=NULL)
Definition: subdivision_projector.cpp:200
SubdivisionProjector(SPIGeometry3d geometry)
Definition: subdivision_projector.h:63
virtual bool refinement_begins_requires_subgrid() const
Definition: subdivision_projector.h:92
virtual number new_vertex(Vertex *vrt, Edge *parent)
called when a new vertex was created from an old edge.
Definition: subdivision_projector.cpp:131
SubdivisionProjector(SPIGeometry3d geometry, Grid::edge_traits::callback cbIsCrease)
Definition: subdivision_projector.h:70
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
double number
Definition: types.h:124
the ug namespace
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836
boost::function< bool(base_object *)> callback
callback type for the elements base type.
Definition: grid.h:150
function ProblemDisc new(problemDesc, dom)