ug4
marker_points.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-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__LIBGRID__MARKER_POINTS__
34 #define __H__LIBGRID__MARKER_POINTS__
35 
36 #include <vector>
37 #include <string>
38 #include "common/common.h"
39 #include "lib_grid/grid/grid.h"
41 
42 namespace ug
43 {
45 
52 {
53  MarkerPoint();
54  MarkerPoint(const char* name, const vector3& position, const vector3& normal);
55 
56  std::string name;
57 
62 };
63 
65 
69 {
70  public:
71  void clear() {m_markers.clear();}
72  inline void add_marker() {m_markers.resize(m_markers.size() + 1);}
73  inline void add_markers(size_t num = 1) {m_markers.resize(m_markers.size() + num);}
74  void add_marker(const MarkerPoint& marker) {m_markers.push_back(marker);}
75 
76  inline size_t num_markers() const {return m_markers.size();}
77 
78  inline MarkerPoint& get_marker(size_t index) {return m_markers[index];}
79  inline const MarkerPoint& get_marker(size_t index) const {return m_markers[index];}
80 
81  inline void set_marker(size_t index,
82  const MarkerPoint& marker) {m_markers[index] = marker;}
83 
84  inline MarkerPoint const *get_array() {return &m_markers.front();}
85 
86  protected:
87  std::vector<MarkerPoint> m_markers;
88 };
89 
90 
94  const char* filename);
95 
98 
115 void SnapMarkerPointToGridVertex(MarkerPoint& markerInOut, Grid& grid,
116  number normalOffset,
119 
120 }// end of namespace
121 
122 #endif
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Definition: marker_points.h:69
void set_marker(size_t index, const MarkerPoint &marker)
Definition: marker_points.h:81
size_t num_markers() const
Definition: marker_points.h:76
void add_marker(const MarkerPoint &marker)
Definition: marker_points.h:74
MarkerPoint & get_marker(size_t index)
Definition: marker_points.h:78
void clear()
Definition: marker_points.h:71
MarkerPoint const * get_array()
Definition: marker_points.h:84
const MarkerPoint & get_marker(size_t index) const
Definition: marker_points.h:79
void add_markers(size_t num=1)
Definition: marker_points.h:73
void add_marker()
Definition: marker_points.h:72
std::vector< MarkerPoint > m_markers
Definition: marker_points.h:87
double number
Definition: types.h:124
the ug namespace
bool LoadMarkerPointsFromFile(MarkerPointManager &manager, const char *filename)
Loads marker points from a file.
Definition: marker_points.cpp:61
void SnapMarkerPointToGridVertex(MarkerPoint &markerInOut, Grid &grid, number normalOffset, Grid::VertexAttachmentAccessor< APosition > &aaPos, Grid::VertexAttachmentAccessor< ANormal > *paaNorm)
Snaps a marker point to a grid vertex.
Definition: marker_points.cpp:94
Definition: marker_points.h:52
std::string name
Definition: marker_points.h:56
vector3 localCoord
Definition: marker_points.h:60
vector3 norm
Definition: marker_points.h:59
vector3 pos
Definition: marker_points.h:58
GridObject * associatedObj
Definition: marker_points.h:61
MarkerPoint()
Definition: marker_points.cpp:43