8 #ifndef SRC_IO_OBSERVE_HH_ 9 #define SRC_IO_OBSERVE_HH_ 11 #include <boost/exception/info.hpp> 30 namespace Input {
namespace Type {
class Record; } }
43 : distance_(numeric_limits<double>::infinity()) {};
77 <<
"Failed to find the element containing the initial observe point.\n");
83 <<
"Failed to find any element in the search radius of the observe point " << EI_PointName::qval
85 <<
"The closest element has index " << EI_ClosestEle::ref(*this).element_idx_ <<
", its distance is " << EI_ClosestEle::ref(*this).distance_ <<
".\n" 86 <<
"Solution: check the position of the observe point, possibly increase the maximal snapping distance " 87 <<
"(keys: observe_points:search_radius, mesh:global_snap_radius)"<<
"\n");
89 <<
"Failed to find any element in the search radius of the observe point" << EI_PointName::qval
90 <<
" inside the snap region: " << EI_RegionName::qval <<
".\n" 91 <<
"The observe point coordinates are " <<
field_value_to_yaml(EI_Point::ref(*
this)) <<
".\n" 92 <<
"The closest element (outside the snap region) has index " << EI_ClosestEle::ref(*this).element_idx_
93 <<
", its distance is " << EI_ClosestEle::ref(*this).distance_ <<
".\n" 94 <<
"Solution: check the position/region of the observe point, possibly increase the maximal snapping distance " 95 <<
"(keys: observe_points:search_radius, mesh:global_snap_radius)"<<
"\n");
103 {
return observe_data_.element_idx_; }
109 {
return observe_data_.global_coords_; }
125 bool have_observe_element();
131 void snap(
Mesh &mesh);
146 void find_observe_point(
Mesh &mesh);
152 void output(ostream &out,
unsigned int indent_spaces,
unsigned int precision);
222 {
return observed_element_indices_;}
227 void output_header();
233 void output_time_frame(
double time,
bool flush);
245 {
return point_ds_; }
262 template <
typename T>
263 ElementDataCache<T> & prepare_compute_data(std::string field_name,
double field_time,
unsigned int n_rows,
unsigned int n_cols);
300 bool no_fields_warning=
false;
333 : observe_(observe), loc_point_idx_(loc_idx)
338 return loc_point_idx_;
343 return observe_->point_4_loc_[loc_point_idx_];
348 return observe_->points_[ this->global_idx() ];
353 return (observe_->point_4_loc_.size() * observe_->observe_time_idx_) + loc_point_idx_;
358 return observe_ != NULL;
std::vector< ObservePoint > points_
Full information about observe points.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
unsigned int global_idx() const
Return global index to point.
double max_search_radius_
OutputDataFieldMap observe_field_values_
Stored field values.
std::ofstream observe_file_
Output file stream.
unsigned int proc_
Actual process of the observe point.
const ObservePoint observe_point() const
Return ElementAccessor to element of loc_ele_idx_.
std::vector< LongIdx > point_4_loc_
Index set assigning to local point index its global index.
arma::vec3 input_point_
Input coordinates of the initial position of the observation point.
const std::vector< ObservePoint > & points() const
ObservePointData()
Constructor.
bool operator==(const ObservePointAccessor &other)
Comparison of accessors.
ObservePointAccessor()
Default invalid accessor.
Template Iter serves as general template for internal iterators.
static const unsigned int max_observe_value_time
Maximal size of observe values times vector.
const Distribution * point_ds() const
unsigned int element_idx_
Final element of the observe point. The index in the mesh.
std::string time_unit_str_
String representation of the time unit.
std::string observe_name_
bool is_valid() const
Check validity of accessor (see default constructor)
arma::vec local_coords_
Local (barycentric) coordinates on the element.
void inc()
Iterates to next local point.
unsigned int loc_point_time_index() const
Return local index in data cache (combination of local point index and index of stored time) ...
unsigned int local_idx() const
Return local index to point.
Input::Record in_rec_
Index in the input array.
unsigned int element_idx() const
arma::vec3 global_coords_
Global coordinates of the observation point.
unsigned int precision_
Precision of float output.
std::string name_
Observation point name.
LongIdx local_idx_
Local index on actual process of the observe point.
LongIdx global_idx_
Global index of the observe point.
std::vector< unsigned int > observed_element_indices_
Elements of the o_points.
const Observe * observe_
Pointer to the Observe owning the point.
unsigned int loc_point_idx_
Index into Observe::point_4_loc_ array.
const std::vector< unsigned int > & observed_elements() const
ObservePointData observe_data_
Helper object stored projection data.
ObservePointAccessor(const Observe *observe, unsigned int loc_idx)
Support classes for parallel programing.
double time_unit_seconds_
Time unit in seconds.
std::map< string, OutputDataPtr > OutputDataFieldMap
std::vector< double > observe_values_time_
Common evaluation time of the fields for single time frame.
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
unsigned int observe_time_idx_
Index of actual (last) time in observe_values_time_ vector.
Distribution * point_ds_
Parallel distribution of observe points.
Point accessor allow iterate over local Observe points.
arma::vec3 global_coords() const
Implementation of range helper class.