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>
84 data_ = std::make_shared<std::vector<typename Value::element_type>>();
85 data_->resize(data_size);
93 template <
int spacedim,
class Value>
105 bool boundary_domain_ =
false;
116 template <
int spacedim,
class Value>
124 if (elm.
dim() == 3) {
125 xprintf(
Err,
"Dimension of element in target mesh must be 0, 1 or 2! elm.idx() = %d\n", elm.
idx());
131 if (elm.
dim() == 0) {
142 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
143 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
148 double total_measure=0.0, measure;
156 if (ele->dim() == 3) {
190 if (measure > epsilon) {
191 unsigned int index = this->
value_.n_rows() * this->
value_.n_cols() * (*it);
193 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])) );
194 Value tmp_value = Value( ret_type_value );
196 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
197 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
198 this->
value_(i,j) += tmp_value(i,j) * measure;
201 total_measure += measure;
207 if (total_measure > epsilon) {
208 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
209 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
210 this->
value_(i,j) /= total_measure;
214 WarningOut().fmt(
"Processed element with idx {} is out of source mesh!\n", elm.
idx());
224 template <
int spacedim,
class Value>
234 template <
int spacedim,
class Value>
237 if (Value::is_scalable()) {
239 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_
std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_name)
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
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
#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.