19 #include <boost/type_traits/is_floating_point.hpp> 36 template <
int spacedim, class
Value>
43 "Input file with ASCII GMSH file format.")
45 "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
49 "Allow set default value of elements that have not listed values in mesh data file.")
51 "Definition of unit of all times defined in mesh data file.")
53 "Allow set time shift of field data read from the mesh data file. For time 't', field descriptor with time 'T', " 54 "time shift 'S' and if 't > T', we read time frame 't + S'.")
59 template <
int spacedim,
class Value>
61 Input::register_class< FieldElementwise<spacedim, Value>,
unsigned int >(
"FieldElementwise") +
66 template <
int spacedim,
class Value>
69 internal_raw_data(true), mesh_(NULL), unit_si_(
UnitSI::dimensionless() )
78 template <
int spacedim,
class Value>
80 unsigned int n_components)
92 template <
int spacedim,
class Value>
127 template <
int spacedim,
class Value>
138 double read_time = (time.
end()+time_shift) / time_unit_coef;
149 WarningOut().fmt(
"Values of some elements of FieldElementwise '{}' at address '{}' is out of limits: <{}, {}>\n" 150 "Unit of the Field: [{}]\n",
159 template <
int spacedim,
class Value>
162 OLD_ASSERT(
mesh_ ==
nullptr ||
mesh_ == mesh,
"Trying to change mesh of the FieldElementwise.");
170 data_ = std::make_shared<std::vector<typename Value::element_type>>();
183 template <
int spacedim,
class Value>
192 return Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
200 template <
int spacedim,
class Value>
211 typename Value::return_type
const &ref = Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[idx]));
212 for(
unsigned int i=0; i< value_list.size(); i++) {
214 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
215 i,
Value(value_list[i]).n_rows(),this->
value_.n_rows());
220 xprintf(
UsrErr,
"FieldElementwise is not implemented for discrete return types.\n");
226 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.
double read_coef(Input::Iterator< std::string > unit_it) const
std::string format_text() const
std::pair< double, double > limits_
virtual ~FieldElementwise()
Some value(s) is set to NaN.
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...
Some value(s) is out of limits.
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.
bool is_elemental() const
static const Input::Type::Tuple & get_input_time_type(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
bool set_time(const TimeStep &time) override
double default_value_
Default value of element if not set in mesh data file.
FieldElementwise(unsigned int n_comp=0)
Space< spacedim >::Point Point
CheckResult
Return type of method that checked data stored in ElementDataCache (NaN values, limits) ...
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
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
bool is_constant_in_space_
Flag detects that field is only dependent on time.
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
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.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)