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>
81 data_ = std::make_shared<std::vector<typename Value::element_type>>();
82 data_->resize(data_size);
90 template <
int spacedim,
class Value>
102 bool boundary_domain_ =
false;
114 template <
int spacedim,
class Value>
122 if (elm.
dim() == 3) {
123 xprintf(
Err,
"Dimension of element in target mesh must be 0, 1 or 2! elm.idx() = %d\n", elm.
idx());
129 if (elm.
dim() == 0) {
140 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
141 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
146 double total_measure=0.0, measure;
154 if (ele->dim() == 3) {
188 if (measure > epsilon) {
189 unsigned int index = this->
value_.n_rows() * this->
value_.n_cols() * (*it);
191 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 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
195 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
196 this->
value_(i,j) += tmp_value(i,j) * measure;
199 total_measure += measure;
205 if (total_measure > epsilon) {
206 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
207 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
208 this->
value_(i,j) /= total_measure;
212 WarningOut().fmt(
"Processed element with idx {} is out of source mesh!\n", elm.
idx());
222 template <
int spacedim,
class Value>
232 template <
int spacedim,
class Value>
235 if (Value::is_scalable()) {
237 for(
unsigned int i=0; i<vec.size(); ++i)
unsigned int computed_elm_boundary_
stored flag if last computed element is boundary
void GetIntersection(const TBisector &, const TBisector &, TPosition &, double &, double &)
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.
double measure() const
Computes the measure of the element.
bool set_time(const TimeStep &time) override
void set_point_from_element(TPoint &p, const Element *ele)
bool IsInner(const TPoint &) const
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.
Value::return_type r_value_
ngh::TAbscissa abscissa_
1D (abscissa) element, used for computing intersection
void set_tetrahedron_from_element(TTetrahedron &te, Element *ele)
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
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
ngh::TPoint point_
0D (point) element, used for computing intersection
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.
std::shared_ptr< Mesh > source_mesh_
mesh, which is interpolated
void get_bounding_box(BoundingBox &bounding_box) const
Space< spacedim >::Point Point
BIHTree * bih_tree_
tree of mesh elements
Dedicated class for storing path to input and output files.
ngh::TTetrahedron tetrahedron_
3D (tetrahedron) element, used for computing intersection
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
enum ngh::Intersections TIntersectionType
void scale_data()
Multiply data_ with unit_conversion_coefficient_.
void set_triangle_from_element(TTriangle &tr, const Element *ele)
#define WarningOut()
Macro defining 'warning' record of log.
#define END_TIMER(tag)
Ends a timer with specified tag.
static std::shared_ptr< Mesh > get_mesh(const FilePath &file_path)
ngh::TTriangle triangle_
2D (triangle) element, used for computing intersection
static std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_path)
std::string field_name_
field name read from input
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
Representation of one time step..
#define FLOW123D_FORCE_LINK_IN_CHILD(x)