Flow123d
JS_before_hm-2196-g9bdbf60c0
|
Go to the documentation of this file.
25 #include <boost/algorithm/string/replace.hpp>
37 return Input::Type::Record( equation_name+
":UserData",
"Record to set fields of the equation: "+equation_name+
".")
39 "Name of user defined field.")
41 "Type of field: boundary or bulk.")
43 "Instance of FieldAlgoBase ScalarField descendant.\n"
44 "One of keys 'scalar_field', 'vector_field', 'tensor_field' must be set.\n"
45 "If you set more than one of these keys, only first key is accepted.")
47 "Instance of FieldAlgoBase VectorField descendant. See above for details.")
49 "Instance of FieldAlgoBase TensorField descendant. See above for details.")
56 OLD_ASSERT(&add_field==found_field,
"Another field of the same name exists when adding field: %s\n",
57 add_field.
name().c_str());
67 for(
auto field_ptr : other.
field_list) this->operator +=(*field_ptr);
76 for(
auto name : names) set += (*this)[name];
82 FieldSet FieldSet::subset( FieldFlag::Flags::Mask mask)
const {
92 string rec_name = equation_name +
":Data";
109 std::shared_ptr<Input::Type::TypeBase> field_type_ptr;
121 if (default_val !=
"") {
122 boost::replace_all(default_val,
"\"",
"\\\"");
163 auto &
field = (*this)[dest_field_name];
181 bool is_bdr =
it->second.val<
bool>(
"is_boundary");
184 if (
it->second.opt_val(
"scalar_field", field_arec)) {
197 }
else if (
it->second.opt_val(
"vector_field", field_arec)) {
210 }
else if (
it->second.opt_val(
"tensor_field", field_arec)) {
224 THROW(ExcFieldNotSet() << FieldCommon::EI_Field(field_name));
238 if (found_field)
return *found_field;
240 THROW(ExcUnknownField() << FieldCommon::EI_Field(field_name));
246 bool changed_all=
false;
254 bool changed_all=
false;
269 bool is_jump =
false;
277 for (
unsigned int i_reg_patch=0; i_reg_patch<cache_map.
n_regions(); ++i_reg_patch) {
286 std::unordered_set<const FieldCommon *> used_fields;
288 for (
unsigned int i_reg=0; i_reg<
mesh_->
region_db().size(); ++i_reg) {
298 if (used_fields.find(f) != used_fields.end() )
return;
299 used_fields.insert(f);
301 for (
auto f_dep : dep_vec) {
321 if (this->
mesh_ !=
nullptr) {
341 s <<
"\nregion_idx " << reg_it.first <<
": ";
342 for (
auto f_it : reg_it.second) {
343 s << f_it->name() <<
", ";
353 it != input_list.
end();
355 std::string name =
it->val<std::string>(
"name");
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
void set_user_fields_map(Input::Array input_list)
FieldCommon & operator[](const std::string &field_name) const
const Input::Type::Record & get_user_field(const std::string &equation_name)
Declare input record type of field defined by user.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
static UnitSI & dimensionless()
Returns dimensionless unit.
std::vector< FieldCommon * > user_field_list_
List of fields defined by user.
bool is_jump_time() const
bool set_time(const TimeStep &time, LimitSide limit_side)
bool is_constant(Region reg) const
#define ASSERT_GT_DBG(a, b)
Definition of comparative assert macro (Greater Than) only for debug mode.
const RegionDB & region_db() const
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Directing class of FieldValueCache.
void set_dependency(FieldSet &used_fieldset)
virtual void copy_from(const FieldCommon &other)=0
FieldCommon * user_field(const std::string &field_name, const TimeStep &time)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Range< FieldListAccessor > fields_range() const
Returns range of Fields held in field_list.
std::map< unsigned int, std::vector< const FieldCommon * > > region_field_update_order_
virtual bool set_time(const TimeStep &time, LimitSide limit_side)=0
FieldCommon & flags(FieldFlag::Flags::Mask mask)
IT::Instance get_input_type() override
std::ostream & operator<<(std::ostream &stream, const FieldSet &set)
static string field_value_shape()
static string field_unit()
std::unordered_map< std::string, Input::Record > user_fields_input_
Map assigns Input::Record to each field defined in optional Input::Array 'user_fields'.
static IT::Record field_descriptor_record(const string &record_name)
std::vector< FieldCommon * > field_list
List of all fields.
FieldCoords X_
Field holds coordinates for computing of FieldFormulas.
void topological_sort(const FieldCommon *f, unsigned int i_reg, std::unordered_set< const FieldCommon * > &used_fields)
Helper method sort used fields by dependency.
std::string print_dependency() const
Return order of evaluated fields by dependency and region_idx.
virtual std::string get_value_attribute() const =0
void set(FieldBasePtr field, double time, std::vector< std::string > region_set_names={"ALL"})
Representation of one time step..
const Mesh * mesh_
Pointer to the mesh.
Implementation of bidirectional map.
Common abstract parent of all Field<...> classes.
Class for representation SI units of Fields.
virtual std::vector< const FieldCommon * > set_dependency(FieldSet &field_set, unsigned int i_reg) const =0
static const std::string field_descriptor_record_description(const string &record_name)
void set_mesh(const Mesh &mesh) override
void cache_update(ElementCacheMap &cache_map)
Container for various descendants of FieldCommonBase.
static constexpr Mask input_copy
void set_field_coords(FieldCoords *field_coords)
Setter of field_coords data member.
bool is_multifield() const
void set_mesh(const Mesh &mesh) override
FieldCommon & input_default(const string &input_default)
virtual IT::Instance get_input_type()=0
void set_mesh(const Mesh &mesh) override
unsigned int region_idx_from_chunk_position(unsigned int chunk_pos) const
Return begin position of region chunk specified by position in map.
static string field_default_value()
void set_mesh(const Mesh &mesh)
virtual IT::Array get_multifield_input_type()=0
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on)
FieldSet()
Default constructor.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
const std::string & input_name() const
void set_field(const std::string &dest_field_name, FieldCommon &source)
FieldCommon & description(const string &description)
Class template representing a field with values dependent on: point, element, and region.
virtual void cache_update(ElementCacheMap &cache_map, unsigned int region_patch_idx) const =0
FieldDepth depth_
Field holds surface depth for computing of FieldFormulas.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
unsigned int n_regions() const
Return number of stored regions.
virtual bool is_constant(Region reg)=0
FieldCommon * field(const std::string &field_name) const
FieldCommon & name(const string &name)