25 #include <boost/algorithm/string/replace.hpp> 35 OLD_ASSERT(&add_field==found_field,
"Another field of the same name exists when adding field: %s\n",
36 add_field.
name().c_str());
46 for(
auto field_ptr : other.
field_list) this->operator +=(*field_ptr);
55 for(
auto name : names)
set += (*this)[name];
61 FieldSet FieldSet::subset( FieldFlag::Flags::Mask mask)
const {
71 string rec_name = equation_name +
":Data";
88 std::shared_ptr<Input::Type::TypeBase> field_type_ptr;
100 if (default_val !=
"") {
101 boost::replace_all(default_val,
"\"",
"\\\"");
142 auto &
field = (*this)[dest_field_name];
158 if (found_field)
return *found_field;
160 THROW(ExcUnknownField() << FieldCommon::EI_Field(field_name));
166 bool changed_all=
false;
174 bool changed_all=
false;
189 bool is_jump =
false;
197 for (
unsigned int i_reg_patch=0; i_reg_patch<cache_map.
n_regions(); ++i_reg_patch) {
207 field_indices_map.
add_item( f_acc.field() );
210 std::queue<const FieldCommon *> q;
212 unordered_map<std::string, unsigned int>::iterator
it;
223 std::fill(used_fields.begin(), used_fields.end(),
false);
224 uint n_used_fields = 0;
226 q.push(f_acc.field());
228 used_fields[ field_indices_map.
get_position( f_acc.field() ) ] =
true;
230 while (q.size() > 0) {
231 auto field = q.front();
235 for (
auto f : dep_vec) {
237 dfs.add_edge(
uint(field_idx), field_pos );
238 if (!used_fields[ field_pos ]) {
241 used_fields[ field_pos ] =
true;
246 auto sort_vec = dfs.topological_sort();
248 for (
unsigned int i_field=0, i_order=0; i_field<sort_vec.size(); ++i_field) {
249 if ( !used_fields[sort_vec[i_field]] )
continue;
285 s <<
"\nregion_idx " << reg_it.first <<
": ";
286 for (
auto f_it : reg_it.second) {
287 s << f_it->name() <<
", ";
std::vector< FieldCommon * > field_list
List of all fields.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
unsigned int size() const
FieldDepth depth_
Field holds surface depth for computing of FieldFormulas.
bool is_jump_time() const
Common abstract parent of all Field<...> classes.
Container for various descendants of FieldCommonBase.
std::map< unsigned int, std::vector< const FieldCommon * > > region_field_update_order_
virtual void copy_from(const FieldCommon &other)=0
const Mesh * mesh_
Pointer to the mesh.
FieldCommon & operator[](const std::string &field_name) const
FieldCoords X_
Field holds coordinates for computing of FieldFormulas.
unsigned int size() const
Return size of map.
void set_field_coords(FieldCoords *field_coords)
Setter of field_coords data member.
void set_dependency(FieldSet &used_fieldset)
virtual bool is_constant(Region reg)=0
Implementation of bidirectional map.
#define ASSERT_GE_DBG(a, b)
Definition of comparative assert macro (Greater or Equal) only for debug mode.
virtual std::string get_value_attribute() const =0
virtual IT::Instance get_input_type()=0
Directing class of FieldValueCache.
virtual bool set_time(const TimeStep &time, LimitSide limit_side)=0
static string field_default_value()
const RegionDB & region_db() const
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
static const std::string field_descriptor_record_description(const string &record_name)
#define ASSERT_GT_DBG(a, b)
Definition of comparative assert macro (Greater Than) only for debug mode.
std::string print_dependency() const
Return order of evaluated fields by dependency and region_idx.
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
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.
FieldCommon * field(const std::string &field_name) const
Range< FieldListAccessor > fields_range() const
Returns range of Fields held in field_list.
unsigned int add_item(T val)
Add new item at the end position of map.
static constexpr Mask input_copy
FieldCommon & input_default(const string &input_default)
static IT::Record field_descriptor_record(const string &record_name)
virtual std::vector< const FieldCommon * > set_dependency(FieldSet &field_set, unsigned int i_reg) const =0
void set_field(const std::string &dest_field_name, FieldCommon &source)
static string field_value_shape()
bool is_multifield() const
FieldCommon & description(const string &description)
virtual IT::Array get_multifield_input_type()=0
void cache_update(ElementCacheMap &cache_map)
bool set_time(const TimeStep &time, LimitSide limit_side)
bool is_constant(Region reg) const
FieldCommon & name(const string &name)
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
static string field_unit()
void set_mesh(const Mesh &mesh)
friend std::ostream & operator<<(std::ostream &stream, const FieldSet &set)
FieldCommon & flags(FieldFlag::Flags::Mask mask)
const std::string & input_name() const
Class for representation SI units of Fields.
int get_position(T val) const
Return position of item of given value.
virtual void cache_update(ElementCacheMap &cache_map, unsigned int region_patch_idx) const =0
FieldSet()
Default constructor.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Representation of one time step..
Bidirectional map templated by <T, unsigned int>.
Input::Type::Record make_field_descriptor_type(const std::string &equation_name) const
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on) ...