25 #include <boost/algorithm/string/replace.hpp>
45 return Input::Type::Record( equation_name+
":UserData",
"Record to set fields of the equation: "+equation_name+
".")
47 "Name of user defined field.")
50 "Instance of FieldAlgoBase descendant.\n"
51 "Please specify shape of field in 'shape_type' key.")
53 "Unit of the field values provided in the main input file, in the external file, or "
54 "by a function (FieldPython).")
61 ASSERT_PERMANENT(&add_field==found_field)(add_field.
name()).error(
"You cannot add field of the same name that exists in FieldSet!\n");
71 for(
auto field_ptr : other.
field_list) this->operator +=(*field_ptr);
80 for(
auto name : names) set += (*this)[name];
86 FieldSet FieldSet::subset( FieldFlag::Flags::Mask mask)
const {
96 string rec_name = equation_name +
":Data";
113 std::shared_ptr<Input::Type::TypeBase> field_type_ptr;
125 if (default_val !=
"") {
126 boost::replace_all(default_val,
"\"",
"\\\"");
167 auto &
field = (*this)[dest_field_name];
183 if (found_field)
return *found_field;
185 THROW(ExcUnknownField() << FieldCommon::EI_Field(field_name) << EI_FieldType(
"FieldSet"));
191 bool changed_all=
false;
199 bool changed_all=
false;
214 bool is_jump =
false;
222 for (
unsigned int i_reg_patch=0; i_reg_patch<cache_map.
n_regions(); ++i_reg_patch) {
231 std::unordered_set<const FieldCommon *> used_fields;
233 for (
unsigned int i_reg=0; i_reg<
mesh_->
region_db().size(); ++i_reg) {
243 if (used_fields.find(f) != used_fields.end() )
return;
244 used_fields.insert(f);
246 for (
auto f_dep : dep_vec) {
266 if (this->
mesh_ !=
nullptr) {
286 s <<
"\nregion_idx " << reg_it.first <<
": ";
287 for (
auto f_it : reg_it.second) {
288 s << f_it->name() <<
", ";
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_GT(a, b)
Definition of comparative assert macro (Greater Than) only for debug mode.
Implementation of bidirectional map.
Directing class of FieldValueCache.
unsigned int n_regions() const
Return number of stored regions.
unsigned int region_idx_from_chunk_position(unsigned int chunk_pos) const
Return begin position of region chunk specified by position in map.
Common abstract parent of all Field<...> classes.
virtual IT::Instance get_input_type()=0
static IT::Record field_descriptor_record(const string &record_name)
static const std::string field_descriptor_record_description(const string &record_name)
virtual bool set_time(const TimeStep &time, LimitSide limit_side)=0
const std::string & input_name() const
virtual bool is_constant(Region reg)=0
virtual std::string get_value_attribute() const =0
virtual void cache_update(ElementCacheMap &cache_map, unsigned int region_patch_idx) const =0
FieldCommon & description(const string &description)
FieldCommon & flags(FieldFlag::Flags::Mask mask)
virtual std::vector< const FieldCommon * > set_dependency(unsigned int i_reg) const =0
FieldCommon & name(const string &name)
bool is_multifield() const
virtual IT::Array get_multifield_input_type()=0
virtual void copy_from(const FieldCommon &other)=0
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
FieldCommon & input_default(const string &input_default)
void set_mesh(const Mesh &mesh) override
void set_field_coords(FieldCoords *field_coords)
Setter of field_coords data member.
void set_mesh(const Mesh &mesh) override
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on)
static constexpr Mask input_copy
Container for various descendants of FieldCommonBase.
FieldCommon & operator[](const std::string &field_name) const
std::map< unsigned int, std::vector< const FieldCommon * > > region_field_update_order_
static const Input::Type::Record & make_user_field_type(const std::string &equation_name)
Declare input record type of field defined by user.
void set_mesh(const Mesh &mesh)
Range< FieldListAccessor > fields_range() const
Returns range of Fields held in field_list.
FieldDepth depth_
Field holds surface depth for computing of FieldFormulas.
FieldSet()
Default constructor.
const Mesh * mesh_
Pointer to the mesh.
FieldCoords X_
Field holds coordinates for computing of FieldFormulas.
std::string print_dependency() const
Return order of evaluated fields by dependency and region_idx.
bool is_constant(Region reg) const
void cache_update(ElementCacheMap &cache_map)
FieldCommon * field(const std::string &field_name) const
static const Input::Type::Selection & get_user_field_shape_selection()
Input selection of user field shape.
bool set_time(const TimeStep &time, LimitSide limit_side)
bool is_jump_time() const
void set_field(const std::string &dest_field_name, FieldCommon &source)
std::vector< FieldCommon * > field_list
List of all fields.
void set_dependency(FieldSet &used_fieldset)
void topological_sort(const FieldCommon *f, unsigned int i_reg, std::unordered_set< const FieldCommon * > &used_fields)
Helper method sort used fields by dependency.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
Class template representing a field with values dependent on: point, element, and region.
IT::Instance get_input_type() override
static string field_unit()
static string field_value_shape()
static string field_default_value()
const RegionDB & region_db() const
Representation of one time step..
static const Input::Type::Record & get_input_type()
Class for representation SI units of Fields.
std::ostream & operator<<(std::ostream &stream, const FieldSet &set)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.