26 : mesh(mesh), algorithm13_(mesh), algorithm23_(mesh), algorithm22_(mesh), algorithm12_(mesh)
35 ASSERT_EQ(dim, 2).error(
"Not implemented for given dim.\n");
43 double subtotal = 0.0;
47 double t1d_length = ele.
measure();
59 subtotal += local_length*t1d_length;
67 double subtotal = 0.0;
72 subtotal += 2*localArea*t2dArea;
80 double subtotal = 0.0;
91 val = arma::norm(from - to, 2);
105 template<u
int dim_A, u
int dim_B>
118 storage.push_back(isec);
129 template<u
int dim_A, u
int dim_B>
132 for(
auto &isec : storage) {
134 unsigned int ele_a_idx = isec.component_ele_idx();
135 unsigned int ele_b_idx = isec.bulk_ele_idx();
139 std::make_pair(ele_b_idx, &(isec)) );
145 std::make_pair(ele_a_idx, &(isec)) );
155 template<
unsigned int dim>
175 unsigned int idx = elm.idx();
177 if(elm->dim() == dim)
246 storage.shrink_to_fit();
328 bool mesh_in_2d_only =
false;
330 for(
uint axis = 0; axis < bb.dimension; axis++)
358 if( mesh_in_2d_only){
370 DebugOut() <<
"Intersection Algorithm d12_3\n";
377 DebugOut() <<
"Intersection Algorithm d12_2\n";
402 string t_name = name;
404 unsigned int number_of_intersection_points = 0;
412 file = fopen((t_name.append(
".msh")).c_str(),
"w");
414 fprintf(file,
"$MeshFormat\n");
416 fprintf(file,
"$EndMeshFormat\n");
420 unsigned int idx = 1;
423 fprintf(file,
"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
432 for(
unsigned int k = 0; k < il.
size();k++){
447 fprintf(file,
"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
456 if(elee->dim() == 3){
457 int id1 = elee.node(0).idx() + 1;
458 int id2 = elee.node(1).idx() + 1;
459 int id3 = elee.node(2).idx() + 1;
460 int id4 = elee.node(3).idx() + 1;
462 fprintf(file,
"%d 4 2 %d %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3, id4);
463 }
else if(elee->dim() == 2){
464 int id1 = elee.node(0).idx() + 1;
465 int id2 = elee.node(1).idx() + 1;
466 int id3 = elee.node(2).idx() + 1;
467 fprintf(file,
"%d 2 2 %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3);
469 }
else if(elee->dim() == 1){
470 int id1 = elee.node(0).idx() + 1;
471 int id2 = elee.node(1).idx() + 1;
472 fprintf(file,
"%d 1 2 %d %d %d %d\n",elee.idx(), elee.region().id(), elee->pid(), id1, id2);
481 number_of_elements++;
484 fprintf(file,
"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes);
485 }
else if(il.
size() == 2){
486 fprintf(file,
"%d 1 2 1001 0 %d %d\n", number_of_elements, nodes, nodes+1);
491 fprintf(file,
"$EndElements\n");
498 string t_name = name;
500 unsigned int number_of_intersection_points = 0;
508 file = fopen((t_name.append(
".msh")).c_str(),
"w");
510 fprintf(file,
"$MeshFormat\n");
512 fprintf(file,
"$EndMeshFormat\n");
516 unsigned int idx = 1;
519 fprintf(file,
"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
544 fprintf(file,
"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
553 if(elee->dim() == 3){
554 int id1 = elee.node(0).idx() + 1;
555 int id2 = elee.node(1).idx() + 1;
556 int id3 = elee.node(2).idx() + 1;
557 int id4 = elee.node(3).idx() + 1;
559 fprintf(file,
"%d 4 2 %d %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3, id4);
560 }
else if(elee->dim() == 2){
561 int id1 = elee.node(0).idx() + 1;
562 int id2 = elee.node(1).idx() + 1;
563 int id3 = elee.node(2).idx() + 1;
564 fprintf(file,
"%d 2 2 %d %d %d %d %d\n", elee.idx(), elee.region().id(), elee->pid(), id1, id2, id3);
567 int id1 = elee.node(0).idx() + 1;
568 int id2 = elee.node(1).idx() + 1;
569 fprintf(file,
"%d 1 2 %d %d %d %d\n",elee.idx(), elee.region().id(), elee->pid(), id1, id2);
574 unsigned int last = 0;
580 for(
unsigned int k = 0; k < il.
size();k++){
582 number_of_elements++;
588 if((k+1) == il.
size() && il.
size()){
589 fprintf(file,
"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, last);
591 fprintf(file,
"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, nodes+1);
597 fprintf(file,
"$EndElements\n");
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
const BoundingBox & tree_box() const
double measure() const
Computes the measure of the element.
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...
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...
std::vector< IntersectionAux< 1, 2 > > intersectionaux_storage12_
Stores temporarily 1D-2D intersections.
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...
unsigned int component_counter_
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.
Class implements algorithm for dim-dimensional intersections with 3D elements.
void compute_intersections_BB()
void compute_intersections(const BIHTree &bih)
Uses BIHtree to find the initial candidate of a component and then prolongates the component interset...
unsigned int n_intersections_
Counter for intersection among elements.
std::vector< std::vector< IntersectionAux< dim, 3 > > > intersection_list_
Resulting vector of intersections.
void compute_intersections_BIHtree(const BIHTree &bih)
Uses only BIHtree to find intersection candidates. (No prolongation).
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
unsigned int component_ele_idx() const
Returns index of component element.
Class represents intersection of two elements.
unsigned int size() const
Returns number of intersection points.
Class represents an intersection point of simplex<N> and simplex<M>. It contains barycentric coordina...
arma::vec3 coords(ElementAccessor< 3 > comp_ele) const
unsigned int n_nodes() const
unsigned int n_elements() const
Range< ElementAccessor< 3 > > elements_range() const
Returns range of mesh elements.
Range< NodeAccessor< 3 > > node_range() const
Returns range of nodes.
ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
IntersectionSearch get_intersection_search()
Getter for input type selection for intersection search algorithm.
const BIHTree & get_bih_tree()
Getter for BIH. Creates and compute BIH at first call.
IntersectionSearch
Types of search algorithm for finding intersection candidates.
void print_mesh_to_file_23(std::string name)
void compute_intersections(IntersectionType d=IntersectionType::all)
InspectElementsAlgorithm12 algorithm12_
double measure_13()
Computes the size of the intersection in dim dimenstions.
void compute_intersections_12_3(std::vector< IntersectionLocal< 1, 2 >> &storage)
void append_to_index(std::vector< IntersectionLocal< dim_A, dim_B >> &storage)
void print_mesh_to_file_13(std::string name)
Generates a mesh file of the given name, including the intersection.
std::vector< IntersectionLocal< 1, 3 > > intersection_storage13_
Stores 1D-3D intersections.
unsigned int number_of_components(unsigned int dim)
InspectElementsAlgorithm22 algorithm22_
InspectElementsAlgorithm< 2 > algorithm23_
void compute_intersections_12_1(std::vector< IntersectionLocal< 1, 2 >> &storage)
std::vector< std::vector< ILpair > > element_intersections_
InspectElementsAlgorithm< 1 > algorithm13_
~MixedMeshIntersections()
std::vector< IntersectionLocal< 2, 2 > > intersection_storage22_
Stores 2D-2D intersections.
std::vector< IntersectionLocal< 2, 3 > > intersection_storage23_
Stores 2D-3D intersections.
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
void store_intersection(std::vector< IntersectionLocal< dim_A, dim_B >> &storage, IntersectionAux< dim_A, dim_B > &isec_aux)
void compute_intersections_22(std::vector< IntersectionLocal< 2, 2 >> &storage)
void compute_intersections_12_2(std::vector< IntersectionLocal< 1, 2 >> &storage)
MixedMeshIntersections(Mesh *mesh)
Global macros to enhance readability and debugging, general constants.
Internal class representing intersection object.
Classes with algorithms for computation of intersections of meshes.
Internal class representing intersection point.
static const double geometry_epsilon
#define DebugOut()
Macro defining 'debug' record of log.
IntersectionType
Selection of intersections of different dimensions.
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
Implementation of range helper class.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
#define END_TIMER(tag)
Ends a timer with specified tag.
#define START_TIMER(tag)
Starts a timer with specified tag.