37 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__FV_SINGULAR_SOURCES_AND_SINKS__
38 #define __H__UG__LIB_DISC__SPATIAL_DISC__FV_SINGULAR_SOURCES_AND_SINKS__
49 template <
int dim,
typename TData>
70 : TData(_data),
point(_point) {}
75 const std::vector<number>& _point
78 if (_point.size () !=
dim)
79 UG_THROW (
"FVPointSourceOrSink: Number of coordinates does not match the dimension.");
80 for (
size_t i = 0; i <
dim; i++)
point[i] = _point[i];
87 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
99 template<
int dim,
typename TData>
128 const std::vector<number>& _point1,
129 const std::vector<number>& _point2
132 if (_point1.size () !=
dim || _point2.size () !=
dim)
133 UG_THROW (
"FVLineSourceOrSink: Number of coordinates does not match the dimension.");
134 for (
size_t i = 0; i <
dim; i++)
147 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
162 template<
typename TData>
192 const std::vector<number>& _point1,
193 const std::vector<number>& _point2
196 UG_THROW (
"FVLineSourceOrSink: Line sources and sinks are not supported in 1d.");
206 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
218 UG_THROW (
"FVLineSourceOrSink: Line sources and sinks are not supported in 1d.");
224 template <
int dim,
typename TPo
intData,
typename TLineData = TPo
intData>
232 typename std::vector<SmartPtr<point_sss_type> >
ListP;
233 typename std::vector<SmartPtr<line_sss_type> >
ListL;
246 ListP.push_back (point_sss);
255 ListL.push_back (line_sss);
267 for (
size_t i = 0; i <
ListP.size (); i++)
268 ((TPointData *)
ListP[i].
get())->init ();
272 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
341 for (
size_t i = 0; i <
ListL.size (); i++)
342 ((TLineData *)
ListL[i].
get())->init ();
346 template <
typename TElem,
typename TAAPos,
typename TFVGeom>
Definition: smart_pointer.h:108
const MathVector< dim > & to_position()
returns the end of the line segment
Definition: fv1_sss.h:203
FVLineSourceOrSink(const MathVector< dim > &_point1, const MathVector< dim > &_point2)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:174
FVLineSourceOrSink(const MathVector< dim > &_point1, const MathVector< dim > &_point2, const TData &_data)
class constructor (with the copy constructor for data)
Definition: fv1_sss.h:182
MathVector< dim > point1
beginning of the line segment
Definition: fv1_sss.h:167
MathVector< dim > point2
end of the line segment
Definition: fv1_sss.h:168
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.h:208
FVLineSourceOrSink(const std::vector< number > &_point1, const std::vector< number > &_point2)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:191
const MathVector< dim > & from_position()
returns the beginning of the line segment
Definition: fv1_sss.h:200
Base class for line sources and sinks.
Definition: fv1_sss.h:101
FVLineSourceOrSink(const MathVector< dim > &_point1, const MathVector< dim > &_point2, const TData &_data)
class constructor (with the copy constructor for data)
Definition: fv1_sss.h:118
MathVector< dim > point1
beginning of the line segment
Definition: fv1_sss.h:103
FVLineSourceOrSink(const std::vector< number > &_point1, const std::vector< number > &_point2)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:127
const MathVector< dim > & from_position()
returns the beginning of the line segment
Definition: fv1_sss.h:141
MathVector< dim > point2
end of the line segment
Definition: fv1_sss.h:104
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
FVLineSourceOrSink(const MathVector< dim > &_point1, const MathVector< dim > &_point2)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:110
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
FVPointSourceOrSink(const std::vector< number > &_point)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:74
const MathVector< dim > & position()
returns the point of the source/sink
Definition: fv1_sss.h:84
FVPointSourceOrSink(const MathVector< dim > &_point)
class constructor (with the default constructor for data)
Definition: fv1_sss.h:59
MathVector< dim > point
the point of the source/sink
Definition: fv1_sss.h:53
FVPointSourceOrSink(const MathVector< dim > &_point, const TData &_data)
class constructor (with the copy constructor for data)
Definition: fv1_sss.h:66
class of line source and sink iterator for a given scv
Definition: fv1_sss.h:348
line_iterator(this_type &op)
copy constructor
Definition: fv1_sss.h:383
line_sss_type * operator*()
access operator
Definition: fv1_sss.h:393
this_type & operator++()
moves to the next valid source or sink
Definition: fv1_sss.h:405
MathVector< dim > m_le
the 2nd of the intersection points with the bnd of the scv
Definition: fv1_sss.h:362
const TFVGeom & m_geo
Definition: fv1_sss.h:356
const MathVector< dim > & seg_start()
the 1st of the intersection points with the bnd of the scv
Definition: fv1_sss.h:396
line_iterator(master_type *sss, TElem *elem, Grid &grid, TAAPos &aaPos, const TFVGeom &geo, size_t co)
class constructor (sets the iterator to the beginnging of the list)
Definition: fv1_sss.h:368
void next_sss(size_t index, MathVector< dim > &ls, MathVector< dim > &le)
Definition: fv1_sss_impl.h:242
FVSingularSourcesAndSinks< dim, TPointData, TLineData > master_type
Definition: fv1_sss.h:350
const MathVector< dim > & seg_end()
the 2nd of the intersection points with the bnd of the scv
Definition: fv1_sss.h:399
AABox< MathVector< dim > > m_elem_bbox
Definition: fv1_sss.h:358
Grid & m_grid
Definition: fv1_sss.h:354
master_type * m_sss
Definition: fv1_sss.h:352
bool is_over()
checks whether we are at the end
Definition: fv1_sss.h:402
size_t m_co
Definition: fv1_sss.h:357
this_type & rewind()
moves the iterator to the beginning of the list
Definition: fv1_sss.h:390
MathVector< dim > m_ls
the 1st of the intersection points with the bnd of the scv
Definition: fv1_sss.h:361
TAAPos & m_aaPos
Definition: fv1_sss.h:355
size_t m_index
index of the current source/sink
Definition: fv1_sss.h:360
line_iterator< TElem, TAAPos, TFVGeom > this_type
Definition: fv1_sss.h:349
TElem * m_elem
Definition: fv1_sss.h:353
class of point source and sink iterator for a given scv
Definition: fv1_sss.h:274
TAAPos & m_aaPos
Definition: fv1_sss.h:281
AABox< MathVector< dim > > m_elem_bbox
Definition: fv1_sss.h:284
point_sss_type * operator*()
access operator
Definition: fv1_sss.h:316
TElem * m_elem
Definition: fv1_sss.h:279
point_iterator(this_type &op)
copy constructor
Definition: fv1_sss.h:306
point_iterator< TElem, TAAPos, TFVGeom > this_type
Definition: fv1_sss.h:275
this_type & operator++()
moves to the next valid source or sink
Definition: fv1_sss.h:322
Grid & m_grid
Definition: fv1_sss.h:280
master_type * m_sss
Definition: fv1_sss.h:278
bool is_over()
checks whether we are at the end
Definition: fv1_sss.h:319
size_t m_index
index of the current source/sink
Definition: fv1_sss.h:285
point_iterator(master_type *sss, TElem *elem, Grid &grid, TAAPos &aaPos, const TFVGeom &geo, size_t co)
class constructor (sets the iterator to the beginnging of the list)
Definition: fv1_sss.h:291
void next_sss(size_t index)
Definition: fv1_sss_impl.h:222
size_t m_co
Definition: fv1_sss.h:283
this_type & rewind()
moves the iterator to the beginning of the list
Definition: fv1_sss.h:313
const TFVGeom & m_geo
Definition: fv1_sss.h:282
FVSingularSourcesAndSinks< dim, TPointData, TLineData > master_type
Definition: fv1_sss.h:276
Manager class for point and line sources and sinks.
Definition: fv1_sss.h:226
void init_all_point_sss()
calls the init-functions of all point sinks (if there are any in TPointData)
Definition: fv1_sss.h:265
FVPointSourceOrSink< dim, TPointData > point_sss_type
Definition: fv1_sss.h:228
point_sss_type * point(size_t i)
return a point sink with a given index
Definition: fv1_sss.h:262
std::vector< SmartPtr< line_sss_type > > ListL
Definition: fv1_sss.h:233
void add_line(SmartPtr< line_sss_type > line_sss)
add a line source or sink
Definition: fv1_sss.h:251
FVLineSourceOrSink< dim, TLineData > line_sss_type
Definition: fv1_sss.h:229
size_t num_points()
returns the number of the point sources and sinks
Definition: fv1_sss.h:259
std::vector< SmartPtr< point_sss_type > > ListP
Definition: fv1_sss.h:232
FVSingularSourcesAndSinks()
class constructor
Definition: fv1_sss.h:238
void init_all_line_sss()
calls the init-functions of all line sinks (if there are any in TLineData)
Definition: fv1_sss.h:339
line_sss_type * line(size_t i)
return a line sink with a given index
Definition: fv1_sss.h:336
size_t num_lines()
returns the number of the line sources and sinks
Definition: fv1_sss.h:333
void add_point(SmartPtr< point_sss_type > point_sss)
add a point source or sink
Definition: fv1_sss.h:242
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
#define UG_THROW(msg)
Definition: error.h:57
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition: bidirectional_boost.h:157
AABox< typename TAAPos::ValueType > CalculateBoundingBox(Vertex *e, TAAPos aaPos)
calculates the smallest axis aligned box that contains the given vertex
Definition: bounding_box_util.h:43