18 #ifndef FIELD_INTERPOLATED_P0_IMPL_HH_ 19 #define FIELD_INTERPOLATED_P0_IMPL_HH_ 37 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.")
51 template <
int spacedim,
class Value>
53 Input::register_class< FieldInterpolatedP0<spacedim, Value>,
unsigned int >(
"FieldInterpolatedP0") +
57 template <
int spacedim,
class Value>
64 template <
int spacedim,
class Value>
78 data_ = std::make_shared<std::vector<typename Value::element_type>>();
79 data_->resize(data_size);
87 template <
int spacedim,
class Value>
100 search_header.
actual =
false;
104 search_header.
time = time.
end();
106 bool boundary_domain_ =
false;
110 return search_header.actual;
115 template <
int spacedim,
class Value>
123 if (elm.
dim() == 3) {
124 xprintf(
Err,
"Dimension of element in target mesh must be 0, 1 or 2! elm.idx() = %d\n", elm.
idx());
130 if (elm.
dim() == 0) {
141 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
142 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
147 double total_measure=0.0, measure;
155 if (ele->dim() == 3) {
189 if (measure > epsilon) {
190 unsigned int index = this->
value_.n_rows() * this->
value_.n_cols() * (*it);
192 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])) );
193 Value tmp_value = Value( ret_type_value );
195 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
196 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
197 this->
value_(i,j) += tmp_value(i,j) * measure;
200 total_measure += measure;
206 if (total_measure > epsilon) {
207 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
208 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
209 this->
value_(i,j) /= total_measure;
213 WarningOut().fmt(
"Processed element with idx {} is out of source mesh!\n", elm.
idx());
223 template <
int spacedim,
class Value>
unsigned int computed_elm_boundary_
stored flag if last computed element is boundary
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 Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
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)
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
virtual void init_from_input(const Input::Record &rec)
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.