sample_point_container.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 #ifndef OOMPH_SAMPLE_POINT_CONTAINER_HEADER
27 #define OOMPH_SAMPLE_POINT_CONTAINER_HEADER
28 
29 #ifdef OOMPH_HAS_CGAL
30 
31 #include <CGAL/Cartesian_d.h>
32 #include <CGAL/Search_traits_d.h>
33 #include <CGAL/Search_traits_adapter.h>
34 #include <boost/iterator/zip_iterator.hpp>
35 #include <CGAL/Orthogonal_k_neighbor_search.h>
36 
37 #endif
38 
39 // oomph-lib includes
41 #include "sparse_vector.h"
42 
46 
47 
48 //=============================================================================
51 //=============================================================================
53 {
54 public:
58  const unsigned& sample_point_index_in_element)
61  {
62  }
63 
65  SamplePoint(const SamplePoint& data) = delete;
66 
68  void operator=(const SamplePoint&) = delete;
69 
71  unsigned element_index_in_mesh() const
72  {
73  return Element_index_in_mesh;
74  }
75 
78  {
80  }
81 
82 
83 private:
86 
89 };
90 
91 
95 
96 
97 // Forward declaration of the RefineableBinArray class.
98 class RefineableBinArray;
99 
100 
101 //==============================================================================
105 //==============================================================================
107 {
108 public:
113  const unsigned& bin_index_in_bin_array)
114  : Sample_point_pt(0),
115  Sub_bin_array_pt(0),
116  Bin_array_pt(bin_array_pt),
117  Bin_index_in_bin_array(bin_index_in_bin_array)
118  {
119  }
120 
121 
123  RefineableBin(const RefineableBin& data) = delete;
124 
126  void operator=(const RefineableBin&) = delete;
127 
129  ~RefineableBin();
130 
133 
135  void add_sample_point(SamplePoint* new_sample_point_pt,
136  const Vector<double>& zeta_coordinates);
137 
141  void locate_zeta(const Vector<double>& zeta,
142  GeomObject*& sub_geom_object_pt,
143  Vector<double>& s);
144 
146  void output(std::ofstream& outfile, const bool& don_t_recurse = false);
147 
149  void output_bins(std::ofstream& outfile);
150 
152  void output_bin_vertices(std::ofstream& outfile);
153 
156  {
157  if (Sample_point_pt == 0)
158  {
159  return 0;
160  }
161  else
162  {
163  return Sample_point_pt->size();
164  }
165  }
166 
167 protected:
171  Vector<SamplePoint*>* Sample_point_pt;
172 
175 
178 
181 
188  void make_sub_bin_array(
189  const Vector<std::pair<double, double>>& min_and_max_coordinates);
190 
193  void get_bin_boundaries(
194  Vector<std::pair<double, double>>& min_and_max_coordinates);
195 };
196 
197 
201 
202 //=========================================================================
204 //=========================================================================
206 {
207 public:
210  Mesh* mesh_pt,
211  const Vector<std::pair<double, double>>& min_and_max_coordinates,
213  const bool& ignore_halo_elements_during_locate_zeta_search,
214  const unsigned& nsample_points_generated_per_element)
215  : Mesh_pt(mesh_pt),
219 #ifdef OOMPH_HAS_MPI
220  Ignore_halo_elements_during_locate_zeta_search(
221  ignore_halo_elements_during_locate_zeta_search),
222 #endif
226  {
227  // Don't limit max. search radius
228  Max_search_radius = DBL_MAX;
229  }
230 
234  {
235  // Throw the error
236  throw OomphLibError("Broken default constructor. Don't call this!",
239  }
240 
243 
245  void operator=(const SamplePointContainer&) = delete;
246 
249 
253  virtual void locate_zeta(const Vector<double>& zeta,
254  GeomObject*& sub_geom_object_pt,
255  Vector<double>& s) = 0;
256 
257 
262  {
264  }
265 
269  const = 0;
270 
272  virtual unsigned ndim_zeta() const = 0;
273 
275  Mesh* mesh_pt() const
276  {
277  return Mesh_pt;
278  }
279 
282  const std::pair<double, double>& min_and_max_coordinates(
283  const unsigned& i) const
284  {
285  return Min_and_max_coordinates[i];
286  }
287 
290  const Vector<std::pair<double, double>>& min_and_max_coordinates() const
291  {
293  }
294 
295 
296 #ifdef OOMPH_HAS_MPI
297 
299  bool ignore_halo_elements_during_locate_zeta_search() const
300  {
301  return Ignore_halo_elements_during_locate_zeta_search;
302  }
303 
304 #endif
305 
309  {
311  }
312 
315  {
317  }
318 
328  {
329  return Max_search_radius;
330  }
331 
332 
335  static std::ofstream Visited_sample_points_file;
336 
340 
344 
347 
349  static double Percentage_offset;
350 
351 protected:
355 
357  Mesh* Mesh_pt;
358 
363  Vector<std::pair<double, double>> Min_and_max_coordinates;
364 
368 
369 #ifdef OOMPH_HAS_MPI
370 
372  bool Ignore_halo_elements_during_locate_zeta_search;
373 
374 #endif
375 
378 
381  unsigned
383 
390 };
391 
392 
396 
397 
398 //=========================================================================
400 //=========================================================================
401 class BinArray : public virtual SamplePointContainer
402 {
403 public:
406  const Vector<std::pair<double, double>>& min_and_max_coordinates,
407  const Vector<unsigned>& dimensions_of_bin_array,
409  const bool& ignore_halo_elements_during_locate_zeta_search,
410  const unsigned& nsample_points_generated_per_element)
414  ignore_halo_elements_during_locate_zeta_search,
417  {
418  // Note: Resizing of Dimensions_of_bin_array if no sizes are specified
419  // is delayed to derived class since refineable and nonrefineable
420  // bin arrays have different defaults.
421  }
422 
426  {
427  // Throw the error
428  throw OomphLibError("Broken default constructor. Don't call this!",
431  }
432 
434  BinArray(const BinArray& data) = delete;
435 
437  void operator=(const BinArray&) = delete;
438 
440  virtual ~BinArray() {}
441 
447  void get_neighbouring_bins_helper(const unsigned& bin_index,
448  const unsigned& radius,
449  Vector<unsigned>& neighbouring_bin_index,
450  const bool& use_old_version = true);
451 
455 
456 
459  unsigned coords_to_bin_index(const Vector<double>& zeta);
460 
461 
463  void coords_to_vectorial_bin_index(const Vector<double>& zeta,
464  Vector<unsigned>& bin_index);
465 
467  virtual void output_bins(std::ofstream& outfile) = 0;
468 
470  virtual void output_bin_vertices(std::ofstream& outfile) = 0;
471 
474  virtual unsigned nbin() const = 0;
475 
477  unsigned max_bin_dimension() const;
478 
480  unsigned ndim_zeta() const
481  {
482  return Dimensions_of_bin_array.size();
483  }
484 
486  unsigned dimension_of_bin_array(const unsigned& i) const
487  {
488  return Dimensions_of_bin_array[i];
489  }
490 
491 
494  Vector<unsigned> dimensions_of_bin_array() const
495  {
497  }
498 
499 
501  unsigned dimensions_of_bin_array(const unsigned& i) const
502  {
503  return Dimensions_of_bin_array[i];
504  }
505 
506 protected:
508  Vector<unsigned> Dimensions_of_bin_array;
509 };
510 
511 
515 
516 
517 //==============================================================================
519 //==============================================================================
520 class RefineableBinArray : public virtual BinArray
521 {
522 public:
524  RefineableBinArray(SamplePointContainerParameters* bin_array_parameters_pt);
525 
528 
530  void operator=(const RefineableBinArray&) = delete;
531 
534  {
535  unsigned n = Bin_pt.size();
536  for (unsigned i = 0; i < n; i++)
537  {
538  if (Bin_pt[i] != 0)
539  {
540  delete Bin_pt[i];
541  Bin_pt[i] = 0;
542  }
543  }
544  }
545 
548  {
549  return Root_bin_array_pt;
550  }
551 
553  RefineableBin* bin_pt(const unsigned& i) const
554  {
555  return Bin_pt[i];
556  }
557 
559  unsigned nbin() const
560  {
561  return Bin_pt.size();
562  }
563 
568  static unsigned Default_n_bin_1d;
569 
572 
574  void fill_bin_array(const Vector<SamplePoint*>& sample_point_pt)
575  {
576  unsigned n_dim = ndim_zeta();
577 
578  unsigned n = sample_point_pt.size();
579  for (unsigned i = 0; i < n; i++)
580  {
581  // Coordinates of this point
582  Vector<double> zeta(n_dim);
583 
584  // Which element is the point in?
585  unsigned e = sample_point_pt[i]->element_index_in_mesh();
586  FiniteElement* el_pt = Mesh_pt->finite_element_pt(e);
587 
588  // Which sample point is it at?
589  unsigned j = sample_point_pt[i]->sample_point_index_in_element();
590  Vector<double> s(n_dim);
591  bool use_equally_spaced_interior_sample_points =
593  el_pt->get_s_plot(j,
595  s,
596  use_equally_spaced_interior_sample_points);
598  {
599  el_pt->interpolated_x(s, zeta);
600  }
601  else
602  {
603  el_pt->interpolated_zeta(s, zeta);
604  }
605 
606  // Add it
607  add_sample_point(sample_point_pt[i], zeta);
608  }
609  }
610 
612  void add_sample_point(SamplePoint* new_sample_point_pt,
613  const Vector<double>& zeta)
614  {
615  // Find the correct bin
616  unsigned bin_index = coords_to_bin_index(zeta);
617 
618  // if the bin is not yet created, create it...
619  if (Bin_pt[bin_index] == 0)
620  {
621  Bin_pt[bin_index] = new RefineableBin(this, bin_index);
622  }
623  // Then add the SamplePoint
624  Bin_pt[bin_index]->add_sample_point(new_sample_point_pt, zeta);
625  }
626 
630  void locate_zeta(const Vector<double>& zeta,
631  GeomObject*& sub_geom_object_pt,
632  Vector<double>& s);
633 
636  void get_bin_boundaries(
637  const unsigned& bin_index,
638  Vector<std::pair<double, double>>& min_and_max_coordinates);
639 
641  unsigned depth() const
642  {
643  return Depth;
644  }
645 
647  unsigned max_depth() const
648  {
649  return Max_depth;
650  }
651 
653  unsigned& max_depth()
654  {
655  return Max_depth;
656  }
657 
660  {
661  return Bin_array_is_recursive;
662  }
663 
667  {
669  }
670 
672  void output_bins(std::ofstream& outfile)
673  {
675  unsigned n_bin = Bin_pt.size();
676  for (unsigned i = 0; i < n_bin; i++)
677  {
678  if (Bin_pt[i] != 0)
679  {
680  Bin_pt[i]->output(outfile);
681  }
682  }
683  }
684 
686  void output_bin_vertices(std::ofstream& outfile);
687 
689  void output_neighbouring_bins(const unsigned& bin_index,
690  const unsigned& radius,
691  std::ofstream& outfile);
692 
693 
697  {
698  if (Depth == 0)
699  {
701  }
702  else
703  {
704  return Root_bin_array_pt
706  }
707  }
708 
713  {
715  }
716 
721  {
723  }
724 
733  {
735  }
736 
742  {
744  }
745 
746 
747 private:
749  void fill_bin_array();
750 
754  void create_sample_points_from_element(FiniteElement* const element_pt,
755  const unsigned& n_element);
756 
757 
759  Vector<RefineableBin*> Bin_pt;
760 
764 
768  unsigned Depth;
769 
771  unsigned Max_depth;
772 
776 
779 
780  // hierher only used in root
781 
786 
791 
799  unsigned
801 
807 };
808 
809 
813 
814 
815 //==============================================================================
817 //==============================================================================
818 class NonRefineableBinArray : public virtual BinArray
819 {
820 public:
823  SamplePointContainerParameters* bin_array_parameters_pt);
824 
827  {
829  }
830 
833 
835  void operator=(const NonRefineableBinArray&) = delete;
836 
840  void locate_zeta(const Vector<double>& zeta,
841  GeomObject*& sub_geom_object_pt,
842  Vector<double>& s);
843 
845  unsigned nbin() const
846  {
847  const unsigned n_lagrangian = ndim_zeta();
848  unsigned ntotalbin = Dimensions_of_bin_array[0];
849  for (unsigned i = 1; i < n_lagrangian; i++)
850  {
851  ntotalbin *= Dimensions_of_bin_array[i];
852  }
853  return ntotalbin;
854  }
855 
860  static unsigned Default_n_bin_1d;
861 
864 
866  unsigned n_spiral_chunk() const
867  {
868  return Nspiral_chunk;
869  }
870 
872  unsigned& n_spiral_chunk()
873  {
874  return Nspiral_chunk;
875  }
876 
879  unsigned& max_spiral_level()
880  {
881  return Max_spiral_level;
882  }
883 
886  {
888  }
889 
892  {
894  }
895 
897  void get_fill_stats(unsigned& n_bin,
898  unsigned& max_n_entry,
899  unsigned& min_n_entry,
900  unsigned& tot_n_entry,
901  unsigned& n_empty) const;
902 
905  double min_distance(const unsigned& i_bin, const Vector<double>& zeta);
906 
908  void output_bin_vertices(std::ofstream& outfile);
909 
913  void get_bin_vertices(const unsigned& i_bin,
914  Vector<Vector<double>>& bin_vertex);
915 
919  void get_bin(const Vector<double>& zeta, int& bin_number);
920 
924  void get_bin(
925  const Vector<double>& zeta,
926  int& bin_number,
927  Vector<std::pair<FiniteElement*, Vector<double>>>& sample_point_pairs);
928 
930  Vector<Vector<std::pair<FiniteElement*, Vector<double>>>> bin_content() const
931  {
932  Vector<Vector<std::pair<FiniteElement*, Vector<double>>>> all_vals;
933  Bin_object_coord_pairs.get_all_values(all_vals);
934  return all_vals;
935  }
936 
938  const std::map<unsigned, Vector<std::pair<FiniteElement*, Vector<double>>>>* get_all_bins_content()
939  const
940  {
941  // Return the content of the bins
942  return Bin_object_coord_pairs.map_pt();
943  }
944 
948  void fill_bin_by_diffusion(const unsigned& bin_diffusion_radius = 1);
949 
950 
952  void output_bins(std::ofstream& outfile);
953 
956  {
957  std::ofstream outfile;
958  outfile.open(filename.c_str());
959  output_bins(outfile);
960  outfile.close();
961  }
962 
967  static unsigned long Total_nbin_cells_counter;
968 
974 
977 
981 
985 
988 
992 
993 private:
995  void fill_bin_array();
996 
1001 
1005  {
1007  Bin_object_coord_pairs.clear();
1008  }
1009 
1011  SparseVector<Vector<std::pair<FiniteElement*, Vector<double>>>>
1013 
1017 
1020 
1023 
1025  unsigned Nspiral_chunk;
1026 };
1027 
1028 
1032 
1033 #ifdef OOMPH_HAS_CGAL
1034 
1035 
1036 //====================================================================
1038 //====================================================================
1039 class CGALSamplePointContainer : public virtual SamplePointContainer
1040 {
1041 public:
1043  CGALSamplePointContainer(
1044  SamplePointContainerParameters* sample_point_container_parameters_pt);
1045 
1047  CGALSamplePointContainer(const CGALSamplePointContainer& data) = delete;
1048 
1050  void operator=(const CGALSamplePointContainer&) = delete;
1051 
1053  virtual ~CGALSamplePointContainer()
1054  {
1055  unsigned n = Sample_point_pt.size();
1056  for (unsigned i = 0; i < n; i++)
1057  {
1058  delete Sample_point_pt[i];
1059  Sample_point_pt[i] = 0;
1060  }
1061  delete CGAL_tree_d_pt;
1062  CGAL_tree_d_pt = 0;
1063  }
1064 
1067  unsigned& first_sample_point_to_actually_lookup_during_locate_zeta()
1068  {
1069  return First_sample_point_to_actually_lookup_during_locate_zeta;
1070  }
1071 
1074  unsigned& last_sample_point_to_actually_lookup_during_locate_zeta()
1075  {
1076  return Last_sample_point_to_actually_lookup_during_locate_zeta;
1077  }
1078 
1079 
1087  unsigned& multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta()
1088  {
1089  return Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta;
1090  }
1091 
1095  unsigned& initial_last_sample_point_to_actually_lookup_during_locate_zeta()
1096  {
1097  return Initial_last_sample_point_to_actually_lookup_during_locate_zeta;
1098  }
1099 
1100 
1104  void locate_zeta(const Vector<double>& zeta,
1105  GeomObject*& sub_geom_object_pt,
1106  Vector<double>& s);
1107 
1108 
1113  void limited_locate_zeta(
1114  const Vector<double>& zeta,
1115  const unsigned& max_sample_points_for_newton_based_search,
1116  GeomObject*& sub_geom_object_pt,
1117  Vector<double>& s);
1118 
1119 
1121  unsigned ndim_zeta() const
1122  {
1123  return Ndim_zeta;
1124  }
1125 
1127  unsigned total_number_of_sample_points_computed_recursively() const;
1128 
1129 private:
1131  double get_sample_points();
1132 
1134  unsigned Ndim_zeta;
1135 
1137  typedef CGAL::Cartesian_d<double> Kernel_d;
1138  typedef Kernel_d::Point_d Point_d;
1139  typedef boost::tuple<Point_d, SamplePoint*> Point_d_and_pointer;
1140  typedef CGAL::Search_traits_d<Kernel_d> Traits_base_d;
1141  typedef CGAL::Search_traits_adapter<
1142  Point_d_and_pointer,
1143  CGAL::Nth_of_tuple_property_map<0, Point_d_and_pointer>,
1144  Traits_base_d>
1145  Traits_d;
1146  typedef CGAL::Orthogonal_k_neighbor_search<Traits_d> K_neighbor_search_d;
1147 
1149  Vector<Point_d> CGAL_sample_point_zeta_d;
1150 
1152  K_neighbor_search_d::Tree* CGAL_tree_d_pt;
1153 
1157  Vector<SamplePoint*> Sample_point_pt;
1158 
1161  unsigned First_sample_point_to_actually_lookup_during_locate_zeta;
1162 
1165  unsigned Last_sample_point_to_actually_lookup_during_locate_zeta;
1166 
1174  unsigned
1175  Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta;
1176 
1180  unsigned Initial_last_sample_point_to_actually_lookup_during_locate_zeta;
1181 };
1182 
1183 #endif // endif oomph has cgal
1184 
1188 
1189 
1190 } // end of namespace extension
1191 
1192 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
int data[]
Definition: Map_placement_new.cpp:1
Base class for all bin arrays.
Definition: sample_point_container.h:402
unsigned dimension_of_bin_array(const unsigned &i) const
Number of bins in coordinate direction i.
Definition: sample_point_container.h:486
unsigned max_bin_dimension() const
Max. bin dimension (number of bins in coordinate directions)
Definition: sample_point_container.cc:659
Vector< unsigned > dimensions_of_bin_array() const
Definition: sample_point_container.h:494
virtual void output_bins(std::ofstream &outfile)=0
Output bins (boundaries and number of sample points in them)
void get_neighbouring_bins_helper(const unsigned &bin_index, const unsigned &radius, Vector< unsigned > &neighbouring_bin_index, const bool &use_old_version=true)
Definition: sample_point_container.cc:1350
unsigned dimensions_of_bin_array(const unsigned &i) const
Number of bins in specified coordinate direction.
Definition: sample_point_container.h:501
unsigned ndim_zeta() const
Dimension of the zeta ( = dim of local coordinate of elements)
Definition: sample_point_container.h:480
Vector< unsigned > Dimensions_of_bin_array
Number of bins in each coordinate direction.
Definition: sample_point_container.h:508
virtual unsigned nbin() const =0
virtual ~BinArray()
Virtual destructor.
Definition: sample_point_container.h:440
BinArray(const BinArray &data)=delete
Broken copy constructor.
BinArray()
Definition: sample_point_container.h:425
unsigned coords_to_bin_index(const Vector< double > &zeta)
Definition: sample_point_container.cc:1840
void profile_get_neighbouring_bins_helper()
Definition: sample_point_container.cc:1227
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.
Definition: sample_point_container.h:405
void operator=(const BinArray &)=delete
Broken assignment operator.
void coords_to_vectorial_bin_index(const Vector< double > &zeta, Vector< unsigned > &bin_index)
Get "coordinates" of bin that contains specified zeta.
Definition: sample_point_container.cc:1969
virtual void output_bin_vertices(std::ofstream &outfile)=0
Output bin vertices (allowing display of bin boundaries as zones).
NonRefineableBinArray class.
Definition: sample_point_container.h:819
static bool Already_warned_about_small_number_of_bin_cells
Definition: sample_point_container.h:991
void get_bin(const Vector< double > &zeta, int &bin_number)
Definition: sample_point_container.cc:2794
void get_bin(const Vector< double > &zeta, int &bin_number, Vector< std::pair< FiniteElement *, Vector< double >>> &sample_point_pairs)
static bool Suppress_warning_about_large_total_number_of_bins
Boolean to supppress warnings about large number of bins.
Definition: sample_point_container.h:976
void fill_bin_array()
Fill the bin array with sample points from FiniteElements stored in mesh.
Definition: sample_point_container.cc:2402
unsigned n_spiral_chunk() const
Number of spirals to be searched in one go const version.
Definition: sample_point_container.h:866
const std::map< unsigned, Vector< std::pair< FiniteElement *, Vector< double > > > > * get_all_bins_content() const
Get the contents of all bins in vector.
Definition: sample_point_container.h:938
unsigned Nspiral_chunk
Number of spirals to be searched in one go.
Definition: sample_point_container.h:1025
unsigned Max_spiral_level
Definition: sample_point_container.h:1016
static unsigned long Total_nbin_cells_counter
Definition: sample_point_container.h:967
void operator=(const NonRefineableBinArray &)=delete
Broken assignment operator.
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Definition: sample_point_container.cc:3088
static unsigned Threshold_for_elements_per_bin_warning
Definition: sample_point_container.h:984
unsigned Current_min_spiral_level
Current min. spiralling level.
Definition: sample_point_container.h:1019
void get_bin_vertices(const unsigned &i_bin, Vector< Vector< double >> &bin_vertex)
Definition: sample_point_container.cc:2912
unsigned Current_max_spiral_level
Current max. spiralling level.
Definition: sample_point_container.h:1022
static bool Suppress_warning_about_small_number_of_bins
Boolean to supppress warnings about small number of bins.
Definition: sample_point_container.h:987
void fill_bin_by_diffusion(const unsigned &bin_diffusion_radius=1)
Definition: sample_point_container.cc:2667
void output_bins(std::string &filename)
Output bins.
Definition: sample_point_container.h:955
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
Definition: sample_point_container.cc:2284
NonRefineableBinArray(const NonRefineableBinArray &data)=delete
Broken copy constructor.
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
Definition: sample_point_container.cc:2357
static bool Already_warned_about_large_number_of_bin_cells
Definition: sample_point_container.h:980
SparseVector< Vector< std::pair< FiniteElement *, Vector< double > > > > Bin_object_coord_pairs
Storage for paired objects and coords in each bin.
Definition: sample_point_container.h:1012
void output_bins(std::ofstream &outfile)
Output bins.
Definition: sample_point_container.cc:2308
Vector< Vector< std::pair< FiniteElement *, Vector< double > > > > bin_content() const
Get the contents of all bins in vector.
Definition: sample_point_container.h:930
static unsigned Default_n_bin_1d
Default number of bins (in each coordinate direction)
Definition: sample_point_container.h:860
unsigned & max_spiral_level()
Definition: sample_point_container.h:879
unsigned & current_max_spiral_level()
Access function to current max. spiral level.
Definition: sample_point_container.h:891
unsigned & n_spiral_chunk()
Number of spirals to be searched in one go.
Definition: sample_point_container.h:872
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.
Definition: sample_point_container.cc:2629
void flush_bins_of_objects()
Definition: sample_point_container.h:1004
static unsigned long Threshold_for_total_bin_cell_number_warning
Definition: sample_point_container.h:973
NonRefineableBinArray(SamplePointContainerParameters *bin_array_parameters_pt)
Constructor.
Definition: sample_point_container.cc:2169
unsigned & current_min_spiral_level()
Access function to current min. spiral level.
Definition: sample_point_container.h:885
double min_distance(const unsigned &i_bin, const Vector< double > &zeta)
Definition: sample_point_container.cc:3057
unsigned nbin() const
Total number of bins (empty or not)
Definition: sample_point_container.h:845
~NonRefineableBinArray()
Destructor:
Definition: sample_point_container.h:826
RefineableBinArray class.
Definition: sample_point_container.h:521
unsigned Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta
Definition: sample_point_container.h:800
unsigned depth() const
Depth of the hierarchical bin_array.
Definition: sample_point_container.h:641
unsigned & max_depth()
Max depth of the hierarchical bin_array.
Definition: sample_point_container.h:653
~RefineableBinArray()
Destructor.
Definition: sample_point_container.h:533
Vector< RefineableBin * > Bin_pt
Vector of pointers to constituent RefineableBins.
Definition: sample_point_container.h:759
unsigned max_depth() const
Max depth of the hierarchical bin_array; const version.
Definition: sample_point_container.h:647
unsigned Max_depth
Max depth of the hierarchical bin_array.
Definition: sample_point_container.h:771
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
Definition: sample_point_container.cc:1820
unsigned First_sample_point_to_actually_lookup_during_locate_zeta
Definition: sample_point_container.h:785
void fill_bin_array(const Vector< SamplePoint * > &sample_point_pt)
Fill the bin array with specified SamplePoints.
Definition: sample_point_container.h:574
bool bin_array_is_recursive() const
Is the BinArray recursive?
Definition: sample_point_container.h:659
static unsigned Default_n_bin_1d
Default number of bins (in each coordinate direction)
Definition: sample_point_container.h:568
void operator=(const RefineableBinArray &)=delete
Broken assignment operator.
void add_sample_point(SamplePoint *new_sample_point_pt, const Vector< double > &zeta)
Add specified SamplePoint to RefineableBinArray.
Definition: sample_point_container.h:612
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Definition: sample_point_container.cc:2002
unsigned & initial_last_sample_point_to_actually_lookup_during_locate_zeta()
Definition: sample_point_container.h:741
unsigned & total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
Definition: sample_point_container.h:696
unsigned nbin() const
Number of bins (not taking recursion into account)
Definition: sample_point_container.h:559
RefineableBinArray * Root_bin_array_pt
Pointer to root bin array.
Definition: sample_point_container.h:778
unsigned Depth
Definition: sample_point_container.h:768
unsigned Max_number_of_sample_point_per_bin
Definition: sample_point_container.h:775
RefineableBinArray * root_bin_array_pt() const
Root bin array.
Definition: sample_point_container.h:547
void fill_bin_array()
Fill the bin array with sample points from FiniteElements stored in mesh.
Definition: sample_point_container.cc:1882
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
Definition: sample_point_container.cc:1027
void output_neighbouring_bins(const unsigned &bin_index, const unsigned &radius, std::ofstream &outfile)
Output neighbouring bins at given "radius" of the specified bin.
Definition: sample_point_container.cc:1044
unsigned Last_sample_point_to_actually_lookup_during_locate_zeta
Definition: sample_point_container.h:790
unsigned & first_sample_point_to_actually_lookup_during_locate_zeta()
Definition: sample_point_container.h:712
void output_bins(std::ofstream &outfile)
Output bins.
Definition: sample_point_container.h:672
void get_bin_boundaries(const unsigned &bin_index, Vector< std::pair< double, double >> &min_and_max_coordinates)
Definition: sample_point_container.cc:995
void create_sample_points_from_element(FiniteElement *const element_pt, const unsigned &n_element)
unsigned Initial_last_sample_point_to_actually_lookup_during_locate_zeta
Definition: sample_point_container.h:806
RefineableBin * bin_pt(const unsigned &i) const
Pointer to i-th bin; can be null if bin is empty.
Definition: sample_point_container.h:553
unsigned & last_sample_point_to_actually_lookup_during_locate_zeta()
Definition: sample_point_container.h:720
unsigned & multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta()
Definition: sample_point_container.h:732
RefineableBinArray(SamplePointContainerParameters *bin_array_parameters_pt)
Constructor.
Definition: sample_point_container.cc:841
unsigned max_number_of_sample_point_per_bin() const
Definition: sample_point_container.h:666
RefineableBinArray(const RefineableBinArray &data)=delete
Broken copy constructor.
bool Bin_array_is_recursive
Definition: sample_point_container.h:763
Definition: sample_point_container.h:107
void output_bins(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
unsigned nsample_points_in_bin()
Number of sample points stored in bin.
Definition: sample_point_container.h:155
void output(std::ofstream &outfile, const bool &don_t_recurse=false)
Output bin; x,[y,[z]],n_sample_points.
Definition: sample_point_container.cc:181
void add_sample_point(SamplePoint *new_sample_point_pt, const Vector< double > &zeta_coordinates)
Add a new sample point to RefineableBin.
Definition: sample_point_container.cc:392
void get_bin_boundaries(Vector< std::pair< double, double >> &min_and_max_coordinates)
Definition: sample_point_container.cc:603
RefineableBinArray * Sub_bin_array_pt
Pointer to a possible sub-BinArray. Null by default.
Definition: sample_point_container.h:174
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
Definition: sample_point_container.cc:291
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
Definition: sample_point_container.cc:65
unsigned Bin_index_in_bin_array
Index of bin in its bin array.
Definition: sample_point_container.h:180
~RefineableBin()
Destructor.
Definition: sample_point_container.cc:42
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Definition: sample_point_container.cc:438
Vector< SamplePoint * > * Sample_point_pt
Definition: sample_point_container.h:171
void operator=(const RefineableBin &)=delete
Broken assignment operator.
RefineableBin(RefineableBinArray *bin_array_pt, const unsigned &bin_index_in_bin_array)
Definition: sample_point_container.h:112
void make_sub_bin_array(const Vector< std::pair< double, double >> &min_and_max_coordinates)
Definition: sample_point_container.cc:91
RefineableBinArray * Bin_array_pt
Pointer to the bin array which "owns" this RefineableBin.
Definition: sample_point_container.h:177
RefineableBin(const RefineableBin &data)=delete
Broken copy constructor.
Base class for all sample point containers.
Definition: sample_point_container.h:206
static bool Always_fail_elemental_locate_zeta
Boolean flag to make to make locate zeta fail.
Definition: sample_point_container.h:339
static double Percentage_offset
Offset of sample point container boundaries beyond max/min coords.
Definition: sample_point_container.h:349
Vector< std::pair< double, double > > Min_and_max_coordinates
Definition: sample_point_container.h:363
static bool Enable_timing_of_setup
Time setup?
Definition: sample_point_container.h:346
unsigned & nsample_points_generated_per_element()
"Measure of" number of sample points generated in each element
Definition: sample_point_container.h:314
const std::pair< double, double > & min_and_max_coordinates(const unsigned &i) const
Definition: sample_point_container.h:282
SamplePointContainer()
Definition: sample_point_container.h:233
const Vector< std::pair< double, double > > & min_and_max_coordinates() const
Definition: sample_point_container.h:290
bool use_eulerian_coordinates_during_setup() const
Definition: sample_point_container.h:308
SamplePointContainer(const SamplePointContainer &data)=delete
Broken copy constructor.
virtual ~SamplePointContainer()
Virtual destructor.
Definition: sample_point_container.h:248
unsigned Nsample_points_generated_per_element
"Measure of" number of sample points generated in each element
Definition: sample_point_container.h:377
unsigned Total_number_of_sample_points_visited_during_locate_zeta_from_top_level
Definition: sample_point_container.h:382
bool Use_eulerian_coordinates_during_setup
Definition: sample_point_container.h:367
Mesh * Mesh_pt
Pointer to mesh from whose FiniteElements sample points are created.
Definition: sample_point_container.h:357
double Max_search_radius
Definition: sample_point_container.h:389
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.
Definition: sample_point_container.h:209
virtual unsigned total_number_of_sample_points_computed_recursively() const =0
virtual void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)=0
static std::ofstream Visited_sample_points_file
File to record sequence of visited sample points in.
Definition: sample_point_container.h:335
double & max_search_radius()
Definition: sample_point_container.h:327
Mesh * mesh_pt() const
Pointer to mesh from whose FiniteElements sample points are created.
Definition: sample_point_container.h:275
void operator=(const SamplePointContainer &)=delete
Broken assignment operator.
virtual unsigned & total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
Definition: sample_point_container.h:261
virtual unsigned ndim_zeta() const =0
Dimension of the zeta ( = dim of local coordinate of elements)
void setup_min_and_max_coordinates()
Setup the min and max coordinates for the mesh, in each dimension.
Definition: sample_point_container.cc:684
static bool Use_equally_spaced_interior_sample_points
Definition: sample_point_container.h:343
Definition: sample_point_container.h:53
SamplePoint(const unsigned &element_index_in_mesh, const unsigned &sample_point_index_in_element)
Definition: sample_point_container.h:57
void operator=(const SamplePoint &)=delete
Broken assignment operator.
SamplePoint(const SamplePoint &data)=delete
Broken copy constructor.
unsigned element_index_in_mesh() const
Access function to the index of finite element in its mesh.
Definition: sample_point_container.h:71
unsigned Sample_point_index_in_element
Index of the sample point within element.
Definition: sample_point_container.h:88
unsigned Element_index_in_mesh
Index of finite element in its mesh.
Definition: sample_point_container.h:85
unsigned sample_point_index_in_element() const
Index of sample point within element.
Definition: sample_point_container.h:77
Matrix< Type, Size, 1 > Vector
\cpp11 SizeƗ1 vector of type Type.
Definition: Eigen/Eigen/src/Core/Matrix.h:515
RealScalar s
Definition: level1_cplx_impl.h:130
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
string filename
Definition: MergeRestartFiles.py:39
radius
Definition: UniformPSDSelfTest.py:15
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2