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.")
53 template <
int spacedim,
class Value>
55 Input::register_class< FieldInterpolatedP0<spacedim, Value>,
unsigned int >(
"FieldInterpolatedP0") +
59 template <
int spacedim,
class Value>
66 template <
int spacedim,
class Value>
82 data_ = std::make_shared<std::vector<typename Value::element_type>>();
83 data_->resize(data_size);
91 template <
int spacedim,
class Value>
104 search_header.
actual =
false;
108 search_header.
time = time.
end();
110 bool boundary_domain_ =
false;
115 return search_header.actual;
120 template <
int spacedim,
class Value>
128 if (elm.
dim() == 3) {
129 xprintf(
Err,
"Dimension of element in target mesh must be 0, 1 or 2! elm.idx() = %d\n", elm.
idx());
135 if (elm.
dim() == 0) {
146 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
147 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
152 double total_measure=0.0, measure;
160 if (ele->dim() == 3) {
194 if (measure > epsilon) {
195 unsigned int index = this->
value_.n_rows() * this->
value_.n_cols() * (*it);
197 typename Value::return_type & ret_type_value =
const_cast<typename Value::return_type &
>( Value::from_raw(this->
r_value_, (
typename Value::element_type *)(&vec[index])) );
198 Value tmp_value = Value( ret_type_value );
200 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
201 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
202 this->
value_(i,j) += tmp_value(i,j) * measure;
205 total_measure += measure;
211 if (total_measure > epsilon) {
212 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
213 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
214 this->
value_(i,j) /= total_measure;
218 WarningOut().fmt(
"Processed element with idx {} is out of source mesh!\n", elm.
idx());
228 template <
int spacedim,
class Value>
238 template <
int spacedim,
class Value>
241 if (Value::is_scalable()) {
243 for(
unsigned int i=0; i<vec.size(); ++i)
unsigned int computed_elm_boundary_
stored flag if last computed element is boundary
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
const Element * element() const
Bounding box in 3d ambient space.
bool set_time(const TimeStep &time) override
void set_point_from_element(TPoint &p, const Element *ele)
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...
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0
FilePath reader_file_
mesh reader file
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
#define INSTANCE_ALL(field)
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
unsigned int computed_elm_idx_
stored index to last computed element
#define ADD_CALLS(n_calls)
Increase number of calls in actual timer.
TAbscissa abscissa_
1D (abscissa) element, used for computing intersection
TPoint point_
0D (point) element, used for computing intersection
Value::return_type r_value_
void set_tetrahedron_from_element(TTetrahedron &te, Element *ele)
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
bool is_elemental() const
Mesh * source_mesh_
mesh, which is interpolated
vector< int > const & elements_id_maps(bool boundary_domain) const
FieldInterpolatedP0(unsigned int n_comp=0)
#define START_TIMER(tag)
Starts a timer with specified tag.
void set_abscissa_from_element(TAbscissa &ab, const Element *ele)
Class for O(log N) lookup for intersections with a set of bounding boxes.
void get_bounding_box(BoundingBox &bounding_box) const
enum Intersections TIntersectionType
Space< spacedim >::Point Point
BIHTree * bih_tree_
tree of mesh elements
Dedicated class for storing path to input and output files.
Value value_
Last value, prevents passing large values (vectors) by value.
std::vector< unsigned int > searched_elements_
vector stored suspect elements in calculating the intersection
void scale_data()
Multiply data_ with unit_conversion_coefficient_.
void set_triangle_from_element(TTriangle &tr, const Element *ele)
TTriangle triangle_
2D (triangle) element, used for computing intersection
std::shared_ptr< GmshMeshReader > get_reader(const FilePath &file_path)
#define WarningOut()
Macro defining 'warning' record of log.
#define END_TIMER(tag)
Ends a timer with specified tag.
TTetrahedron tetrahedron_
3D (tetrahedron) element, used for computing intersection
std::string field_name_
field name read from input
static ReaderInstances * instance()
Returns singleton instance.
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
void GetIntersection(const TBisector &, const TBisector &, TPosition &, double &, double &)
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
bool IsInner(const TPoint &) const
ElementVector element
Vector of elements of the mesh.