Flow123d  release_2.2.0-914-gf1a3a4f
mixed_mesh_intersections.cc
Go to the documentation of this file.
1 /*
2  * MixedMeshIntersections.cpp
3  *
4  * Created on: 13.4.2014
5  * Author: viktor, pe, jb
6  */
7 
10 #include "intersection_aux.hh"
11 #include "intersection_local.hh"
12 
13 #include "system/global_defs.h"
14 #include "system/sys_profiler.hh"
15 
16 #include "mesh/mesh.h"
17 #include "mesh/ref_element.hh"
19 #include "mesh/bih_tree.hh"
20 
21 
25 
26 
27 
29 : mesh(mesh), algorithm13_(mesh), algorithm23_(mesh), algorithm22_(mesh), algorithm12_(mesh)
30 {}
31 
33 {}
34 
35 
36 unsigned int MixedMeshIntersections::number_of_components(unsigned int dim)
37 {
38  ASSERT(dim < 3);
39 // if(dim == 1) return algorithm13_.component_counter_;
40  if(dim == 2) return algorithm22_.component_counter_;
41  else xprintf(Err, "Not implemented for dim %d\n.",dim);
42  return 0;
43 }
44 
45 
47 {
48  double subtotal = 0.0;
49 
50  for(unsigned int i = 0; i < intersection_storage13_.size(); i++){
51  ElementFullIter ele = mesh->element(intersection_storage13_[i].component_ele_idx());
52  double t1d_length = ele->measure();
53  double local_length = intersection_storage13_[i].compute_measure();
54 
55  if(intersection_storage13_[i].size() == 2)
56  {
57  arma::vec3 from = intersection_storage13_[i][0].coords(ele);
58  arma::vec3 to = intersection_storage13_[i][1].coords(ele);
59 // DebugOut().fmt("sublength from [{} {} {}] to [{} {} {}] = %f\n",
60 // from[0], from[1], from[2],
61 // to[0], to[1], to[2],
62 // local_length*t1d_length);
63  }
64  subtotal += local_length*t1d_length;
65  }
66  return subtotal;
67 }
68 
69 
71 {
72  double subtotal = 0.0;
73 
74  for(unsigned int i = 0; i < intersection_storage23_.size(); i++){
75  double t2dArea = mesh->element(intersection_storage23_[i].component_ele_idx())->measure();
76  double localArea = intersection_storage23_[i].compute_measure();
77  subtotal += 2*localArea*t2dArea;
78  }
79  return subtotal;
80 }
81 
82 
84 {
85  double subtotal = 0.0;
86  double val;
87 
88  for(unsigned int i = 0; i < intersection_storage22_.size(); i++){
89  if(intersection_storage22_[i].size() > 1)
90  {
91  ElementFullIter eleA = mesh->element(intersection_storage22_[i].component_ele_idx());
92 // ElementFullIter eleB = mesh->element(intersection_storage22_[i].bulk_ele_idx());
93 
94  arma::vec3 from = intersection_storage22_[i][0].coords(eleA);
95  arma::vec3 to = intersection_storage22_[i][1].coords(eleA);
96  val = arma::norm(from - to, 2);
97 
98 // DebugOut().fmt("{}--{}:sublength from [{} {} {}] to [{} {} {}] = {}\n",
99 // eleA->id(), eleB->id(),
100 // from[0], from[1], from[2],
101 // to[0], to[1], to[2],
102 // val);
103  subtotal += val;
104  }
105  }
106  return subtotal;
107 }
108 
109 
110 template<uint dim_A, uint dim_B>
112  //unsigned int ele_a_idx = isec_aux.component_ele_idx();
113  //unsigned int ele_b_idx = isec_aux.bulk_ele_idx();
114 
115  //WARNING:
116  // - not all algorithms uses this function (e.g. 2d2d pushes directly into storage)
117  // - we cannot throw away isec of zero measure generaly (e.g. 1d2d, 1d3d)
118  // - is it not better to test number of IPs according to dimensions?
119 
120  IntersectionLocal<dim_A, dim_B> isec(isec_aux);
121  //if ( (! (dim_A==1 && dim_B==2)) && isec.compute_measure() < 1e-14) return;
122 
123  storage.push_back(isec);
124  /*
125  element_intersections_[ele_a_idx].push_back(
126  std::make_pair(ele_b_idx, &(storage.back())) );
127 
128  element_intersections_[ele_b_idx].push_back(
129  std::make_pair(ele_a_idx, &(storage.back())) );
130  */
131 
132 }
133 
134 template<uint dim_A, uint dim_B>
136 {
137  for(auto &isec : storage) {
138 
139  unsigned int ele_a_idx = isec.component_ele_idx();
140  unsigned int ele_b_idx = isec.bulk_ele_idx();
141  ASSERT_EQ_DBG(mesh->element(ele_a_idx)->dim(), dim_A)(ele_a_idx);
142  ASSERT_EQ_DBG(mesh->element(ele_b_idx)->dim(), dim_B)(ele_b_idx);
143  element_intersections_[ele_a_idx].push_back(
144  std::make_pair(ele_b_idx, &(isec)) );
145 
146 
147  if (dim_B==3) {
148  // necessary for 2d-2d intersections
149  element_intersections_[ele_b_idx].push_back(
150  std::make_pair(ele_a_idx, &(isec)) );
151 
152  }
153 /*
154  element_intersections_[ele_b_idx].push_back(
155  std::make_pair(ele_a_idx, &(isec)) );*/
156  }
157 }
158 
159 
160 template<unsigned int dim>
163 {
164  START_TIMER("Intersection algorithm");
165 
167  switch(is){
170  case Mesh::BBsearch: iea.compute_intersections_BB(); break;
171  default: ASSERT(0).error("Unsupported search algorithm.");
172  }
173 
174  END_TIMER("Intersection algorithm");
175 
176  START_TIMER("Intersection into storage");
177  storage.reserve(iea.n_intersections_);
178 
179  FOR_ELEMENTS(mesh, elm) {
180  unsigned int idx = elm->index();
181  unsigned int bulk_idx;
182 
183  if(elm->dim() == dim)
184  {
185 // intersection_map_[idx].resize(iea.intersection_list_[idx].size());
186  element_intersections_[idx].reserve(iea.intersection_list_[idx].size());
187  for(unsigned int j = 0; j < iea.intersection_list_[idx].size(); j++){
188 
189  // skip zero intersections (are made in iea.prolongate())
190  if(iea.intersection_list_[idx][j].size() == 0) continue;
191  store_intersection(storage, iea.intersection_list_[idx][j]); }
192  }
193  }
194  END_TIMER("Intersection into storage");
195 
196 // for(IntersectionLocal<2,3> &is : intersection_storage23_) {
197 // DebugOut().fmt("comp-bulk: {} {}\n", is.component_ele_idx(), is.bulk_ele_idx());
198 // }
199 }
200 
202 {
203  START_TIMER("Intersection algorithm");
205  END_TIMER("Intersection algorithm");
206 
207 // START_TIMER("Intersection into storage");
208 //
209 // storage.reserve(algorithm22_.intersectionaux_storage22_.size());
210 //
211 // for(IntersectionAux<2,2> &is : algorithm22_.intersectionaux_storage22_) {
212 // unsigned int triaA_idx = is.component_ele_idx();
213 // unsigned int triaB_idx = is.bulk_ele_idx();
214 //
215 // //HACK: 'skip flag' move this check into algorithm12_.compute_intersections()
216 // bool skip = false;
217 // for(unsigned int i=0; i<element_intersections_[triaA_idx].size(); i++)
218 // {
219 // if(element_intersections_[triaA_idx][i].first == triaB_idx)
220 // skip = true;
221 // }
222 // if(! skip) {
223 // storage.push_back(IntersectionLocal<2,2>(is));
224 // element_intersections_[triaA_idx].push_back(std::make_pair(
225 // triaB_idx,
226 // &(storage.back())
227 // ));
228 // element_intersections_[triaB_idx].push_back(std::make_pair(
229 // triaA_idx,
230 // &(storage.back())
231 // ));
232 //
233 // // DebugOut().fmt("2D-2D intersection [{} - {}]:\n",
234 // // mesh->element(is.component_ele_idx())->id(),
235 // // mesh->element(is.bulk_ele_idx())->id());
236 // // for(const IntersectionPointAux<2,2>& ip : is.points()) {
237 // // DebugOut() << ip;
238 // // auto p = ip.coords(mesh->element(is.component_ele_idx()));
239 // // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
240 // // }
241 // }
242 // }
243 // DBGVAR(algorithm22_.intersectionaux_storage22_.size());
244 //
245 // END_TIMER("Intersection into storage");
246 }
247 
249 {
250  START_TIMER("Intersection algorithm");
251  storage.reserve(intersection_storage13_.size());
253  storage.shrink_to_fit();
254  END_TIMER("Intersection algorithm");
255 
256 // START_TIMER("Intersection into storage");
257 // storage.reserve(algorithm12_.intersectionaux_storage12_.size());
258 
259 // for(IntersectionAux<1,2> &is : algorithm12_.intersectionaux_storage12_) {
260 // unsigned int abscissa_idx = is.component_ele_idx();
261 // unsigned int triangle_idx = is.bulk_ele_idx();
262 //
263 // //HACK: 'skip flag' move this check into algorithm12_.compute_intersections()
264 // bool skip = false;
265 // for(unsigned int i=0; i<intersection_map_[abscissa_idx].size(); i++)
266 // {
267 // if(intersection_map_[abscissa_idx][i].first == triangle_idx)
268 // skip = true;
269 // }
270 // if(! skip) {
271 // storage.push_back(IntersectionLocal<1,2>(is));
272 // intersection_map_[abscissa_idx].push_back(std::make_pair(
273 // triangle_idx,
274 // &(storage.back())
275 // ));
276 // intersection_map_[triangle_idx].push_back(std::make_pair(
277 // abscissa_idx,
278 // &(storage.back())
279 // ));
280 // DebugOut().fmt("1D-2D intersection [{} - {}]:\n",is.component_ele_idx(), is.bulk_ele_idx());
281 // for(const IntersectionPointAux<1,2>& ip : is.points()) {
282 // //DebugOut() << ip;
283 // auto p = ip.coords(mesh->element(is.component_ele_idx()));
284 // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
285 // }
286 // }
287 // }
288 // END_TIMER("Intersection into storage");
289 }
290 
292 {
293  START_TIMER("Intersection algorithm");
295  END_TIMER("Intersection algorithm");
297 
298  START_TIMER("Intersection into storage");
299  storage.reserve(algorithm12_.intersectionaux_storage12_.size());
300 
302  store_intersection(storage, is);
303 // DebugOut().fmt("1D-2D intersection [{} - {}]:\n",is.component_ele_idx(), is.bulk_ele_idx());
304 // for(const IntersectionPointAux<1,2>& ip : is.points()) {
305 // //DebugOut() << ip;
306 // auto p = ip.coords(mesh->element(is.component_ele_idx()));
307 // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
308 // }
309  }
310  END_TIMER("Intersection into storage");
311 }
312 
313 
314 
315 
317 {
318  /* Algorithm:
319  *
320  * 1) create BIH tree
321  * 2) for every 1D, find list of candidates
322  * 3) compute intersections for 1d, store it to master_elements
323  *
324  */
325 
326  const BIHTree &bih_tree =mesh->get_bih_tree();
327 
328  for(unsigned int i_ele=0; i_ele<mesh->n_elements(); i_ele++) {
329  Element &ele = mesh->element[i_ele];
330 
331  if (ele.dim() == 1) {
332  vector<unsigned int> candidate_list;
333  bih_tree.find_bounding_box(ele.bounding_box(), candidate_list);
334 
335  for(unsigned int i_elm : candidate_list) {
336  ElementFullIter elm = mesh->element( i_elm );
337  if (elm->dim() == 2) {
338  ngh::IntersectionLocal *intersection;
339  GetIntersection( ngh::TAbscissa(ele), ngh::TTriangle(*elm), intersection);
340  if (intersection && intersection->get_type() == ngh::IntersectionLocal::line) {
341 
342  // make IntersectionAux<1,2> from IntersectionLocal (from ngh)
343  IntersectionAux<1,2> is(ele.index(), elm.index());
344  for(uint i=0; i< intersection->n_points(); i++) {
345  // convert local to barycentric
346  ASSERT_EQ_DBG(intersection->get_point(i)->el1_coord().size(), 1)(i);
347  ASSERT_EQ_DBG(intersection->get_point(i)->el2_coord().size(), 2)(i);
348 
349  arma::vec::fixed<1> local_on_1d = arma::vec::fixed<1>(intersection->get_point(i)->el1_coord().data());
350  arma::vec::fixed<2> local_on_2d = arma::vec::fixed<2>(intersection->get_point(i)->el2_coord().data());
351 
352  is.points().push_back(IntersectionPointAux<1,2>(
353  RefElement<1>::local_to_bary( local_on_1d ),
354  RefElement<2>::local_to_bary( local_on_2d ) ));
355  }
356 
357  store_intersection(storage, is);
358  }
359  }
360 
361  }
362  }
363  }
364 
365 }
366 
367 
369 {
371 
372 
373 
375  START_TIMER("Intersections 1D-3D");
376 // DebugOut() << "Intersection Algorithm d13\n";
377  compute_intersections<1>(algorithm13_,intersection_storage13_);
378  END_TIMER("Intersections 1D-3D");
379  }
381 
382 
384  START_TIMER("Intersections 2D-3D");
385 // DebugOut() << "Intersection Algorithm d23\n";
386  compute_intersections<2>(algorithm23_,intersection_storage23_);
387  END_TIMER("Intersections 2D-3D");
388  }
390 
391 
392  if(d & IntersectionType::d22){
393  START_TIMER("Intersections 2D-2D");
394 // DebugOut() << "Intersection Algorithm d22\n";
396  END_TIMER("Intersections 2D-2D");
397  }
399  //append_to_index(intersection_storage22_);
400 
401 
402  if(d & IntersectionType::d12_3){
403  START_TIMER("Intersections 1D-2D (3)");
404 // DebugOut() << "Intersection Algorithm d12_3\n";
406  END_TIMER("Intersections 1D-2D (3)");
407 
408  }
409 
410  if(d & IntersectionType::d12_2){
411  START_TIMER("Intersections 1D-2D (2)");
412 // DebugOut() << "Intersection Algorithm d12_2\n";
414  END_TIMER("Intersections 1D-2D (2)");
415  }
416 
418  intersection_storage12_.clear();
419 // DebugOut() << "Intersection Algorithm d12_ngh\n";
421  }
422 
423  //ASSERT_EQ(intersection_storage13_.size(), 0);
424  //ASSERT_EQ(intersection_storage23_.size(), 0);
425  //ASSERT_EQ(intersection_storage22_.size(), 0);
426  // compose master
428 
429  // release temporary links from 3d elements
430  FOR_ELEMENTS(mesh, elm) {
431  if(elm->dim() == 3) element_intersections_[elm->index()].clear();
432  }
433 
434 
435 
436 }
437 
438 
439 
440 
442 {
443  string t_name = name;
444 
445  unsigned int number_of_intersection_points = 0;
446  unsigned int number_of_nodes = mesh->n_nodes();
447 
448  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
449  number_of_intersection_points += intersection_storage13_[j].size();
450  }
451 
452  FILE * file;
453  file = fopen((t_name.append(".msh")).c_str(),"w");
454 
455  fprintf(file, "$MeshFormat\n");
456  fprintf(file, "2.2 0 8\n");
457  fprintf(file, "$EndMeshFormat\n");
458  fprintf(file, "$Nodes\n");
459  fprintf(file, "%d\n", (mesh->n_nodes() + number_of_intersection_points));
460 
461  unsigned int idx = 1;
462  FOR_NODES(mesh, nod){
463  arma::vec3 _nod = nod->point();
464  fprintf(file,"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
465  idx++;
466  }
467 
468  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
471 // ElementFullIter el3D = mesh->element(il.bulk_ele_idx());
472 
473  for(unsigned int k = 0; k < il.size();k++){
474  number_of_nodes++;
475  IntersectionPoint<1,3> IP13 = il[k];
476  arma::vec3 global = IP13.coords(el1D);
477 
478 // if(i == 0){
479 // _global = (IP13.local_bcoords_A())[0] * el1D->node[0]->point()
480 // +(IP13.local_bcoords_A())[1] * el1D->node[1]->point();
481 // }else{
482 // _global = (IP13.local_bcoords_B())[0] * el3D->node[0]->point()
483 // +(IP13.local_bcoords_B())[1] * el3D->node[1]->point()
484 // +(IP13.local_bcoords_B())[2] * el3D->node[2]->point()
485 // +(IP13.local_bcoords_B())[3] * el3D->node[3]->point();
486 // }
487 
488  fprintf(file,"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
489  }
490  }
491 
492  fprintf(file,"$EndNodes\n");
493  fprintf(file,"$Elements\n");
494  fprintf(file,"%d\n", ((unsigned int)intersection_storage13_.size() + mesh->n_elements()) );
495 
496  FOR_ELEMENTS(mesh, elee){
497  if(elee->dim() == 3){
498  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
499  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
500  int id3 = mesh->node_vector.index(elee->node[2]) + 1;
501  int id4 = mesh->node_vector.index(elee->node[3]) + 1;
502 
503  fprintf(file,"%d 4 2 %d %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3, id4);
504  }else if(elee->dim() == 2){
505  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
506  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
507  int id3 = mesh->node_vector.index(elee->node[2]) + 1;
508  fprintf(file,"%d 2 2 %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3);
509 
510  }else if(elee->dim() == 1){
511  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
512  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
513  fprintf(file,"%d 1 2 %d %d %d %d\n",elee.id(), elee->region().id(), elee->pid, id1, id2);
514  }
515  }
516 
517  unsigned int number_of_elements = mesh->n_elements();
518  unsigned int nodes = mesh->n_nodes();
519 
520  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
522  number_of_elements++;
523  nodes++;
524  if(il.size() == 1){
525  fprintf(file,"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes);
526  }else if(il.size() == 2){
527  fprintf(file,"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes+1);
528  nodes++;
529  }
530  }
531 
532  fprintf(file,"$EndElements\n");
533  fclose(file);
534 }
535 
537 {
538  //for(unsigned int i = 0; i < 2;i++){
539  string t_name = name;
540 
541  unsigned int number_of_intersection_points = 0;
542  unsigned int number_of_nodes = mesh->n_nodes();
543 
544  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
545  number_of_intersection_points += intersection_storage23_[j].size();
546  }
547 
548  FILE * file;
549  file = fopen((t_name.append(".msh")).c_str(),"w");
550 
551  fprintf(file, "$MeshFormat\n");
552  fprintf(file, "2.2 0 8\n");
553  fprintf(file, "$EndMeshFormat\n");
554  fprintf(file, "$Nodes\n");
555  fprintf(file, "%d\n", (mesh->n_nodes() + number_of_intersection_points));
556 
557  unsigned int idx = 1;
558  FOR_NODES(mesh, nod){
559  arma::vec3 _nod = nod->point();
560  fprintf(file,"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
561  idx++;
562  }
563 
564  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
565 
568 // ElementFullIter el3D = mesh->element(il.bulk_ele_idx());
569 
570  for(unsigned int k = 0; k < intersection_storage23_[j].size();k++){
571 
572  number_of_nodes++;
573  IntersectionPoint<2,3> IP23 = il[k];
574  arma::vec3 global = IP23.coords(el2D);
575 // if(i == 0){
576 // _global = (IP23.local_bcoords_A())[0] * el2D->node[0]->point()
577 // +(IP23.local_bcoords_A())[1] * el2D->node[1]->point()
578 // +(IP23.local_bcoords_A())[2] * el2D->node[2]->point();
579 // }else{
580 // _global = (IP23.local_bcoords_B())[0] * el3D->node[0]->point()
581 // +(IP23.local_bcoords_B())[1] * el3D->node[1]->point()
582 // +(IP23.local_bcoords_B())[2] * el3D->node[2]->point()
583 // +(IP23.local_bcoords_B())[3] * el3D->node[3]->point();
584 // }
585  fprintf(file,"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
586  }
587  }
588 
589  fprintf(file,"$EndNodes\n");
590  fprintf(file,"$Elements\n");
591  fprintf(file,"%d\n", (number_of_intersection_points + mesh->n_elements()) );
592 
593  FOR_ELEMENTS(mesh, elee){
594  if(elee->dim() == 3){
595  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
596  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
597  int id3 = mesh->node_vector.index(elee->node[2]) + 1;
598  int id4 = mesh->node_vector.index(elee->node[3]) + 1;
599 
600  fprintf(file,"%d 4 2 %d %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3, id4);
601  }else if(elee->dim() == 2){
602  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
603  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
604  int id3 = mesh->node_vector.index(elee->node[2]) + 1;
605  fprintf(file,"%d 2 2 %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3);
606 
607  }else{
608  int id1 = mesh->node_vector.index(elee->node[0]) + 1;
609  int id2 = mesh->node_vector.index(elee->node[1]) + 1;
610  fprintf(file,"%d 1 2 %d %d %d %d\n",elee.id(), elee->region().id(), elee->pid, id1, id2);
611  }
612  }
613 
614  unsigned int number_of_elements = mesh->n_elements();
615  unsigned int last = 0;
616  unsigned int nodes = mesh->n_nodes();
617 
618  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
620 
621  for(unsigned int k = 0; k < il.size();k++){
622 
623  number_of_elements++;
624  nodes++;
625  if(k == 0){
626  last = nodes;
627  }
628 
629  if((k+1) == il.size() && il.size()){
630  fprintf(file,"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, last);
631  }else{
632  fprintf(file,"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, nodes+1);
633  }
634  //if(il.size() < 3) break;
635  }
636  }
637 
638  fprintf(file,"$EndElements\n");
639  fclose(file);
640  //}
641 }
642 
643 
void GetIntersection(const TBisector &, const TBisector &, TPosition &, double &, double &)
IntersectionType
Selection of intersections of different dimensions.
void compute_intersections_12_ngh_plane(std::vector< IntersectionLocal< 1, 2 > > &storage)
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:331
unsigned int n_points() const
void compute_intersections_22(std::vector< IntersectionLocal< 2, 2 >> &storage)
unsigned int uint
Classes with algorithms for computation of intersections of meshes.
void print_mesh_to_file_13(std::string name)
Generates a mesh file of the given name, including the intersection.
#define DBGVAR(var)
Definition: global_defs.h:165
#define FOR_ELEMENTS(_mesh_, __i)
Definition: mesh.h:480
void compute_intersections_12(std::vector< IntersectionLocal< 1, 2 >> &storage)
void compute_intersections(std::vector< std::vector< ILpair >> &intersection_map, std::vector< IntersectionLocal< 1, 2 >> &storage)
Runs the algorithm (3): compute 1D-2D intersection inside 3D mesh. It directly fills the intersection...
const IntersectionPoint * get_point(const unsigned int index) const
IntersectionType get_type() const
unsigned int index() const
Definition: mesh.h:99
Class represents intersection of two elements.
Class represents an intersection point of simplex<N> and simplex<M>. It contains barycentric coordina...
InspectElementsAlgorithm< 1 > algorithm13_
int index() const
Definition: sys_vector.hh:78
std::vector< std::vector< ILpair > > element_intersections_
unsigned int n_intersections_
Counter for intersection among elements.
unsigned int size() const
Returns number of intersection points.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:346
void compute_intersections_BIHtree(const BIHTree &bih)
Uses only BIHtree to find intersection candidates. (No prolongation).
arma::vec3 coords(ElementFullIter comp_ele) const
unsigned int component_ele_idx() const
Returns index of component element.
void print_mesh_to_file_23(std::string name)
unsigned int dim() const
const std::vector< double > & el2_coord() const
void compute_intersections(std::vector< std::vector< ILpair >> &intersection_map, std::vector< IntersectionLocal< 2, 2 >> &storage)
Runs the core algorithm for computing 2D-2D intersection in 3D.
Global macros to enhance readability and debugging, general constants.
unsigned int n_elements() const
Definition: mesh.h:156
std::vector< IntersectionAux< 1, 2 > > intersectionaux_storage12_
Stores temporarily 1D-2D intersections.
void compute_intersections_12_2(std::vector< IntersectionLocal< 1, 2 >> &storage)
void find_bounding_box(const BoundingBox &boundingBox, std::vector< unsigned int > &result_list, bool full_list=false) const
Definition: bih_tree.cc:215
std::vector< std::vector< IntersectionAux< dim, 3 > > > intersection_list_
Resulting vector of intersections.
InspectElementsAlgorithm< 2 > algorithm23_
IntersectionSearch get_intersection_search()
Getter for input type selection for intersection search algorithm.
Definition: mesh.cc:122
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
Definition: ostream.cc:56
#define xprintf(...)
Definition: system.hh:92
#define START_TIMER(tag)
Starts a timer with specified tag.
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:36
unsigned int index(const T *pointer) const
Definition: sys_vector.hh:373
std::vector< IntersectionLocal< 1, 3 > > intersection_storage13_
Stores 1D-3D intersections.
void append_to_index(std::vector< IntersectionLocal< dim_A, dim_B >> &storage)
#define FOR_NODES(_mesh_, i)
Definition: mesh.h:56
const std::vector< double > & el1_coord() const
double measure_13()
Computes the size of the intersection in dim dimenstions.
const BIHTree & get_bih_tree()
Getter for BIH. Creates and compute BIH at first call.
Definition: mesh.cc:752
void compute_intersections(IntersectionType d=IntersectionType::all)
void store_intersection(std::vector< IntersectionLocal< dim_A, dim_B >> &storage, IntersectionAux< dim_A, dim_B > &isec_aux)
unsigned int number_of_components(unsigned int dim)
Class implements algorithm for dim-dimensional intersections with 3D elements.
InspectElementsAlgorithm22 algorithm22_
void compute_intersections(const BIHTree &bih)
Uses BIHtree to find the initial candidate of a component and then prolongates the component interset...
InspectElementsAlgorithm12 algorithm12_
#define END_TIMER(tag)
Ends a timer with specified tag.
Internal auxiliary class represents an intersection point of simplex<N> and simplex<M>.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
Definition: system.hh:64
unsigned int n_nodes() const
Definition: mesh.h:152
#define print_var(var)
Definition: logger.hh:260
void compute_intersections_2(const BIHTree &bih)
Runs the algorithm (2): compute 1D-2D intersection in 3D ambient space BIH is used to find intersecti...
IntersectionSearch
Types of search algorithm for finding intersection candidates.
Definition: mesh.h:114
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
std::vector< IntersectionLocal< 2, 2 > > intersection_storage22_
Stores 2D-2D intersections.
#define DebugOut()
Macro defining &#39;debug&#39; record of log.
Definition: logger.hh:252
Internal class representing intersection point.
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
std::vector< IntersectionLocal< 2, 3 > > intersection_storage23_
Stores 2D-3D intersections.
NodeVector node_vector
Vector of nodes of the mesh.
Definition: mesh.h:258
ElementVector element
Vector of elements of the mesh.
Definition: mesh.h:260
Internal class representing intersection object.
BoundingBox bounding_box()
Definition: elements.h:117