7#ifndef D3F_UG4_SUBMODULE_SOHLE_H
8#define D3F_UG4_SUBMODULE_SOHLE_H
13namespace ug {
namespace d3f{
29 for (
size_t ip = 0;
ip < nip; ++
ip) {
30 vValue[
ip] = vGlobIP[
ip][dim - 1];
35 value = globIP[dim - 1];
49 for (
size_t ip = 0;
ip < nip; ++
ip) {
50 vValue[
ip] = vGlobIP[
ip][dim - 1];
60template<
typename TDomain>
63 static const int dim = TDomain::dim;
64 typedef typename TDomain::grid_type
TGrid;
65 typedef typename TGrid::template EdgeAttachmentAccessor<ANumber>
accessor_type;
66 typedef typename TGrid::template VertexAttachmentAccessor<ANumber>
v_accessor_type;
72 auto grid = dom->grid();
73 auto sh = dom->subset_handler();
74 auto vAcc = dom->position_accessor();
81 std::stringstream ss(
subset);
83 std::vector<int> subsets;
84 while (getline(ss,
s,
',')) {
85 subsets.push_back(sh->get_subset_index(
s.c_str()));
93 std::queue<std::pair<Vertex*, number>> queue;
96 for (
int subset_id : subsets) {
97 auto vIt = sh->template begin<Vertex>(subset_id, 0);
98 auto vEnd = sh->template end<Vertex>(subset_id, 0);
99 for (; vIt != vEnd; ++vIt) {
100 queue.push({*vIt, 0.0});
106 std::vector<Vertex*> neighborhood;
107 while (!queue.empty()) {
108 Vertex* v = queue.front().first;
109 number curr_dist = queue.front().second;
118 for (
Vertex* neighbor : neighborhood) {
120 visited.
mark(neighbor);
130 queue.push({neighbor, curr_dist + step_dist});
137 UG_THROW(
"ConstantSohlGradient: Not implemented for single global positions.\n");
143 template <
int refDim>
154 const size_t numSH = 2;
160 std::vector<number> vShape;
163 Edge* edgeElem =
static_cast<Edge*
>(elem);
166 for (
size_t ip = 0;
ip < nip; ++
ip) {
167 rTrialSpace.
shapes(vShape, vLocIP[
ip]);
171 for (
size_t sh = 0; sh < numSH; ++sh) {
182 template <
int refDim>
193 std::vector<std::vector<number>> vvvDeriv[],
196 evaluate<refDim>(vValue, vGlobIP,
time, si, elem, vCornerCoords, vLocIP, nip, u, vJT);
parameterString s
Definition Biogas.lua:2
bool is_marked(Edge *e) const
void mark(Edge *e, bool mark=true)
TData & value(size_t s, size_t ip)
virtual Vertex * vertex(size_t index) const
virtual ReferenceObjectID reference_object_id() const=0
const MathVector< dim > & ip(size_t s, size_t ip) const
virtual void shapes(std::vector< std::vector< shape_type > > &vvShape, const std::vector< MathVector< dim > > &vLocPos) const=0
Calculates a river bed profile by applying a constant slope starting from a specific boundary.
Definition sohle.h:61
TDomain::grid_type TGrid
Definition sohle.h:64
TGrid::template VertexAttachmentAccessor< ANumber > v_accessor_type
Definition sohle.h:66
void evaluate(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, const MathMatrix< refDim, dim > *vJT=NULL) const
Interpolates the pre-calculated vertex bed elevations at the integration points.
Definition sohle.h:144
TGrid::template EdgeAttachmentAccessor< ANumber > accessor_type
Definition sohle.h:65
static const int dim
Definition sohle.h:63
bool requires_grid_fct() const
Definition sohle.h:200
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) const
Derivatives for the Newton solver. Because bed elevation is constant and doesn't depend on water dept...
Definition sohle.h:183
ConstantSohlGradient(const char *subset, number slope, SmartPtr< TDomain > dom)
Constructor that performs the BFS grid traversal to pre-calculate bed elevations.
Definition sohle.h:71
ANumber m_aSohle
Definition sohle.h:203
void evaluate(number &value, const MathVector< dim > &globIP, number time, int si) const
Definition sohle.h:136
v_accessor_type m_aaSohle
Definition sohle.h:204
Reads the river bed elevation directly from the spatial z-coordinate.
Definition sohle.h:20
void evaluate(number &value, const MathVector< dim > &globIP, number time, int si) const
Definition sohle.h:34
void evaluate(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, const MathMatrix< refDim, dim > *vJT=NULL) const
Definition sohle.h:39
virtual void operator()(number &value, const MathVector< dim > &globIP, number time, int si) const
Definition sohle.h:22
virtual void operator()(number vValue[], const MathVector< dim > vGlobIP[], number time, int si, const size_t nip) const
Definition sohle.h:26
void CollectNeighbors(std::vector< Edge * > &vNeighborsOut, Edge *e, Grid &grid, NeighborhoodType nbhType=NHT_VERTEX_NEIGHBORS)
vector_t::value_type VecDistance(const vector_t &v1, const vector_t &v2)