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>
130 template <
int spacedim,
class Value>
133 OLD_ASSERT(
mesh_ ==
nullptr ||
mesh_ == mesh,
"Trying to change mesh of the FieldElementwise.");
145 data_ = std::make_shared<std::vector<typename Value::element_type>>();
158 template <
int spacedim,
class Value>
167 return Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
175 template <
int spacedim,
class Value>
186 typename Value::return_type
const &ref = Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
187 for(
unsigned int i=0; i< value_list.size(); i++) {
189 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
190 i, Value(value_list[i]).n_rows(),this->
value_.n_rows());
195 xprintf(
UsrErr,
"FieldElementwise is not implemented for discrete return types.\n");
201 template <
int spacedim,
class Value>
204 if (Value::is_scalable()) {
206 bool printed_warning =
false;
207 for(
unsigned int i=0; i<vec.size(); ++i) {
209 if ( !printed_warning && ((vec[i] <
limits_.first) || (vec[i] >
limits_.second)) ) {
210 printed_warning =
true;
211 WarningOut().fmt(
"Values of some elements of FieldElementwise '{}' at address '{}' is out of limits: <{}, {}>\n" 212 "Unit of the Field: [{}]\n",
221 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
std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_name)
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 ReaderInstances * instance()
Returns singleton instance.
#define DebugOut()
Macro defining 'debug' record of log.
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)