40 template <
int spacedim, class
Value>
47 "Input file with ASCII GMSH file format.")
49 "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
53 "Allow set default value of elements that have not listed values in mesh data file.")
55 "Definition of unit of all times defined in mesh data file.")
57 "Allow set time shift of field data read from the mesh data file. For time 't', field descriptor with time 'T', " 58 "time shift 'S' and if 't > T', we read time frame 't + S'.")
64 template <
int spacedim,
class Value>
66 Input::register_class< FieldInterpolatedP0<spacedim, Value>,
unsigned int >(
"FieldInterpolatedP0") +
70 template <
int spacedim,
class Value>
79 template <
int spacedim,
class Value>
98 data_ = std::make_shared<std::vector<typename Value::element_type>>();
99 data_->resize(data_size);
110 template <
int spacedim,
class Value>
122 bool boundary_domain_ =
false;
125 double read_time = (time.
end()+time_shift) / time_unit_coef;
142 template <
int spacedim,
class Value>
150 if (elm.
dim() == 3) {
151 xprintf(
Err,
"Dimension of element in target mesh must be 0, 1 or 2! elm.idx() = %d\n", elm.
idx());
154 double epsilon = 4* numeric_limits<double>::epsilon() * elm.
measure();
157 if (elm.
dim() == 0) {
167 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
168 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
173 double total_measure=0.0, measure;
184 if (ele->
dim() == 3) {
188 arma::vec::fixed<3> real_point = elm.
node(0)->
point();
189 arma::mat::fixed<3, 4> elm_map = mapping.element_map(ele);
190 arma::vec::fixed<4> unit_point = mapping.project_real_to_unit(real_point, elm_map);
192 measure = (std::fabs(arma::sum( unit_point )-1) <= 1e-14
193 && arma::min( unit_point ) >= 0)
220 if (measure > epsilon) {
221 unsigned int index = this->
value_.n_rows() * this->
value_.n_cols() * (*it);
223 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])) );
226 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
227 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
228 this->
value_(i,j) += tmp_value(i,j) * measure;
231 total_measure += measure;
237 if (total_measure > epsilon) {
238 for (
unsigned int i=0; i < this->
value_.n_rows(); i++) {
239 for (
unsigned int j=0; j < this->
value_.n_cols(); j++) {
240 this->
value_(i,j) /= total_measure;
244 WarningOut().fmt(
"Processed element with idx {} is out of source mesh!\n", elm.
idx());
254 template <
int spacedim,
class Value>
unsigned int computed_elm_boundary_
stored flag if last computed element is boundary
double default_value_
Default value of element if not set in mesh data file.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell...
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
Bounding box in 3d ambient space.
double read_coef(Input::Iterator< std::string > unit_it) const
Classes with algorithms for computation of intersections of meshes.
Some value(s) is set to NaN.
bool set_time(const TimeStep &time) override
unsigned int component_idx_
Specify if the field is part of a MultiField and which component it is.
double compute_measure() const override
Computes the relative measure of intersection object.
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
Fundamental simplicial intersections.
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)
void init()
Initializes lower dimensional objects. Sets correctly the pointers to Plucker coordinates and product...
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_
void init()
Initializes lower dimensional objects. Sets correctly the pointers to Plucker coordinates and product...
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
static const Input::Type::Tuple & get_input_time_type(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
FieldInterpolatedP0(unsigned int n_comp=0)
#define START_TIMER(tag)
Starts a timer with specified tag.
Input::Record in_rec_
Accessor to Input::Record.
Class for O(log N) lookup for intersections with a set of bounding boxes.
std::shared_ptr< Mesh > source_mesh_
mesh, which is interpolated
BoundingBox bounding_box() const
static bool check_compatible_mesh(const FilePath &file_path, Mesh &mesh)
double measure() const
Computes the measure of the element.
Space< spacedim >::Point Point
CheckResult
Return type of method that checked data stored in ElementDataCache (NaN values, limits) ...
BIHTree * bih_tree_
tree of mesh elements
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
Dedicated class for storing path to input and output files.
bool is_constant_in_space_
Flag detects that field is only dependent on time.
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
Class for 2D-2D intersections.
#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)
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
static std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_path)
std::string field_name_
field name read from input
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Representation of one time step..
void add_boxes(const std::vector< BoundingBox > &boxes)
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Internal class representing intersection object.
const Node * node(unsigned int ni) const