Flow123d  release_3.0.0-967-g1590fa8
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/side_impl.hh"
17 #include "mesh/mesh.h"
18 #include "mesh/ref_element.hh"
20 #include "mesh/bih_tree.hh"
21 #include "mesh/accessors.hh"
22 #include "mesh/node_accessor.hh"
23 #include "mesh/range_wrapper.hh"
24 
25 
27 : mesh(mesh), algorithm13_(mesh), algorithm23_(mesh), algorithm22_(mesh), algorithm12_(mesh)
28 {}
29 
31 {}
32 
33 
34 unsigned int MixedMeshIntersections::number_of_components(unsigned int dim)
35 {
36  ASSERT(dim < 3);
37 // if(dim == 1) return algorithm13_.component_counter_;
38  if(dim == 2) return algorithm22_.component_counter_;
39  else xprintf(Err, "Not implemented for dim %d\n.",dim);
40  return 0;
41 }
42 
43 
45 {
46  double subtotal = 0.0;
47 
48  for(unsigned int i = 0; i < intersection_storage13_.size(); i++){
49  ElementAccessor<3> ele = mesh->element_accessor( intersection_storage13_[i].component_ele_idx() );
50  double t1d_length = ele.measure();
51  double local_length = intersection_storage13_[i].compute_measure();
52 
53  if(intersection_storage13_[i].size() == 2)
54  {
55  arma::vec3 from = intersection_storage13_[i][0].coords(ele);
56  arma::vec3 to = intersection_storage13_[i][1].coords(ele);
57 // DebugOut().fmt("sublength from [{} {} {}] to [{} {} {}] = %f\n",
58 // from[0], from[1], from[2],
59 // to[0], to[1], to[2],
60 // local_length*t1d_length);
61  }
62  subtotal += local_length*t1d_length;
63  }
64  return subtotal;
65 }
66 
67 
69 {
70  double subtotal = 0.0;
71 
72  for(unsigned int i = 0; i < intersection_storage23_.size(); i++){
73  double t2dArea = mesh->element_accessor( intersection_storage23_[i].component_ele_idx() ).measure();
74  double localArea = intersection_storage23_[i].compute_measure();
75  subtotal += 2*localArea*t2dArea;
76  }
77  return subtotal;
78 }
79 
80 
82 {
83  double subtotal = 0.0;
84  double val;
85 
86  for(unsigned int i = 0; i < intersection_storage22_.size(); i++){
87  if(intersection_storage22_[i].size() > 1)
88  {
89  ElementAccessor<3> eleA = mesh->element_accessor( intersection_storage22_[i].component_ele_idx() );
90 // ElementAccessor<3> eleB = mesh->element_accessor( intersection_storage22_[i].bulk_ele_idx() );
91 
92  arma::vec3 from = intersection_storage22_[i][0].coords(eleA);
93  arma::vec3 to = intersection_storage22_[i][1].coords(eleA);
94  val = arma::norm(from - to, 2);
95 
96 // DebugOut().fmt("{}--{}:sublength from [{} {} {}] to [{} {} {}] = {}\n",
97 // eleA.idx(), eleB.idx(),
98 // from[0], from[1], from[2],
99 // to[0], to[1], to[2],
100 // val);
101  subtotal += val;
102  }
103  }
104  return subtotal;
105 }
106 
107 
108 template<uint dim_A, uint dim_B>
110  //unsigned int ele_a_idx = isec_aux.component_ele_idx();
111  //unsigned int ele_b_idx = isec_aux.bulk_ele_idx();
112 
113  //WARNING:
114  // - not all algorithms uses this function (e.g. 2d2d pushes directly into storage)
115  // - we cannot throw away isec of zero measure generaly (e.g. 1d2d, 1d3d)
116  // - is it not better to test number of IPs according to dimensions?
117 
118  IntersectionLocal<dim_A, dim_B> isec(isec_aux);
119  //if ( (! (dim_A==1 && dim_B==2)) && isec.compute_measure() < 1e-14) return;
120 
121  storage.push_back(isec);
122  /*
123  element_intersections_[ele_a_idx].push_back(
124  std::make_pair(ele_b_idx, &(storage.back())) );
125 
126  element_intersections_[ele_b_idx].push_back(
127  std::make_pair(ele_a_idx, &(storage.back())) );
128  */
129 
130 }
131 
132 template<uint dim_A, uint dim_B>
134 {
135  for(auto &isec : storage) {
136 
137  unsigned int ele_a_idx = isec.component_ele_idx();
138  unsigned int ele_b_idx = isec.bulk_ele_idx();
139  ASSERT_EQ_DBG(mesh->element_accessor(ele_a_idx)->dim(), dim_A)(ele_a_idx);
140  ASSERT_EQ_DBG(mesh->element_accessor(ele_b_idx)->dim(), dim_B)(ele_b_idx);
141  element_intersections_[ele_a_idx].push_back(
142  std::make_pair(ele_b_idx, &(isec)) );
143 
144 
145  if (dim_B==3) {
146  // necessary for 2d-2d intersections
147  element_intersections_[ele_b_idx].push_back(
148  std::make_pair(ele_a_idx, &(isec)) );
149 
150  }
151 /*
152  element_intersections_[ele_b_idx].push_back(
153  std::make_pair(ele_a_idx, &(isec)) );*/
154  }
155 }
156 
157 
158 template<unsigned int dim>
161 {
162  START_TIMER("Intersection algorithm");
163 
165  switch(is){
168  case Mesh::BBsearch: iea.compute_intersections_BB(); break;
169  default: ASSERT(0).error("Unsupported search algorithm.");
170  }
171 
172  END_TIMER("Intersection algorithm");
173 
174  START_TIMER("Intersection into storage");
175  storage.reserve(iea.n_intersections_);
176 
177  for (auto elm : mesh->elements_range()) {
178  unsigned int idx = elm.idx();
179 
180  if(elm->dim() == dim)
181  {
182 // intersection_map_[idx].resize(iea.intersection_list_[idx].size());
183  element_intersections_[idx].reserve(iea.intersection_list_[idx].size());
184  for(unsigned int j = 0; j < iea.intersection_list_[idx].size(); j++){
185 
186  // skip zero intersections (are made in iea.prolongate())
187  if(iea.intersection_list_[idx][j].size() == 0) continue;
188  store_intersection(storage, iea.intersection_list_[idx][j]); }
189  }
190  }
191  END_TIMER("Intersection into storage");
192 
193 // for(IntersectionLocal<2,3> &is : intersection_storage23_) {
194 // DebugOut().fmt("comp-bulk: {} {}\n", is.component_ele_idx(), is.bulk_ele_idx());
195 // }
196 }
197 
199 {
200  START_TIMER("Intersection algorithm");
202  END_TIMER("Intersection algorithm");
203 
204 // START_TIMER("Intersection into storage");
205 //
206 // storage.reserve(algorithm22_.intersectionaux_storage22_.size());
207 //
208 // for(IntersectionAux<2,2> &is : algorithm22_.intersectionaux_storage22_) {
209 // unsigned int triaA_idx = is.component_ele_idx();
210 // unsigned int triaB_idx = is.bulk_ele_idx();
211 //
212 // //HACK: 'skip flag' move this check into algorithm12_.compute_intersections()
213 // bool skip = false;
214 // for(unsigned int i=0; i<element_intersections_[triaA_idx].size(); i++)
215 // {
216 // if(element_intersections_[triaA_idx][i].first == triaB_idx)
217 // skip = true;
218 // }
219 // if(! skip) {
220 // storage.push_back(IntersectionLocal<2,2>(is));
221 // element_intersections_[triaA_idx].push_back(std::make_pair(
222 // triaB_idx,
223 // &(storage.back())
224 // ));
225 // element_intersections_[triaB_idx].push_back(std::make_pair(
226 // triaA_idx,
227 // &(storage.back())
228 // ));
229 //
230 // // DebugOut().fmt("2D-2D intersection [{} - {}]:\n",
231 // // mesh->element_accessor(is.component_ele_idx()).idx(),
232 // // mesh->element_accessor(is.bulk_ele_idx()).idx());
233 // // for(const IntersectionPointAux<2,2>& ip : is.points()) {
234 // // DebugOut() << ip;
235 // // auto p = ip.coords(mesh->element(is.component_ele_idx()));
236 // // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
237 // // }
238 // }
239 // }
240 // DBGVAR(algorithm22_.intersectionaux_storage22_.size());
241 //
242 // END_TIMER("Intersection into storage");
243 }
244 
246 {
247  storage.reserve(intersection_storage13_.size());
249  storage.shrink_to_fit();
250 
251 // START_TIMER("Intersection into storage");
252 // storage.reserve(algorithm12_.intersectionaux_storage12_.size());
253 
254 // for(IntersectionAux<1,2> &is : algorithm12_.intersectionaux_storage12_) {
255 // unsigned int abscissa_idx = is.component_ele_idx();
256 // unsigned int triangle_idx = is.bulk_ele_idx();
257 //
258 // //HACK: 'skip flag' move this check into algorithm12_.compute_intersections()
259 // bool skip = false;
260 // for(unsigned int i=0; i<intersection_map_[abscissa_idx].size(); i++)
261 // {
262 // if(intersection_map_[abscissa_idx][i].first == triangle_idx)
263 // skip = true;
264 // }
265 // if(! skip) {
266 // storage.push_back(IntersectionLocal<1,2>(is));
267 // intersection_map_[abscissa_idx].push_back(std::make_pair(
268 // triangle_idx,
269 // &(storage.back())
270 // ));
271 // intersection_map_[triangle_idx].push_back(std::make_pair(
272 // abscissa_idx,
273 // &(storage.back())
274 // ));
275 // DebugOut().fmt("1D-2D intersection [{} - {}]:\n",is.component_ele_idx(), is.bulk_ele_idx());
276 // for(const IntersectionPointAux<1,2>& ip : is.points()) {
277 // //DebugOut() << ip;
278 // auto p = ip.coords(mesh->element(is.component_ele_idx()));
279 // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
280 // }
281 // }
282 // }
283 // END_TIMER("Intersection into storage");
284 }
285 
287 {
289 // DBGVAR(algorithm12_.intersectionaux_storage12_.size());
290 
291  START_TIMER("Intersection into storage");
292  storage.reserve(algorithm12_.intersectionaux_storage12_.size());
293 
295  store_intersection(storage, is);
296 // DebugOut().fmt("1D-2D intersection [{} - {}]:\n",is.component_ele_idx(), is.bulk_ele_idx());
297 // for(const IntersectionPointAux<1,2>& ip : is.points()) {
298 // //DebugOut() << ip;
299 // auto p = ip.coords(mesh->element(is.component_ele_idx()));
300 // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
301 // }
302  }
303  END_TIMER("Intersection into storage");
304 }
305 
307 {
309 // DBGVAR(algorithm12_.intersectionaux_storage12_.size());
310 
311  START_TIMER("Intersection into storage");
312  storage.reserve(algorithm12_.intersectionaux_storage12_.size());
313 
315  store_intersection(storage, is);
316 // DebugOut().fmt("1D-2D intersection [{} - {}]:\n",is.component_ele_idx(), is.bulk_ele_idx());
317 // for(const IntersectionPointAux<1,2>& ip : is.points()) {
318 // //DebugOut() << ip;
319 // auto p = ip.coords(mesh->element(is.component_ele_idx()));
320 // DebugOut() << "[" << p[0] << " " << p[1] << " " << p[2] << "]\n";
321 // }
322  }
323  END_TIMER("Intersection into storage");
324 }
325 
327 {
329 
330  // check whether the mesh is in plane only
331  bool mesh_in_2d_only = false;
332  auto bb = mesh->get_bih_tree().tree_box();
333  for(uint axis = 0; axis < bb.dimension; axis++)
334  if(bb.size(axis) < geometry_epsilon) mesh_in_2d_only = true;
335 
337  START_TIMER("Intersections 1D-3D");
338 // DebugOut() << "Intersection Algorithm d13\n";
339  compute_intersections<1>(algorithm13_,intersection_storage13_);
340  END_TIMER("Intersections 1D-3D");
341  }
343 
344 
346  START_TIMER("Intersections 2D-3D");
347 // DebugOut() << "Intersection Algorithm d23\n";
348  compute_intersections<2>(algorithm23_,intersection_storage23_);
349  END_TIMER("Intersections 2D-3D");
350  }
352 
353 
354  if(d & IntersectionType::d22){
355  START_TIMER("Intersections 2D-2D");
356 // DebugOut() << "Intersection Algorithm d22\n";
358  END_TIMER("Intersections 2D-2D");
359  }
360 
361  if( mesh_in_2d_only){
362  START_TIMER("Intersections 1D-2D (1)");
364  END_TIMER("Intersections 1D-2D (1)");
365  }
366  // make sence only if some intersections in 3D are computed
367  // TODO: this does NOT compute 1d-2d outside 3d bulk
368  // NOTE: create input record in mesh to decide, whether compute also outside (means to call alg. 2)
369  else if( ! intersection_storage13_.empty() &&
370  ! intersection_storage23_.empty() &&
372  START_TIMER("Intersections 1D-2D (3)");
373  DebugOut() << "Intersection Algorithm d12_3\n";
375  END_TIMER("Intersections 1D-2D (3)");
376  }
377  // otherwise compute 1d-2d in the most general case
378  else if(d & IntersectionType::d12_2){
379  START_TIMER("Intersections 1D-2D (2)");
380  DebugOut() << "Intersection Algorithm d12_2\n";
382  END_TIMER("Intersections 1D-2D (2)");
383  }
384 
385  //ASSERT_EQ(intersection_storage13_.size(), 0);
386  //ASSERT_EQ(intersection_storage23_.size(), 0);
387  //ASSERT_EQ(intersection_storage22_.size(), 0);
388  // compose master
390 
391  // release temporary links from 3d elements
392  for (auto elm : mesh->elements_range()) {
393  if(elm->dim() == 3) element_intersections_[elm.idx()].clear();
394  }
395 
396 
397 
398 }
399 
400 
401 
402 
404 {
405  string t_name = name;
406 
407  unsigned int number_of_intersection_points = 0;
408  unsigned int number_of_nodes = mesh->n_nodes();
409 
410  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
411  number_of_intersection_points += intersection_storage13_[j].size();
412  }
413 
414  FILE * file;
415  file = fopen((t_name.append(".msh")).c_str(),"w");
416 
417  fprintf(file, "$MeshFormat\n");
418  fprintf(file, "2.2 0 8\n");
419  fprintf(file, "$EndMeshFormat\n");
420  fprintf(file, "$Nodes\n");
421  fprintf(file, "%d\n", (mesh->n_nodes() + number_of_intersection_points));
422 
423  unsigned int idx = 1;
424  for (auto nod : mesh->node_range()) {
425  arma::vec3 _nod = nod->point();
426  fprintf(file,"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
427  idx++;
428  }
429 
430  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
433 // ElementAccessor<3> el3D = mesh->element_accessor( il.bulk_ele_idx() );
434 
435  for(unsigned int k = 0; k < il.size();k++){
436  number_of_nodes++;
437  IntersectionPoint<1,3> IP13 = il[k];
438  arma::vec3 global = IP13.coords(el1D);
439 
440 // if(i == 0){
441 // _global = (IP13.local_bcoords_A())[0] * el1D.node(0)->point()
442 // +(IP13.local_bcoords_A())[1] * el1D.node(1)->point();
443 // }else{
444 // _global = (IP13.local_bcoords_B())[0] * el3D.node(0)->point()
445 // +(IP13.local_bcoords_B())[1] * el3D.node(1)->point()
446 // +(IP13.local_bcoords_B())[2] * el3D.node(2)->point()
447 // +(IP13.local_bcoords_B())[3] * el3D.node(3)->point();
448 // }
449 
450  fprintf(file,"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
451  }
452  }
453 
454  fprintf(file,"$EndNodes\n");
455  fprintf(file,"$Elements\n");
456  fprintf(file,"%d\n", ((unsigned int)intersection_storage13_.size() + mesh->n_elements()) );
457 
458  for (auto elee : mesh->elements_range()) {
459  if(elee->dim() == 3){
460  int id1 = elee.node_accessor(0).idx() + 1;
461  int id2 = elee.node_accessor(1).idx() + 1;
462  int id3 = elee.node_accessor(2).idx() + 1;
463  int id4 = elee.node_accessor(3).idx() + 1;
464 
465  fprintf(file,"%d 4 2 %d %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3, id4);
466  }else if(elee->dim() == 2){
467  int id1 = elee.node_accessor(0).idx() + 1;
468  int id2 = elee.node_accessor(1).idx() + 1;
469  int id3 = elee.node_accessor(2).idx() + 1;
470  fprintf(file,"%d 2 2 %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3);
471 
472  }else if(elee->dim() == 1){
473  int id1 = elee.node_accessor(0).idx() + 1;
474  int id2 = elee.node_accessor(1).idx() + 1;
475  fprintf(file,"%d 1 2 %d %d %d %d\n",elee.idx(), elee.region().id(), elee->pid(), id1, id2);
476  }
477  }
478 
479  unsigned int number_of_elements = mesh->n_elements();
480  unsigned int nodes = mesh->n_nodes();
481 
482  for(unsigned int j = 0; j < intersection_storage13_.size();j++){
484  number_of_elements++;
485  nodes++;
486  if(il.size() == 1){
487  fprintf(file,"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes);
488  }else if(il.size() == 2){
489  fprintf(file,"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes+1);
490  nodes++;
491  }
492  }
493 
494  fprintf(file,"$EndElements\n");
495  fclose(file);
496 }
497 
499 {
500  //for(unsigned int i = 0; i < 2;i++){
501  string t_name = name;
502 
503  unsigned int number_of_intersection_points = 0;
504  unsigned int number_of_nodes = mesh->n_nodes();
505 
506  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
507  number_of_intersection_points += intersection_storage23_[j].size();
508  }
509 
510  FILE * file;
511  file = fopen((t_name.append(".msh")).c_str(),"w");
512 
513  fprintf(file, "$MeshFormat\n");
514  fprintf(file, "2.2 0 8\n");
515  fprintf(file, "$EndMeshFormat\n");
516  fprintf(file, "$Nodes\n");
517  fprintf(file, "%d\n", (mesh->n_nodes() + number_of_intersection_points));
518 
519  unsigned int idx = 1;
520  for (auto nod : mesh->node_range()) {
521  arma::vec3 _nod = nod->point();
522  fprintf(file,"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
523  idx++;
524  }
525 
526  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
527 
530 // ElementAccessor<3> el3D = mesh->element_accessor( il.bulk_ele_idx() );
531 
532  for(unsigned int k = 0; k < intersection_storage23_[j].size();k++){
533 
534  number_of_nodes++;
535  IntersectionPoint<2,3> IP23 = il[k];
536  arma::vec3 global = IP23.coords(el2D);
537 // if(i == 0){
538 // _global = (IP23.local_bcoords_A())[0] * el2D.node(0)->point()
539 // +(IP23.local_bcoords_A())[1] * el2D.node(1)->point()
540 // +(IP23.local_bcoords_A())[2] * el2D.node(2)->point();
541 // }else{
542 // _global = (IP23.local_bcoords_B())[0] * el3D.node(0)->point()
543 // +(IP23.local_bcoords_B())[1] * el3D.node(1)->point()
544 // +(IP23.local_bcoords_B())[2] * el3D.node(2)->point()
545 // +(IP23.local_bcoords_B())[3] * el3D.node(3)->point();
546 // }
547  fprintf(file,"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
548  }
549  }
550 
551  fprintf(file,"$EndNodes\n");
552  fprintf(file,"$Elements\n");
553  fprintf(file,"%d\n", (number_of_intersection_points + mesh->n_elements()) );
554 
555  for (auto elee : mesh->elements_range()) {
556  if(elee->dim() == 3){
557  int id1 = elee.node_accessor(0).idx() + 1;
558  int id2 = elee.node_accessor(1).idx() + 1;
559  int id3 = elee.node_accessor(2).idx() + 1;
560  int id4 = elee.node_accessor(3).idx() + 1;
561 
562  fprintf(file,"%d 4 2 %d %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3, id4);
563  }else if(elee->dim() == 2){
564  int id1 = elee.node_accessor(0).idx() + 1;
565  int id2 = elee.node_accessor(1).idx() + 1;
566  int id3 = elee.node_accessor(2).idx() + 1;
567  fprintf(file,"%d 2 2 %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3);
568 
569  }else{
570  int id1 = elee.node_accessor(0).idx() + 1;
571  int id2 = elee.node_accessor(1).idx() + 1;
572  fprintf(file,"%d 1 2 %d %d %d %d\n",elee.idx(), elee.region().id(), elee->pid(), id1, id2);
573  }
574  }
575 
576  unsigned int number_of_elements = mesh->n_elements();
577  unsigned int last = 0;
578  unsigned int nodes = mesh->n_nodes();
579 
580  for(unsigned int j = 0; j < intersection_storage23_.size();j++){
582 
583  for(unsigned int k = 0; k < il.size();k++){
584 
585  number_of_elements++;
586  nodes++;
587  if(k == 0){
588  last = nodes;
589  }
590 
591  if((k+1) == il.size() && il.size()){
592  fprintf(file,"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, last);
593  }else{
594  fprintf(file,"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, nodes+1);
595  }
596  //if(il.size() < 3) break;
597  }
598  }
599 
600  fprintf(file,"$EndElements\n");
601  fclose(file);
602  //}
603 }
604 
605 
IntersectionType
Selection of intersections of different dimensions.
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:331
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.
Definition: mesh.h:76
Class represents intersection of two elements.
Class represents an intersection point of simplex<N> and simplex<M>. It contains barycentric coordina...
InspectElementsAlgorithm< 1 > algorithm13_
static const double geometry_epsilon
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
virtual unsigned int n_nodes() const
Definition: mesh.h:129
void compute_intersections_BIHtree(const BIHTree &bih)
Uses only BIHtree to find intersection candidates. (No prolongation).
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
Definition: mesh.cc:726
unsigned int component_ele_idx() const
Returns index of component element.
void print_mesh_to_file_23(std::string name)
unsigned int dim() const
Definition: elements.h:124
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.
std::vector< IntersectionAux< 1, 2 > > intersectionaux_storage12_
Stores temporarily 1D-2D intersections.
void compute_intersections_12_2(std::vector< IntersectionLocal< 1, 2 >> &storage)
void compute_intersections_3(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...
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:151
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
Definition: ostream.cc:56
void compute_intersections_12_1(std::vector< IntersectionLocal< 1, 2 >> &storage)
const BoundingBox & tree_box() const
Definition: bih_tree.cc:229
#define xprintf(...)
Definition: system.hh:92
#define START_TIMER(tag)
Starts a timer with specified tag.
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
Definition: mesh.cc:1040
std::vector< IntersectionLocal< 1, 3 > > intersection_storage13_
Stores 1D-3D intersections.
double measure() const
Computes the measure of the element.
Definition: accessors.hh:254
void append_to_index(std::vector< IntersectionLocal< dim_A, dim_B >> &storage)
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:931
arma::vec3 coords(ElementAccessor< 3 > comp_ele) const
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
Definition: mesh.h:346
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.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
Definition: system.hh:64
Range< NodeAccessor< 3 > > node_range() const
Returns range of nodes.
Definition: mesh.cc:1046
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...
void compute_intersections_1(const BIHTree &bih)
Runs the algorithm (1): compute 1D-2D intersection in 2D plane. BIH is used to find intersection cand...
IntersectionSearch
Types of search algorithm for finding intersection candidates.
Definition: mesh.h:91
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
std::vector< IntersectionLocal< 2, 2 > > intersection_storage22_
Stores 2D-2D intersections.
void compute_intersections_12_3(std::vector< IntersectionLocal< 1, 2 >> &storage)
#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.
Implementation of range helper class.
std::vector< IntersectionLocal< 2, 3 > > intersection_storage23_
Stores 2D-3D intersections.
Internal class representing intersection object.