Flow123d  JS_before_hm-978-gf0793cd
field_divide.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file field_divide.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_DIVIDE_HH_
19 #define FIELD_DIVIDE_HH_
20 
21 #include "fields/field.hh"
22 
23 
24 /**
25  * This field is meant to be used to implement for initialization of velocity fields in Darcy flows.
26  * You can either use velocity which is proportion of flux and cross section etc.
27  * Unfortunately it introduce one more level of indirection, namely one more virtual call for getting the field value.
28  *
29  * - The field can not be initialized form the input.
30  * - We allow only Scalar Value with element_type double of divisor field.
31  */
32 template <int spacedim, class Value>
33 class FieldDivide : public FieldAlgorithmBase<spacedim, Value> {
34 public:
36  typedef typename Space<spacedim>::Point Point;
37  /**
38  *
39  */
40  FieldDivide( std::shared_ptr< FieldAlgorithmBase<spacedim, Value> > inner_dividend, Field<3, FieldValue<3>::Scalar> inner_divisor, unsigned int n_comp=0);
41 
42  /**
43  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
44  */
45  virtual typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
46 
47  /**
48  * Returns std::vector of scalar values in several points at once.
49  */
50  virtual void value_list (const Armor::array &point_list, const ElementAccessor<spacedim> &elm,
52 
53  /**
54  * Update time and possibly update data.
55  */
56  bool set_time(const TimeStep &time) override;
57 
58  virtual ~FieldDivide();
59 
60 private:
61  /// Field to which we add linear potential.
62  std::shared_ptr< FieldAlgorithmBase<spacedim, Value> > inner_dividend_;
63  /// Field to which we add linear potential.
65 };
66 
67 
68 #endif /* FIELD_DIVIDE_HH_ */
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: field_divide.cc:35
bool set_time(const TimeStep &time) override
Definition: field_divide.cc:75
Armor::ArmaVec< double, spacedim > Point
Definition: point.hh:42
Class template representing a field with values dependent on: point, element, and region...
Definition: field.hh:92
FieldDivide(std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > inner_dividend, Field< 3, FieldValue< 3 >::Scalar > inner_divisor, unsigned int n_comp=0)
Definition: field_divide.cc:23
Space< spacedim >::Point Point
Definition: field_divide.hh:36
Field< 3, FieldValue< 3 >::Scalar > inner_divisor_
Field to which we add linear potential.
Definition: field_divide.hh:64
virtual void value_list(const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Definition: field_divide.cc:54
std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > inner_dividend_
Field to which we add linear potential.
Definition: field_divide.hh:62
virtual ~FieldDivide()
Definition: field_divide.cc:85
Field< spacedim, Value >::FactoryBase FactoryBaseType
Definition: field_divide.hh:35
Representation of one time step..
unsigned int n_comp() const