Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
plane_cut_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_plane_cut_projector
34#define __H__UG_plane_cut_projector
35
37
38namespace ug{
39
41
46public:
48 m_p (0, 0, 0),
49 m_n (0, 0, 1)
50 {}
51
53 const vector3& normal) :
54 m_p (position),
55 m_n (normal)
56 {}
57
66
67 virtual ~PlaneCutProjector () {}
68
70 const vector3& position () const {return m_p;}
71
72 void set_normal (const vector3& normal) {m_n = normal;}
73 const vector3& normal () const {return m_n;}
74
76 virtual number new_vertex(Vertex* vrt, Edge* parent)
77 {
78 number t;
79 vector3 v;
80 vector3 dir;
81 VecSubtract(dir, pos(parent->vertex(1)), pos(parent->vertex(0)));
82
83 if(RayPlaneIntersection(v, t, pos(parent->vertex(0)), dir, m_p, m_n)) {
84 set_pos(vrt, v);
85 }
86 else{
88 }
89 return 1;
90 }
91
92private:
94
95 template <class Archive>
96 void serialize( Archive& ar, const unsigned int version)
97 {
98 ar & make_nvp("position", m_p);
99 ar & make_nvp("normal", m_n);
101 }
102
105};
106
107}// end of namespace
108
109#endif //__H__UG_plane_cut_projector
#define UG_EMPTY_BASE_CLASS_SERIALIZATION(clsDerived, clsBase)
Definition boost_serialization.h:51
Base-class for edges.
Definition grid_base_objects.h:397
virtual Vertex * vertex(size_t index) const
Definition grid_base_objects.h:366
calculates new positions by cutting parent edges with a plane
Definition plane_cut_projector.h:45
PlaneCutProjector(SPIGeometry3d geometry, const vector3 &position, const vector3 &normal)
Definition plane_cut_projector.h:59
void set_normal(const vector3 &normal)
Definition plane_cut_projector.h:72
vector3 m_n
Definition plane_cut_projector.h:104
PlaneCutProjector(const vector3 &position, const vector3 &normal)
Definition plane_cut_projector.h:52
vector3 m_p
Definition plane_cut_projector.h:103
const vector3 & position() const
Definition plane_cut_projector.h:70
virtual ~PlaneCutProjector()
Definition plane_cut_projector.h:67
void serialize(Archive &ar, const unsigned int version)
Definition plane_cut_projector.h:96
virtual number new_vertex(Vertex *vrt, Edge *parent)
called when a new vertex was created from an old edge.
Definition plane_cut_projector.h:76
PlaneCutProjector()
Definition plane_cut_projector.h:47
void set_position(const vector3 &position)
Definition plane_cut_projector.h:69
friend class boost::serialization::access
Definition plane_cut_projector.h:93
const vector3 & normal() const
Definition plane_cut_projector.h:73
Adjusts vertex coordinates during refinement.
Definition refinement_projector.h:55
void set_pos(Vertex *v, const vector3 &p)
Definition refinement_projector.h:157
virtual number new_vertex(Vertex *vrt, Vertex *parent)
called when a new vertex was created from an old vertex.
Definition refinement_projector.h:121
vector3 pos(Vertex *v) const
Definition refinement_projector.h:149
virtual SPIGeometry3d geometry() const
Definition refinement_projector.h:81
Base-class for all vertex-types.
Definition grid_base_objects.h:231
double number
Definition types.h:124
bool RayPlaneIntersection(vector_t &vOut, number &tOut, const vector_t &rayFrom, const vector_t &rayDir, const vector_t &p, const vector_t &n)
calculates the intersection of the ray rayFrom+t*rayDir and the plane (x-p)*n=0.
Definition math_util_impl.hpp:360
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition math_vector_functions_common_impl.hpp:226
the ug namespace