50 if (Sub_bin_array_pt!=0)
52 delete Sub_bin_array_pt;
56 if (Sample_point_pt!=0)
58 unsigned n=Sample_point_pt->size();
59 for (
unsigned i=0;
i<n;
i++)
61 delete (*Sample_point_pt)[
i];
63 delete Sample_point_pt;
77 if (Sub_bin_array_pt!=0)
79 count=Sub_bin_array_pt->total_number_of_sample_points_computed_recursively();
83 if (Sample_point_pt!=0)
85 count=Sample_point_pt->size();
98 const Vector<std::pair<double, double> >& min_and_max_coordinates)
102 RefineableBinArrayParameters* ref_bin_array_parameters_pt=
103 new RefineableBinArrayParameters(Bin_array_pt->mesh_pt());
106 ref_bin_array_parameters_pt->min_and_max_coordinates()=
107 min_and_max_coordinates;
109 ref_bin_array_parameters_pt->dimensions_of_bin_array()=
110 Bin_array_pt->dimensions_of_bin_array();
113 if (Bin_array_pt->use_eulerian_coordinates_during_setup())
115 ref_bin_array_parameters_pt->enable_use_eulerian_coordinates_during_setup();
119 ref_bin_array_parameters_pt->
120 disable_use_eulerian_coordinates_during_setup();
127 if (Bin_array_pt->ignore_halo_elements_during_locate_zeta_search())
129 ref_bin_array_parameters_pt->
130 enable_ignore_halo_elements_during_locate_zeta_search();
134 ref_bin_array_parameters_pt->
135 disable_ignore_halo_elements_during_locate_zeta_search();
141 ref_bin_array_parameters_pt->nsample_points_generated_per_element()=
142 Bin_array_pt->nsample_points_generated_per_element();
146 if (Bin_array_pt->bin_array_is_recursive())
148 ref_bin_array_parameters_pt->enable_bin_array_is_recursive();
152 ref_bin_array_parameters_pt->disable_bin_array_is_recursive();
156 ref_bin_array_parameters_pt->depth()=Bin_array_pt->depth()+1;
159 ref_bin_array_parameters_pt->max_depth()=Bin_array_pt->max_depth();
162 ref_bin_array_parameters_pt->max_number_of_sample_point_per_bin()=
163 Bin_array_pt->max_number_of_sample_point_per_bin();
166 ref_bin_array_parameters_pt->root_bin_array_pt()=
167 Bin_array_pt->root_bin_array_pt();
170 BinArrayParameters* bin_array_parameters_pt=ref_bin_array_parameters_pt;
172 delete ref_bin_array_parameters_pt;
175 Sub_bin_array_pt->fill_bin_array(*Sample_point_pt);
179 delete Sample_point_pt;
190 if ((Sub_bin_array_pt!=0)&&(!don_t_recurse))
192 Sub_bin_array_pt->output_bins(outfile);
196 unsigned n_lagr=Bin_array_pt->ndim_zeta();
197 Vector<std::pair<double, double> > min_and_max_coordinates(n_lagr);
198 get_bin_boundaries(min_and_max_coordinates);
201 unsigned n_sample_points=0;
202 if (Sample_point_pt!=0)
204 n_sample_points=Sample_point_pt->size();
210 outfile <<
"ZONE I=2\n" 211 << min_and_max_coordinates[0].first
212 <<
" " << n_sample_points << std::endl
213 << min_and_max_coordinates[0].second
214 <<
" " << n_sample_points << std::endl;
219 outfile <<
"ZONE I=2, J=2\n" 220 << min_and_max_coordinates[0].first <<
" " 221 << min_and_max_coordinates[1].first <<
" " 222 << n_sample_points <<
"\n" 224 << min_and_max_coordinates[0].second <<
" " 225 << min_and_max_coordinates[1].first<<
" " 226 << n_sample_points <<
"\n" 228 << min_and_max_coordinates[0].first <<
" " 229 << min_and_max_coordinates[1].second <<
" " 230 << n_sample_points <<
"\n" 232 << min_and_max_coordinates[0].second <<
" " 233 << min_and_max_coordinates[1].second <<
" " 234 << n_sample_points <<
"\n";
240 outfile <<
"ZONE I=2, J=2, K=2\n" 241 << min_and_max_coordinates[0].first <<
" " 242 << min_and_max_coordinates[1].first <<
" " 243 << min_and_max_coordinates[2].first <<
" " 244 << n_sample_points <<
"\n" 246 << min_and_max_coordinates[0].second <<
" " 247 << min_and_max_coordinates[1].first<<
" " 248 << min_and_max_coordinates[2].first <<
" " 249 << n_sample_points <<
"\n" 251 << min_and_max_coordinates[0].first <<
" " 252 << min_and_max_coordinates[1].second <<
" " 253 << min_and_max_coordinates[2].first <<
" " 254 << n_sample_points <<
"\n" 256 << min_and_max_coordinates[0].second <<
" " 257 << min_and_max_coordinates[1].second <<
" " 258 << min_and_max_coordinates[2].first <<
" " 259 << n_sample_points <<
"\n" 261 << min_and_max_coordinates[0].first <<
" " 262 << min_and_max_coordinates[1].first <<
" " 263 << min_and_max_coordinates[2].second <<
" " 264 << n_sample_points <<
"\n" 266 << min_and_max_coordinates[0].second <<
" " 267 << min_and_max_coordinates[1].first<<
" " 268 << min_and_max_coordinates[2].second <<
" " 269 << n_sample_points <<
"\n" 271 << min_and_max_coordinates[0].first <<
" " 272 << min_and_max_coordinates[1].second <<
" " 273 << min_and_max_coordinates[2].second <<
" " 274 << n_sample_points <<
"\n" 276 << min_and_max_coordinates[0].second <<
" " 277 << min_and_max_coordinates[1].second <<
" " 278 << min_and_max_coordinates[2].second <<
" " 279 << n_sample_points <<
"\n";
285 oomph_info <<
"n_lagr=" << n_lagr<< std::endl;
286 throw OomphLibError(
"Wrong dimension",
287 OOMPH_CURRENT_FUNCTION,
288 OOMPH_EXCEPTION_LOCATION);
302 if (Sub_bin_array_pt!=0)
304 Sub_bin_array_pt->output_bin_vertices(outfile);
308 unsigned n_lagr=Bin_array_pt->ndim_zeta();
309 Vector<std::pair<double, double> > min_and_max_coordinates(n_lagr);
310 get_bin_boundaries(min_and_max_coordinates);
315 outfile <<
"ZONE I=2\n" 316 << min_and_max_coordinates[0].first
318 << min_and_max_coordinates[0].second
324 outfile <<
"ZONE I=2, J=2\n" 325 << min_and_max_coordinates[0].first <<
" " 326 << min_and_max_coordinates[1].first <<
" " 329 << min_and_max_coordinates[0].second <<
" " 330 << min_and_max_coordinates[1].first<<
" " 333 << min_and_max_coordinates[0].first <<
" " 334 << min_and_max_coordinates[1].second <<
" " 337 << min_and_max_coordinates[0].second <<
" " 338 << min_and_max_coordinates[1].second <<
" " 345 outfile <<
"ZONE I=2, J=2, K=2\n" 346 << min_and_max_coordinates[0].first <<
" " 347 << min_and_max_coordinates[1].first <<
" " 348 << min_and_max_coordinates[2].first <<
" " 351 << min_and_max_coordinates[0].second <<
" " 352 << min_and_max_coordinates[1].first<<
" " 353 << min_and_max_coordinates[2].first <<
" " 356 << min_and_max_coordinates[0].first <<
" " 357 << min_and_max_coordinates[1].second <<
" " 358 << min_and_max_coordinates[2].first <<
" " 361 << min_and_max_coordinates[0].second <<
" " 362 << min_and_max_coordinates[1].second <<
" " 363 << min_and_max_coordinates[2].first <<
" " 366 << min_and_max_coordinates[0].first <<
" " 367 << min_and_max_coordinates[1].first <<
" " 368 << min_and_max_coordinates[2].second <<
" " 371 << min_and_max_coordinates[0].second <<
" " 372 << min_and_max_coordinates[1].first<<
" " 373 << min_and_max_coordinates[2].second <<
" " 376 << min_and_max_coordinates[0].first <<
" " 377 << min_and_max_coordinates[1].second <<
" " 378 << min_and_max_coordinates[2].second <<
" " 381 << min_and_max_coordinates[0].second <<
" " 382 << min_and_max_coordinates[1].second <<
" " 383 << min_and_max_coordinates[2].second <<
" " 390 oomph_info <<
"n_lagr=" << n_lagr<< std::endl;
391 throw OomphLibError(
"Wrong dimension",
392 OOMPH_CURRENT_FUNCTION,
393 OOMPH_EXCEPTION_LOCATION);
405 const Vector<double>& zeta_coordinates)
408 if (Sub_bin_array_pt == 0)
411 if (Sample_point_pt == 0)
413 Sample_point_pt =
new Vector<SamplePoint*>;
415 this->Sample_point_pt->push_back(new_sample_point_pt);
420 if ((Bin_array_pt->bin_array_is_recursive()) &&
421 (Sample_point_pt->size() >
422 Bin_array_pt->max_number_of_sample_point_per_bin()) &&
423 (Bin_array_pt->depth()<Bin_array_pt->max_depth()) )
426 Vector<std::pair<double, double> > min_and_max_coordinates(
427 Bin_array_pt->ndim_zeta());
428 get_bin_boundaries(min_and_max_coordinates);
432 this->make_sub_bin_array(min_and_max_coordinates);
438 this->Sub_bin_array_pt->add_sample_point(new_sample_point_pt,
450 GeomObject*& sub_geom_object_pt,
455 sub_geom_object_pt=0;
458 if (Sub_bin_array_pt != 0)
460 Sub_bin_array_pt->locate_zeta(zeta,sub_geom_object_pt,s);
469 if (Bin_array_pt->root_bin_array_pt()->
470 total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
471 <Bin_array_pt->root_bin_array_pt()->
472 first_sample_point_to_actually_lookup_during_locate_zeta())
477 if (Bin_array_pt->root_bin_array_pt()->
478 total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
479 >Bin_array_pt->root_bin_array_pt()->
480 last_sample_point_to_actually_lookup_during_locate_zeta())
485 double max_search_radius=Bin_array_pt->root_bin_array_pt()->
487 bool dont_do_it_because_of_radius=
false;
488 if (max_search_radius<DBL_MAX)
491 unsigned n=zeta.size();
492 double dist_squared=0.0;
495 Vector<std::pair<double, double> > min_and_max_coordinates(n);
496 get_bin_boundaries(min_and_max_coordinates);
497 for (
unsigned i=0;
i<n;
i++)
499 cog=0.5*(min_and_max_coordinates[
i].first+
500 min_and_max_coordinates[
i].second);
502 dist_squared+=aux*aux;
504 if (dist_squared>max_search_radius*max_search_radius)
507 dont_do_it_because_of_radius=
true;
513 if (!dont_do_it_because_of_radius)
516 Bin_array_pt->root_bin_array_pt()->
517 total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
518 += Sample_point_pt->size();
525 unsigned n_sample_point = Sample_point_pt->size();
527 while ( (i < n_sample_point) && (sub_geom_object_pt == 0))
530 FiniteElement* el_pt=Bin_array_pt->mesh_pt()->finite_element_pt(
531 (*Sample_point_pt)[i]->element_index_in_mesh());
536 if ((Bin_array_pt->ignore_halo_elements_during_locate_zeta_search()) &&
546 bool use_equally_spaced_interior_sample_points=
548 unsigned j=(*Sample_point_pt)[
i]->sample_point_index_in_element();
550 Bin_array_pt->nsample_points_generated_per_element(),
552 use_equally_spaced_interior_sample_points);
558 unsigned cached_dim_zeta=Bin_array_pt->ndim_zeta();
559 Vector<double> zeta_sample(cached_dim_zeta);
560 if (Bin_array_pt->use_eulerian_coordinates_during_setup())
562 el_pt->interpolated_x(s,zeta_sample);
566 el_pt->interpolated_zeta(s,zeta_sample);
569 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
572 << zeta_sample[ii] <<
" ";
573 dist+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
576 << Bin_array_pt->root_bin_array_pt()->
577 total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
584 Bin_array_pt->root_bin_array_pt()->
585 total_number_of_sample_points_visited_during_locate_zeta_from_top_level()++;
587 bool use_coordinate_as_initial_guess=
true;
588 el_pt->locate_zeta(zeta, sub_geom_object_pt, s,
589 use_coordinate_as_initial_guess);
595 sub_geom_object_pt=0;
612 min_and_max_coordinates)
614 unsigned n_bin = Bin_index_in_bin_array;
617 unsigned current_dim = Bin_array_pt->ndim_zeta();
618 min_and_max_coordinates.resize(current_dim);
619 for (
unsigned u = 0; u < current_dim; u++)
623 n_bin % Bin_array_pt->dimension_of_bin_array(u);
624 n_bin /= Bin_array_pt->dimension_of_bin_array(u);
627 double range = (Bin_array_pt->min_and_max_coordinates(u).second -
628 Bin_array_pt->min_and_max_coordinates(u).first) /
629 double(Bin_array_pt->dimension_of_bin_array(u));
632 min_and_max_coordinates[u].first =
633 Bin_array_pt->min_and_max_coordinates(u).first + nbin_in_dir * range;
634 min_and_max_coordinates[u].second =
635 min_and_max_coordinates[u].first + range;
671 unsigned dim=ndim_zeta();
672 unsigned n_max_level=Dimensions_of_bin_array[0];
675 if (Dimensions_of_bin_array[1] > n_max_level)
677 n_max_level=Dimensions_of_bin_array[1];
682 if (Dimensions_of_bin_array[2] > n_max_level)
684 n_max_level=Dimensions_of_bin_array[2];
697 int n_lagrangian = ndim_zeta();
701 double zeta_min_local[n_lagrangian];
702 double zeta_max_local[n_lagrangian];
703 for(
int i=0;
i<n_lagrangian;
i++)
705 zeta_min_local[
i] = DBL_MAX;
706 zeta_max_local[
i] = -DBL_MAX;
710 unsigned n_el=Mesh_pt->nelement();
711 for (
unsigned e=0;
e<n_el;
e++)
713 FiniteElement* el_pt = Mesh_pt->finite_element_pt(
e);
717 unsigned n_plot_points=el_pt->nplot_points(n_plot);
720 for (
unsigned iplot=0;iplot<n_plot_points;iplot++)
722 Vector<double> s_local(n_lagrangian);
723 Vector<double> zeta_global(n_lagrangian);
727 bool use_equally_spaced_interior_sample_points=
false;
728 el_pt->get_s_plot(iplot,n_plot,s_local,
729 use_equally_spaced_interior_sample_points);
732 if (Use_eulerian_coordinates_during_setup)
734 el_pt->interpolated_x(s_local,zeta_global);
738 el_pt->interpolated_zeta(s_local,zeta_global);
742 for(
int i=0;
i<n_lagrangian;
i++)
745 if(zeta_global[
i] < zeta_min_local[
i])
747 zeta_min_local[
i] = zeta_global[
i];
750 if(zeta_global[i] > zeta_max_local[i])
752 zeta_max_local[
i] = zeta_global[
i];
759 double zeta_min[n_lagrangian];
760 double zeta_max[n_lagrangian];
761 for(
int i=0;
i<n_lagrangian;
i++)
763 zeta_min[
i] = 0.0; zeta_max[
i] = 0.0;
769 if ( Mesh_pt->is_mesh_distributed() )
772 if (Mesh_pt->communicator_pt()!=0)
774 int n_proc=Mesh_pt->communicator_pt()->nproc();
778 MPI_Allreduce(zeta_min_local,zeta_min,n_lagrangian,MPI_DOUBLE,MPI_MIN,
779 Mesh_pt->communicator_pt()->mpi_comm());
780 MPI_Allreduce(zeta_max_local,zeta_max,n_lagrangian,MPI_DOUBLE,MPI_MAX,
781 Mesh_pt->communicator_pt()->mpi_comm());
786 std::ostringstream error_message_stream;
788 <<
"Communicator not set for a Mesh\n" 789 <<
"that was created from a distributed Mesh";
790 throw OomphLibError(error_message_stream.str(),
791 OOMPH_CURRENT_FUNCTION,
792 OOMPH_EXCEPTION_LOCATION);
798 for(
int i=0;
i<n_lagrangian;
i++)
800 zeta_min[
i] = zeta_min_local[
i];
801 zeta_max[
i] = zeta_max_local[
i];
804 #else // If we're not using MPI then the mesh can't be distributed 805 for(
int i=0;
i<n_lagrangian;
i++)
807 zeta_min[
i] = zeta_min_local[
i];
808 zeta_max[
i] = zeta_max_local[
i];
815 for(
int i=0;
i<n_lagrangian;
i++)
817 double length = zeta_max[
i] - zeta_min[
i];
818 zeta_min[
i] -= ((Percentage_offset/100.0)*length);
819 zeta_max[
i] += ((Percentage_offset/100.0)*length);
823 Min_and_max_coordinates.resize(n_lagrangian);
824 for(
int i=0;
i<n_lagrangian;
i++)
826 Min_and_max_coordinates[
i].first = zeta_min[
i];
827 Min_and_max_coordinates[
i].second = zeta_max[
i];
845 sample_point_container_parameters_pt) :
847 sample_point_container_parameters_pt->mesh_pt(),
848 sample_point_container_parameters_pt->min_and_max_coordinates(),
849 sample_point_container_parameters_pt->
850 use_eulerian_coordinates_during_setup(),
851 sample_point_container_parameters_pt->
852 ignore_halo_elements_during_locate_zeta_search(),
853 sample_point_container_parameters_pt->
854 nsample_points_generated_per_element()),
856 sample_point_container_parameters_pt->mesh_pt(),
857 sample_point_container_parameters_pt->min_and_max_coordinates(),
858 dynamic_cast<BinArrayParameters*>(sample_point_container_parameters_pt)->
859 dimensions_of_bin_array(),
860 sample_point_container_parameters_pt->use_eulerian_coordinates_during_setup(),
861 sample_point_container_parameters_pt->
862 ignore_halo_elements_during_locate_zeta_search(),
863 sample_point_container_parameters_pt->
864 nsample_points_generated_per_element())
867 RefineableBinArrayParameters* ref_bin_array_parameters_pt=
868 dynamic_cast<RefineableBinArrayParameters*
> 869 (sample_point_container_parameters_pt);
872 if (ref_bin_array_parameters_pt==0)
874 throw OomphLibError(
"Wrong sample_point_container_parameters_pt",
875 OOMPH_CURRENT_FUNCTION,
876 OOMPH_EXCEPTION_LOCATION);
881 Depth=ref_bin_array_parameters_pt->depth();
882 Max_depth=ref_bin_array_parameters_pt->max_depth();
884 ref_bin_array_parameters_pt->max_number_of_sample_point_per_bin();
893 dim =
Mesh_pt->finite_element_pt(0)->dim();
900 if(
Mesh_pt->is_mesh_distributed())
903 if(
Mesh_pt->communicator_pt()!=0)
905 int n_proc=
Mesh_pt->communicator_pt()->nproc();
909 MPI_Allreduce(&dim,&dim_reduce,1,MPI_INT,
910 MPI_MAX,
Mesh_pt->communicator_pt()->mpi_comm());
930 for (
unsigned i=0;
i<dim;
i++)
948 "Must specify root_bin_array for lower-level bin arrays\n",
949 OOMPH_CURRENT_FUNCTION,
950 OOMPH_EXCEPTION_LOCATION);
967 if (SamplePointContainer::Enable_timing_of_setup)
972 if (SamplePointContainer::Enable_timing_of_setup)
977 <<
"-dimensional sample point container containing " 978 << npts <<
" sample points: " 979 << t_end-t_start <<
" sec (ref_bin); third party: 0 sec ( = 0 %)" 992 Vector<std::pair<double, double> >&
993 min_and_max_coordinates_of_bin)
995 unsigned bin_index_local=bin_index;
999 min_and_max_coordinates_of_bin.resize(current_dim);
1000 for (
unsigned u = 0; u < current_dim; u++)
1012 min_and_max_coordinates_of_bin[u].first =
1014 min_and_max_coordinates_of_bin[u].second =
1015 min_and_max_coordinates_of_bin[u].first + range;
1027 unsigned n_bin=
Bin_pt.size();
1028 for (
unsigned i=0;
i<n_bin;
i++)
1032 Bin_pt[
i]->output_bin_vertices(outfile);
1042 const unsigned& radius,
1043 std::ofstream& outfile)
1047 Vector<unsigned> neighbouring_bin_index;
1049 unsigned nneigh=neighbouring_bin_index.size();
1055 outfile <<
"ZONE I=2\n" 1062 outfile <<
"ZONE I=2, J=2\n" 1082 outfile <<
"ZONE I=2, J=2, K=2 \n" 1126 oomph_info <<
"n_lagr=" << n_lagr << std::endl;
1127 throw OomphLibError(
"Wrong dimension!",
1128 OOMPH_CURRENT_FUNCTION,
1129 OOMPH_EXCEPTION_LOCATION);
1134 for (
unsigned i=0;
i<nneigh;
i++)
1142 outfile <<
"ZONE I=2\n" 1143 << min_and_max_coordinates[0].first << std::endl
1144 << min_and_max_coordinates[0].second << std::endl;
1149 outfile <<
"ZONE I=2, J=2\n" 1150 << min_and_max_coordinates[0].first <<
" " 1151 << min_and_max_coordinates[1].first <<
" " 1154 << min_and_max_coordinates[0].second <<
" " 1155 << min_and_max_coordinates[1].first<<
" " 1158 << min_and_max_coordinates[0].first <<
" " 1159 << min_and_max_coordinates[1].second <<
" " 1162 << min_and_max_coordinates[0].second <<
" " 1163 << min_and_max_coordinates[1].second <<
" " 1169 outfile <<
"ZONE I=2, J=2, K=2\n" 1170 << min_and_max_coordinates[0].first <<
" " 1171 << min_and_max_coordinates[1].first <<
" " 1172 << min_and_max_coordinates[2].first <<
" " 1175 << min_and_max_coordinates[0].second <<
" " 1176 << min_and_max_coordinates[1].first<<
" " 1177 << min_and_max_coordinates[2].first <<
" " 1180 << min_and_max_coordinates[0].first <<
" " 1181 << min_and_max_coordinates[1].second <<
" " 1182 << min_and_max_coordinates[2].first <<
" " 1185 << min_and_max_coordinates[0].second <<
" " 1186 << min_and_max_coordinates[1].second <<
" " 1187 << min_and_max_coordinates[2].first <<
" " 1190 << min_and_max_coordinates[0].first <<
" " 1191 << min_and_max_coordinates[1].first <<
" " 1192 << min_and_max_coordinates[2].second <<
" " 1195 << min_and_max_coordinates[0].second <<
" " 1196 << min_and_max_coordinates[1].first<<
" " 1197 << min_and_max_coordinates[2].second <<
" " 1200 << min_and_max_coordinates[0].first <<
" " 1201 << min_and_max_coordinates[1].second <<
" " 1202 << min_and_max_coordinates[2].second <<
" " 1205 << min_and_max_coordinates[0].second <<
" " 1206 << min_and_max_coordinates[1].second <<
" " 1207 << min_and_max_coordinates[2].second <<
" " 1213 oomph_info <<
"n_lagr=" << n_lagr << std::endl;
1214 throw OomphLibError(
"Wrong dimension!",
1215 OOMPH_CURRENT_FUNCTION,
1216 OOMPH_EXCEPTION_LOCATION);
1229 unsigned old_faster=0;
1230 unsigned new_faster=0;
1231 double t_total_new=0.0;
1232 double t_total_old=0.0;
1237 Vector<double> zeta(dim);
1238 for(
unsigned i=0;
i<dim;
i++)
1250 throw OomphLibError(
"Negative bin index...",
1251 OOMPH_CURRENT_FUNCTION,
1252 OOMPH_EXCEPTION_LOCATION);
1257 unsigned radius = 0;
1261 Vector<unsigned> bin_index_v(dim);
1266 unsigned max_radius = 0;
1267 for (
unsigned k=0;k<dim;k++)
1269 unsigned local=std::max((bin_index_v[k] + 1),
1271 if (local > max_radius)
1279 Vector<unsigned> bin_index_at_current_radius_old;
1280 Vector<unsigned> bin_index_at_current_radius_new;
1281 while (radius <= max_radius)
1284 bin_index_at_current_radius_old.clear();
1288 bin_index_at_current_radius_old,
true);
1289 unsigned nbin_at_current_radius_old = bin_index_at_current_radius_old.size();
1291 double t_old=t_end-t_start;
1293 bin_index_at_current_radius_new.clear();
1297 bin_index_at_current_radius_new,
false);
1298 unsigned nbin_at_current_radius_new = bin_index_at_current_radius_new.size();
1301 double t_new=t_end_new-t_start_new;
1303 if (nbin_at_current_radius_new!=nbin_at_current_radius_old)
1305 oomph_info <<
"Number of bins don't match: new = " 1306 << nbin_at_current_radius_new
1308 << nbin_at_current_radius_old
1309 <<
" radius = " << radius
1312 for (
unsigned i=0;
i<nbin_at_current_radius_old;
i++)
1314 oomph_info << bin_index_at_current_radius_old[
i] <<
" ";
1318 for (
unsigned i=0;
i<nbin_at_current_radius_new;
i++)
1320 oomph_info << bin_index_at_current_radius_new[
i] <<
" ";
1340 oomph_info <<
"Number of times old/new version was faster: " 1341 << old_faster <<
" " << new_faster << std::endl
1342 <<
"Total old/new time: " << t_total_old <<
" " 1343 << t_total_new <<
" " << std::endl;
1353 const unsigned& radius,
1355 neighbouring_bin_index,
1356 const bool& use_old_version)
1360 if (use_old_version)
1362 neighbouring_bin_index.clear();
1368 neighbouring_bin_index.push_back(bin_index);
1373 unsigned level=radius;
1374 unsigned bin=bin_index;
1377 const unsigned n_lagrangian = this->
ndim_zeta();
1381 if (n_lagrangian==1)
1385 neighbouring_bin_index.reserve(2);
1388 unsigned nbr_bin_left=bin-level;
1391 unsigned nbr_bin=nbr_bin_left;
1392 neighbouring_bin_index.push_back(nbr_bin);
1394 unsigned nbr_bin_right=bin+level;
1396 (nbr_bin_right!=nbr_bin_left))
1398 unsigned nbr_bin=nbr_bin_right;
1399 neighbouring_bin_index.push_back(nbr_bin);
1402 else if (n_lagrangian==2)
1406 const unsigned n_max_neighbour_bins = 8*level;
1407 neighbouring_bin_index.reserve(n_max_neighbour_bins);
1416 const unsigned bin_row=bin/Dimensions_of_bin_array[0];
1422 const unsigned n_length=(level*2)+1;
1447 const unsigned j_precomputed = level*Dimensions_of_bin_array[0];
1449 const unsigned j_initial_row=bin_row-level;
1452 for (
unsigned i=0;
i<n_length;
i++)
1455 const unsigned initial_neighbour_bin=bin-(level-
i)-j_precomputed;
1461 const unsigned initial_neighbour_bin_row=
1462 initial_neighbour_bin/Dimensions_of_bin_array[0];
1467 if ((j_initial_row==initial_neighbour_bin_row) &&
1468 (initial_neighbour_bin<n_total_bin))
1470 neighbouring_bin_index.push_back(initial_neighbour_bin);
1480 for (
unsigned j=1;j<n_length-1;j++)
1483 const unsigned initial_neighbour_bin=
1484 bin-(level)-((level-j)*Dimensions_of_bin_array[0]);
1490 const unsigned initial_neighbour_bin_row=
1491 initial_neighbour_bin/Dimensions_of_bin_array[0];
1494 const unsigned initial_row=bin_row-(level-j);
1500 if ((initial_row==initial_neighbour_bin_row) &&
1501 (initial_neighbour_bin<n_total_bin))
1503 neighbouring_bin_index.push_back(initial_neighbour_bin);
1507 const unsigned final_neighbour_bin=
1508 bin+(level)-((level-j)*Dimensions_of_bin_array[0]);
1514 const unsigned final_neighbour_bin_row=
1515 final_neighbour_bin/Dimensions_of_bin_array[0];
1518 const unsigned final_row=bin_row-(level-j);
1524 if ((final_row==final_neighbour_bin_row) &&
1525 (final_neighbour_bin<n_total_bin))
1527 neighbouring_bin_index.push_back(final_neighbour_bin);
1534 const unsigned j_final_row=bin_row+level;
1537 for (
unsigned i=0;
i<n_length;
i++)
1540 const unsigned final_neighbour_bin=bin-(level-
i)+j_precomputed;
1546 const unsigned final_neighbour_bin_row=
1547 final_neighbour_bin/Dimensions_of_bin_array[0];
1552 if ((j_final_row==final_neighbour_bin_row) &&
1553 (final_neighbour_bin<n_total_bin))
1555 neighbouring_bin_index.push_back(final_neighbour_bin);
1563 else if (n_lagrangian==3)
1567 const unsigned n_max_neighbour_bins =
1568 8*level*(3+2*(level-1))+2*(2*(level-1)+1)*(2*(level-1)+1);
1569 neighbouring_bin_index.reserve(n_max_neighbour_bins);
1571 unsigned n_total_bin=
1581 bin/(Dimensions_of_bin_array[0]*Dimensions_of_bin_array[1]);
1585 (bin/Dimensions_of_bin_array[0])-(bin_layer*Dimensions_of_bin_array[1]);
1591 unsigned n_length=(level*2)+1;
1594 for (
unsigned k=0;k<n_length;k++)
1597 for (
unsigned j=0;j<n_length;j++)
1600 for (
unsigned i=0;
i<n_length;
i++)
1603 if ((k==0) || (k==n_length-1) || (j==0) ||
1604 (j==n_length-1) || (
i==0) || (
i==n_length-1))
1607 bin-level+
i-((level-j)*Dimensions_of_bin_array[0])-
1608 ((level-k)*Dimensions_of_bin_array[0]*Dimensions_of_bin_array[1]);
1613 unsigned nbr_bin_layer=
1614 nbr_bin/(Dimensions_of_bin_array[0]*Dimensions_of_bin_array[1]);
1617 unsigned nbr_bin_row=(nbr_bin/Dimensions_of_bin_array[0])-
1618 (nbr_bin_layer*Dimensions_of_bin_array[1]);
1621 unsigned layer=bin_layer-level+k;
1622 unsigned row=bin_row-level+j;
1628 if ((row==nbr_bin_row) && (layer==nbr_bin_layer)
1629 && (nbr_bin<n_total_bin))
1631 neighbouring_bin_index.push_back(nbr_bin);
1645 neighbouring_bin_index.clear();
1651 neighbouring_bin_index.push_back(bin_index);
1659 Vector<int> vector_of_positions(3);
1662 Vector<int> vector_of_dimensions(3);
1666 Vector<int> vector_of_radiuses(3);
1671 std::vector<bool> vector_of_active_dim(3);
1675 Vector<int> vector_of_coef(3);
1680 for (
unsigned u=0;u<dim;u++)
1682 vector_of_positions[u] =
1684 vector_of_coef[u] = coef;
1687 vector_of_radiuses[u] = radius;
1688 vector_of_active_dim[u] =
true;
1691 for (
unsigned u = dim; u < 3; u++)
1693 vector_of_positions[u] = 0;
1694 vector_of_coef[u] = 0;
1695 vector_of_dimensions[u] = 1;
1696 vector_of_radiuses[u] = 0;
1697 vector_of_active_dim[u] =
false;
1703 for (
int j = -vector_of_radiuses[0]; j <= vector_of_radiuses[0];
1704 j += 2 * vector_of_radiuses[0])
1706 int local_tempj = vector_of_positions[0] + j;
1708 if (local_tempj >= 0 && local_tempj < vector_of_dimensions[0])
1711 for (
int i = -vector_of_radiuses[1];
i <= vector_of_radiuses[1];
i++)
1714 int local_tempi = vector_of_positions[1] +
i;
1716 if (local_tempi >= 0 && local_tempi < vector_of_dimensions[1])
1718 for (
int k = -vector_of_radiuses[2];
1719 k <= vector_of_radiuses[2]; k++)
1722 int local_tempk = vector_of_positions[2] + k;
1724 if (local_tempk >= 0 && local_tempk < vector_of_dimensions[2])
1726 neighbouring_bin_index.push_back(
1727 local_tempj * vector_of_coef[0] +
1728 local_tempi * vector_of_coef[1] +
1729 local_tempk * vector_of_coef[2]);
1738 if (vector_of_active_dim[1])
1741 for (
int i = -vector_of_radiuses[1];
i <= vector_of_radiuses[1];
1742 i += 2 * vector_of_radiuses[1])
1744 int local_tempi = vector_of_positions[1] +
i;
1745 if (local_tempi >= 0 && local_tempi < vector_of_dimensions[1])
1748 for (
int j = -vector_of_radiuses[0] + 1;
1749 j <= vector_of_radiuses[0] - 1; j++)
1751 int local_tempj = vector_of_positions[0] + j;
1752 if (local_tempj >= 0 && local_tempj < vector_of_dimensions[0])
1754 for (
int k = -vector_of_radiuses[2]; k <= vector_of_radiuses[2];
1757 int local_tempk = vector_of_positions[2] + k;
1758 if (local_tempk >= 0 && local_tempk < vector_of_dimensions[2])
1760 neighbouring_bin_index.push_back(
1761 local_tempj * vector_of_coef[0] +
1762 local_tempi * vector_of_coef[1] +
1763 local_tempk * vector_of_coef[2]);
1773 if (vector_of_active_dim[2])
1776 for (
int k = -vector_of_radiuses[2]; k <= vector_of_radiuses[2];
1777 k += 2 * vector_of_radiuses[2])
1779 int local_tempk = vector_of_positions[2] + k;
1780 if (local_tempk >= 0 && local_tempk < vector_of_dimensions[2])
1783 for (
int j = -vector_of_radiuses[0] + 1;
1784 j <= vector_of_radiuses[0] - 1; j++)
1786 int local_tempj = vector_of_positions[0] + j;
1787 if (local_tempj >= 0 && local_tempj < vector_of_dimensions[0])
1789 for (
int i = -vector_of_radiuses[1] + 1;
1790 i <= vector_of_radiuses[1] - 1;
i++)
1792 int local_tempi = vector_of_positions[1] +
i;
1793 if (local_tempi >= 0 && local_tempi < vector_of_dimensions[1])
1795 neighbouring_bin_index.push_back(
1796 local_tempj * vector_of_coef[0] +
1797 local_tempi * vector_of_coef[1] +
1798 local_tempk * vector_of_coef[2]);
1818 unsigned n_bin=
nbin();
1819 for (
unsigned i=0;
i<n_bin;
i++)
1823 count+=
Bin_pt[
i]->total_number_of_sample_points_computed_recursively();
1841 for (
unsigned u=0;u<dim;u++)
1844 unsigned local_bin_number = 0;
1859 unsigned(floor(
double(zeta[u] -
1867 n_bin += local_bin_number * coef;
1881 unsigned nel=
Mesh_pt->nelement();
1882 for (
unsigned e=0;
e<nel;
e++)
1884 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(
e);
1890 for (
unsigned j=0;j<nplot;j++)
1899 bool use_equally_spaced_interior_sample_points=
1902 use_equally_spaced_interior_sample_points);
1905 el_pt->interpolated_x(s,zeta);
1909 el_pt->interpolated_zeta(s,zeta);
1915 bool is_inside=
true;
1916 std::ostringstream error_message;
1918 for (
unsigned i=0;
i<dim;
i++)
1925 <<
"Sample point at zeta[" <<
i <<
"] = " << zeta[
i]
1926 <<
" is outside limits of bin array: " 1934 error_message <<
"Please correct the limits passed to the " 1935 <<
"constructor." << std::endl;
1936 throw OomphLibError(error_message.str(),
1937 OOMPH_CURRENT_FUNCTION,
1938 OOMPH_EXCEPTION_LOCATION);
1948 if (
Bin_pt[bin_index] == 0)
1954 Bin_pt[bin_index]->add_sample_point(new_sample_point_pt,zeta);
1965 const Vector<double>& zeta,
1966 Vector<unsigned>& bin_index)
1969 bin_index.resize(dim);
1970 for (
unsigned u=0;u<dim;u++)
2002 GeomObject*& sub_geom_object_pt,
2007 sub_geom_object_pt=0;
2025 for(
unsigned i=0;
i<dim;
i++)
2048 throw OomphLibError(
"Negative bin index...",
2049 OOMPH_CURRENT_FUNCTION,
2050 OOMPH_EXCEPTION_LOCATION);
2055 unsigned radius = 0;
2059 Vector<unsigned> bin_index_v(dim);
2064 unsigned max_radius = 0;
2065 for (
unsigned k=0;k<dim;k++)
2067 unsigned local=std::max((bin_index_v[k] + 1),
2069 if (local > max_radius)
2077 Vector<unsigned> bin_index_at_current_radius;
2078 while (radius <= max_radius)
2081 bin_index_at_current_radius.clear();
2084 bin_index_at_current_radius);
2086 unsigned nbin_at_current_radius = bin_index_at_current_radius.size();
2087 unsigned n_bin =
nbin();
2091 while ((k < nbin_at_current_radius) && (sub_geom_object_pt==0))
2093 int neigh_bin_index = bin_index_at_current_radius[k];
2095 if (neigh_bin_index < 0 )
2097 throw OomphLibError(
"Negative neighbour bin index...",
2098 OOMPH_CURRENT_FUNCTION,
2099 OOMPH_EXCEPTION_LOCATION);
2102 if (neigh_bin_index <
int(n_bin) )
2105 if (
Bin_pt[neigh_bin_index] != 0)
2108 Bin_pt[neigh_bin_index]->locate_zeta(zeta,
2118 if (sub_geom_object_pt!=0)
2141 std::ostringstream error_message;
2143 <<
"Zeta not found after visiting " 2145 <<
" sample points out of " 2148 <<
"Where are the missing sample points???\n";
2151 error_message.str(),
2152 OOMPH_CURRENT_FUNCTION,
2153 OOMPH_EXCEPTION_LOCATION);
2176 SamplePointContainerParameters*
2177 sample_point_container_parameters_pt) :
2179 sample_point_container_parameters_pt->
mesh_pt(),
2181 sample_point_container_parameters_pt->
2183 sample_point_container_parameters_pt->
2185 sample_point_container_parameters_pt->
2188 sample_point_container_parameters_pt->
2190 dynamic_cast<BinArrayParameters*>(
2192 sample_point_container_parameters_pt->
2194 sample_point_container_parameters_pt->
2196 sample_point_container_parameters_pt->
2205 dim =
Mesh_pt->finite_element_pt(0)->dim();
2211 #ifdef OOMPH_HAS_MPI 2213 if(
Mesh_pt->is_mesh_distributed())
2216 if(
Mesh_pt->communicator_pt()!=0)
2218 int n_proc=
Mesh_pt->communicator_pt()->nproc();
2222 MPI_Allreduce(&dim,&dim_reduce,1,MPI_INT,
2223 MPI_MAX,
Mesh_pt->communicator_pt()->mpi_comm());
2244 NonRefineableBinArrayParameters* non_ref_bin_array_parameters_pt=
2245 dynamic_cast<NonRefineableBinArrayParameters*
>(
2246 sample_point_container_parameters_pt);
2249 if (non_ref_bin_array_parameters_pt==0)
2251 throw OomphLibError(
"Wrong sample_point_container_parameters_pt",
2252 OOMPH_CURRENT_FUNCTION,
2253 OOMPH_EXCEPTION_LOCATION);
2257 Nspiral_chunk=non_ref_bin_array_parameters_pt->nspiral_chunk();
2262 if (SamplePointContainer::Enable_timing_of_setup)
2270 if (SamplePointContainer::Enable_timing_of_setup)
2275 <<
"-dimensional sample point container containing " 2276 << npts <<
" sample points: " 2277 << t_end-t_start <<
" sec (non-ref_bin); third party: 0 sec ( = 0 %)" 2292 const std::map<unsigned,Vector<std::pair<FiniteElement*,Vector<double> > > >*
2299 typedef std::map<unsigned,Vector<
2300 std::pair<FiniteElement*,Vector<double> > > >::const_iterator IT;
2301 for (IT it=map_pt->begin();it!=map_pt->end();it++)
2303 count+=(*it).second.size();
2315 const unsigned n_lagrangian = this->
ndim_zeta();
2318 unsigned nbin_y = 1;
2320 unsigned nbin_z = 1;
2324 for (
unsigned iz=0;iz<nbin_z;iz++)
2326 for (
unsigned iy=0;iy<nbin_y;iy++)
2328 for (
unsigned ix=0;ix<nbin_x;ix++)
2331 for (
unsigned e=0;
e<nentry;
e++)
2335 Vector<double> zeta(n_lagrangian);
2338 el_pt->interpolated_x(s, zeta);
2342 el_pt->interpolated_zeta(s, zeta);
2344 for (
unsigned i=0;
i<n_lagrangian;
i++)
2346 outfile << zeta[
i] <<
" ";
2348 outfile << ix <<
" " 2367 const unsigned n_lagrangian = this->
ndim_zeta();
2373 for (
unsigned i_bin=0;i_bin<
nbin;i_bin++)
2376 Vector<Vector<double> > bin_vertex;
2378 switch(n_lagrangian)
2381 outfile <<
"ZONE I=2\n";
2385 outfile <<
"ZONE I=2, J=2\n";
2389 outfile <<
"ZONE I=2, J=2, K=2\n";
2393 unsigned nvertex=bin_vertex.size();
2394 for (
unsigned i=0;
i<nvertex;
i++)
2396 for (
unsigned j=0;j<n_lagrangian;j++)
2399 << bin_vertex[
i][j] <<
" ";
2401 outfile << std::endl;
2414 const unsigned n_lagrangian = this->
ndim_zeta();
2420 std::map<unsigned,Vector<std::pair<FiniteElement*,Vector<double> > > >
2421 tmp_bin_object_coord_pairs;
2424 unsigned ntotalbin=
nbin();
2434 unsigned n_mesh_element=
Mesh_pt->nelement();
2435 unsigned elements_per_bin = n_mesh_element / ntotalbin;
2442 std::ostringstream warn_message;
2444 <<
"The average (integer) number of elements per bin is \n\n" 2446 <<
", which is more than \n\n" 2447 <<
" NonRefineableBinArray::Threshold_for_elements_per_bin_warning=" 2449 <<
"\n\nIf the lookup seems slow (and you have the memory)," 2450 <<
"consider increasing\n" 2451 <<
"BinArray::Dimensions_of_bin_array from their current\n" 2454 for (
unsigned ii=0;ii<nn;ii++)
2460 <<
"\nNOTE: You can suppress this warning by increasing\n\n" 2461 <<
" NonRefineableBinArray::" 2462 <<
"Threshold_for_elements_per_bin_warning\n\n" 2463 <<
"or by setting \n\n " 2464 <<
"NonRefineableBinArray::Suppress_warning_about_small_number_of_bins\n\n" 2465 <<
"to true (both are public static data).\n\n";
2468 OOMPH_CURRENT_FUNCTION,
2469 OOMPH_EXCEPTION_LOCATION);
2487 std::ostringstream warn_message;
2489 <<
"Have allocated \n\n" 2490 <<
" NonRefineableBinArray::Total_nbin_cells_counter=" 2492 <<
"\n\nbin cells, which is more than \n\n" 2493 <<
" NonRefineableBinArray::" 2494 <<
"Threshold_for_total_bin_cell_number_warning=" 2496 <<
"\n\nIf you run out of memory, consider reducing\n" 2497 <<
"BinArray::Dimensions_of_bin_array from their current\n" 2500 for (
unsigned ii=0;ii<nn;ii++)
2506 <<
"\nNOTE: You can suppress this warning by increasing\n\n" 2507 <<
" NonRefineableBinArray::" 2508 <<
"Threshold_for_total_bin_cell_number_warning\n\n" 2509 <<
"or by setting \n\n NonRefineableBinArray::" 2510 <<
"Suppress_warning_about_large_total_number_of_bins\n\n" 2511 <<
"to true (both are public static data).\n\n" 2512 <<
"NOTE: I'll only issue this warning once -- total number of\n" 2513 <<
"bins may grow yet further!\n";
2516 OOMPH_CURRENT_FUNCTION,
2517 OOMPH_EXCEPTION_LOCATION);
2523 unsigned n_sub=
Mesh_pt->nelement();
2524 for (
unsigned e=0;
e<n_sub;
e++)
2527 FiniteElement* el_pt=
dynamic_cast<FiniteElement*
> 2531 unsigned n_plot_points=
2534 for (
unsigned iplot=0;iplot<n_plot_points;iplot++)
2537 Vector<double> local_coord(n_lagrangian,0.0);
2538 Vector<double> global_coord(n_lagrangian,0.0);
2541 bool use_equally_spaced_interior_sample_points=
2543 el_pt->get_s_plot(iplot,
2546 use_equally_spaced_interior_sample_points);
2551 el_pt->interpolated_x(local_coord,global_coord);
2555 el_pt->interpolated_zeta(local_coord,global_coord);
2559 unsigned bin_number=0;
2560 unsigned multiplier=1;
2562 for(
unsigned i=0;
i<n_lagrangian;
i++)
2568 std::ostringstream error_message;
2570 <<
"Bin sample point " << iplot <<
" in element " <<
e <<
"\n" 2571 <<
"is outside bin limits in coordinate direction " <<
i <<
":\n" 2572 <<
"Sample point coordinate: " << global_coord[
i] <<
"\n" 2573 <<
"Max bin coordinate : " 2575 <<
"Min bin coordinate : " 2577 <<
"You should either setup the bin boundaries manually\n" 2578 <<
"or increase the percentage offset by which the\n" 2579 <<
"automatically computed bin limits are increased \n" 2580 <<
"beyond their sampled max/mins. This is defined in\n" 2581 <<
"the (public) namespace member\n\n" 2582 <<
"SamplePointContainer::Percentage_offset \n\n which \n" 2583 <<
"currently has the value: " 2584 << SamplePointContainer::Percentage_offset
2586 throw OomphLibError(
2587 error_message.str(),
2588 OOMPH_CURRENT_FUNCTION,
2589 OOMPH_EXCEPTION_LOCATION);
2593 unsigned bin_number_i =
2604 bin_number += multiplier*bin_number_i;
2611 tmp_bin_object_coord_pairs[bin_number].push_back
2612 (std::make_pair(el_pt,local_coord));
2619 typedef std::map<unsigned,Vector<
2620 std::pair<FiniteElement*,Vector<double> > > >::iterator IT;
2621 for (IT it=tmp_bin_object_coord_pairs.begin();
2622 it!=tmp_bin_object_coord_pairs.end();it++)
2627 (*it).second.clear();
2639 unsigned& max_n_entry,
2640 unsigned& min_n_entry,
2641 unsigned& tot_n_entry,
2642 unsigned& n_empty)
const 2649 const std::map<unsigned,Vector<std::pair<FiniteElement*,Vector<double> > > >*
2654 min_n_entry=UINT_MAX;
2658 typedef std::map<unsigned,Vector<
2659 std::pair<FiniteElement*,Vector<double> > > >::const_iterator IT;
2660 for (IT it=map_pt->begin();it!=map_pt->end();it++)
2662 unsigned nentry=(*it).second.size();
2663 if (nentry>max_n_entry) max_n_entry=nentry;
2664 if (nentry<min_n_entry) min_n_entry=nentry;
2665 tot_n_entry+=nentry;
2677 bin_diffusion_radius)
2683 std::list<unsigned> empty_bins;
2684 unsigned n_bin =
nbin();
2685 std::vector<bool> was_empty_until_current_iteration(n_bin,
false);
2686 for (
unsigned i=0;
i<n_bin;
i++)
2690 empty_bins.push_front(
i);
2691 was_empty_until_current_iteration[
i] =
true;
2697 Vector<unsigned> newly_filled_bin;
2698 while (empty_bins.size()!=0)
2700 newly_filled_bin.clear();
2701 newly_filled_bin.reserve(empty_bins.size());
2702 for (std::list<unsigned>::iterator it = empty_bins.begin();
2703 it!=empty_bins.end();it++)
2705 unsigned bin = (*it);
2708 unsigned level = bin_diffusion_radius;
2709 Vector<unsigned> neighbour_bin;
2711 unsigned n_neigh = neighbour_bin.size();
2714 double min_dist = DBL_MAX;
2715 std::pair<FiniteElement*, Vector<double> > closest_pair;
2716 for (
unsigned i=0;
i<n_neigh;
i++)
2718 unsigned neigh_bin = neighbour_bin[
i];
2722 if (!was_empty_until_current_iteration[neigh_bin])
2725 for (
unsigned j=0;j<nbin_content;j++)
2729 Vector<double> x(2);
2730 el_pt->interpolated_x(s, x);
2749 if (min_dist!=DBL_MAX)
2751 Vector<std::pair<FiniteElement*, Vector<double> > > new_entry;
2752 new_entry.push_back(closest_pair);
2756 newly_filled_bin.push_back(bin);
2759 std::list<unsigned>::iterator it_to_be_deleted = it;
2761 empty_bins.erase(it_to_be_deleted);
2768 unsigned n = newly_filled_bin.size();
2769 for (
unsigned i=0;
i<n;
i++)
2771 was_empty_until_current_iteration[newly_filled_bin[
i]] =
false;
2779 for (
unsigned i=0;
i<n_bin;
i++)
2783 std::ostringstream error_message_stream;
2784 error_message_stream
2785 <<
"Bin " <<
i <<
" is still empty\n" 2786 <<
"after trying to fill it by diffusion\n";
2787 throw OomphLibError(error_message_stream.str(),
2788 OOMPH_CURRENT_FUNCTION,
2789 OOMPH_EXCEPTION_LOCATION);
2810 const unsigned n_lagrangian = this->
ndim_zeta();
2815 for(
unsigned i=0;
i<n_lagrangian;
i++)
2836 unsigned multiplier=1;
2839 for(
unsigned i=0;
i<n_lagrangian;
i++)
2842 unsigned bin_number_i =
2849 bin_number += multiplier*bin_number_i;
2860 unsigned nvertex=(int)pow(2,n_lagrangian);
2861 Vector<Vector<double> > bin_vertex(nvertex);
2862 for (
unsigned j=0;j<nvertex;j++)
2864 bin_vertex[j].resize(n_lagrangian);
2867 for (
unsigned i=0;
i<n_lagrangian;
i++)
2869 double min_vertex_coord=DBL_MAX;
2870 double max_vertex_coord=-DBL_MAX;
2871 for (
unsigned j=0;j<nvertex;j++)
2873 if (bin_vertex[j][
i]<min_vertex_coord)
2875 min_vertex_coord=bin_vertex[j][
i];
2877 if (bin_vertex[j][
i]>max_vertex_coord)
2879 max_vertex_coord=bin_vertex[j][
i];
2882 if (zeta[
i]<min_vertex_coord-tol)
2884 std::ostringstream error_message_stream;
2885 error_message_stream
2886 <<
"Trouble! " <<
i <<
" -th coordinate of sample point, " 2887 << zeta[
i] <<
" , isn't actually between limits, " 2888 << min_vertex_coord <<
" and " << max_vertex_coord
2889 <<
" [it's below by more than " << tol <<
" !] " << std::endl;
2890 throw OomphLibError(error_message_stream.str(),
2891 OOMPH_CURRENT_FUNCTION,
2892 OOMPH_EXCEPTION_LOCATION);
2895 if (zeta[
i]>max_vertex_coord+tol)
2897 std::ostringstream error_message_stream;
2898 error_message_stream
2899 <<
"Trouble! " <<
i <<
" -th coordinate of sample point, " 2900 << zeta[
i] <<
" , isn't actually between limits, " 2901 << min_vertex_coord <<
" and " << max_vertex_coord
2902 <<
" [it's above by more than " << tol <<
"!] " << std::endl;
2903 throw OomphLibError(error_message_stream.str(),
2904 OOMPH_CURRENT_FUNCTION,
2905 OOMPH_EXCEPTION_LOCATION);
2919 const unsigned& i_bin,
2920 Vector<Vector<double> >& bin_vertex)
2923 const unsigned n_lagrangian = this->
ndim_zeta();
2926 unsigned n_vertices=1;
2927 for (
unsigned i=0;
i<n_lagrangian;
i++)
2931 bin_vertex.resize(n_vertices);
2935 Vector<Vector<double> > zeta_vertex_bin(2);
2936 zeta_vertex_bin[0].resize(n_lagrangian);
2937 zeta_vertex_bin[1].resize(n_lagrangian);
2939 Vector<double> dzeta;
2941 Vector<unsigned> i_1d;
2944 switch (n_lagrangian)
2954 bin_vertex[0].resize(1);
2956 bin_vertex[1].resize(1);
2976 for (
unsigned i=0;
i<n_lagrangian;
i++)
2979 double(i_1d[
i])*dzeta[
i];
2981 double(i_1d[i]+1)*dzeta[
i];
2986 for (
unsigned i_min_max=0;i_min_max<2;i_min_max++)
2988 for (
unsigned j_min_max=0;j_min_max<2;j_min_max++)
2990 bin_vertex[count].resize(2);
2991 bin_vertex[count][0]=zeta_vertex_bin[i_min_max][0];
2992 bin_vertex[count][1]=zeta_vertex_bin[j_min_max][1];
3020 for (
unsigned i=0;
i<n_lagrangian;
i++)
3023 double(i_1d[
i])*dzeta[
i];
3025 double(i_1d[i]+1)*dzeta[
i];
3030 for (
unsigned i_min_max=0;i_min_max<2;i_min_max++)
3032 for (
unsigned j_min_max=0;j_min_max<2;j_min_max++)
3034 for (
unsigned k_min_max=0;k_min_max<2;k_min_max++)
3036 bin_vertex[count].resize(3);
3037 bin_vertex[count][0]=zeta_vertex_bin[i_min_max][0];
3038 bin_vertex[count][1]=zeta_vertex_bin[j_min_max][1];
3039 bin_vertex[count][2]=zeta_vertex_bin[k_min_max][2];
3049 std::ostringstream error_message;
3051 <<
"Can't deal with bins in dimension " << n_lagrangian <<
"\n";
3052 throw OomphLibError(
3053 error_message.str(),
3054 OOMPH_CURRENT_FUNCTION,
3055 OOMPH_EXCEPTION_LOCATION);
3066 const Vector<double>& zeta)
3069 const unsigned n_lagrangian = this->
ndim_zeta();
3072 Vector<Vector<double> > bin_vertex;
3074 double min_dist=DBL_MAX;
3075 unsigned nvertex=bin_vertex.size();
3076 for (
unsigned v=0;v<nvertex;v++)
3079 for (
unsigned i=0;
i<n_lagrangian;
i++)
3081 dist+=pow(bin_vertex[v][
i]-zeta[
i],2);
3084 if (dist<min_dist) min_dist=dist;
3098 GeomObject*& sub_geom_object_pt,
3111 sub_geom_object_pt=0;
3114 const unsigned n_lagrangian = this->
ndim_zeta();
3122 for(
unsigned i=0;
i<n_lagrangian;
i++)
3139 unsigned bin_number=0;
3142 unsigned multiplier=1;
3145 for(
unsigned i=0;
i<n_lagrangian;
i++)
3148 unsigned bin_number_i =
3161 bin_number += multiplier*bin_number_i;
3168 Vector<unsigned> neighbour_bin;
3171 for (
unsigned i_level=min_level;i_level<=max_level;i_level++)
3178 unsigned n_nbr_bin=neighbour_bin.size();
3233 bool found_zeta=
false;
3234 for (
unsigned i_nbr=0;i_nbr<n_nbr_bin;i_nbr++)
3255 for (
unsigned i_sam=0;i_sam<n_sample;i_sam++)
3259 [neighbour_bin[i_nbr]][i_sam].first;
3267 unsigned cached_dim_zeta=this->
ndim_zeta();
3268 Vector<double> zeta_sample(cached_dim_zeta);
3271 el_pt->interpolated_x(s,zeta_sample);
3275 el_pt->interpolated_zeta(s,zeta_sample);
3278 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
3281 << zeta_sample[ii] <<
" ";
3282 dist+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
3286 <<
" " << sqrt(dist)
3291 bool use_coordinate_as_initial_guess=
true;
3294 el_pt->locate_zeta(zeta,sub_geom_object_pt,s,
3295 use_coordinate_as_initial_guess);
3304 sub_geom_object_pt=0;
3308 #ifdef OOMPH_HAS_MPI 3313 FiniteElement* test_el_pt=
3314 dynamic_cast<FiniteElement*
>(sub_geom_object_pt);
3318 if (test_el_pt->is_halo()) {sub_geom_object_pt=0;}
3324 if (sub_geom_object_pt!=0)
3382 #ifdef OOMPH_HAS_CGAL 3389 SamplePointContainerParameters* sample_point_container_parameters_pt) :
3391 sample_point_container_parameters_pt->
mesh_pt(),
3393 sample_point_container_parameters_pt->
3395 sample_point_container_parameters_pt->
3397 sample_point_container_parameters_pt->
3404 dim =
Mesh_pt->finite_element_pt(0)->dim();
3409 #ifdef OOMPH_HAS_MPI 3411 if(
Mesh_pt->is_mesh_distributed())
3414 if(
Mesh_pt->communicator_pt()!=0)
3416 int n_proc=
Mesh_pt->communicator_pt()->nproc();
3420 MPI_Allreduce(&dim,&dim_reduce,1,MPI_INT,
3421 MPI_MAX,
Mesh_pt->communicator_pt()->mpi_comm());
3440 if (SamplePointContainer::Enable_timing_of_setup)
3448 if (SamplePointContainer::Enable_timing_of_setup)
3453 <<
"-dimensional sample point container containing " 3454 << npts <<
" sample points: " 3455 << t_end-t_start <<
" sec (cgal); third party: " 3456 << CGAL_setup_time <<
" sec ( = " 3457 << CGAL_setup_time/(t_end-t_start)*100.0 <<
" %)" 3477 unsigned nel=
Mesh_pt->nelement();
3480 unsigned n_sample_estimate=0;
3483 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(0);
3487 n_sample_estimate=nel*
3495 for (
unsigned e=0;
e<nel;
e++)
3497 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(
e);
3503 for (
unsigned j=0;j<nplot;j++)
3512 bool use_equally_spaced_interior_sample_points=
3515 use_equally_spaced_interior_sample_points);
3518 el_pt->interpolated_x(s,zeta);
3522 el_pt->interpolated_zeta(s,zeta);
3528 bool is_inside=
true;
3529 std::ostringstream error_message;
3531 for (
unsigned i=0;
i<dim;
i++)
3538 <<
"Sample point at zeta[" <<
i <<
"] = " << zeta[
i]
3539 <<
" is outside limits of sample point container: " 3547 error_message <<
"Please correct the limits passed to the " 3548 <<
"constructor." << std::endl;
3549 throw OomphLibError(error_message.str(),
3550 OOMPH_CURRENT_FUNCTION,
3551 OOMPH_EXCEPTION_LOCATION);
3564 double CGAL_setup_time=0.0;
3565 if (SamplePointContainer::Enable_timing_of_setup)
3576 if (SamplePointContainer::Enable_timing_of_setup)
3580 return CGAL_setup_time;
3602 GeomObject*& sub_geom_object_pt,
3616 sub_geom_object_pt=0;
3619 const unsigned n_lagrangian = this->
ndim_zeta();
3624 if (!SamplePointContainer::Always_fail_elemental_locate_zeta)
3627 for(
unsigned i=0;
i<n_lagrangian;
i++)
3646 Point_d query(zeta.size(),zeta.begin(),zeta.end());
3649 const unsigned n_nearest_neighbours_max =
3654 unsigned n_nearest_neighbours=1;
3655 unsigned n_neighbours_visited_last_time=0;
3656 bool can_increase_n_nearest_neighbours=
true;
3657 bool keep_going=
true;
3661 const unsigned n_nearest_neighbours_actual =
3662 std::min(n_nearest_neighbours,n_nearest_neighbours_max);
3664 n_nearest_neighbours_actual);
3668 for(K_neighbor_search_d::iterator it = search.begin();
3669 it != search.end(); it++)
3673 if ((count>n_neighbours_visited_last_time)&&
3677 SamplePoint* sample_point_pt=boost::get<1>(it->first);
3680 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(
3684 #ifdef OOMPH_HAS_MPI 3698 bool use_equally_spaced_interior_sample_points=
3701 el_pt->get_s_plot(i,
3704 use_equally_spaced_interior_sample_points);
3710 Vector<double> zeta_sample(cached_dim_zeta);
3713 el_pt->interpolated_x(s,zeta_sample);
3717 el_pt->interpolated_zeta(s,zeta_sample);
3720 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
3722 dist_sq+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
3732 if (SamplePointContainer::Visited_sample_points_file.is_open())
3735 Vector<double> zeta_sample(cached_dim_zeta);
3738 el_pt->interpolated_x(s,zeta_sample);
3742 el_pt->interpolated_zeta(s,zeta_sample);
3745 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
3747 SamplePointContainer::Visited_sample_points_file
3748 << zeta_sample[ii] <<
" ";
3749 dist+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
3751 SamplePointContainer::Visited_sample_points_file
3753 <<
" " << sqrt(dist)
3760 bool use_coordinate_as_initial_guess=
true;
3761 el_pt->locate_zeta(zeta, sub_geom_object_pt, s,
3762 use_coordinate_as_initial_guess);
3766 if (SamplePointContainer::Always_fail_elemental_locate_zeta)
3768 sub_geom_object_pt=0;
3771 if (sub_geom_object_pt!=0)
3777 #ifdef OOMPH_HAS_MPI 3784 n_neighbours_visited_last_time=count;
3787 if (can_increase_n_nearest_neighbours)
3789 unsigned factor_for_increase_in_nearest_neighbours=10;
3790 n_nearest_neighbours*=factor_for_increase_in_nearest_neighbours;
3793 if (n_nearest_neighbours>n_nearest_neighbours_max)
3795 can_increase_n_nearest_neighbours=
false;
3815 const Vector<double>& zeta,
3816 const unsigned& max_sample_points_for_newton_based_search,
3817 GeomObject*& sub_geom_object_pt,
3826 sub_geom_object_pt=0;
3832 Point_d query(zeta.size(),zeta.begin(),zeta.end());
3835 const unsigned n_nearest_neighbours_max =
3836 std::min(n_sample,max_sample_points_for_newton_based_search);
3842 for(K_neighbor_search_d::iterator it = search.begin();
3843 it != search.end(); it++)
3846 SamplePoint* sample_point_pt=boost::get<1>(it->first);
3849 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(
3853 #ifdef OOMPH_HAS_MPI 3868 bool use_equally_spaced_interior_sample_points=
3871 el_pt->get_s_plot(i,
3874 use_equally_spaced_interior_sample_points);
3880 Vector<double> zeta_sample(cached_dim_zeta);
3883 el_pt->interpolated_x(s,zeta_sample);
3887 el_pt->interpolated_zeta(s,zeta_sample);
3890 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
3892 dist_sq+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
3903 if (SamplePointContainer::Visited_sample_points_file.is_open())
3906 Vector<double> zeta_sample(cached_dim_zeta);
3909 el_pt->interpolated_x(s,zeta_sample);
3913 el_pt->interpolated_zeta(s,zeta_sample);
3916 for (
unsigned ii=0;ii<cached_dim_zeta;ii++)
3918 SamplePointContainer::Visited_sample_points_file
3919 << zeta_sample[ii] <<
" ";
3920 dist+=(zeta[ii]-zeta_sample[ii])*(zeta[ii]-zeta_sample[ii]);
3922 SamplePointContainer::Visited_sample_points_file
3924 <<
" " << sqrt(dist)
3931 bool use_coordinate_as_initial_guess=
true;
3932 el_pt->locate_zeta(zeta, sub_geom_object_pt, s,
3933 use_coordinate_as_initial_guess);
3937 if (SamplePointContainer::Always_fail_elemental_locate_zeta)
3939 sub_geom_object_pt=0;
3942 if (sub_geom_object_pt!=0)
3948 #ifdef OOMPH_HAS_MPI 3956 K_neighbor_search_d::iterator it = search.begin();
3959 SamplePoint* sample_point_pt=boost::get<1>(it->first);
3962 FiniteElement* el_pt=
Mesh_pt->finite_element_pt(
3966 bool use_equally_spaced_interior_sample_points=
3969 el_pt->get_s_plot(i,
3972 use_equally_spaced_interior_sample_points);
3974 sub_geom_object_pt=el_pt;
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've visited during top level call to locate_zeta...
K_neighbor_search_d::Tree * CGAL_tree_d_pt
Pointer to tree-based representation of sample points.
unsigned Max_spiral_level
Max. spiralling level (for efficiency; effect similar to max_search_radius)
void get_neighbouring_bins_helper(const unsigned &bin_index, const unsigned &radius, Vector< unsigned > &neighbouring_bin_index, const bool &use_old_version=true)
Helper function for computing the bin indices of neighbouring bins at a given "radius" of the specifi...
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
void output_neighbouring_bins(const unsigned &bin_index, const unsigned &radius, std::ofstream &outfile)
Output neighbouring bins at given "radius" of the specified bin.
CGAL::Orthogonal_k_neighbor_search< Traits_d > K_neighbor_search_d
~RefineableBin()
Destructor.
CGALSamplePointContainer(SamplePointContainerParameters *sample_point_container_parameters_pt)
Constructor.
static bool Suppress_warning_about_large_total_number_of_bins
Boolean to supppress warnings about large number of bins.
void get_bin_boundaries(Vector< std::pair< double, double > > &min_and_max_coordinates)
Boundaries of bin in each coordinate direction. *.first = min; *.second = max.
double min_distance(const unsigned &i_bin, const Vector< double > &zeta)
Compute the minimum distance of any vertex in the specified bin from the specified Lagrangian coordin...
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with gl...
void profile_get_neighbouring_bins_helper()
Profiling function to compare performance of two different versions of the get_neighbouring_bins_help...
bool Use_eulerian_coordinates_during_setup
Use Eulerian coordinates (i.e. interpolated_x) rather than zeta itself (i.e. interpolated_zeta) to id...
Vector< SamplePoint * > Sample_point_pt
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...
void fill_bin_by_diffusion(const unsigned &bin_diffusion_radius=1)
Fill bin by diffusion, populating each empty bin with the same content as the first non-empty bin fou...
bool ignore_halo_elements_during_locate_zeta_search() const
Ignore halo elements?
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.
Vector< std::pair< double, double > > Min_and_max_coordinates
NonRefineableBinArray(SamplePointContainerParameters *bin_array_parameters_pt)
Constructor.
unsigned Nsample_points_generated_per_element
"Measure of" number of sample points generated in each element
void fill_bin_array()
Fill the bin array with sample points from FiniteElements stored in mesh.
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...
unsigned Max_depth
Max depth of the hierarchical bin_array.
Vector< Point_d > CGAL_sample_point_zeta_d
Vector containing sample point coordinates.
unsigned Current_min_spiral_level
Current min. spiralling level.
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with gl...
virtual unsigned & total_number_of_sample_points_visited_during_locate_zeta_from_top_level()
Counter to keep track of how many sample points we've visited during top level call to locate_zeta...
unsigned First_sample_point_to_actually_lookup_during_locate_zeta
When searching through sample points recursively from the top level RefineableBinArray (in determinis...
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...
void coords_to_vectorial_bin_index(const Vector< double > &zeta, Vector< unsigned > &bin_index)
Get "coordinates" of bin that contains specified zeta.
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with gl...
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 dimension_of_bin_array(const unsigned &i) const
Number of bins in coordinate direction i.
void setup_min_and_max_coordinates()
Helper function to compute the min and max coordinates for the mesh, in each dimension.
void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Find sub-GeomObject (finite element) and the local coordinate s within it that contains point with gl...
bool Bin_array_is_recursive
Variable which stores if the RefineableBinArray is recursive or not.
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.
unsigned max_bin_dimension() const
Max. bin dimension (number of bins in coordinate directions)
Kernel_d::Point_d Point_d
void limited_locate_zeta(const Vector< double > &zeta, const unsigned &max_sample_points_for_newton_based_search, GeomObject *&sub_geom_object_pt, Vector< double > &s)
Find the sub geometric object and local coordinate therein that corresponds to the intrinsic coordina...
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
unsigned coords_to_bin_index(const Vector< double > &zeta)
Get (linearly enumerated) bin index of bin that contains specified zeta.
static unsigned long Total_nbin_cells_counter
Counter for overall number of bins allocated – used to issue warning if this exceeds a threshhold...
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points in sample point container.
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'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 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.
double timer()
returns the time in seconds after some point in past
RefineableBinArray(SamplePointContainerParameters *bin_array_parameters_pt)
Constructor.
Vector< unsigned > Dimensions_of_bin_array
Number of bins in each coordinate direction.
void output(std::ofstream &outfile, const bool &don_t_recurse=false)
Output bin; x,[y,[z]],n_sample_points.
void get_bin(const Vector< double > &zeta, int &bin_number)
Get the number of the bin containing the specified coordinate. Bin number is negative if the coordina...
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.
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.
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'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't move this into a common base class...
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
RefineableBinArray * Root_bin_array_pt
Pointer to root bin array.
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...
void make_sub_bin_array(const Vector< std::pair< double, double > > &min_and_max_coordinates)
Method for building a new subbin_array (called when the Bin size is greater than the Max_number_of_sa...
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'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...
unsigned total_number_of_sample_points_computed_recursively() const
Compute total number of sample points recursively.
void output_bins(std::ofstream &outfile)
Output bins.
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...
void get_bin_vertices(const unsigned &i_bin, Vector< Vector< double > > &bin_vertex)
Get vector of vectors containing the coordinates of the vertices of the i_bin-th bin: bin_vertex[j][i...
void get_bin_boundaries(const unsigned &bin_index, Vector< std::pair< double, double > > &min_and_max_coordinates)
Boundaries of specified bin in each coordinate direction. *.first = min; *.second = max...
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't move this into a common base clas...
unsigned ndim_zeta() const
Dimension of the zeta ( = dim of local coordinate of elements)
void fill_bin_array()
Fill the bin array with sample points from FiniteElements stored in mesh.
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.
void add_sample_point(SamplePoint *new_sample_point_pt, const Vector< double > &zeta_coordinates)
Add a new sample point to RefineableBin.
unsigned Current_max_spiral_level
Current max. spiralling level.
double & max_search_radius()
Set maximum search radius for locate zeta. This is initialised do DBL_MAX so we brutally search throu...
void output_bin_vertices(std::ofstream &outfile)
Output bin vertices (allowing display of bins as zones).
unsigned & current_min_spiral_level()
Access function to current min. spiral level.
double get_sample_points()
Get the sample points; return time for setup of CGAL tree.
unsigned & nsample_points_generated_per_element()
"Measure of" number of sample points generated in each element
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...
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...