8 #ifndef SRC_IO_OBSERVE_HH_
9 #define SRC_IO_OBSERVE_HH_
31 namespace Input {
namespace Type {
class Record; } }
68 :
distance_(numeric_limits<double>::infinity()) {};
102 <<
"Failed to find the element containing the initial observe point.\n");
108 <<
"Failed to find any element in the search radius of the observe point " << EI_PointName::qval
110 <<
"The closest element has index " << EI_ClosestEle::ref(*this).element_idx_ <<
", its distance is " << EI_ClosestEle::ref(*this).distance_ <<
".\n"
111 <<
"Solution: check the position of the observe point, possibly increase the maximal snapping distance "
112 <<
"(keys: observe_points:search_radius, mesh:global_snap_radius)"<<
"\n");
114 <<
"Failed to find any element in the search radius of the observe point" << EI_PointName::qval
115 <<
" inside the snap region: " << EI_RegionName::qval <<
".\n"
116 <<
"The observe point coordinates are " <<
field_value_to_yaml(EI_Point::ref(*
this)) <<
".\n"
117 <<
"The closest element (outside the snap region) has index " << EI_ClosestEle::ref(*this).element_idx_
118 <<
", its distance is " << EI_ClosestEle::ref(*this).distance_ <<
".\n"
119 <<
"Solution: check the position/region of the observe point, possibly increase the maximal snapping distance "
120 <<
"(keys: observe_points:search_radius, mesh:global_snap_radius)"<<
"\n");
183 void output(ostream &out,
unsigned int indent_spaces,
unsigned int precision);
242 unsigned int precision,
const std::shared_ptr<TimeUnitConversion>& time_unit_conv);
302 ASSERT(
it !=
observe_field_values_.end())(field_name).error(
"Element data cache of given field doesn't exist. Did you call prepare_compute_data?\n");
Point accessor allow iterate over local Observe points.
void inc()
Iterates to next local point.
ObservePointAccessor()
Default invalid accessor.
const ObservePoint observe_point() const
Return ElementAccessor to element of loc_ele_idx_.
bool operator==(const ObservePointAccessor &other)
Comparison of accessors.
bool is_valid() const
Check validity of accessor (see default constructor)
unsigned int local_idx() const
Return local index to point.
unsigned int loc_point_idx_
Index into Observe::point_4_loc_ array.
ObservePointAccessor(const Observe *observe, unsigned int loc_idx)
const Observe * observe_
Pointer to the Observe owning the point.
unsigned int global_idx() const
Return global index to point.
unsigned int loc_point_time_index() const
Return local index in data cache (combination of local point index and index of stored time)
ObservePointData()
Constructor.
unsigned int element_idx_
Final element of the observe point. The index in the mesh.
unsigned int proc_
Actual process of the observe point.
LongIdx global_idx_
Global index of the observe point.
LongIdx local_idx_
Local index on actual process of the observe point.
arma::vec local_coords_
Local (barycentric) coordinates on the element.
arma::vec3 global_coords_
Global coordinates of the observation point.
arma::vec3 global_coords() const
arma::vec3 input_point_
Input coordinates of the initial position of the observation point.
Input::Record in_rec_
Index in the input array.
DECLARE_INPUT_EXCEPTION(ExcNoObserveElement,<< "Failed to find any element in the search radius of the observe point"<< EI_PointName::qval<< " inside the snap region: "<< EI_RegionName::qval<< ".\n"<< "The observe point coordinates are "<< field_value_to_yaml(EI_Point::ref(*this))<< ".\n"<< "The closest element (outside the snap region) has index "<< EI_ClosestEle::ref(*this).element_idx_<< ", its distance is "<< EI_ClosestEle::ref(*this).distance_<< ".\n"<< "Solution: check the position/region of the observe point, possibly increase the maximal snapping distance "<< "(keys: observe_points:search_radius, mesh:global_snap_radius)"<< "\n")
TYPEDEF_ERR_INFO(EI_ClosestEle, ObservePointData)
unsigned int element_idx() const
void output(ostream &out, unsigned int indent_spaces, unsigned int precision)
DECLARE_INPUT_EXCEPTION(ExcNoObserveElementCandidates,<< "Failed to find any element in the search radius of the observe point "<< EI_PointName::qval<< " with given coordinates "<< field_value_to_yaml(EI_Point::ref(*this))<< ".\n"<< "The closest element has index "<< EI_ClosestEle::ref(*this).element_idx_<< ", its distance is "<< EI_ClosestEle::ref(*this).distance_<< ".\n"<< "Solution: check the position of the observe point, possibly increase the maximal snapping distance "<< "(keys: observe_points:search_radius, mesh:global_snap_radius)"<< "\n")
TYPEDEF_ERR_INFO(EI_RegionName, std::string)
bool have_observe_element()
TYPEDEF_ERR_INFO(EI_PointName, std::string)
arma::vec local_coords() const
std::string name_
Observation point name.
ObservePointData point_projection(unsigned int i_elm, ElementAccessor< 3 > elm)
Project point to given element by dimension of this element.
static const Input::Type::Record & get_input_type()
ObservePointData observe_data_
Helper object stored projection data.
DECLARE_INPUT_EXCEPTION(ExcNoInitialPoint,<< "Failed to find the element containing the initial observe point.\n")
double max_search_radius_
TYPEDEF_ERR_INFO(EI_Point, arma::vec3)
void find_observe_point(Mesh &mesh)
const Distribution * point_ds() const
PatchPointVec patch_point_data_
Holds observe data of eval points on patch.
static const unsigned int max_observe_value_time
Maximal size of observe values times vector.
std::vector< ObservePoint > points_
Full information about observe points.
unsigned int observe_time_idx_
Index of actual (last) time in observe_values_time_ vector.
Observe(string observe_name, Mesh &mesh, Input::Array in_array, unsigned int precision, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
const std::vector< unsigned int > & observed_elements() const
Range< ObservePointAccessor > local_range() const
Returns local range of observe points.
void flush_values()
Effectively writes the data into the observe stream.
std::vector< unsigned int > observed_element_indices_
Elements of the o_points.
std::ofstream observe_file_
Output file stream.
std::vector< double > observe_values_time_
Common evaluation time of the fields for single time frame.
std::string observe_name_
OutputDataPtr get_output_cache(std::string field_name)
~Observe()
Destructor, must close the file.
OutputDataFieldMap observe_field_values_
Stored field values.
std::map< string, OutputDataPtr > OutputDataFieldMap
PatchPointVec & patch_point_data()
Getter of patch_point_data.
std::shared_ptr< TimeUnitConversion > time_unit_conversion_
Time unit conversion object.
unsigned int precision_
Precision of float output.
const std::vector< ObservePoint > & points() const
std::vector< LongIdx > point_4_loc_
Index set assigning to local point index its global index.
Distribution * point_ds_
Parallel distribution of observe points.
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
void output_time_frame(bool flush)
OutputDataPtr prepare_compute_data(std::string field_name, double field_time, unsigned int n_shape)
Helper class storing unit conversion coefficient and functionality for conversion of units.
Support classes for parallel programing.
Template Iter serves as general template for internal iterators.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
std::vector< PatchPointData > PatchPointVec
Implementation of range helper class.
Holds data of one eval point on patch (index of element and local coordinations).
unsigned int i_reg
Index of region (use during patch creating)
PatchPointData(const PatchPointData &other)
Copy constructor.
unsigned int i_quad
Index of quadrature (use during patch creating), i_quad = dim-1.
PatchPointData(unsigned int elm_idx, arma::vec loc_coords)
Constructor with data mebers initialization.
PatchPointData()
Default constructor.
unsigned int elem_idx
Index of element.
arma::vec local_coords
Local coords of point.
unsigned int i_quad_point
Index of point in quadrature (use during patch creating)