Flow123d  release_3.0.0-973-g92f55e826
field.impl.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file field.impl.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_IMPL_HH_
19 #define FIELD_IMPL_HH_
20 
21 #include "field.hh"
22 #include "field_algo_base.impl.hh"
23 #include "field_fe.hh"
24 #include "mesh/region.hh"
26 #include "input/accessors.hh"
27 #include "io/observe.hh"
28 #include "io/output_mesh.hh"
29 #include "io/output_element.hh"
30 
31 
32 /******************************************************************************************
33  * Implementation of Field<...>
34  */
35 
36 template<int spacedim, class Value>
38 : data_(std::make_shared<SharedData>())
39 {
40  // n_comp is nonzero only for variable size vectors Vector, VectorEnum, ..
41  // this invariant is kept also by n_comp setter
42  shared_->n_comp_ = (Value::NRows_ ? 0 : 1);
43  this->add_factory( std::make_shared<FactoryBase>() );
44 
45  this->multifield_ = false;
46 }
47 
48 
49 template<int spacedim, class Value>
50 Field<spacedim,Value>::Field(const string &name, bool bc)
51 : data_(std::make_shared<SharedData>())
52 
53 {
54  // n_comp is nonzero only for variable size vectors Vector, VectorEnum, ..
55  // this invariant is kept also by n_comp setter
56  shared_->n_comp_ = (Value::NRows_ ? 0 : 1);
57  shared_->bc_=bc;
58  this->name( name );
59  this->add_factory( std::make_shared<FactoryBase>() );
60  this->multifield_ = false;
61 }
62 
63 
64 
65 template<int spacedim, class Value>
66 Field<spacedim,Value>::Field(unsigned int component_index, string input_name, string name, bool bc)
67 : data_(std::make_shared<SharedData>())
68 {
69  // n_comp is nonzero only for variable size vectors Vector, VectorEnum, ..
70  // this invariant is kept also by n_comp setter
71  shared_->n_comp_ = (Value::NRows_ ? 0 : 1);
72  this->set_component_index(component_index);
73  this->name_ = (name=="") ? input_name : name;
74  this->shared_->input_name_ = input_name;
75  shared_->bc_ = bc;
76 
77  this->multifield_ = false;
78 }
79 
80 
81 template<int spacedim, class Value>
83 : FieldCommon(other),
84  data_(other.data_),
85  region_fields_(other.region_fields_),
86  factories_(other.factories_)
87 {
88  if (other.no_check_control_field_)
89  no_check_control_field_ = make_shared<ControlField>(*other.no_check_control_field_);
90 
91  this->multifield_ = false;
92 }
93 
94 
95 template<int spacedim, class Value>
97 {
98  //ASSERT( flags().match(FieldFlag::input_copy) )(this->name())(other.name()).error("Try to assign to non-copy field from the field.");
99  ASSERT(other.shared_->mesh_).error("Must call set_mesh before assign to other field.\n");
100  ASSERT( !shared_->mesh_ || (shared_->mesh_==other.shared_->mesh_) ).error("Assignment between fields with different meshes.\n");
101 
102  // check for self assignement
103  if (&other == this) return *this;
104 
105  // class members derived from FieldCommon
106  shared_ = other.shared_;
107  shared_->is_fully_initialized_ = false;
109  last_time_ = other.last_time_;
113  this->multifield_ = false;
114 
115  // class members of Field class
116  data_ = other.data_;
117  factories_ = other.factories_;
118  region_fields_ = other.region_fields_;
119 
120  if (other.no_check_control_field_) {
121  no_check_control_field_ = make_shared<ControlField>(*other.no_check_control_field_);
122  }
123 
124  return *this;
125 }
126 
127 
128 
129 template<int spacedim, class Value>
131  return FieldBaseType::get_input_type_instance(shared_->input_element_selection_);
132 }
133 
134 
135 
136 template<int spacedim, class Value>
138  ASSERT(false).error("This method can't be used for Field");
139 
140  it::Array arr = it::Array( it::Integer() );
141  return arr;
142 }
143 
144 
145 
146 template<int spacedim, class Value>
148  const Field<spacedim, typename FieldValue<spacedim>::Enum > &control_field,
149  const vector<FieldEnum> &value_list) -> Field &
150 {
151  no_check_control_field_=std::make_shared<ControlField>(control_field);
152  shared_->no_check_values_=value_list;
153  return *this;
154 }
155 
156 template<int spacedim, class Value>
157 void Field<spacedim,Value>::set_mesh(const Mesh &in_mesh) {
158  // since we allow copy of fields before set_mesh is called
159  // we have to check that all copies set the same mesh
160  if (shared_->mesh_ && shared_->mesh_ != &in_mesh) {
161  THROW(ExcFieldMeshDifference() << EI_Field(name()) );
162  }
163 
164  shared_->mesh_ = &in_mesh;
165 
166  // initialize table if it is empty, we assume that the RegionDB is closed at this moment
167  region_fields_.resize( mesh()->region_db().size() );
168  RegionHistory init_history(history_length_limit_); // capacity
169  data_->region_history_.resize( mesh()->region_db().size(), init_history );
170 
171  if (no_check_control_field_) no_check_control_field_->set_mesh(in_mesh);
172 }
173 
174 
175 /*
176 template<int spacedim, class Value>
177 std::shared_ptr< typename Field<spacedim,Value>::FieldBaseType >
178 Field<spacedim,Value>::operator[] (Region reg)
179 {
180  ASSERT_LT(reg.idx(), this->region_fields_.size());
181  return this->region_fields_[reg.idx()];
182 }
183 */
184 
185 
186 template <int spacedim, class Value>
188  ASSERT(this->set_time_result_ != TimeStatus::unknown).error("Unknown time status.\n");
189  ASSERT_LT(reg.idx(), this->region_fields_.size());
190  FieldBasePtr region_field = this->region_fields_[reg.idx()];
191  return ( region_field && region_field->is_constant_in_space() );
192 }
193 
194 
195 template<int spacedim, class Value>
197  const RegionSet &domain,
198  FieldBasePtr field,
199  double time)
200 {
201  ASSERT_PTR(field).error("Null field pointer.\n");
202 
203  ASSERT_PTR( mesh() ).error("Null mesh pointer, set_mesh() has to be called before set_field().\n");
204  if (domain.size() == 0) return;
205 
206  ASSERT_EQ( field->n_comp() , n_comp());
207  field->set_mesh( mesh() , is_bc() );
208 
209  HistoryPoint hp = HistoryPoint(time, field);
210  for(const Region &reg: domain) {
211  RegionHistory &region_history = data_->region_history_[reg.idx()];
212  // insert hp into descending time sequence
213  ASSERT( region_history.size() == 0 || region_history[0].first < hp.first)(hp.first)(region_history[0].first)
214  .error("Can not insert smaller time then last time in field's history.\n");
215  region_history.push_front(hp);
216  }
218 }
219 
220 
221 
222 template<int spacedim, class Value>
224  const RegionSet &domain,
225  const Input::AbstractRecord &a_rec,
226  double time)
227 {
228  FieldAlgoBaseInitData init_data(input_name(), n_comp(), units(), limits(), flags());
229  set_field(domain, FieldBaseType::function_factory(a_rec, init_data), time);
230 }
231 
232 
233 
234 
235 template<int spacedim, class Value>
236 bool Field<spacedim, Value>::set_time(const TimeStep &time_step, LimitSide limit_side)
237 {
238  ASSERT_PTR( mesh() )( name() ).error("NULL mesh pointer of field with given name. set_mesh must be called before.\n");
239 
240  // Skip setting time if the new time is equal to current time of the field
241  // and if either the field is continuous in that time or the current limit side is same as the new one.
242  if (time_step.end() == last_time_) {
243  if ( ! is_jump_time() ||
244  limit_side == last_limit_side_) {
245  last_limit_side_ = limit_side;
246  return changed();
247  }
248  }
249 
250  last_time_=time_step.end();
251  last_limit_side_ = limit_side;
252 
253  // possibly update our control field
255  no_check_control_field_->set_time(time_step, limit_side);
256  }
257 
259 
260  // read all descriptors satisfying time.ge(input_time)
261  update_history(time_step);
262  check_initialized_region_fields_();
263 
264  //
265  is_jump_time_=false;
266  // set time_step on all regions
267  // for regions that match type of the field domain
268  for(const Region &reg: mesh()->region_db().get_region_set("ALL") ) {
269  auto rh = data_->region_history_[reg.idx()];
270 
271  // skip regions with no matching BC flag
272  if (reg.is_boundary() != is_bc()) continue;
273 
274  // Check regions with empty history, possibly set default.
275  if ( rh.empty()) continue;
276 
277  double last_time_in_history = rh.front().first;
278  unsigned int history_size=rh.size();
279  unsigned int i_history;
280  ASSERT( time_step.ge(last_time_in_history) ).error("Setting field time back in history not fully supported yet!");
281 
282  // set history index
283  if ( time_step.gt(last_time_in_history) ) {
284  // in smooth time_step
285  i_history=0;
286  } else {
287  // time_step .eq. input_time; i.e. jump time
288  is_jump_time_=true;
289  if (limit_side == LimitSide::right) {
290  i_history=0;
291  } else {
292  i_history=1;
293  }
294  }
295  i_history=min(i_history, history_size - 1);
296  ASSERT(i_history >= 0).error("Empty field history.");
297  // possibly update field pointer
298 
299  auto new_ptr = rh.at(i_history).second;
300  if (new_ptr != region_fields_[reg.idx()]) {
301  region_fields_[reg.idx()]=new_ptr;
303  }
304  // let FieldBase implementation set the time
305  if ( new_ptr->set_time(time_step) ) set_time_result_ = TimeStatus::changed;
306 
307  }
308 
309  return changed();
310 }
311 
312 
313 template<int spacedim, class Value>
315  ASSERT( flags().match(FieldFlag::equation_input))(other.name().c_str())(this->name().c_str())
316  .error("Can not copy to the non-input field.");
317 
318  // do not use copy if the field have its own input
320  && this->shared_->input_list_.size() != 0 ) return;
321 
322  if (typeid(other) == typeid(*this)) {
323  auto const &other_field = dynamic_cast< Field<spacedim, Value> const &>(other);
324  this->operator=(other_field);
325  }
326 }
327 
328 
329 
330 template<int spacedim, class Value>
331 void Field<spacedim, Value>::field_output(std::shared_ptr<OutputTime> stream)
332 {
333  // currently we cannot output boundary fields
334  if (!is_bc()) {
335  const OutputTime::DiscreteSpace type = this->get_output_type();
336 
338  this->compute_field_data( type, stream);
339  }
340 }
341 
342 
343 template<int spacedim, class Value>
344 void Field<spacedim, Value>::observe_output(std::shared_ptr<Observe> observe)
345 {
346  typedef typename Value::element_type ElemType;
347 
348  if (observe->point_ds()->size() == 0) return;
349 
350  ElementDataCache<ElemType> &output_data = observe->prepare_compute_data<ElemType>(this->name(), this->time(),
351  (unsigned int)Value::NRows_, (unsigned int)Value::NCols_);
352 
353  unsigned int loc_point_time_index, ele_index;
354  for(ObservePointAccessor op_acc : observe->local_range()) {
355  loc_point_time_index = op_acc.loc_point_time_index();
356  ele_index = op_acc.observe_point().element_idx();
357  const Value &obs_value =
358  Value( const_cast<typename Value::return_type &>(
359  this->value(op_acc.observe_point().global_coords(),
360  ElementAccessor<spacedim>(this->mesh(), ele_index)) ));
361  ASSERT_EQ(output_data.n_comp(), obs_value.n_rows()*obs_value.n_cols()).error();
362  output_data.store_value(loc_point_time_index, obs_value.mem_ptr());
363  }
364 }
365 
366 
367 
368 template<int spacedim, class Value>
370 
371  FieldResult result_all = result_none;
372  for(Region &reg : region_set) {
373  auto f = region_fields_[reg.idx()];
374  if (f) {
375  FieldResult fr = f->field_result();
376  if (result_all == result_none) // first region
377  result_all = fr;
378  else if (fr != result_all)
379  result_all = result_other; // if results from individual regions are different
380  } else return result_none; // if field is undefined on any region of the region set
381  }
382 
383  if (result_all == result_constant && region_set.size() > 1)
384  return result_other; // constant result for individual regions could be non-constant on the whole region set
385 
386  return result_all;
387 
388 }
389 
390 
391 template<int spacedim, class Value>
393 {
394  int nrows = Value::NRows_;
395  int ncols = Value::NCols_;
396  string type = "Integer";
398  type = "Double";
399 
400  return fmt::format("{{ \"shape\": [ {}, {} ], \"type\": \"{}\", \"limit\": [ {}, {} ] }}",
401  nrows, ncols, type, this->limits().first, this->limits().second);
402 }
403 
404 
405 template<int spacedim, class Value>
407  ASSERT_PTR( mesh() ).error("Null mesh pointer, set_mesh() has to be called before.\n");
408 
409  // read input up to given time
410  double input_time;
411  if (shared_->input_list_.size() != 0) {
412  while( shared_->list_idx_ < shared_->input_list_.size()
413  && time.ge( input_time = time.read_time( shared_->input_list_[shared_->list_idx_].find<Input::Tuple>("time") ) ) ) {
414 
415  const Input::Record & actual_list_item = shared_->input_list_[shared_->list_idx_];
416  // get domain specification
417  RegionSet domain;
418  Input::Array domain_name_array;
419  unsigned int id;
420  if (actual_list_item.opt_val("region", domain_name_array)) {
421  std::vector<string> domain_names = mesh()->region_db().get_and_check_operands(domain_name_array);
422  domain = mesh()->region_db().union_set(domain_names);
423 
424  } else if (actual_list_item.opt_val("rid", id)) {
425  Region region;
426  try {
427  region = mesh()->region_db().find_id(id);
428  } catch (RegionDB::ExcUniqueRegionId &e) {
429  e << actual_list_item.ei_address();
430  throw;
431  }
432  if (region.is_valid())
433  domain.push_back(region);
434  else
435  THROW(RegionDB::ExcUnknownRegion() << RegionDB::EI_ID(id) );
436  } else {
437  THROW(ExcMissingDomain()
438  << actual_list_item.ei_address() );
439  }
440 
441  // get field instance
442  for(auto rit = factories_.rbegin() ; rit != factories_.rend(); ++rit) {
443  FieldBasePtr field_instance = (*rit)->create_field(actual_list_item, *this);
444  if (field_instance) // skip descriptors without related keys
445  {
446  // add to history
447  ASSERT_EQ( field_instance->n_comp() , n_comp());
448  field_instance->set_mesh( mesh() , is_bc() );
449  for(const Region &reg: domain) {
450  // if region history is empty, add new field
451  // or if region history is not empty and the input_time is higher, add new field
452  // otherwise (region history is not empty and the input_time is the same),
453  // rewrite the region field
454  if( data_->region_history_[reg.idx()].size() == 0
455  || data_->region_history_[reg.idx()].back().first < input_time)
456  {
457  data_->region_history_[reg.idx()].push_front(
458  HistoryPoint(input_time, field_instance));
459  //DebugOut() << "Update history" << print_var(this->name()) << print_var(reg.label()) << print_var(input_time);
460  }
461  else
462  {
463  data_->region_history_[reg.idx()].back() =
464  HistoryPoint(input_time, field_instance);
465  }
466  }
467  break;
468  }
469  }
470 
471  ++shared_->list_idx_;
472  }
473  }
474 }
475 
476 template<int spacedim, class Value>
478  ASSERT_PTR(mesh()).error("Null mesh pointer.");
479  //if (shared_->is_fully_initialized_) return;
480 
481  // check there are no empty field pointers, collect regions to be initialized from default value
482  RegionSet regions_to_init; // empty vector
483 
484  for(const Region &reg : mesh()->region_db().get_region_set("ALL") )
485  if (reg.is_boundary() == is_bc()) { // for regions that match type of the field domain
486  RegionHistory &rh = data_->region_history_[reg.idx()];
487  if ( rh.empty() || ! rh[0].second) // empty region history
488  {
489  // test if check is turned on and control field is FieldConst
490  if (no_check_control_field_ && no_check_control_field_->is_constant(reg) ) {
491  // get constant enum value
492  auto elm = ElementAccessor<spacedim>(mesh(), reg);
493  FieldEnum value = no_check_control_field_->value(elm.centre(),elm);
494  // check that the value is in the disable list
495  if ( std::find(shared_->no_check_values_.begin(), shared_->no_check_values_.end(), value)
496  != shared_->no_check_values_.end() )
497  continue; // the field is not needed on this region
498  }
499  if (shared_->input_default_ != "") { // try to use default
500  regions_to_init.push_back( reg );
501  } else {
502  xprintf(UsrErr, "Missing value of the input field '%s' ('%s') on region ID: %d label: %s.\n",
503  input_name().c_str(), name().c_str(), reg.id(), reg.label().c_str() );
504  }
505  }
506  }
507 
508  // possibly set from default value
509  if ( regions_to_init.size() ) {
510  std::string region_list;
511  // has to deal with fact that reader can not deal with input consisting of simple values
512  string default_input=input_default();
513  auto input_type = get_input_type().make_instance().first;
514  Input::ReaderToStorage reader( default_input, *input_type, Input::FileFormat::format_JSON );
515 
516  auto a_rec = reader.get_root_interface<Input::AbstractRecord>();
517  FieldAlgoBaseInitData init_data(input_name(), n_comp(), units(), limits(), flags());
518  auto field_ptr = FieldBaseType::function_factory( a_rec , init_data );
519  field_ptr->set_mesh( mesh(), is_bc() );
520  for(const Region &reg: regions_to_init) {
521  data_->region_history_[reg.idx()]
522  .push_front(HistoryPoint( 0.0, field_ptr) );
523  region_list+=" "+reg.label();
524  }
525  FieldCommon::messages_data_.push_back( MessageData(input_default(), name(), region_list) );
526 
527  }
528  //shared_->is_fully_initialized_ = true;
529 }
530 
531 
532 template<int spacedim, class Value>
533 void Field<spacedim,Value>::add_factory(const std::shared_ptr<FactoryBase> factory) {
534  factories_.push_back( factory );
535 }
536 
537 
538 template<int spacedim, class Value>
540  Input::AbstractRecord field_record;
541  if (rec.opt_val(field.input_name(), field_record)) {
542  FieldAlgoBaseInitData init_data(field.input_name(), field.n_comp(), field.units(), field.limits(), field.get_flags());
543  return FieldBaseType::function_factory(field_record, init_data );
544  }
545  else
546  return FieldBasePtr();
547 }
548 
549 
550 template<int spacedim, class Value>
552  return in_rec.find<Input::AbstractRecord>(input_name);
553 }
554 
555 
556 
557 
558 template<int spacedim, class Value>
560  if (! flags().match(FieldFlag::declare_input)) return;
561 
562  // check that times forms ascending sequence
563  double time,last_time=0.0;
564 
566  it != list.end();
567  ++it) {
568  for(auto rit = factories_.rbegin() ; rit != factories_.rend(); ++rit) {
569  if ( (*rit)->is_active_field_descriptor( (*it), this->input_name() ) ) {
570  shared_->input_list_.push_back( Input::Record( *it ) );
571  time = tg.read_time( it->find<Input::Tuple>("time") );
572  if (time < last_time) {
573  THROW( ExcNonascendingTime()
574  << EI_Time(time)
575  << EI_Field(input_name())
576  << it->ei_address());
577  }
578  last_time = time;
579 
580  break;
581  }
582  }
583  }
584 
585 }
586 
587 
588 
589 template<int spacedim, class Value>
590 void Field<spacedim,Value>::compute_field_data(OutputTime::DiscreteSpace space_type, std::shared_ptr<OutputTime> stream) {
591  typedef typename Value::element_type ElemType;
592 
593  OutputTime::OutputDataPtr output_data_base = stream->prepare_compute_data<ElemType>(this->name(), space_type,
594  (unsigned int)Value::NRows_, (unsigned int)Value::NCols_);
595 
596  try{
597  // try casting actual ElementDataCache
598  if( ! output_data_base->is_dummy()){
599  auto output_data = std::dynamic_pointer_cast<ElementDataCache<ElemType>>(output_data_base);
600  fill_data_cache(space_type, stream, output_data);
601  }
602 
603  } catch(const std::bad_cast& e){
604  // skip
605  }
606 
607  /* Set the last time */
608  stream->update_time(this->time());
609 
610 }
611 
612 template<int spacedim, class Value>
614  std::shared_ptr<OutputTime> stream,
615  std::shared_ptr<ElementDataCache<typename Value::element_type>> data_cache)
616 {
617  std::shared_ptr<OutputMeshBase> output_mesh = stream->get_output_mesh_ptr();
618  ASSERT(output_mesh);
619 
620  /* Copy data to array */
621  switch(space_type) {
624  unsigned int node_index = 0;
625  for(const auto & ele : *output_mesh )
626  {
627  std::vector<Space<3>::Point> vertices = ele.vertex_list();
628  for(unsigned int i=0; i < ele.n_nodes(); i++)
629  {
630  const Value &node_value =
631  Value( const_cast<typename Value::return_type &>(
632  this->value(vertices[i],
633  ElementAccessor<spacedim>(ele.orig_mesh(), ele.orig_element_idx()) ))
634  );
635  ASSERT_EQ(data_cache->n_comp(), node_value.n_rows()*node_value.n_cols()).error();
636  data_cache->store_value(node_index, node_value.mem_ptr() );
637  ++node_index;
638  }
639  }
640  }
641  break;
642  case OutputTime::ELEM_DATA: {
643  for(const auto & ele : *output_mesh )
644  {
645  unsigned int ele_index = ele.idx();
646  const Value &ele_value =
647  Value( const_cast<typename Value::return_type &>(
648  this->value(ele.centre(),
649  ElementAccessor<spacedim>(ele.orig_mesh(), ele.orig_element_idx()))
650  )
651  );
652  ASSERT_EQ(data_cache->n_comp(), ele_value.n_rows()*ele_value.n_cols()).error();
653  data_cache->store_value(ele_index, ele_value.mem_ptr() );
654  }
655  }
656  break;
658  std::shared_ptr< FieldFE<spacedim, Value> > field_fe_ptr = this->get_field_fe();
659 
660  if (field_fe_ptr) {
661  auto native_output_data_base = stream->prepare_compute_data<double>(this->name(), space_type,
662  (unsigned int)Value::NRows_, (unsigned int)Value::NCols_);
663  // try casting actual ElementDataCache
664  auto native_output_data = std::dynamic_pointer_cast<ElementDataCache<double>>(native_output_data_base);
665  field_fe_ptr->native_data_to_cache(*native_output_data);
666  } else {
667  WarningOut().fmt("Field '{}' of native data space type is not of type FieldFE. Output will be skipped.\n", this->name());
668  }
669  }
670  break;
673  //should not happen
674  break;
675  }
676 }
677 
678 template<int spacedim, class Value>
679 std::shared_ptr< FieldFE<spacedim, Value> > Field<spacedim,Value>::get_field_fe() {
680  ASSERT_EQ_DBG(this->mesh()->region_db().size(), region_fields_.size()).error();
681  ASSERT(!this->shared_->bc_).error("FieldFE output of native data is supported only for bulk fields!");
682 
683  std::shared_ptr< FieldFE<spacedim, Value> > field_fe_ptr;
684 
685  bool is_fe = (region_fields_.size()>0); // indicate if FieldFE is defined on all bulk regions
686  is_fe = is_fe && region_fields_[1] && (typeid(*region_fields_[1]) == typeid(FieldFE<spacedim, Value>));
687  for (unsigned int i=3; i<2*this->mesh()->region_db().bulk_size(); i+=2)
688  if (!region_fields_[i] || (region_fields_[i] != region_fields_[1])) {
689  is_fe = false;
690  break;
691  }
692  if (is_fe) {
693  field_fe_ptr = std::dynamic_pointer_cast< FieldFE<spacedim, Value> >( region_fields_[1] );
694  }
695 
696  return field_fe_ptr;
697 }
698 
699 
700 
701 
702 #endif /* FIELD_IMPL_HH_ */
FieldCommon::units
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Definition: field_common.hh:140
result_none
@ result_none
Definition: field_algo_base.hh:69
LimitSide::right
@ right
FieldCommon::shared_
std::shared_ptr< SharedData > shared_
Definition: field_common.hh:571
FlagArray::match
constexpr bool match(Mask mask) const
Definition: flag_array.hh:163
reader_to_storage.hh
FieldCommon::last_limit_side_
LimitSide last_limit_side_
Definition: field_common.hh:594
Input::ReaderToStorage
Reader for (slightly) modified input files.
Definition: reader_to_storage.hh:96
Field::compute_field_data
void compute_field_data(OutputTime::DiscreteSpace space_type, std::shared_ptr< OutputTime > stream)
Definition: field.impl.hh:590
FieldCommon::get_output_type
OutputTime::DiscreteSpace get_output_type() const
Definition: field_common.hh:251
Field< 3, FieldValue< 3 >::TensorFixed >::HistoryPoint
pair< double, FieldBasePtr > HistoryPoint
Pair: time, pointer to FieldBase instance.
Definition: field.hh:341
FieldCommon::last_time_
double last_time_
Definition: field_common.hh:593
UsrErr
@ UsrErr
Definition: system.hh:64
Field::set_time
bool set_time(const TimeStep &time, LimitSide limit_side) override
Definition: field.impl.hh:236
FieldCommon::flags
FieldFlag::Flags & flags()
Definition: field_common.hh:263
ElementDataCache
Definition: element_data_cache.hh:44
ASSERT
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:346
FieldCommon::messages_data_
static std::vector< MessageData > messages_data_
Vector of data of initialization messages.
Definition: field_common.hh:627
FieldCommon::TimeStatus::changed
@ changed
Field::check_initialized_region_fields_
void check_initialized_region_fields_()
Definition: field.impl.hh:477
FieldCommon::set_component_index
void set_component_index(unsigned int idx)
Definition: field_common.hh:427
Input::Type::Integer
Class for declaration of the integral input data.
Definition: type_base.hh:483
Field::Field
Field()
Definition: field.impl.hh:37
FieldEnum
unsigned int FieldEnum
Definition: field_values.hh:55
value
static constexpr bool value
Definition: json.hpp:87
Field::observe_output
void observe_output(std::shared_ptr< Observe > observe) override
Definition: field.impl.hh:344
ElementDataCacheBase::n_comp
unsigned int n_comp() const
Definition: element_data_cache_base.hh:145
RegionIdx::is_valid
bool is_valid() const
Returns false if the region has undefined/invalid value.
Definition: region.hh:78
FieldResult
FieldResult
Definition: field_algo_base.hh:68
FieldCommon::mesh
const Mesh * mesh() const
Definition: field_common.hh:260
result_other
@ result_other
Definition: field_algo_base.hh:70
THROW
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
std::vector< FieldEnum >
ElementAccessor
Definition: fe_value_handler.hh:29
TimeStep::gt
bool gt(double other_time) const
Definition: time_governor.hh:157
OutputTime::ELEM_DATA
@ ELEM_DATA
Definition: output_time.hh:107
ASSERT_EQ_DBG
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:331
MultiField::get_input_type
IT::Instance get_input_type() override
Definition: multi_field.impl.hh:109
FieldCommon::TimeStatus::constant
@ constant
Field::get_input_type
IT::Instance get_input_type() override
Definition: field.impl.hh:130
field_fe.hh
RegionIdx::idx
unsigned int idx() const
Returns a global index of the region.
Definition: region.hh:82
Field::get_field_fe
std::shared_ptr< FieldFE< spacedim, Value > > get_field_fe()
Definition: field.impl.hh:679
fmt::format
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3141
Field::get_value_attribute
std::string get_value_attribute() const override
Definition: field.impl.hh:392
Field::fill_data_cache
void fill_data_cache(OutputTime::DiscreteSpace space_type, std::shared_ptr< OutputTime > stream, std::shared_ptr< ElementDataCache< typename Value::element_type >> data_cache)
Fills acutally the data cache with field values, used in compute_field_data.
Definition: field.impl.hh:613
ASSERT_LT
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than)
Definition: asserts.hh:295
result_constant
@ result_constant
Definition: field_algo_base.hh:71
Region
Definition: region.hh:146
Input::Iterator
Definition: accessors.hh:143
FieldCommon::input_default
const std::string & input_default() const
Definition: field_common.hh:237
Field::update_history
void update_history(const TimeStep &time)
Definition: field.impl.hh:406
TimeStep::end
double end() const
Definition: time_governor.hh:151
ObservePointAccessor
Point accessor allow iterate over local Observe points.
Definition: observe.hh:310
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
MultiField::size
unsigned int size() const
Number of subfields that compose the multi-field.
Definition: multi_field.hh:204
FieldCommon::multifield_
bool multifield_
Definition: field_common.hh:616
OutputTime::MESH_DEFINITION
@ MESH_DEFINITION
Definition: output_time.hh:109
FieldCommon::units
const UnitSI & units() const
Definition: field_common.hh:240
RegionDB::bulk_size
unsigned int bulk_size() const
Definition: region.cc:268
FieldAlgoBaseInitData
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Definition: field_algo_base.hh:79
xprintf
#define xprintf(...)
Definition: system.hh:92
Field::field_output
void field_output(std::shared_ptr< OutputTime > stream) override
Definition: field.impl.hh:331
accessors.hh
TimeStep
Representation of one time step..
Definition: time_governor.hh:113
TimeGovernor
Basic time management functionality for unsteady (and steady) solvers (class Equation).
Definition: time_governor.hh:294
Field::field_result
FieldResult field_result(RegionSet region_set) const override
Indicates special field states.
Definition: field.impl.hh:369
Input::AbstractRecord
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:458
Input::Type::Instance::make_instance
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_generic.cc:122
FieldCommon
Common abstract parent of all Field<...> classes.
Definition: field_common.hh:71
Field::data_
std::shared_ptr< SharedData > data_
Definition: field.hh:355
Input::Record::ei_address
EI_Address ei_address() const
Definition: accessors.cc:178
Mesh::region_db
const RegionDB & region_db() const
Definition: mesh.h:147
ASSERT_EQ
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
Definition: asserts.hh:327
Field::factories_
std::vector< std::shared_ptr< FactoryBase > > factories_
Definition: field.hh:372
RegionDB::find_id
Region find_id(unsigned int id, unsigned int dim) const
Definition: region.cc:180
Input::Record::opt_val
bool opt_val(const string &key, Ret &value) const
Definition: accessors_impl.hh:107
Input::format_JSON
@ format_JSON
Definition: reader_to_storage.hh:60
Input::Type::Instance
Helper class that stores data of generic types.
Definition: type_generic.hh:89
Input::ReaderToStorage::get_root_interface
T get_root_interface() const
Returns the root accessor.
Definition: reader_to_storage.cc:150
MultiField::operator=
MultiField & operator=(const MultiField &other)
Definition: multi_field.impl.hh:58
FieldCommon::changed
bool changed() const
Definition: field_common.hh:337
LimitSide
LimitSide
Definition: field_common.hh:58
FieldCommon::TimeStatus::unknown
@ unknown
FieldCommon::is_bc
bool is_bc() const
Definition: field_common.hh:254
Field::get_multifield_input_type
IT::Array get_multifield_input_type() override
Definition: field.impl.hh:137
Field::region_fields_
std::vector< FieldBasePtr > region_fields_
Definition: field.hh:370
field_algo_base.impl.hh
RegionDB::get_and_check_operands
std::vector< std::string > get_and_check_operands(const Input::Array &operands) const
Definition: region.cc:312
Field< 3, FieldValue< 3 >::TensorFixed >::RegionHistory
boost::circular_buffer< HistoryPoint > RegionHistory
Nearest history of one region.
Definition: field.hh:343
Input::Record::find
Iterator< Ret > find(const string &key) const
Definition: accessors_impl.hh:91
FieldValue_
Definition: field_values.hh:247
Field::add_factory
void add_factory(std::shared_ptr< FactoryBase > factory)
Definition: field.impl.hh:533
Field::set_field
void set_field(const RegionSet &domain, FieldBasePtr field, double time=0.0)
Definition: field.impl.hh:196
Input::Type
Definition: balance.hh:38
Field::value
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) const
Definition: field.hh:392
Value
@ Value
Definition: finite_element.hh:47
observe.hh
Field< 3, FieldValue< 3 >::TensorFixed >::FieldBasePtr
std::shared_ptr< FieldBaseType > FieldBasePtr
Definition: field.hh:87
OutputTime::UNDEFINED
@ UNDEFINED
Definition: output_time.hh:110
FieldFE
Definition: field.hh:56
Mesh
Definition: mesh.h:80
OutputTime::NODE_DATA
@ NODE_DATA
Definition: output_time.hh:105
Field::no_check_control_field_
std::shared_ptr< ControlField > no_check_control_field_
Definition: field.hh:365
TimeGovernor::read_time
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
Definition: time_governor.cc:767
Input::Type::Array
Class for declaration of inputs sequences.
Definition: type_base.hh:339
Field::set_mesh
void set_mesh(const Mesh &mesh) override
Definition: field.impl.hh:157
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
OutputTime::OutputDataPtr
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
Definition: output_time.hh:122
WarningOut
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:246
Input::Tuple
Accessor to the data with type Type::Tuple.
Definition: accessors.hh:411
std
Definition: doxy_dummy_defs.hh:5
FieldFlag::equation_input
static constexpr Mask equation_input
The field is data parameter of the owning equation. (default on)
Definition: field_flag.hh:33
OutputTime::CORNER_DATA
@ CORNER_DATA
Definition: output_time.hh:106
FieldCommon::get_flags
FieldFlag::Flags get_flags() const
Definition: field_common.hh:266
output_mesh.hh
Classes for auxiliary output mesh.
Field::FactoryBase::is_active_field_descriptor
virtual bool is_active_field_descriptor(const Input::Record &in_rec, const std::string &input_name)
Definition: field.impl.hh:551
FieldCommon::history_length_limit_
static const unsigned int history_length_limit_
Definition: field_common.hh:621
region.hh
FieldFlag::declare_input
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on)
Definition: field_flag.hh:35
FieldCommon::SharedData
Definition: field_common.hh:485
Field::set_input_list
void set_input_list(const Input::Array &list, const TimeGovernor &tg) override
Definition: field.impl.hh:559
FieldCommon::name
const std::string & name() const
Definition: field_common.hh:231
FieldCommon::n_comp
unsigned int n_comp() const
Definition: field_common.hh:257
Field::is_constant
bool is_constant(Region reg) override
Definition: field.impl.hh:187
OutputTime::DiscreteSpace
DiscreteSpace
Definition: output_time.hh:104
FieldCommon::is_jump_time_
bool is_jump_time_
Definition: field_common.hh:600
FieldCommon::input_name
const std::string & input_name() const
Definition: field_common.hh:228
FieldCommon::is_jump_time
bool is_jump_time()
Definition: field_common.hh:280
FieldCommon::limits
std::pair< double, double > limits() const
Definition: field_common.hh:246
Field
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:83
std::list
Definition: doxy_dummy_defs.hh:9
TimeStep::ge
bool ge(double other_time) const
Definition: time_governor.hh:163
MultiField::no_check_control_field_
const MultiField< spacedim, typename FieldValue< spacedim >::Enum > * no_check_control_field_
Definition: multi_field.hh:265
FieldCommon::set_history_changed
void set_history_changed()
Definition: field_common.hh:471
Field::disable_where
auto disable_where(const Field< spacedim, typename FieldValue< spacedim >::Enum > &control_field, const vector< FieldEnum > &value_list) -> Field &
Definition: field.impl.hh:147
ASSERT_PTR
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Definition: asserts.hh:335
Field::FactoryBase::create_field
virtual FieldBasePtr create_field(Input::Record rec, const FieldCommon &field)
Definition: field.impl.hh:539
OutputTime::N_DISCRETE_SPACES
static const unsigned int N_DISCRETE_SPACES
Definition: output_time.hh:103
output_element.hh
Class OutputElement and its iterator OutputElementIterator on the output mesh.
Field::copy_from
void copy_from(const FieldCommon &other) override
Definition: field.impl.hh:314
FieldCommon::time
double time() const
Definition: field_common.hh:273
ElementDataCache::store_value
void store_value(unsigned int idx, const T *value)
Definition: element_data_cache.cc:218
FieldAlgorithmBase::function_factory
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory(const Input::AbstractRecord &rec, const struct FieldAlgoBaseInitData &init_data)
Definition: field_algo_base.impl.hh:127
field.hh
FieldCommon::MessageData
Store data of one initialization message.
Definition: field_common.hh:86
FieldCommon::set_time_result_
TimeStatus set_time_result_
Definition: field_common.hh:587
FieldCommon::name_
std::string name_
Definition: field_common.hh:566
OutputTime::NATIVE_DATA
@ NATIVE_DATA
Definition: output_time.hh:108
FieldCommon::component_index_
unsigned int component_index_
Definition: field_common.hh:610
FieldCommon::name
FieldCommon & name(const string &name)
Definition: field_common.hh:108
RegionDB::union_set
RegionSet union_set(std::vector< std::string > set_names) const
Definition: region.cc:481
Field::operator=
Field & operator=(const Field &other)
Definition: field.impl.hh:96