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// Version 1.0; svn revision $LastChangedRevision: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 #ifndef SAMPLE_POINT_CONTAINER_HEADER
31 #define SAMPLE_POINT_CONTAINER_HEADER
32 
33 
34 #ifdef OOMPH_HAS_CGAL
35 
36 #include <CGAL/Cartesian_d.h>
37 #include <CGAL/Search_traits_d.h>
38 #include<CGAL/Search_traits_adapter.h>
39 #include<boost/iterator/zip_iterator.hpp>
40 #include<CGAL/Orthogonal_k_neighbor_search.h>
41 
42 #endif
43 
44 // oomph-lib includes
46 #include "sparse_vector.h"
47 
48 ////////////////////////////////////////////////////////////////////
49 ////////////////////////////////////////////////////////////////////
50 ////////////////////////////////////////////////////////////////////
51 
52 
53 //=============================================================================
54 /// \short Class for containing sample points: Number of finite element in
55 /// its mesh and index of sample point within that element.
56 //=============================================================================
58 {
59 
60  public:
61 
62  /// \short Construct SamplePoint object from number of finite element
63  /// in its mesh, and index of sample point within that element
65  const unsigned& sample_point_index_in_element) :
66  Element_index_in_mesh(element_index_in_mesh),
67  Sample_point_index_in_element(sample_point_index_in_element)
68  {}
69 
70  /// \short Broken copy constructor.
71  SamplePoint(const SamplePoint& data) {BrokenCopy::broken_copy("SamplePoint");}
72 
73  /// Broken assignment operator.
74  void operator=(const SamplePoint&) {BrokenCopy::broken_assign("SamplePoint");}
75 
76  /// Access function to the index of finite element in its mesh
77  unsigned element_index_in_mesh() const
78  {
79  return Element_index_in_mesh;
80  }
81 
82  /// Index of sample point within element
84  {
86  }
87 
88 
89  private:
90 
91  /// Index of finite element in its mesh
93 
94  /// \short Index of the sample point within element
96 
97 };
98 
99 
100 ////////////////////////////////////////////////////////////////////
101 ////////////////////////////////////////////////////////////////////
102 ////////////////////////////////////////////////////////////////////
103 
104 
105 // Forward declaration of the RefineableBinArray class.
106 class RefineableBinArray;
107 
108 
109 //==============================================================================
110 /// RefineableBin class. Contains sample points and is embedded in a RefineableBinArray.
111 /// May itself be represented by a RefineableBinArray to make it recursive.
112 //==============================================================================
114 {
115  public:
116 
117  /// \short Constructor. Pass pointer to bin array that
118  /// contains this bin and the index of the newly created bin in that
119  /// RefineableBinArray
121  const unsigned& bin_index_in_bin_array)
122  : Sample_point_pt(0),
123  Sub_bin_array_pt(0),
124  Bin_array_pt(bin_array_pt),
125  Bin_index_in_bin_array(bin_index_in_bin_array)
126  {}
127 
128 
129  /// \short Broken copy constructor.
131  {
132  BrokenCopy::broken_copy("RefineableBin");
133  }
134 
135  /// Broken assignment operator.
136  void operator=(const RefineableBin&)
137  {
138  BrokenCopy::broken_assign("RefineableBin");
139  }
140 
141  /// Destructor
142  ~RefineableBin();
143 
144  /// Compute total number of sample points recursively
145  unsigned total_number_of_sample_points_computed_recursively() const;
146 
147  /// Add a new sample point to RefineableBin
148  void add_sample_point(SamplePoint* new_sample_point_pt,
149  const Vector<double>& zeta_coordinates);
150 
151  /// \short Find sub-GeomObject (finite element) and the local coordinate
152  /// s within it that contains point with global coordinate zeta.
153  /// sub_geom_object_pt=0 if point can't be found.
154  void locate_zeta(const Vector<double>& zeta,
155  GeomObject*& sub_geom_object_pt,
156  Vector<double>& s);
157 
158  /// \short Output bin; x,[y,[z]],n_sample_points
159  void output(std::ofstream& outfile, const bool& don_t_recurse=false);
160 
161  /// \short Output bin vertices (allowing display of bins as zones).
162  void output_bins(std::ofstream& outfile);
163 
164  /// \short Output bin vertices (allowing display of bins as zones).
165  void output_bin_vertices(std::ofstream& outfile);
166 
167  /// Number of sample points stored in bin
169  {
170  if (Sample_point_pt==0)
171  {
172  return 0;
173  }
174  else
175  {
176  return Sample_point_pt->size();
177  }
178  }
179 
180  protected:
181 
182  /// \short Container of SamplePoints. Pointer to vector because it's shorter
183  /// than an empty vector! (Not all RefineableBins have sample
184  /// points -- the ones that are subdivided don't!)
185  Vector<SamplePoint*>* Sample_point_pt;
186 
187  /// \short Pointer to a possible sub-BinArray. Null by default
189 
190  /// Pointer to the bin array which "owns" this RefineableBin.
192 
193  /// Index of bin in its bin array
195 
196  /// \short Method for building a new subbin_array (called when the Bin size
197  /// is greater than the Max_number_of_sample_point_per_bin (and the Bin is
198  /// recursive). Pass in the extremal coordinates of the bin which is
199  /// being subdivided. Redistributes all existing sample points to
200  /// newly made sub-bin-array and empties its own storage. Pass
201  /// Max./min. coordinates of new bin array for efficiency.
202  void make_sub_bin_array(const Vector<std::pair<double, double> >&
203  min_and_max_coordinates);
204 
205  /// \short Boundaries of bin in each coordinate direction.
206  /// *.first = min; *.second = max
207  void get_bin_boundaries(Vector<std::pair<double, double> >&
208  min_and_max_coordinates);
209 
210 
211  };
212 
213 
214 
215 ////////////////////////////////////////////////////////////////////////
216 ////////////////////////////////////////////////////////////////////////
217 ////////////////////////////////////////////////////////////////////////
218 
219 //=========================================================================
220 /// \short Base class for all sample point containers
221 //=========================================================================
223 {
224 
225  public:
226 
227 
228  /// Constructor
230  Mesh* mesh_pt,
231  const Vector<std::pair<double, double> >& min_and_max_coordinates,
232  const bool& use_eulerian_coordinates_during_setup,
233  const bool& ignore_halo_elements_during_locate_zeta_search,
234  const unsigned& nsample_points_generated_per_element) :
235  Mesh_pt(mesh_pt),
236  Min_and_max_coordinates(min_and_max_coordinates),
237  Use_eulerian_coordinates_during_setup(use_eulerian_coordinates_during_setup),
238 #ifdef OOMPH_HAS_MPI
239  Ignore_halo_elements_during_locate_zeta_search(
240  ignore_halo_elements_during_locate_zeta_search),
241 #endif
242  Nsample_points_generated_per_element(nsample_points_generated_per_element),
243  Total_number_of_sample_points_visited_during_locate_zeta_from_top_level(0)
244  {
245  // Don't limit max. search radius
246  Max_search_radius = DBL_MAX;
247  }
248 
249  /// \short Broken default constructor; needed for broken
250  /// copy constructors. Don't call. It will die.
252  {
253  //Throw the error
254  throw OomphLibError("Broken default constructor. Don't call this!",
255  OOMPH_CURRENT_FUNCTION,
256  OOMPH_EXCEPTION_LOCATION);
257  }
258 
259  /// \short Broken copy constructor.
261  {BrokenCopy::broken_copy("SamplePointContainer");}
262 
263  /// Broken assignment operator.
265  {BrokenCopy::broken_assign("SamplePointContainer");}
266 
267  /// Virtual destructor
269 
270  /// \short Find sub-GeomObject (finite element) and the local coordinate
271  /// s within it that contains point with global coordinate zeta.
272  /// sub_geom_object_pt=0 if point can't be found.
273  virtual void locate_zeta(const Vector<double>& zeta,
274  GeomObject*& sub_geom_object_pt,
275  Vector<double>& s)=0;
276 
277 
278  /// \short Counter to keep track of how many sample points we've
279  /// visited during top level call to locate_zeta. Virtual so it can be
280  /// overloaded for different versions.
282  {
283  return
284  Total_number_of_sample_points_visited_during_locate_zeta_from_top_level;
285  }
286 
287  /// \short Total number of sample points in sample point container, possibly
288  /// computed recursively.
289  virtual unsigned total_number_of_sample_points_computed_recursively() const =0;
290 
291  /// Dimension of the zeta ( = dim of local coordinate of elements)
292  virtual unsigned ndim_zeta() const = 0;
293 
294  /// Pointer to mesh from whose FiniteElements sample points are created
295  Mesh* mesh_pt() const
296  {
297  return Mesh_pt;
298  }
299 
300  /// \short Pair of doubles for min and maximum coordinates in i-th direction:
301  /// min (first) and max. (second) coordinates
302  const std::pair<double, double>& min_and_max_coordinates(
303  const unsigned& i) const
304  {
305  return Min_and_max_coordinates[i];
306  }
307 
308  /// \short Vector of pair of doubles for min and maximum coordinates.
309  /// min (first) and max. (second) coordinates
310  const Vector<std::pair<double, double> >& min_and_max_coordinates() const
311  {
312  return Min_and_max_coordinates;
313  }
314 
315 
316 #ifdef OOMPH_HAS_MPI
317 
318  /// Ignore halo elements?
320  {
321  return Ignore_halo_elements_during_locate_zeta_search;
322  }
323 
324 #endif
325 
326  /// \short Use Eulerian coordinates (i.e. interpolated_x) rather than
327  /// zeta itself (i.e. interpolated_zeta) to identify point.
329  {
330  return Use_eulerian_coordinates_during_setup;
331  }
332 
333  /// "Measure of" number of sample points generated in each element
335  {
336  return Nsample_points_generated_per_element;
337  }
338 
339  /// \short Set maximum search radius for locate zeta. This is initialised
340  /// do DBL_MAX so we brutally search through the entire bin structure,
341  /// no matter how big it is until we've found the required point (or
342  /// failed to do so. This can be VERY costly with fine meshes.
343  /// Here the user takes full responsibility and states that we have
344  /// no chance in hell to find the required point in
345  /// a bin whose closest vertex is further than the specified
346  /// max search radius.
347  double& max_search_radius()
348  {
349  return Max_search_radius;
350  }
351 
352 
353  /// File to record sequence of visited sample points in. Used for debugging/
354  /// illustration of search procedures.
355  static std::ofstream Visited_sample_points_file;
356 
357  /// \short Boolean flag to make to make locate zeta fail. Used for debugging/
358  /// illustration of search procedures.
360 
361  /// \short Use equally spaced sample points? (otherwise vertices are sampled
362  /// repeatedly
364 
365  /// Time setup?
367 
368  /// Offset of sample point container boundaries beyond max/min coords
369  static double Percentage_offset;
370 
371  protected:
372 
373  /// \short Helper function to compute the min and max coordinates for the
374  /// mesh, in each dimension
375  void setup_min_and_max_coordinates();
376 
377  /// Pointer to mesh from whose FiniteElements sample points are created
378  Mesh* Mesh_pt;
379 
380  /// Vector of pairs of doubles for min and maximum coordinates.
381  /// Call: Min_and_max_coordinates[j] gives me the
382  /// pair of min (first) and max. (second) coordinates in the j-th
383  /// coordinate direction.
384  Vector<std::pair<double, double> > Min_and_max_coordinates;
385 
386  /// \short Use Eulerian coordinates (i.e. interpolated_x) rather than
387  /// zeta itself (i.e. interpolated_zeta) to identify point.
389 
390 #ifdef OOMPH_HAS_MPI
391 
392  /// Ignore halo elements?
394 
395 #endif
396 
397  /// "Measure of" number of sample points generated in each element
399 
400  /// \short Counter to keep track of how many sample points we've
401  /// visited during top level call to locate_zeta
403 
404  /// \short Max radius beyond which we stop searching the bin. Initialised
405  /// to DBL_MAX so keep going until the point is found or until
406  /// we've searched every single bin. Overwriting this means we won't search
407  /// in bins whose closest vertex is at a distance greater than
408  /// Max_search_radius from the point to be located.
410 
411 
412 };
413 
414 
415 ////////////////////////////////////////////////////////////////////////
416 ////////////////////////////////////////////////////////////////////////
417 ////////////////////////////////////////////////////////////////////////
418 
419 
420 //=========================================================================
421 /// \short Base class for all bin arrays
422 //=========================================================================
423 class BinArray : public virtual SamplePointContainer
424 {
425 
426  public:
427 
428  /// Constructor
429  BinArray(Mesh* mesh_pt,
430  const Vector<std::pair<double, double> >& min_and_max_coordinates,
431  const Vector<unsigned>& dimensions_of_bin_array,
432  const bool& use_eulerian_coordinates_during_setup,
433  const bool& ignore_halo_elements_during_locate_zeta_search,
434  const unsigned& nsample_points_generated_per_element) :
435  SamplePointContainer(mesh_pt,
436  min_and_max_coordinates,
437  use_eulerian_coordinates_during_setup,
438  ignore_halo_elements_during_locate_zeta_search,
439  nsample_points_generated_per_element),
440  Dimensions_of_bin_array(dimensions_of_bin_array)
441  {
442  // Note: Resizing of Dimensions_of_bin_array if no sizes are specified
443  // is delayed to derived class since refineable and nonrefineable
444  // bin arrays have different defaults.
445  }
446 
447  /// \short Broken default constructor; needed for broken
448  /// copy constructors. Don't call. It will die.
450  {
451  //Throw the error
452  throw OomphLibError("Broken default constructor. Don't call this!",
453  OOMPH_CURRENT_FUNCTION,
454  OOMPH_EXCEPTION_LOCATION);
455  }
456 
457  /// \short Broken copy constructor.
458  BinArray(const BinArray& data) {BrokenCopy::broken_copy("BinArray");}
459 
460  /// Broken assignment operator.
461  void operator=(const BinArray&) {BrokenCopy::broken_assign("BinArray");}
462 
463  /// Virtual destructor
464  virtual ~BinArray(){}
465 
466  /// \short Helper function for computing the bin indices of neighbouring bins
467  /// at a given "radius" of the specified bin. Final, optional boolean
468  /// (default: true) chooses to use the old version which appears to be
469  /// faster than Louis' new one after all (in the few cases where this
470  /// functionality is still used -- not all if we have cgal!)
471  void get_neighbouring_bins_helper(const unsigned& bin_index,
472  const unsigned& radius,
473  Vector<unsigned>& neighbouring_bin_index,
474  const bool& use_old_version=true);
475 
476  /// \short Profiling function to compare performance of two different
477  /// versions of the get_neighbouring_bins_helper(...) function
478  void profile_get_neighbouring_bins_helper();
479 
480 
481  /// \short Get (linearly enumerated) bin index of bin that
482  /// contains specified zeta
483  unsigned coords_to_bin_index(const Vector<double>& zeta);
484 
485 
486  /// \short Get "coordinates" of bin that contains specified zeta
487  void coords_to_vectorial_bin_index(const Vector<double>& zeta,
488  Vector<unsigned>& bin_index);
489 
490  /// Output bins (boundaries and number of sample points in them)
491  virtual void output_bins(std::ofstream& outfile)=0;
492 
493  /// \short Output bin vertices (allowing display of bin boundaries as zones).
494  virtual void output_bin_vertices(std::ofstream& outfile)=0;
495 
496  /// Number of bins (not taking recursion into account for refineable
497  /// versions)
498  virtual unsigned nbin() const=0;
499 
500  /// Max. bin dimension (number of bins in coordinate directions)
501  unsigned max_bin_dimension() const;
502 
503  /// Dimension of the zeta ( = dim of local coordinate of elements)
504  unsigned ndim_zeta() const
505  {
506  return Dimensions_of_bin_array.size();
507  }
508 
509  /// \short Number of bins in coordinate direction i
510  unsigned dimension_of_bin_array(const unsigned& i) const
511  {
512  return Dimensions_of_bin_array[i];
513  }
514 
515 
516  /// \short Number of bins in coordinate directions. Const vector-based
517  /// version
518  Vector<unsigned> dimensions_of_bin_array() const
519  {
520  return Dimensions_of_bin_array;
521  }
522 
523 
524  /// \short Number of bins in specified coordinate direction
525  unsigned dimensions_of_bin_array(const unsigned& i) const
526  {
527  return Dimensions_of_bin_array[i];
528  }
529 
530  protected:
531 
532  /// \short Number of bins in each coordinate direction
533  Vector<unsigned> Dimensions_of_bin_array;
534 
535 };
536 
537 
538 ////////////////////////////////////////////////////////////////////////
539 ////////////////////////////////////////////////////////////////////////
540 ////////////////////////////////////////////////////////////////////////
541 
542 
543 //==============================================================================
544 /// RefineableBinArray class.
545 //==============================================================================
546  class RefineableBinArray : public virtual BinArray
547  {
548 
549  public:
550 
551  /// Constructor
552  RefineableBinArray(SamplePointContainerParameters* bin_array_parameters_pt);
553 
554  /// \short Broken copy constructor.
556  {
557  BrokenCopy::broken_copy("RefineableBinArray");
558  }
559 
560  /// Broken assignment operator.
562  {
563  BrokenCopy::broken_assign("RefineableBinArray");
564  }
565 
566  /// Destructor
568  {
569  unsigned n=Bin_pt.size();
570  for (unsigned i=0;i<n;i++)
571  {
572  if (Bin_pt[i]!=0)
573  {
574  delete Bin_pt[i];
575  Bin_pt[i]=0;
576  }
577  }
578  }
579 
580  /// Root bin array
582  {
583  return Root_bin_array_pt;
584  }
585 
586  /// Pointer to i-th bin; can be null if bin is empty
587  RefineableBin* bin_pt(const unsigned& i) const
588  {
589  return Bin_pt[i];
590  }
591 
592  /// Number of bins (not taking recursion into account)
593  unsigned nbin() const
594  {
595  return Bin_pt.size();
596  }
597 
598  /// \short Default number of bins (in each coordinate direction)
599  /// (Note: don't move this into a common base class because
600  /// each derived class has its own value; we'll want far fewer
601  /// in the refineable version!)
602  static unsigned Default_n_bin_1d;
603 
604  /// Compute total number of sample points recursively
605  unsigned total_number_of_sample_points_computed_recursively() const;
606 
607  /// Fill the bin array with specified SamplePoints
608  void fill_bin_array(const Vector<SamplePoint*>& sample_point_pt)
609  {
610  unsigned n_dim=ndim_zeta();
611 
612  unsigned n=sample_point_pt.size();
613  for (unsigned i = 0; i < n; i++)
614  {
615  // Coordinates of this point
616  Vector<double> zeta(n_dim);
617 
618  // Which element is the point in?
619  unsigned e=sample_point_pt[i]->element_index_in_mesh();
620  FiniteElement* el_pt=Mesh_pt->finite_element_pt(e);
621 
622  // Which sample point is it at?
623  unsigned j=sample_point_pt[i]->sample_point_index_in_element();
624  Vector<double> s(n_dim);
625  bool use_equally_spaced_interior_sample_points=
627  el_pt->get_s_plot(j,Nsample_points_generated_per_element,s,
628  use_equally_spaced_interior_sample_points);
629  if (Use_eulerian_coordinates_during_setup)
630  {
631  el_pt->interpolated_x(s,zeta);
632  }
633  else
634  {
635  el_pt->interpolated_zeta(s,zeta);
636  }
637 
638  // Add it
639  add_sample_point(sample_point_pt[i],zeta);
640  }
641  }
642 
643  /// Add specified SamplePoint to RefineableBinArray
644  void add_sample_point(SamplePoint* new_sample_point_pt,
645  const Vector<double>& zeta)
646  {
647  // Find the correct bin
648  unsigned bin_index = coords_to_bin_index(zeta);
649 
650  // if the bin is not yet created, create it...
651  if (Bin_pt[bin_index] == 0)
652  {
653  Bin_pt[bin_index] = new RefineableBin(this,bin_index);
654  }
655  // Then add the SamplePoint
656  Bin_pt[bin_index]->add_sample_point(new_sample_point_pt,zeta);
657  }
658 
659  /// \short Find sub-GeomObject (finite element) and the local coordinate
660  /// s within it that contains point with global coordinate zeta.
661  /// sub_geom_object_pt=0 if point can't be found.
662  void locate_zeta(const Vector<double>& zeta,
663  GeomObject*& sub_geom_object_pt,
664  Vector<double>& s);
665 
666  /// \short Boundaries of specified bin in each coordinate direction.
667  /// *.first = min; *.second = max.
668  void get_bin_boundaries(const unsigned& bin_index,
669  Vector<std::pair<double, double> >&
670  min_and_max_coordinates);
671 
672  /// \short Depth of the hierarchical bin_array.
673  unsigned depth() const
674  {
675  return Depth;
676  }
677 
678  /// \short Max depth of the hierarchical bin_array; const version
679  unsigned max_depth() const
680  {
681  return Max_depth;
682  }
683 
684  /// \short Max depth of the hierarchical bin_array
685  unsigned& max_depth()
686  {
687  return Max_depth;
688  }
689 
690  /// Is the BinArray recursive?
692  {
693  return Bin_array_is_recursive;
694  }
695 
696  /// \short Maximum number of sample points in bin (before its subdivided
697  /// recursively)
699  {
700  return Max_number_of_sample_point_per_bin;
701  }
702 
703  /// Output bins
704  void output_bins(std::ofstream& outfile)
705  {
706  /// Loop over bins
707  unsigned n_bin=Bin_pt.size();
708  for (unsigned i=0;i<n_bin;i++)
709  {
710  if (Bin_pt[i]!=0)
711  {
712  Bin_pt[i]->output(outfile);
713  }
714  }
715  }
716 
717  /// \short Output bin vertices (allowing display of bins as zones).
718  void output_bin_vertices(std::ofstream& outfile);
719 
720  /// Output neighbouring bins at given "radius" of the specified bin
721  void output_neighbouring_bins(const unsigned& bin_index,
722  const unsigned& radius,
723  std::ofstream& outfile);
724 
725 
726  /// \short Counter to keep track of how many sample points we've
727  /// visited during top level call to locate_zeta
729  {
730  if (Depth==0)
731  {
732  return
733  Total_number_of_sample_points_visited_during_locate_zeta_from_top_level;
734  }
735  else
736  {
737  return Root_bin_array_pt->
738  total_number_of_sample_points_visited_during_locate_zeta_from_top_level();
739  }
740  }
741 
742  /// \short When searching through sample points recursively from the top
743  /// level RefineableBinArray (in deterministic order!) only actually do the
744  /// locate_zeta calls when when the counter exceeds this value.
746  {
747  return First_sample_point_to_actually_lookup_during_locate_zeta;
748  }
749 
750  /// \short When searching through sample points recursively from the top
751  /// level RefineableBinArray (in deterministic order!) only actually do the
752  /// locate_zeta calls when when the counter is less than this value.
754  {
755  return Last_sample_point_to_actually_lookup_during_locate_zeta;
756  }
757 
758  /// \short Every time we've completed a "spiral", visiting a finite
759  /// number of sample points in a deterministic order, use this
760  /// multiplier to increase the max. number of sample points to be visited.
761  /// Using a multiplier rather than a constant increment increases
762  /// the amount of (more and more unlikely to yield anything!) work
763  /// done locally before doing another costly mpi round trip
764  /// when we're already far from the point we're trying to find.
766  {
767  return Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta;
768  }
769 
770  /// \short When searching through sample points recursively from the top
771  /// level RefineableBinArray (in deterministic order!) only actually do the
772  /// locate_zeta calls when when the counter exceeds this value.
773  /// This is the initial value when starting the spiral based search.
775  {
776  return Initial_last_sample_point_to_actually_lookup_during_locate_zeta;
777  }
778 
779 
780  private:
781 
782  /// Fill the bin array with sample points from FiniteElements stored in mesh
783  void fill_bin_array();
784 
785  /// \short Loop over all sample points in the element specified via the pointer
786  /// and create a SamplePoint for each. Also specify the index of
787  /// the element in its mesh.
788  void create_sample_points_from_element(FiniteElement* const element_pt,
789  const unsigned& n_element);
790 
791 
792 
793 
794  /// Vector of pointers to constituent RefineableBins.
795  Vector<RefineableBin*> Bin_pt;
796 
797  /// \short Variable which stores if the RefineableBinArray is
798  /// recursive or not.
800 
801  /// \short Variable which stores the Depth value of the bin_array. Useful for
802  /// debugging and for preventing "infinite" recursion in case if there is
803  /// a problem.
804  unsigned Depth;
805 
806  /// Max depth of the hierarchical bin_array
807  unsigned Max_depth;
808 
809  /// \short Maximum number of sample points in bin (before it's subdivided
810  /// recursively)
812 
813  /// Pointer to root bin array
815 
816  // hierher only used in root
817 
818  /// \short When searching through sample points recursively from the top
819  /// level RefineableBinArray (in deterministic order!) only actually do the
820  /// locate_zeta calls when when the counter exceeds this value.
822 
823  /// \short When searching through sample points recursively from the top
824  /// level RefineableBinArray (in deterministic order!) only actually do the
825  /// locate_zeta calls when when the counter is less than this value.
827 
828  /// \short Every time we've completed a "spiral", visiting a finite
829  /// number of sample points in a deterministic order, use this
830  /// multiplier to increase the max. number of sample points to be visited.
831  /// Using a multiplier rather than a constant increment increases
832  /// the amount of (more and more unlikely to yield anything!) work
833  /// done locally before doing another costly mpi round trip
834  /// when we're already far from the point we're trying to find.
836 
837  /// \short When searching through sample points recursively from the top
838  /// level RefineableBinArray (in deterministic order!) only actually do the
839  /// locate_zeta calls when when the counter exceeds this value.
840  /// This is the initial value when starting the spiral based search.
842 
843 
844  };
845 
846 
847 ////////////////////////////////////////////////////////////////////////////////
848 ////////////////////////////////////////////////////////////////////////////////
849 ////////////////////////////////////////////////////////////////////////////////
850 
851 
852 //==============================================================================
853 /// NonRefineableBinArray class.
854 //==============================================================================
855  class NonRefineableBinArray : public virtual BinArray
856  {
857 
858  public:
859 
860 
861  /// Constructor
862  NonRefineableBinArray(SamplePointContainerParameters*
863  bin_array_parameters_pt);
864 
865  /// Destructor:
867  {
868  flush_bins_of_objects();
869  }
870 
871  /// \short Broken copy constructor.
873  {
874  BrokenCopy::broken_copy("NonRefineableBinArray");
875  }
876 
877  /// Broken assignment operator.
879  {
880  BrokenCopy::broken_assign("NonRefineableBinArray");
881  }
882 
883  /// \short Find sub-GeomObject (finite element) and the local coordinate
884  /// s within it that contains point with global coordinate zeta.
885  /// sub_geom_object_pt=0 if point can't be found.
886  void locate_zeta(const Vector<double>& zeta,
887  GeomObject*& sub_geom_object_pt,
888  Vector<double>& s);
889 
890  /// Total number of bins (empty or not)
891  unsigned nbin() const
892  {
893  const unsigned n_lagrangian = ndim_zeta();
894  unsigned ntotalbin = Dimensions_of_bin_array[0];
895  for(unsigned i=1;i<n_lagrangian;i++)
896  {
897  ntotalbin *= Dimensions_of_bin_array[i];
898  }
899  return ntotalbin;
900  }
901 
902  /// \short Default number of bins (in each coordinate direction).
903  /// (Note: don't move this into a common base class because
904  /// each derived class has its own value; nonrefineable bin
905  /// wants a much larger value than the refineable one!)
906  static unsigned Default_n_bin_1d;
907 
908  /// Compute total number of sample points recursively
909  unsigned total_number_of_sample_points_computed_recursively() const;
910 
911 /// Number of spirals to be searched in one go const version
912  unsigned n_spiral_chunk() const
913  {
914  return Nspiral_chunk;
915  }
916 
917 /// Number of spirals to be searched in one go
918  unsigned& n_spiral_chunk()
919  {
920  return Nspiral_chunk;
921  }
922 
923  /// \short Access function to max. spiral level during straight locate_zeta
924  /// search (for efficiency; similar to max_search_radius())
925  unsigned& max_spiral_level() { return Max_spiral_level; }
926 
927  /// Access function to current min. spiral level
928  unsigned& current_min_spiral_level() { return Current_min_spiral_level; }
929 
930  /// Access function to current max. spiral level
931  unsigned& current_max_spiral_level() { return Current_max_spiral_level; }
932 
933  /// Provide some stats on the fill level of the associated bin
934  void get_fill_stats(unsigned& n_bin,
935  unsigned& max_n_entry,
936  unsigned& min_n_entry,
937  unsigned& tot_n_entry,
938  unsigned& n_empty) const;
939 
940  /// \short Compute the minimum distance of any vertex in the specified bin
941  /// from the specified Lagrangian coordinate zeta
942  double min_distance(const unsigned& i_bin,
943  const Vector<double>& zeta);
944 
945  /// \short Output bin vertices (allowing display of bins as zones).
946  void output_bin_vertices(std::ofstream& outfile);
947 
948  /// \short Get vector of vectors containing the coordinates of the
949  /// vertices of the i_bin-th bin: bin_vertex[j][i] contains the
950  /// i-th coordinate of the j-th vertex.
951  void get_bin_vertices(const unsigned& i_bin,
952  Vector<Vector<double> >& bin_vertex);
953 
954  /// \short Get the number of the bin containing the specified coordinate.
955  /// Bin number is negative if the coordinate is outside
956  /// the bin structure.
957  void get_bin(const Vector<double>& zeta, int& bin_number);
958 
959  /// \short Get the number of the bin containing the specified coordinate; also
960  /// return the contents of that bin. Bin number is negative if the
961  /// coordinate is outside the bin structure.
962  void get_bin(const Vector<double>& zeta, int& bin_number,
963  Vector<std::pair<FiniteElement*,
964  Vector<double> > >& sample_point_pairs);
965 
966  /// Get the contents of all bins in vector
967  Vector<Vector<std::pair<FiniteElement*,Vector<double> > > > bin_content() const
968  {
969  Vector<Vector<std::pair<FiniteElement*, Vector<double> > > > all_vals;
970  Bin_object_coord_pairs.get_all_values(all_vals);
971  return all_vals;
972  }
973 
974  /// Get the contents of all bins in vector
975  const std::map<unsigned, Vector<std::pair<FiniteElement*, Vector<double> > > >*
977  {
978  // Return the content of the bins
979  return Bin_object_coord_pairs.map_pt();
980  }
981 
982  /// \short Fill bin by diffusion, populating each empty bin with the
983  /// same content as the first non-empty bin found during a spiral-based search
984  /// up to the specified "radius" (default 1)
985  void fill_bin_by_diffusion(const unsigned& bin_diffusion_radius = 1);
986 
987 
988 
989  /// Output bins
990  void output_bins(std::ofstream& outfile);
991 
992  /// Output bins
993  void output_bins(std::string& filename)
994  {
995  std::ofstream outfile;
996  outfile.open(filename.c_str());
997  output_bins(outfile);
998  outfile.close();
999  }
1000 
1001  /// \short Counter for overall number of bins allocated -- used to
1002  /// issue warning if this exceeds a threshhold. (Default assignment
1003  /// of 100^DIM bins per MeshAsGeomObject can be a killer if there
1004  /// are huge numbers of sub-meshes (e.g. in unstructured FSI).
1005  static unsigned long Total_nbin_cells_counter;
1006 
1007  /// \short Total number of bins above which warning is issued.
1008  /// (Default assignment of 100^DIM bins per MeshAsGeomObject can
1009  /// be a killer if there are huge numbers of sub-meshes (e.g. in
1010  /// unstructured FSI).
1012 
1013  /// \short Boolean to supppress warnings about large number of bins
1015 
1016  /// \short Boolean flag to make sure that warning about large number
1017  /// of bin cells only gets triggered once.
1019 
1020  /// \short Fraction of elements/bin that triggers warning. Too many
1021  /// elements per bin can lead to very slow computations
1023 
1024  /// \short Boolean to supppress warnings about small number of bins
1026 
1027  /// \short Boolean flag to make sure that warning about small number
1028  /// of bin cells only gets triggered once.
1030 
1031  private:
1032 
1033  /// Fill the bin array with sample points from FiniteElements stored in mesh
1034  void fill_bin_array();
1035 
1036  /// Initialise and populate the "bin" structure for locating coordinates
1037  /// and increment counter for total number of bins in active use by any
1038  /// MeshAsGeomObject)
1039  void create_bins_of_objects();
1040 
1041  /// \short Flush the storage for the binning method (and decrement counter
1042  /// for total number of bins in active use by any MeshAsGeomObject)
1044  {
1045  Total_nbin_cells_counter -= Bin_object_coord_pairs.nnz();
1046  Bin_object_coord_pairs.clear();
1047  }
1048 
1049  /// Storage for paired objects and coords in each bin
1050  SparseVector<Vector<std::pair<FiniteElement*, Vector<double> > > >
1052 
1053  /// \short Max. spiralling level (for efficiency; effect similar to
1054  /// max_search_radius)
1056 
1057  /// Current min. spiralling level
1059 
1060  /// Current max. spiralling level
1062 
1063 /// Number of spirals to be searched in one go
1064  unsigned Nspiral_chunk;
1065 
1066  };
1067 
1068 
1069 ////////////////////////////////////////////////////////////////////////
1070 ////////////////////////////////////////////////////////////////////////
1071 ////////////////////////////////////////////////////////////////////////
1072 
1073 #ifdef OOMPH_HAS_CGAL
1074 
1075 
1076 //====================================================================
1077 /// CGAL-based SamplePointContainer
1078 //====================================================================
1080 {
1081 
1082  public:
1083 
1084  /// Constructor
1085  CGALSamplePointContainer(SamplePointContainerParameters*
1086  sample_point_container_parameters_pt);
1087 
1088  /// \short Broken copy constructor.
1090  {
1091  BrokenCopy::broken_copy("CGALSamplePointContainer");
1092  }
1093 
1094  /// Broken assignment operator.
1096  {
1097  BrokenCopy::broken_assign("CGALSamplePointContainer");
1098  }
1099 
1100  /// Virtual destructor
1102  {
1103  unsigned n=Sample_point_pt.size();
1104  for (unsigned i=0;i<n;i++)
1105  {
1106  delete Sample_point_pt[i];
1107  Sample_point_pt[i]=0;
1108  }
1109  delete CGAL_tree_d_pt;
1110  CGAL_tree_d_pt=0;
1111  }
1112 
1113  /// \short When searching through sample points only actually do the
1114  /// locate_zeta calls when when the counter exceeds this value.
1116  {
1117  return First_sample_point_to_actually_lookup_during_locate_zeta;
1118  }
1119 
1120  /// \short When searching through sample points only actually do the
1121  /// locate_zeta calls when when the counter is less than this value.
1123  {
1124  return Last_sample_point_to_actually_lookup_during_locate_zeta;
1125  }
1126 
1127 
1128  /// \short Every time we've completed a "spiral", visiting a finite
1129  /// number of sample points in a deterministic order, use this
1130  /// multiplier to increase the max. number of sample points to be visited.
1131  /// Using a multiplier rather than a constant increment increases
1132  /// the amount of (more and more unlikely to yield anything!) work
1133  /// done locally before doing another costly mpi round trip
1134  /// when we're already far from the point we're trying to find.
1136  {
1137  return Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta;
1138  }
1139 
1140  /// \short When searching through sample points only actually do the
1141  /// locate_zeta calls when when the counter exceeds this value.
1142  /// This is the initial value when starting the spiral based search.
1144  {
1145  return Initial_last_sample_point_to_actually_lookup_during_locate_zeta;
1146  }
1147 
1148 
1149  /// \short Find sub-GeomObject (finite element) and the local coordinate
1150  /// s within it that contains point with global coordinate zeta.
1151  /// sub_geom_object_pt=0 if point can't be found.
1152  void locate_zeta(const Vector<double>& zeta,
1153  GeomObject*& sub_geom_object_pt,
1154  Vector<double>& s);
1155 
1156 
1157  /// \short Find the sub geometric object and local coordinate therein that
1158  /// corresponds to the intrinsic coordinate zeta, using up to the specified
1159  /// number of sample points as initial guess for the Newton-based search.
1160  /// If this fails, return the nearest sample point.
1161  void limited_locate_zeta(
1162  const Vector<double>& zeta,
1163  const unsigned& max_sample_points_for_newton_based_search,
1164  GeomObject*& sub_geom_object_pt,
1165  Vector<double>& s);
1166 
1167 
1168  /// Dimension of the zeta ( = dim of local coordinate of elements)
1169  unsigned ndim_zeta() const
1170  {
1171  return Ndim_zeta;
1172  }
1173 
1174  /// Compute total number of sample points in sample point container
1175  unsigned total_number_of_sample_points_computed_recursively() const;
1176 
1177  private:
1178 
1179  /// Get the sample points; return time for setup of CGAL tree.
1180  double get_sample_points();
1181 
1182  /// Dimension of the zeta ( = dim of local coordinate of elements)
1183  unsigned Ndim_zeta;
1184 
1185  /// typedefs for cgal stuff
1186  typedef CGAL::Cartesian_d<double> Kernel_d;
1187  typedef Kernel_d::Point_d Point_d;
1188  typedef boost::tuple<Point_d,SamplePoint* > Point_d_and_pointer;
1189  typedef CGAL::Search_traits_d<Kernel_d> Traits_base_d;
1190  typedef CGAL::Search_traits_adapter<Point_d_and_pointer,
1191  CGAL::Nth_of_tuple_property_map<0, Point_d_and_pointer>,
1192  Traits_base_d> Traits_d;
1193  typedef CGAL::Orthogonal_k_neighbor_search<Traits_d> K_neighbor_search_d;
1194 
1195  /// Vector containing sample point coordinates
1196  Vector<Point_d> CGAL_sample_point_zeta_d;
1197 
1198  /// Pointer to tree-based representation of sample points
1199  K_neighbor_search_d::Tree* CGAL_tree_d_pt;
1200 
1201  /// Vector storing pointers to sample point objects (which represent
1202  /// sample point in terms of number of element
1203  /// in its mesh and number of sample point)
1204  Vector<SamplePoint*> Sample_point_pt;
1205 
1206  /// \short When searching through sample points only actually do the
1207  /// locate_zeta calls when when the counter exceeds this value.
1209 
1210  /// \short When searching through sample points only actually do the
1211  /// locate_zeta calls when when the counter is less than this value.
1213 
1214  /// \short Every time we've completed a "spiral", visiting a finite
1215  /// number of sample points in a deterministic order, use this
1216  /// multiplier to increase the max. number of sample points to be visited.
1217  /// Using a multiplier rather than a constant increment increases
1218  /// the amount of (more and more unlikely to yield anything!) work
1219  /// done locally before doing another costly mpi round trip
1220  /// when we're already far from the point we're trying to find.
1222 
1223  /// \short When searching through sample points only actually do the
1224  /// locate_zeta calls when when the counter exceeds this value.
1225  /// This is the initial value when starting the "spiral based" search.
1227 
1228 };
1229 
1230 #endif // endif oomph has cgal
1231 
1232 ////////////////////////////////////////////////////////////////////////
1233 ////////////////////////////////////////////////////////////////////////
1234 ////////////////////////////////////////////////////////////////////////
1235 
1236 
1237 
1238 } // end of namespace extension
1239 
1240 #endif
void operator=(const NonRefineableBinArray &)
Broken assignment operator.
Class for containing sample points: Number of finite element in its mesh and index of sample point wi...
unsigned Total_number_of_sample_points_visited_during_locate_zeta_from_top_level
Counter to keep track of how many sample points we&#39;ve visited during top level call to locate_zeta...
void fill_bin_array(const Vector< SamplePoint *> &sample_point_pt)
Fill the bin array with specified SamplePoints.
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.
K_neighbor_search_d::Tree * CGAL_tree_d_pt
Pointer to tree-based representation of sample points.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
unsigned Max_spiral_level
Max. spiralling level (for efficiency; effect similar to max_search_radius)
unsigned & last_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
SamplePoint(const SamplePoint &data)
Broken copy constructor.
CGAL::Orthogonal_k_neighbor_search< Traits_d > K_neighbor_search_d
Vector< SamplePoint * > * Sample_point_pt
Container of SamplePoints. Pointer to vector because it&#39;s shorter than an empty vector! (Not all Refi...
Vector< Vector< std::pair< FiniteElement *, Vector< double > > > > bin_content() const
Get the contents of all bins in vector.
CGAL::Cartesian_d< double > Kernel_d
typedefs for cgal stuff
unsigned Element_index_in_mesh
Index of finite element in its mesh.
RefineableBin(const RefineableBin &data)
Broken copy constructor.
static bool Suppress_warning_about_large_total_number_of_bins
Boolean to supppress warnings about large number of bins.
cstr elem_len * i
Definition: cfortran.h:607
void operator=(const SamplePoint &)
Broken assignment operator.
bool Use_eulerian_coordinates_during_setup
Use Eulerian coordinates (i.e. interpolated_x) rather than zeta itself (i.e. interpolated_zeta) to id...
unsigned & multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta()
Every time we&#39;ve completed a "spiral", visiting a finite number of sample points in a deterministic o...
unsigned max_depth() const
Max depth of the hierarchical bin_array; const version.
Vector< SamplePoint * > Sample_point_pt
unsigned & multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta()
Every time we&#39;ve completed a "spiral", visiting a finite number of sample points in a deterministic o...
unsigned & first_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points only actually do the locate_zeta calls when when the counter exc...
bool ignore_halo_elements_during_locate_zeta_search() const
Ignore halo elements?
void operator=(const CGALSamplePointContainer &)
Broken assignment operator.
unsigned Last_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points only actually do the locate_zeta calls when when the counter is ...
unsigned Nspiral_chunk
Number of spirals to be searched in one go.
unsigned & last_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points only actually do the locate_zeta calls when when the counter is ...
RefineableBinArray class.
unsigned & max_spiral_level()
Access function to max. spiral level during straight locate_zeta search (for efficiency; similar to m...
Vector< std::pair< double, double > > Min_and_max_coordinates
bool bin_array_is_recursive() const
Is the BinArray recursive?
virtual ~BinArray()
Virtual destructor.
CGAL-based SamplePointContainer.
unsigned Nsample_points_generated_per_element
"Measure of" number of sample points generated in each element
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...
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...
void output_bins(std::ofstream &outfile)
Output bins.
unsigned Max_depth
Max depth of the hierarchical bin_array.
virtual ~SamplePointContainer()
Virtual destructor.
Vector< Point_d > CGAL_sample_point_zeta_d
Vector containing sample point coordinates.
CGAL::Search_traits_d< Kernel_d > Traits_base_d
e
Definition: cfortran.h:575
unsigned Current_min_spiral_level
Current min. spiralling level.
unsigned & first_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
virtual unsigned & total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
Counter to keep track of how many sample points we&#39;ve visited during top level call to locate_zeta...
unsigned First_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
BinArray()
Broken default constructor; needed for broken copy constructors. Don&#39;t call. It will die...
static unsigned long Threshold_for_total_bin_cell_number_warning
Total number of bins above which warning is issued. (Default assignment of 100^DIM bins per MeshAsGeo...
unsigned max_number_of_sample_point_per_bin() const
Maximum number of sample points in bin (before its subdivided recursively)
void add_sample_point(SamplePoint *new_sample_point_pt, const Vector< double > &zeta)
Add specified SamplePoint to RefineableBinArray.
CGAL::Search_traits_adapter< Point_d_and_pointer, CGAL::Nth_of_tuple_property_map< 0, Point_d_and_pointer >, Traits_base_d > Traits_d
unsigned & initial_last_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points only actually do the locate_zeta calls when when the counter exc...
virtual ~CGALSamplePointContainer()
Virtual destructor.
void flush_bins_of_objects()
Flush the storage for the binning method (and decrement counter for total number of bins in active us...
RefineableBinArray * root_bin_array_pt() const
Root bin array.
bool use_eulerian_coordinates_during_setup() const
Use Eulerian coordinates (i.e. interpolated_x) rather than zeta itself (i.e. interpolated_zeta) to id...
unsigned Ndim_zeta
Dimension of the zeta ( = dim of local coordinate of elements)
static std::ofstream Visited_sample_points_file
File to record sequence of visited sample points in.
unsigned depth() const
Depth of the hierarchical bin_array.
unsigned dimension_of_bin_array(const unsigned &i) const
Number of bins in coordinate direction i.
~RefineableBinArray()
Destructor.
bool Bin_array_is_recursive
Variable which stores if the RefineableBinArray is recursive or not.
unsigned nsample_points_in_bin()
Number of sample points stored in bin.
unsigned & current_max_spiral_level()
Access function to current max. spiral level.
unsigned ndim_zeta() const
Dimension of the zeta ( = dim of local coordinate of elements)
Base class for all bin arrays.
RefineableBinArray * Sub_bin_array_pt
Pointer to a possible sub-BinArray. Null by default.
RefineableBinArray(const RefineableBinArray &data)
Broken copy constructor.
void output_bins(std::string &filename)
Output bins.
static char t char * s
Definition: cfortran.h:572
static unsigned long Total_nbin_cells_counter
Counter for overall number of bins allocated – used to issue warning if this exceeds a threshhold...
RefineableBin * bin_pt(const unsigned &i) const
Pointer to i-th bin; can be null if bin is empty.
unsigned Sample_point_index_in_element
Index of the sample point within element.
NonRefineableBinArray(const NonRefineableBinArray &data)
Broken copy constructor.
static double Percentage_offset
Offset of sample point container boundaries beyond max/min coords.
unsigned Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta
Every time we&#39;ve completed a "spiral", visiting a finite number of sample points in a deterministic o...
SparseVector< Vector< std::pair< FiniteElement *, Vector< double > > > > Bin_object_coord_pairs
Storage for paired objects and coords in each bin.
unsigned n_spiral_chunk() const
Number of spirals to be searched in one go const version.
unsigned nbin() const
Number of bins (not taking recursion into account)
static bool Suppress_warning_about_small_number_of_bins
Boolean to supppress warnings about small number of bins.
void operator=(const BinArray &)
Broken assignment operator.
Vector< unsigned > Dimensions_of_bin_array
Number of bins in each coordinate direction.
void output(std::ostream &outfile)
Output with default number of plot points.
unsigned element_index_in_mesh() const
Access function to the index of finite element in its mesh.
static bool Use_equally_spaced_interior_sample_points
Use equally spaced sample points? (otherwise vertices are sampled repeatedly.
SamplePoint(const unsigned &element_index_in_mesh, const unsigned &sample_point_index_in_element)
Construct SamplePoint object from number of finite element in its mesh, and index of sample point wit...
const std::map< unsigned, Vector< std::pair< FiniteElement *, Vector< double > > > > * get_all_bins_content() const
Get the contents of all bins in vector.
static bool Always_fail_elemental_locate_zeta
Boolean flag to make to make locate zeta fail. Used for debugging/ illustration of search procedures...
unsigned Multiplier_for_max_sample_point_to_actually_lookup_during_locate_zeta
Every time we&#39;ve completed a "spiral", visiting a finite number of sample points in a deterministic o...
static unsigned Default_n_bin_1d
Default number of bins (in each coordinate direction) (Note: don&#39;t move this into a common base class...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
NonRefineableBinArray class.
unsigned & initial_last_sample_point_to_actually_lookup_during_locate_zeta()
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
RefineableBin(RefineableBinArray *bin_array_pt, const unsigned &bin_index_in_bin_array)
Constructor. Pass pointer to bin array that contains this bin and the index of the newly created bin ...
RefineableBinArray * Root_bin_array_pt
Pointer to root bin array.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn&#39;t been defined.
static bool Already_warned_about_large_number_of_bin_cells
Boolean flag to make sure that warning about large number of bin cells only gets triggered once...
unsigned First_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points only actually do the locate_zeta calls when when the counter exc...
Mesh * mesh_pt() const
Pointer to mesh from whose FiniteElements sample points are created.
unsigned Initial_last_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points only actually do the locate_zeta calls when when the counter exc...
unsigned Max_number_of_sample_point_per_bin
Maximum number of sample points in bin (before it&#39;s subdivided recursively)
bool Ignore_halo_elements_during_locate_zeta_search
Ignore halo elements?
unsigned Initial_last_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
CGALSamplePointContainer(const CGALSamplePointContainer &data)
Broken copy constructor.
static bool Already_warned_about_small_number_of_bin_cells
Boolean flag to make sure that warning about small number of bin cells only gets triggered once...
boost::tuple< Point_d, SamplePoint *> Point_d_and_pointer
unsigned dimensions_of_bin_array(const unsigned &i) const
Number of bins in specified coordinate direction.
unsigned nbin() const
Total number of bins (empty or not)
Mesh * Mesh_pt
Pointer to mesh from whose FiniteElements sample points are created.
unsigned sample_point_index_in_element() const
Index of sample point within element.
static unsigned Default_n_bin_1d
Default number of bins (in each coordinate direction). (Note: don&#39;t move this into a common base clas...
void operator=(const RefineableBin &)
Broken assignment operator.
void operator=(const SamplePointContainer &)
Broken assignment operator.
unsigned ndim_zeta() const
Dimension of the zeta ( = dim of local coordinate of elements)
Vector< unsigned > dimensions_of_bin_array() const
Number of bins in coordinate directions. Const vector-based version.
Vector< RefineableBin * > Bin_pt
Vector of pointers to constituent RefineableBins.
Base class for all sample point containers.
unsigned Current_max_spiral_level
Current max. spiralling level.
unsigned & n_spiral_chunk()
Number of spirals to be searched in one go.
double & max_search_radius()
Set maximum search radius for locate zeta. This is initialised do DBL_MAX so we brutally search throu...
unsigned & total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
Counter to keep track of how many sample points we&#39;ve visited during top level call to locate_zeta...
unsigned Bin_index_in_bin_array
Index of bin in its bin array.
unsigned & current_min_spiral_level()
Access function to current min. spiral level.
void operator=(const RefineableBinArray &)
Broken assignment operator.
SamplePointContainer(const SamplePointContainer &data)
Broken copy constructor.
SamplePointContainer()
Broken default constructor; needed for broken copy constructors. Don&#39;t call. It will die...
unsigned & nsample_points_generated_per_element()
"Measure of" number of sample points generated in each element
unsigned & max_depth()
Max depth of the hierarchical bin_array.
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.
RefineableBinArray * Bin_array_pt
Pointer to the bin array which "owns" this RefineableBin.
static unsigned Threshold_for_elements_per_bin_warning
Fraction of elements/bin that triggers warning. Too many elements per bin can lead to very slow compu...
BinArray(const BinArray &data)
Broken copy constructor.
double Max_search_radius
Max radius beyond which we stop searching the bin. Initialised to DBL_MAX so keep going until the poi...
static bool Enable_timing_of_setup
Time setup?
unsigned Depth
Variable which stores the Depth value of the bin_array. Useful for debugging and for preventing "infi...
unsigned Last_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points recursively from the top level RefineableBinArray (in determinis...