33 template <
int spacedim, class
Value>
40 "Input file with ASCII GMSH file format.")
42 "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
49 template <
int spacedim,
class Value>
51 Input::register_class< FieldElementwise<spacedim, Value>,
unsigned int >(
"FieldElementwise") +
56 template <
int spacedim,
class Value>
59 internal_raw_data(true), mesh_(NULL), unit_si_(
UnitSI::dimensionless() )
67 template <
int spacedim,
class Value>
69 unsigned int n_components)
81 template <
int spacedim,
class Value>
113 template <
int spacedim,
class Value>
132 template <
int spacedim,
class Value>
135 OLD_ASSERT(
mesh_ ==
nullptr ||
mesh_ == mesh,
"Trying to change mesh of the FieldElementwise.");
147 data_ = std::make_shared<std::vector<typename Value::element_type>>();
160 template <
int spacedim,
class Value>
169 return Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
177 template <
int spacedim,
class Value>
188 typename Value::return_type
const &ref = Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
189 for(
unsigned int i=0; i< value_list.size(); i++) {
191 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
192 i,
Value(value_list[i]).n_rows(),this->
value_.n_rows());
197 xprintf(
UsrErr,
"FieldElementwise is not implemented for discrete return types.\n");
203 template <
int spacedim,
class Value>
206 if (Value::is_scalable()) {
208 bool printed_warning =
false;
209 for(
unsigned int i=0; i<vec.size(); ++i) {
211 if ( !printed_warning && ((vec[i] <
limits_.first) || (vec[i] >
limits_.second)) ) {
212 printed_warning =
true;
213 WarningOut().fmt(
"Values of some elements of FieldElementwise '{}' at address '{}' is out of limits: <{}, {}>\n" 214 "Unit of the Field: [{}]\n",
223 template <
int spacedim,
class Value>
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
std::string format_text() const
std::pair< double, double > limits_
virtual ~FieldElementwise()
Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) override
unsigned int component_idx_
Specify if the field is part of a MultiField and which component it is.
bool is_boundary() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
#define INSTANCE_ALL(field)
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Value::return_type r_value_
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) override
static constexpr bool value
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
unsigned int n_elements() const
bool is_elemental() const
bool set_time(const TimeStep &time) override
void scale_and_check_limits()
Multiply data_ with unit_conversion_coefficient_ and check limits of field.
FieldElementwise(unsigned int n_comp=0)
ElementVector bc_elements
Space< spacedim >::Point Point
Dedicated class for storing path to input and output files.
unsigned int n_components_
Size of Value.
void set_mesh(const Mesh *mesh, bool boundary_domain) override
Value value_
Last value, prevents passing large values (vectors) by value.
unsigned int n_entities_
Number of rows in data_ buffer.
#define WarningOut()
Macro defining 'warning' record of log.
void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list) override
#define OLD_ASSERT_EQUAL(a, b)
std::pair< double, double > limits_
Input::Record in_rec_
Accessor to Input::Record.
Class for representation SI units of Fields.
static std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_path)
#define DebugOut()
Macro defining 'debug' record of log.
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)