Setup mutual visibility for Stefan Boltzmann radiation for all face elements (derived from StefanBoltzmannRadiationBase) contained in vector.
2178 std::ofstream some_file;
2182 unsigned nel=sb_face_element_pt.size();
2183 for (
unsigned e_illuminated=0;e_illuminated<nel;e_illuminated++)
2185 StefanBoltzmannRadiationBase* illuminated_el_pt=
2186 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2187 sb_face_element_pt[e_illuminated]);
2189 if (illuminated_el_pt==0)
2191 std::stringstream error_message;
2192 error_message <<
"Failed to cast illuminated element "
2194 <<
" to StefanBoltzmannRadiationBase";
2195 throw OomphLibError(
2196 error_message.str(),
2203 illuminated_el_pt->wipe_stefan_boltzmann_illumination_info();
2210 Vector<double> r_illuminated(2);
2211 Vector<double> s_illuminated(1);
2212 Vector<double> unit_normal_illuminated(2);
2213 Vector<double> r_illuminating(2);
2214 Vector<double> s_illuminating(1);
2215 Vector<double> unit_normal_illuminating(2);
2218 const bool use_bins=
true;
2242 unsigned nel=sb_face_element_pt.size();
2243 for (
unsigned e_illuminated=0;e_illuminated<nel;e_illuminated++)
2245 StefanBoltzmannRadiationBase* illuminated_el_pt=
2246 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2247 sb_face_element_pt[e_illuminated]);
2249 if (illuminated_el_pt==0)
2251 std::stringstream error_message;
2252 error_message <<
"Failed to cast illuminated element "
2254 <<
" to StefanBoltzmannRadiationBase";
2255 throw OomphLibError(
2256 error_message.str(),
2263 unsigned nint=illuminated_el_pt->integral_pt()->nweight();
2264 for (
unsigned ipt_illuminated=0;ipt_illuminated<nint;ipt_illuminated++)
2268 illuminated_el_pt->integral_pt()->knot(ipt_illuminated,0);
2272 illuminated_el_pt->interpolated_x(s_illuminated,r_illuminated);
2274 for (
unsigned i=0;
i<2;
i++)
2283 double percentage_offset=5.0;
2284 for (
unsigned i=0;
i<2;
i++)
2296 const bool test_horizontal_and_vertical_rays=
false;
2297 if (test_horizontal_and_vertical_rays)
2305 Vector<std::pair<unsigned,unsigned> > dummy_intersected_bin;
2306 bool populate_bin=
true;
2307 std::ofstream dummy_file;
2308 Vector<Vector<double> > sample_vertex(2);
2309 sample_vertex[0].resize(2);
2310 sample_vertex[1].resize(2);
2311 sample_vertex[0][0]=-0.9;
2312 sample_vertex[0][1]=0.9;
2313 sample_vertex[1][0]=0.9;
2314 sample_vertex[1][1]=0.9;
2316 StefanBoltzmannRadiationBase* el_pt=
2317 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2318 sb_face_element_pt[0]);
2322 dummy_intersected_bin,
2335 Vector<std::pair<unsigned,unsigned> > dummy_intersected_bin;
2336 bool populate_bin=
true;
2337 std::ofstream dummy_file;
2338 Vector<Vector<double> > sample_vertex(2);
2339 sample_vertex[0].resize(2);
2340 sample_vertex[1].resize(2);
2341 sample_vertex[0][0]= 0.9;
2342 sample_vertex[0][1]=-0.9;
2343 sample_vertex[1][0]=-0.9;
2344 sample_vertex[1][1]=-0.9;
2346 StefanBoltzmannRadiationBase* el_pt=
2347 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2348 sb_face_element_pt[0]);
2352 dummy_intersected_bin,
2363 Vector<std::pair<unsigned,unsigned> > dummy_intersected_bin;
2364 bool populate_bin=
true;
2365 std::ofstream dummy_file;
2366 Vector<Vector<double> > sample_vertex(2);
2367 sample_vertex[0].resize(2);
2368 sample_vertex[1].resize(2);
2369 sample_vertex[0][0]=-0.7;
2370 sample_vertex[0][1]=-0.9;
2371 sample_vertex[1][0]=-0.7;
2372 sample_vertex[1][1]= 0.9;
2374 StefanBoltzmannRadiationBase* el_pt=
2375 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2376 sb_face_element_pt[0]);
2380 dummy_intersected_bin,
2391 Vector<std::pair<unsigned,unsigned> > dummy_intersected_bin;
2392 bool populate_bin=
true;
2393 std::ofstream dummy_file;
2394 Vector<Vector<double> > sample_vertex(2);
2395 sample_vertex[0].resize(2);
2396 sample_vertex[1].resize(2);
2397 sample_vertex[0][0]= 0.7;
2398 sample_vertex[0][1]= 0.9;
2399 sample_vertex[1][0]= 0.7;
2400 sample_vertex[1][1]=-0.9;
2402 StefanBoltzmannRadiationBase* el_pt=
2403 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2404 sb_face_element_pt[0]);
2408 dummy_intersected_bin,
2419 nel=sb_face_element_pt.size();
2420 for (
unsigned e=0;
e<nel;
e++)
2422 StefanBoltzmannRadiationBase* el_pt=
2423 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2424 sb_face_element_pt[
e]);
2428 std::stringstream error_message;
2429 error_message <<
"Failed to cast possible intersecting element "
2431 <<
" to StefanBoltzmannRadiationBase";
2432 throw OomphLibError(
2433 error_message.str(),
2440 Vector<Vector<double> > sample_vertex(2);
2441 sample_vertex[0].resize(2);
2442 sample_vertex[1].resize(2);
2446 Vector<double>
s(1);
2447 unsigned j_sample=0;
2448 el_pt->get_s_plot(j_sample,
Nsample,
s);
2451 el_pt->interpolated_x(
s,sample_vertex[0]);
2454 for (
unsigned j_sample=1;j_sample<
Nsample;j_sample++)
2458 el_pt->get_s_plot(j_sample,
Nsample,
s);
2461 el_pt->interpolated_x(
s,sample_vertex[1]);
2466 Vector<std::pair<unsigned,unsigned> > dummy_intersected_bin;
2467 bool populate_bin=
true;
2468 std::ofstream dummy_file;
2471 dummy_intersected_bin,
2476 sample_vertex[0]=sample_vertex[1];
2482 << t_end_bin-t_start_bin << std::endl;
2485 nel=sb_face_element_pt.size();
2488 unsigned nintpt_all=sb_face_element_pt[0]->integral_pt()->nweight();
2491 const bool exploit_symmetry=
true;
2497 Vector<Vector<Vector<Vector<unsigned> > > > aux;
2498 if (exploit_symmetry)
2500 nintpt_all=sb_face_element_pt[0]->integral_pt()->nweight();
2502 for (
unsigned e=0;
e<nel;
e++)
2504 aux[
e].resize(nintpt_all);
2505 for (
unsigned ipt=0;ipt<nintpt_all;ipt++)
2507 aux[
e][ipt].resize(nel);
2513 for (
unsigned e_illuminated=0;e_illuminated<nel;e_illuminated++)
2515 StefanBoltzmannRadiationBase* illuminated_el_pt=
2516 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2517 sb_face_element_pt[e_illuminated]);
2520 if (illuminated_el_pt==0)
2522 std::stringstream error_message;
2523 error_message <<
"Failed to cast illuminated element "
2525 <<
" to StefanBoltzmannRadiationBase";
2526 throw OomphLibError(
2527 error_message.str(),
2534 FaceElement* illuminated_face_el_pt=
2535 dynamic_cast<FaceElement*
>(illuminated_el_pt);
2538 unsigned nint=illuminated_el_pt->integral_pt()->nweight();
2539 for (
unsigned ipt_illuminated=0;ipt_illuminated<nint;ipt_illuminated++)
2543 illuminated_el_pt->integral_pt()->knot(ipt_illuminated,0);
2547 illuminated_el_pt->interpolated_x(s_illuminated,r_illuminated);
2550 illuminated_face_el_pt->outer_unit_normal(s_illuminated,
2551 unit_normal_illuminated);
2557 if (exploit_symmetry) e_lo=e_illuminated;
2558 for (
unsigned e_illuminating=e_lo;e_illuminating<nel;e_illuminating++)
2560 StefanBoltzmannRadiationBase* illuminating_el_pt=
2561 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2562 sb_face_element_pt[e_illuminating]);
2565 if (illuminating_el_pt==0)
2567 std::stringstream error_message;
2568 error_message <<
"Failed to cast illuminating element "
2570 <<
" to StefanBoltzmannRadiationBase";
2571 throw OomphLibError(
2572 error_message.str(),
2579 FaceElement* illuminating_face_el_pt=
2580 dynamic_cast<FaceElement*
>(illuminating_el_pt);
2585 Vector<unsigned> illuminating_integration_point_index;
2588 unsigned nint=illuminating_el_pt->integral_pt()->nweight();
2589 for (
unsigned ipt_illuminating=0;ipt_illuminating<nint;
2594 illuminating_el_pt->integral_pt()->knot(ipt_illuminating,0);
2598 illuminating_el_pt->interpolated_x(s_illuminating,r_illuminating);
2601 illuminating_face_el_pt->
2602 outer_unit_normal(s_illuminating,
2603 unit_normal_illuminating);
2606 Vector<double> ray(2);
2607 ray[0]=r_illuminated[0]-r_illuminating[0];
2608 ray[1]=r_illuminated[1]-r_illuminating[1];
2611 Vector<Vector<double> > ray_vertex(2);
2612 ray_vertex[0].resize(2);
2613 ray_vertex[1].resize(2);
2614 ray_vertex[0][0]=r_illuminated[0];
2615 ray_vertex[0][1]=r_illuminated[1];
2616 ray_vertex[1][0]=r_illuminating[0];
2617 ray_vertex[1][1]=r_illuminating[1];
2621 double dot_illuminating=
2622 (unit_normal_illuminating[0]*ray[0]+
2623 unit_normal_illuminating[1]*ray[1]);
2624 if (dot_illuminating>0.0)
2629 double dot_illuminated=
2630 (unit_normal_illuminated[0]*ray[0]+
2631 unit_normal_illuminated[1]*ray[1]);
2632 if (dot_illuminated<0.0)
2640 Vector<std::pair<unsigned,unsigned> > intersected_bin;
2645 sprintf(
filename,
"RESLT/latest_ray.dat");
2650 Vector<std::pair<unsigned,unsigned> > intersected_bin;
2651 bool populate_bin=
false;
2652 FiniteElement* dummy_el_pt=0;
2663 pause(
"done latest ray");
2667 Vector<Vector<double> > segment_vertex(2);
2668 segment_vertex[0].resize(2);
2669 segment_vertex[1].resize(2);
2672 bool have_intersection=
false;
2673 unsigned nbin=intersected_bin.size();
2674 for (
unsigned b=0;
b<nbin;
b++)
2677 unsigned i=intersected_bin[
b].first;
2678 unsigned j=intersected_bin[
b].second;
2681 for (std::set<FiniteElement*>::iterator it=
2686 StefanBoltzmannRadiationBase* el_pt=
2687 dynamic_cast<StefanBoltzmannRadiationBase*
>(*it);
2690 if (illuminated_el_pt==0)
2692 std::stringstream error_message;
2694 <<
"Failed to cast possibly blocking element "
2695 <<
" to StefanBoltzmannRadiationBase";
2696 throw OomphLibError(
2697 error_message.str(),
2703 if ((el_pt!=illuminated_el_pt)&&
2704 (el_pt!=illuminating_el_pt))
2709 for (
unsigned j_sample=0;j_sample<
Nsample-1;j_sample++)
2713 Vector<double>
s(1);
2714 el_pt->get_s_plot(j_sample,
Nsample,
s);
2717 el_pt->interpolated_x(
s,segment_vertex[0]);
2721 el_pt->get_s_plot(j_sample+1,
Nsample,
s);
2724 el_pt->interpolated_x(
s,segment_vertex[1]);
2728 segment_vertex,ray_vertex);
2733 have_intersection=
true;
2738 if (have_intersection)
break;
2740 if (have_intersection)
break;
2745 if (!have_intersection)
2748 illuminating_integration_point_index.
2749 push_back(ipt_illuminating);
2757 Vector<Vector<double> > segment_vertex(2);
2758 segment_vertex[0].resize(2);
2759 segment_vertex[1].resize(2);
2762 bool have_intersection=
false;
2763 for (
unsigned e_intersect=0;e_intersect<nel;
2768 if (! ( (e_intersect==e_illuminated) ||
2769 (e_intersect==e_illuminating) ) )
2777 Vector<double>
s(1);
2778 sb_face_element_pt[e_intersect]->
2782 sb_face_element_pt[e_intersect]->
2783 interpolated_x(
s,segment_vertex[0]);
2787 sb_face_element_pt[e_intersect]->
2791 sb_face_element_pt[e_intersect]->
2792 interpolated_x(
s,segment_vertex[1]);
2796 segment_vertex,ray_vertex);
2800 have_intersection=
true;
2805 if (have_intersection)
2812 if (!have_intersection)
2815 illuminating_integration_point_index.
2816 push_back(ipt_illuminating);
2827 unsigned npt=illuminating_integration_point_index.size();
2831 illuminated_el_pt->add_stefan_boltzmann_illumination_info(
2832 ipt_illuminated,illuminating_el_pt,
2833 illuminating_integration_point_index);
2836 if (exploit_symmetry)
2838 for (
unsigned i_ing=0;i_ing<npt;i_ing++)
2841 [illuminating_integration_point_index[i_ing]]
2842 [e_illuminated].push_back(ipt_illuminated);
2853 if (exploit_symmetry)
2856 for (
unsigned e_illuminated=0;e_illuminated<nel;e_illuminated++)
2858 StefanBoltzmannRadiationBase* illuminated_el_pt=
2859 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2860 sb_face_element_pt[e_illuminated]);
2863 if (illuminated_el_pt==0)
2865 std::stringstream error_message;
2866 error_message <<
"Failed to cast illuminated element "
2868 <<
" to StefanBoltzmannRadiationBase";
2869 throw OomphLibError(
2870 error_message.str(),
2877 unsigned nint=illuminated_el_pt->integral_pt()->nweight();
2878 for (
unsigned ipt_illuminated=0;ipt_illuminated<nint;ipt_illuminated++)
2881 for (
unsigned e_illuminating=0;
2882 e_illuminating<e_illuminated;e_illuminating++)
2884 StefanBoltzmannRadiationBase* illuminating_el_pt=
2885 dynamic_cast<StefanBoltzmannRadiationBase*
>(
2886 sb_face_element_pt[e_illuminating]);
2889 if (illuminating_el_pt==0)
2891 std::stringstream error_message;
2892 error_message <<
"Failed to cast illuminating element "
2894 <<
" to StefanBoltzmannRadiationBase";
2895 throw OomphLibError(
2896 error_message.str(),
2902 Vector<unsigned> illuminating_integration_point_index=
2903 aux[e_illuminated][ipt_illuminated][e_illuminating];
2904 unsigned npt=illuminating_integration_point_index.size();
2908 illuminated_el_pt->add_stefan_boltzmann_illumination_info(
2909 ipt_illuminated,illuminating_el_pt,
2910 illuminating_integration_point_index);
2918 oomph_info <<
"Time for setting up mutual Stefan Boltzmann radiation: "
2919 << t_end-t_start << std::endl;
Scalar * b
Definition: benchVecAdd.cpp:17
string filename
Definition: MergeRestartFiles.py:39
bool intersects(const Vector< Vector< double > > &first_segment_vertex, const Vector< Vector< double > > &second_segment_vertex, const double &epsilon_parallel=1.0e-15)
Definition: temporary_stefan_boltzmann_elements.h:57
void bin_helper(const Vector< Vector< double > > &ray_vertex, const bool &populate_bin, Vector< std::pair< unsigned, unsigned > > &intersected_bin, FiniteElement *el_pt, std::ofstream &outfile)
Definition: temporary_stefan_boltzmann_elements.h:1861
void pause(std::string message)
Pause and display message.
Definition: oomph_utilities.cc:1265
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
double timer
Definition: oomph_metis_from_parmetis_3.1.1/struct.h:210
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2