5#ifndef UG4_RICHARDS_FS_HEIGHT_IMPL_H
6#define UG4_RICHARDS_FS_HEIGHT_IMPL_H
18template<
typename TGr
idFunction>
27 m_glob_userdata(spGf, cmp),
28 m_sp_ls_pos_z(spGf, spGf->fct_id_by_name(cmp), 0)
36 spGf->domain()->grid()->attach_to_vertices_dv(
m_a_vrt_num, -1);
37 spGf->domain()->grid()->attach_to_vertices_dv(
m_a_vrt_val, 0.0);
44 template<
typename TGr
idFunction>
47 m_sp_ls_pos_z.reinit();
49 Grid&
grid = *m_spGf->domain()->grid();
54 auto vAccPos = m_spGf->domain()->position_accessor();
57 m_measurement_points.clear();
58 m_sp_vrt_val->clear();
63 std::vector<Vertex*> local_vertices;
66 for (
size_t i = 0; i < m_SsGrp.size (); i++)
70 for (
auto iter = m_spGf->template begin<Vertex> (si);
71 iter != m_spGf->template end<Vertex> (si); ++iter, ++n) {
73 aa_vrt_num[*iter] = n;
74 local_vertices.push_back(*iter);
78 for (
size_t d = 0; d < dim - 1; d++) {
79 xy_coords[d] = vAccPos[*iter][d];
83 m_measurement_points.push_back(xy_coords);
84 m_sp_vrt_val->push_back(0);
86 auto& pnt = m_measurement_points.back();
87 pnt.valid = m_sp_ls_pos_z.get_height_at(pnt.xy, pnt.z);
90 aa_vrt_val[*iter] = pnt.z;
93 aa_vrt_val[*iter] = -std::numeric_limits<number>::max();
107 typedef decltype(m_a_vrt_val) a_val_type;
126 for (
size_t j = 0; j < local_vertices.size(); j++) {
127 Vertex* vrt = local_vertices[j];
128 number synced_z = aa_vrt_val[vrt];
129 auto& pnt = m_measurement_points[j];
131 if (synced_z == -std::numeric_limits<number>::max()) {
135 aa_vrt_val[vrt] = 0.0;
140 (*m_sp_vrt_val)[j] = synced_z;
149template<
typename TGr
idFunction>
164 std::vector<std::vector<number> > vvvDeriv[],
168 typedef typename gf_type::template dim_traits<refDim>::grid_base_object elem_type;
171 if (! m_SsGrp.contains (si))
172 UG_THROW (
"RichardsFreeSurfaceHeight: Attempt to get the value for a subset that has not been specified.");
176 const elem_type * elem =
dynamic_cast<elem_type *
> (grid_obj);
180 num_aa_type aa_vrt_num (* m_spGf->domain()->grid (), m_a_vrt_num);
181 val_aa_type aa_vrt_val (* m_spGf->domain()->grid (), m_a_vrt_val);
182 std::vector<number> shape;
185 for (
size_t ip = 0; ip < nip; ++ip) {
187 rTrialSpace.
shapes (shape, vLocIP [ip]);
193 for (
size_t sh = 0; sh < shape.size (); ++sh) {
194 const Vertex* vrt = elem->vertex (sh);
195 size_t vrt_no = aa_vrt_num [vrt];
198 if (m_measurement_points[vrt_no].valid) {
201 vValue [ip] += aa_vrt_val[vrt] * shape [sh];
207 vValue [ip] += vCornerCoords[sh][dim -1] * shape [sh];
parameterString s
Definition Biogas.lua:2
bool communicate(int tag=749345)
void exchange_data(const TLayoutMap &layoutMap, const typename TLayoutMap::Key &keyFrom, const typename TLayoutMap::Key &keyTo, ICommunicationPolicy< TLayout > &commPol)
GridLayoutMap & grid_layout_map()
virtual ReferenceObjectID reference_object_id() const=0
virtual void shapes(std::vector< std::vector< shape_type > > &vvShape, const std::vector< MathVector< dim > > &vLocPos) const=0
void add(const char *name)
void set_subset_handler(ConstSmartPtr< ISubsetHandler > sh)
void reinit()
initialize the object: find the intersected elements and prepare the tree
Definition level_set_pos.h:139
SubsetGroup m_SsGrp
Definition richards_fs_height.h:109
val_a_type m_a_vrt_val
Definition richards_fs_height.h:114
void reinit()
Reinitializes the measurer.
Definition richards_fs_height_impl.h:45
RichardsFreeSurfaceHeight(SmartPtr< gf_type > spGf, const char *subset="top", const char *cmp="p")
Constructor for RichardsFreeSurfaceHeight.
Definition richards_fs_height_impl.h:20
num_a_type m_a_vrt_num
Definition richards_fs_height.h:113
void eval_and_deriv(number vValue[], const MathVector< dim > vGlobIP[], number time, int si, GridObject *elem, const MathVector< dim > vCornerCoords[], const MathVector< refDim > vLocIP[], const size_t nip, LocalVector *u, bool bDeriv, int s, std::vector< std::vector< number > > vvvDeriv[], const MathMatrix< refDim, dim > *vJT=NULL)
Evaluates the free surface height at integration points of a grid element.
Definition richards_fs_height_impl.h:152
measurer_type m_sp_ls_pos_z
Definition richards_fs_height.h:116
SmartPtr< std::vector< number > > m_sp_vrt_val
Definition richards_fs_height.h:115
vector< string > TokenizeString(const char *str, const char delimiter=',')
SmartPtr< T, FreePolicy > make_sp(T *inst)