NonRefineableBinArray class. More...
#include <sample_point_container.h>
Public Member Functions | |
NonRefineableBinArray (SamplePointContainerParameters *bin_array_parameters_pt) | |
Constructor. More... | |
~NonRefineableBinArray () | |
Destructor: More... | |
NonRefineableBinArray (const NonRefineableBinArray &data) | |
Broken copy constructor. More... | |
void | operator= (const NonRefineableBinArray &) |
Broken assignment operator. More... | |
void | locate_zeta (const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s) |
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with global coordinate zeta. sub_geom_object_pt=0 if point can't be found. More... | |
unsigned | nbin () const |
Total number of bins (empty or not) More... | |
unsigned | total_number_of_sample_points_computed_recursively () const |
Compute total number of sample points recursively. More... | |
unsigned | n_spiral_chunk () const |
Number of spirals to be searched in one go const version. More... | |
unsigned & | n_spiral_chunk () |
Number of spirals to be searched in one go. More... | |
unsigned & | max_spiral_level () |
Access function to max. spiral level during straight locate_zeta search (for efficiency; similar to max_search_radius()) More... | |
unsigned & | current_min_spiral_level () |
Access function to current min. spiral level. More... | |
unsigned & | current_max_spiral_level () |
Access function to current max. spiral level. More... | |
void | get_fill_stats (unsigned &n_bin, unsigned &max_n_entry, unsigned &min_n_entry, unsigned &tot_n_entry, unsigned &n_empty) const |
Provide some stats on the fill level of the associated bin. More... | |
double | min_distance (const unsigned &i_bin, const Vector< double > &zeta) |
Compute the minimum distance of any vertex in the specified bin from the specified Lagrangian coordinate zeta. More... | |
void | output_bin_vertices (std::ofstream &outfile) |
Output bin vertices (allowing display of bins as zones). More... | |
void | get_bin_vertices (const unsigned &i_bin, Vector< Vector< double > > &bin_vertex) |
Get vector of vectors containing the coordinates of the vertices of the i_bin-th bin: bin_vertex[j][i] contains the i-th coordinate of the j-th vertex. More... | |
void | get_bin (const Vector< double > &zeta, int &bin_number) |
Get the number of the bin containing the specified coordinate. Bin number is negative if the coordinate is outside the bin structure. More... | |
void | get_bin (const Vector< double > &zeta, int &bin_number, Vector< std::pair< FiniteElement *, Vector< double > > > &sample_point_pairs) |
Get the number of the bin containing the specified coordinate; also return the contents of that bin. Bin number is negative if the coordinate is outside the bin structure. More... | |
Vector< Vector< std::pair< FiniteElement *, Vector< double > > > > | bin_content () const |
Get the contents of all bins in vector. More... | |
const std::map< unsigned, Vector< std::pair< FiniteElement *, Vector< double > > > > * | get_all_bins_content () const |
Get the contents of all bins in vector. More... | |
void | fill_bin_by_diffusion (const unsigned &bin_diffusion_radius=1) |
Fill bin by diffusion, populating each empty bin with the same content as the first non-empty bin found during a spiral-based search up to the specified "radius" (default 1) More... | |
void | output_bins (std::ofstream &outfile) |
Output bins. More... | |
void | output_bins (std::string &filename) |
Output bins. More... | |
![]() | |
BinArray (Mesh *mesh_pt, const Vector< std::pair< double, double > > &min_and_max_coordinates, const Vector< unsigned > &dimensions_of_bin_array, const bool &use_eulerian_coordinates_during_setup, const bool &ignore_halo_elements_during_locate_zeta_search, const unsigned &nsample_points_generated_per_element) | |
Constructor. More... | |
BinArray () | |
Broken default constructor; needed for broken copy constructors. Don't call. It will die. More... | |
BinArray (const BinArray &data) | |
Broken copy constructor. More... | |
void | operator= (const BinArray &) |
Broken assignment operator. More... | |
virtual | ~BinArray () |
Virtual destructor. More... | |
void | get_neighbouring_bins_helper (const unsigned &bin_index, const unsigned &radius, Vector< unsigned > &neighbouring_bin_index, const bool &use_old_version=true) |
Helper function for computing the bin indices of neighbouring bins at a given "radius" of the specified bin. Final, optional boolean (default: true) chooses to use the old version which appears to be faster than Louis' new one after all (in the few cases where this functionality is still used – not all if we have cgal!) More... | |
void | profile_get_neighbouring_bins_helper () |
Profiling function to compare performance of two different versions of the get_neighbouring_bins_helper(...) function. More... | |
unsigned | coords_to_bin_index (const Vector< double > &zeta) |
Get (linearly enumerated) bin index of bin that contains specified zeta. More... | |
void | coords_to_vectorial_bin_index (const Vector< double > &zeta, Vector< unsigned > &bin_index) |
Get "coordinates" of bin that contains specified zeta. More... | |
unsigned | max_bin_dimension () const |
Max. bin dimension (number of bins in coordinate directions) More... | |
unsigned | ndim_zeta () const |
Dimension of the zeta ( = dim of local coordinate of elements) More... | |
unsigned | dimension_of_bin_array (const unsigned &i) const |
Number of bins in coordinate direction i. More... | |
Vector< unsigned > | dimensions_of_bin_array () const |
Number of bins in coordinate directions. Const vector-based version. More... | |
unsigned | dimensions_of_bin_array (const unsigned &i) const |
Number of bins in specified coordinate direction. More... | |
![]() | |
SamplePointContainer (Mesh *mesh_pt, const Vector< std::pair< double, double > > &min_and_max_coordinates, const bool &use_eulerian_coordinates_during_setup, const bool &ignore_halo_elements_during_locate_zeta_search, const unsigned &nsample_points_generated_per_element) | |
Constructor. More... | |
SamplePointContainer () | |
Broken default constructor; needed for broken copy constructors. Don't call. It will die. More... | |
SamplePointContainer (const SamplePointContainer &data) | |
Broken copy constructor. More... | |
void | operator= (const SamplePointContainer &) |
Broken assignment operator. More... | |
virtual | ~SamplePointContainer () |
Virtual destructor. More... | |
virtual unsigned & | total_number_of_sample_points_visited_during_locate_zeta_from_top_level () |
Counter to keep track of how many sample points we've visited during top level call to locate_zeta. Virtual so it can be. More... | |
Mesh * | mesh_pt () const |
Pointer to mesh from whose FiniteElements sample points are created. More... | |
const std::pair< double, double > & | min_and_max_coordinates (const unsigned &i) const |
Pair of doubles for min and maximum coordinates in i-th direction: min (first) and max. (second) coordinates. More... | |
const Vector< std::pair< double, double > > & | min_and_max_coordinates () const |
Vector of pair of doubles for min and maximum coordinates. min (first) and max. (second) coordinates. More... | |
bool | ignore_halo_elements_during_locate_zeta_search () const |
Ignore halo elements? More... | |
bool | use_eulerian_coordinates_during_setup () const |
Use Eulerian coordinates (i.e. interpolated_x) rather than zeta itself (i.e. interpolated_zeta) to identify point. More... | |
unsigned & | nsample_points_generated_per_element () |
"Measure of" number of sample points generated in each element More... | |
double & | max_search_radius () |
Set maximum search radius for locate zeta. This is initialised do DBL_MAX so we brutally search through the entire bin structure, no matter how big it is until we've found the required point (or failed to do so. This can be VERY costly with fine meshes. Here the user takes full responsibility and states that we have no chance in hell to find the required point in a bin whose closest vertex is further than the specified max search radius. More... | |
Static Public Attributes | |
static unsigned | Default_n_bin_1d =100 |
Default number of bins (in each coordinate direction). (Note: don't move this into a common base class because each derived class has its own value; nonrefineable bin wants a much larger value than the refineable one!) More... | |
static unsigned long | Total_nbin_cells_counter =0 |
Counter for overall number of bins allocated – used to issue warning if this exceeds a threshhold. (Default assignment of 100^DIM bins per MeshAsGeomObject can be a killer if there are huge numbers of sub-meshes (e.g. in unstructured FSI). More... | |
static unsigned long | Threshold_for_total_bin_cell_number_warning =50000000 |
Total number of bins above which warning is issued. (Default assignment of 100^DIM bins per MeshAsGeomObject can be a killer if there are huge numbers of sub-meshes (e.g. in unstructured FSI). More... | |
static bool | Suppress_warning_about_large_total_number_of_bins =false |
Boolean to supppress warnings about large number of bins. More... | |
static bool | Already_warned_about_large_number_of_bin_cells =false |
Boolean flag to make sure that warning about large number of bin cells only gets triggered once. More... | |
static unsigned | Threshold_for_elements_per_bin_warning =100 |
Fraction of elements/bin that triggers warning. Too many elements per bin can lead to very slow computations. More... | |
static bool | Suppress_warning_about_small_number_of_bins =false |
Boolean to supppress warnings about small number of bins. More... | |
static bool | Already_warned_about_small_number_of_bin_cells =false |
Boolean flag to make sure that warning about small number of bin cells only gets triggered once. More... | |
![]() | |
static std::ofstream | Visited_sample_points_file |
File to record sequence of visited sample points in. More... | |
static bool | Always_fail_elemental_locate_zeta =false |
Boolean flag to make to make locate zeta fail. Used for debugging/ illustration of search procedures. More... | |
static bool | Use_equally_spaced_interior_sample_points =true |
Use equally spaced sample points? (otherwise vertices are sampled repeatedly. More... | |
static bool | Enable_timing_of_setup =false |
Time setup? More... | |
static double | Percentage_offset =5.0 |
Offset of sample point container boundaries beyond max/min coords. More... | |
Private Member Functions | |
void | fill_bin_array () |
Fill the bin array with sample points from FiniteElements stored in mesh. More... | |
void | create_bins_of_objects () |
void | flush_bins_of_objects () |
Flush the storage for the binning method (and decrement counter for total number of bins in active use by any MeshAsGeomObject) More... | |
Private Attributes | |
SparseVector< Vector< std::pair< FiniteElement *, Vector< double > > > > | Bin_object_coord_pairs |
Storage for paired objects and coords in each bin. More... | |
unsigned | Max_spiral_level |
Max. spiralling level (for efficiency; effect similar to max_search_radius) More... | |
unsigned | Current_min_spiral_level |
Current min. spiralling level. More... | |
unsigned | Current_max_spiral_level |
Current max. spiralling level. More... | |
unsigned | Nspiral_chunk |
Number of spirals to be searched in one go. More... | |
Additional Inherited Members | |
![]() | |
void | setup_min_and_max_coordinates () |
Helper function to compute the min and max coordinates for the mesh, in each dimension. More... | |
![]() | |
Vector< unsigned > | Dimensions_of_bin_array |
Number of bins in each coordinate direction. More... | |
![]() | |
Mesh * | Mesh_pt |
Pointer to mesh from whose FiniteElements sample points are created. More... | |
Vector< std::pair< double, double > > | Min_and_max_coordinates |
bool | Use_eulerian_coordinates_during_setup |
Use Eulerian coordinates (i.e. interpolated_x) rather than zeta itself (i.e. interpolated_zeta) to identify point. More... | |
bool | Ignore_halo_elements_during_locate_zeta_search |
Ignore halo elements? More... | |
unsigned | Nsample_points_generated_per_element |
"Measure of" number of sample points generated in each element More... | |
unsigned | Total_number_of_sample_points_visited_during_locate_zeta_from_top_level |
Counter to keep track of how many sample points we've visited during top level call to locate_zeta. More... | |
double | Max_search_radius |
Max radius beyond which we stop searching the bin. Initialised to DBL_MAX so keep going until the point is found or until we've searched every single bin. Overwriting this means we won't search in bins whose closest vertex is at a distance greater than Max_search_radius from the point to be located. More... | |
NonRefineableBinArray class.
Definition at line 855 of file sample_point_container.h.
NonRefineableBinArray::NonRefineableBinArray | ( | SamplePointContainerParameters * | bin_array_parameters_pt | ) |
Constructor.
Definition at line 2175 of file sample_point_container.cc.
References Current_max_spiral_level, Current_min_spiral_level, Default_n_bin_1d, BinArray::Dimensions_of_bin_array, fill_bin_array(), BinArray::max_bin_dimension(), Max_spiral_level, SamplePointContainer::Mesh_pt, SamplePointContainer::Min_and_max_coordinates, Nspiral_chunk, oomph::oomph_info, SamplePointContainer::setup_min_and_max_coordinates(), oomph::TimingHelpers::timer(), and total_number_of_sample_points_computed_recursively().
|
inline |
Destructor:
Definition at line 866 of file sample_point_container.h.
|
inline |
Broken copy constructor.
Definition at line 872 of file sample_point_container.h.
References oomph::BrokenCopy::broken_copy().
|
inline |
Get the contents of all bins in vector.
Definition at line 967 of file sample_point_container.h.
|
private |
Initialise and populate the "bin" structure for locating coordinates and increment counter for total number of bins in active use by any MeshAsGeomObject)
|
inline |
Access function to current max. spiral level.
Definition at line 931 of file sample_point_container.h.
Referenced by oomph::Multi_domain_functions::aux_setup_multi_domain_interaction(), and locate_zeta().
|
inline |
Access function to current min. spiral level.
Definition at line 928 of file sample_point_container.h.
Referenced by oomph::Multi_domain_functions::aux_setup_multi_domain_interaction(), and locate_zeta().
|
private |
Fill the bin array with sample points from FiniteElements stored in mesh.
Loop over subobjects (elements) to decide which bin they belong in...
Definition at line 2410 of file sample_point_container.cc.
References Already_warned_about_large_number_of_bin_cells, Already_warned_about_small_number_of_bin_cells, Bin_object_coord_pairs, BinArray::Dimensions_of_bin_array, e, flush_bins_of_objects(), i, SamplePointContainer::Mesh_pt, SamplePointContainer::Min_and_max_coordinates, nbin(), BinArray::ndim_zeta(), SamplePointContainer::Nsample_points_generated_per_element, Suppress_warning_about_large_total_number_of_bins, Suppress_warning_about_small_number_of_bins, Threshold_for_elements_per_bin_warning, Threshold_for_total_bin_cell_number_warning, Total_nbin_cells_counter, SamplePointContainer::Use_equally_spaced_interior_sample_points, and SamplePointContainer::Use_eulerian_coordinates_during_setup.
Referenced by NonRefineableBinArray().
void NonRefineableBinArray::fill_bin_by_diffusion | ( | const unsigned & | bin_diffusion_radius = 1 | ) |
Fill bin by diffusion, populating each empty bin with the same content as the first non-empty bin found during a spiral-based search up to the specified "radius" (default 1)
Fill bin by diffusion, populating each empty bin with the same content as the first non-empty bin found during a spiral-based search up to the specified "radius" (default 1)
Definition at line 2676 of file sample_point_container.cc.
References Bin_object_coord_pairs, BinArray::get_neighbouring_bins_helper(), i, min_distance(), nbin(), and s.
Referenced by oomph::RefineableTriangleMesh< ELEMENT >::adapt().
|
inlineprivate |
Flush the storage for the binning method (and decrement counter for total number of bins in active use by any MeshAsGeomObject)
Definition at line 1043 of file sample_point_container.h.
Referenced by fill_bin_array().
|
inline |
Get the contents of all bins in vector.
Definition at line 976 of file sample_point_container.h.
Referenced by oomph::RefineableTriangleMesh< ELEMENT >::adapt().
void NonRefineableBinArray::get_bin | ( | const Vector< double > & | zeta, |
int & | bin_number | ||
) |
Get the number of the bin containing the specified coordinate. Bin number is negative if the coordinate is outside the bin structure.
Get the number of the bin containing the specified coordinate. Bin number is negative if the coordinate is outside the bin structure.
Definition at line 2803 of file sample_point_container.cc.
References BinArray::Dimensions_of_bin_array, get_bin_vertices(), i, SamplePointContainer::Min_and_max_coordinates, and BinArray::ndim_zeta().
Referenced by oomph::RefineableTriangleMesh< ELEMENT >::adapt().
void NonRefineableBinArray::get_bin | ( | const Vector< double > & | zeta, |
int & | bin_number, | ||
Vector< std::pair< FiniteElement *, Vector< double > > > & | sample_point_pairs | ||
) |
Get the number of the bin containing the specified coordinate; also return the contents of that bin. Bin number is negative if the coordinate is outside the bin structure.
void NonRefineableBinArray::get_bin_vertices | ( | const unsigned & | i_bin, |
Vector< Vector< double > > & | bin_vertex | ||
) |
Get vector of vectors containing the coordinates of the vertices of the i_bin-th bin: bin_vertex[j][i] contains the i-th coordinate of the j-th vertex.
Get vector of vectors containing the coordinates of the vertices of the i_bin-th bin: bin_vertex[j][i] contains the i-th coordinate of the j-th vertex.
Definition at line 2918 of file sample_point_container.cc.
References BinArray::Dimensions_of_bin_array, i, SamplePointContainer::Min_and_max_coordinates, and BinArray::ndim_zeta().
Referenced by get_bin(), min_distance(), and output_bin_vertices().
void NonRefineableBinArray::get_fill_stats | ( | unsigned & | n_bin, |
unsigned & | max_n_entry, | ||
unsigned & | min_n_entry, | ||
unsigned & | tot_n_entry, | ||
unsigned & | n_empty | ||
) | const |
Provide some stats on the fill level of the associated bin.
Definition at line 2638 of file sample_point_container.cc.
References Bin_object_coord_pairs, and nbin().
Referenced by oomph::RefineableTriangleMesh< ELEMENT >::adapt().
|
virtual |
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with global coordinate zeta. sub_geom_object_pt=0 if point can't be found.
Find the sub geometric object and local coordinate therein that corresponds to the intrinsic coordinate zeta. If sub_geom_object_pt=0 on return from this function, none of the constituent sub-objects contain the required coordinate.
Implements SamplePointContainer.
Definition at line 3097 of file sample_point_container.cc.
References Already_warned_about_large_number_of_bin_cells, Already_warned_about_small_number_of_bin_cells, SamplePointContainer::Always_fail_elemental_locate_zeta, Bin_object_coord_pairs, current_max_spiral_level(), current_min_spiral_level(), Default_n_bin_1d, BinArray::Dimensions_of_bin_array, BinArray::get_neighbouring_bins_helper(), i, SamplePointContainer::Ignore_halo_elements_during_locate_zeta_search, SamplePointContainer::Max_search_radius, SamplePointContainer::Min_and_max_coordinates, min_distance(), BinArray::ndim_zeta(), Suppress_warning_about_large_total_number_of_bins, Suppress_warning_about_small_number_of_bins, Threshold_for_elements_per_bin_warning, Threshold_for_total_bin_cell_number_warning, Total_nbin_cells_counter, SamplePointContainer::total_number_of_sample_points_visited_during_locate_zeta_from_top_level(), SamplePointContainer::Total_number_of_sample_points_visited_during_locate_zeta_from_top_level, SamplePointContainer::use_eulerian_coordinates_during_setup(), and SamplePointContainer::Visited_sample_points_file.
|
inline |
Access function to max. spiral level during straight locate_zeta search (for efficiency; similar to max_search_radius())
Definition at line 925 of file sample_point_container.h.
double NonRefineableBinArray::min_distance | ( | const unsigned & | i_bin, |
const Vector< double > & | zeta | ||
) |
Compute the minimum distance of any vertex in the specified bin from the specified Lagrangian coordinate zeta.
Compute the minimum distance of any vertex in the specified bin from the specified Lagrangian coordinate zeta.
Definition at line 3065 of file sample_point_container.cc.
References get_bin_vertices(), i, and BinArray::ndim_zeta().
Referenced by fill_bin_by_diffusion(), and locate_zeta().
|
inline |
Number of spirals to be searched in one go const version.
Definition at line 912 of file sample_point_container.h.
Referenced by oomph::Multi_domain_functions::aux_setup_multi_domain_interaction().
|
inline |
Number of spirals to be searched in one go.
Definition at line 918 of file sample_point_container.h.
|
inlinevirtual |
Total number of bins (empty or not)
Implements BinArray.
Definition at line 891 of file sample_point_container.h.
References i.
Referenced by fill_bin_array(), fill_bin_by_diffusion(), get_fill_stats(), and output_bin_vertices().
|
inline |
Broken assignment operator.
Definition at line 878 of file sample_point_container.h.
References oomph::BrokenCopy::broken_assign(), and s.
|
virtual |
Output bin vertices (allowing display of bins as zones).
Implements BinArray.
Definition at line 2364 of file sample_point_container.cc.
References BinArray::Dimensions_of_bin_array, get_bin_vertices(), i, nbin(), and BinArray::ndim_zeta().
|
virtual |
Output bins.
Implements BinArray.
Definition at line 2312 of file sample_point_container.cc.
References Bin_object_coord_pairs, BinArray::Dimensions_of_bin_array, e, i, BinArray::ndim_zeta(), s, and SamplePointContainer::Use_eulerian_coordinates_during_setup.
|
inline |
Output bins.
Definition at line 993 of file sample_point_container.h.
|
virtual |
Compute total number of sample points recursively.
Implements SamplePointContainer.
Definition at line 2289 of file sample_point_container.cc.
References Bin_object_coord_pairs.
Referenced by NonRefineableBinArray().
|
static |
Boolean flag to make sure that warning about large number of bin cells only gets triggered once.
Definition at line 1018 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
static |
Boolean flag to make sure that warning about small number of bin cells only gets triggered once.
Definition at line 1029 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
private |
Storage for paired objects and coords in each bin.
Definition at line 1051 of file sample_point_container.h.
Referenced by fill_bin_array(), fill_bin_by_diffusion(), get_fill_stats(), locate_zeta(), output_bins(), and total_number_of_sample_points_computed_recursively().
|
private |
Current max. spiralling level.
Definition at line 1061 of file sample_point_container.h.
Referenced by NonRefineableBinArray().
|
private |
Current min. spiralling level.
Definition at line 1058 of file sample_point_container.h.
Referenced by NonRefineableBinArray().
|
static |
Default number of bins (in each coordinate direction). (Note: don't move this into a common base class because each derived class has its own value; nonrefineable bin wants a much larger value than the refineable one!)
Default number of bins (in each coordinate direction)
Definition at line 906 of file sample_point_container.h.
Referenced by locate_zeta(), and NonRefineableBinArray().
|
private |
Max. spiralling level (for efficiency; effect similar to max_search_radius)
Definition at line 1055 of file sample_point_container.h.
Referenced by NonRefineableBinArray().
|
private |
Number of spirals to be searched in one go.
Definition at line 1064 of file sample_point_container.h.
Referenced by NonRefineableBinArray().
|
static |
Boolean to supppress warnings about large number of bins.
Definition at line 1014 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
static |
Boolean to supppress warnings about small number of bins.
Definition at line 1025 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
static |
Fraction of elements/bin that triggers warning. Too many elements per bin can lead to very slow computations.
Definition at line 1022 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
static |
Total number of bins above which warning is issued. (Default assignment of 100^DIM bins per MeshAsGeomObject can be a killer if there are huge numbers of sub-meshes (e.g. in unstructured FSI).
Definition at line 1011 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().
|
static |
Counter for overall number of bins allocated – used to issue warning if this exceeds a threshhold. (Default assignment of 100^DIM bins per MeshAsGeomObject can be a killer if there are huge numbers of sub-meshes (e.g. in unstructured FSI).
Definition at line 1005 of file sample_point_container.h.
Referenced by fill_bin_array(), and locate_zeta().