49 template <
int dim,
typename TData>
50 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
65 for (
size_t i = 0; i < geo.num_scvf(); i++)
67 const typename TFVGeom::SCVF& scvf = geo.scvf(i);
70 if (scvf.from() == co)
72 if (
VecDot(d, scvf.normal()) >= 0.0)
75 else if (scvf.to() == co)
77 if (
VecDot(d, scvf.normal()) < 0.0)
95 template <
int dim,
typename TData>
96 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
115 number lambda_min, lambda_max;
129 if (lambda_min < 0.0 || lambda_max > 1.0)
138 for (
size_t i = 0; i < geo.num_scvf(); i++)
140 const typename TFVGeom::SCVF& scvf = geo.scvf(i);
141 number d_min, d_max, lambda;
142 if (scvf.from() == co)
145 d_min =
VecDot(
p, scvf.normal());
147 d_max =
VecDot(
p, scvf.normal());
148 if (d_min*d_max < 0.0)
150 lambda = fabs(d_min)/(fabs(d_min)+fabs(d_max));
157 else if (d_min > 0.0)
160 else if (scvf.to() == co)
163 d_min =
VecDot(
p, scvf.normal());
165 d_max =
VecDot(
p, scvf.normal());
166 if (d_min*d_max < 0.0)
168 lambda = fabs(d_min)/(fabs(d_min)+fabs(d_max));
175 else if (d_min < 0.0)
180 else if (elem_dim + 1 ==
dim)
183 if (lambda_min < 0.0 || lambda_max > 1.0)
187 if (std::fabs (lambda_max - lambda_min) >
SMALL)
188 UG_THROW (
"FVLineSourceOrSink: Line source or sink lyes in a low-dimensional element!");
192 for (
size_t i = 0; i < geo.num_scvf(); i++)
194 const typename TFVGeom::SCVF& scvf = geo.scvf(i);
197 if (scvf.from() == co)
199 if (
VecDot(d, scvf.normal()) > 0.0)
202 else if (scvf.to() == co)
204 if (
VecDot(d, scvf.normal()) < 0.0)
211 UG_THROW (
"FVLineSourceOrSink: Dimension mismatch with a grid element!");
219 template <
int dim,
typename TPo
intData,
typename TLineData>
220 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
226 for (m_index = index; m_index < m_sss->num_points (); m_index++)
229 if (! m_elem_bbox.contains_point (pnt_sss->
position ()))
231 if (pnt_sss->
corresponds_to (m_elem, m_grid, m_aaPos, m_geo, m_co))
239 template <
int dim,
typename TPo
intData,
typename TLineData>
240 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
248 for (m_index = index; m_index < m_sss->num_lines (); m_index++)
253 if (line_sss->
corresponds_to (m_elem, m_grid, m_aaPos, m_geo, m_co, ls, le))
Base class for line sources and sinks.
Definition: fv1_sss.h:101
const MathVector< dim > & from_position()
returns the beginning of the line segment
Definition: fv1_sss.h:141
const MathVector< dim > & to_position()
returns the end of the line segment
Definition: fv1_sss.h:144
bool corresponds_to(TElem *elem, Grid &grid, TAAPos &aaPos, const TFVGeom &geo, size_t co, MathVector< dim > &ls, MathVector< dim > &le)
test whether a source/sink point corresponds to a given corner of the element
Definition: fv1_sss_impl.h:98
Base class for the point sources and sinks.
Definition: fv1_sss.h:51
bool corresponds_to(TElem *elem, Grid &grid, TAAPos &aaPos, const TFVGeom &geo, size_t co)
test whether a source/sink point corresponds to a given corner of the element
Definition: fv1_sss_impl.h:52
const MathVector< dim > & position()
returns the point of the source/sink
Definition: fv1_sss.h:84
Manager class for point and line sources and sinks.
Definition: fv1_sss.h:226
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
UG_API bool ContainsPoint(const EdgeVertices *e, const vector_t &p, TAAPos aaPos)
Returns true if the given point lies on the given edge.
Definition: edge_util_impl.hpp:513
#define UG_THROW(msg)
Definition: error.h:57
double number
Definition: types.h:124
void VecScaleAdd(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
Scales two Vectors, adds them and returns the sum in a third vector.
Definition: math_vector_functions_common_impl.hpp:265
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
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
returns the dot-product of two vector_ts
Definition: math_vector_functions_common_impl.hpp:385
const number SMALL
Definition: math_constants.h:41
int ReferenceElementDimension(ReferenceObjectID roid)
returns the reference element dimension at run-time
Definition: reference_element_util.h:40
bool RayElementIntersection(number &sminOut, number &smaxOut, const vector2 &from, const vector2 &dir, Edge *e, Grid &, Grid::VertexAttachmentAccessor< AVector2 > aaPos, number sml)
2d ray-element intersection for edges
Definition: ray_element_intersection_util.cpp:83