29 : mesh(mesh), algorithm13_(mesh), algorithm23_(mesh), algorithm22_(mesh), algorithm12_(mesh)
41 else xprintf(
Err,
"Not implemented for dim %d\n.",dim);
48 double subtotal = 0.0;
52 double t1d_length = ele->measure();
64 subtotal += local_length*t1d_length;
72 double subtotal = 0.0;
77 subtotal += 2*localArea*t2dArea;
85 double subtotal = 0.0;
96 val = arma::norm(from - to, 2);
110 template<u
int dim_A, u
int dim_B>
123 storage.push_back(isec);
134 template<u
int dim_A, u
int dim_B>
137 for(
auto &isec : storage) {
139 unsigned int ele_a_idx = isec.component_ele_idx();
140 unsigned int ele_b_idx = isec.bulk_ele_idx();
144 std::make_pair(ele_b_idx, &(isec)) );
150 std::make_pair(ele_a_idx, &(isec)) );
160 template<
unsigned int dim>
171 default:
ASSERT(0).error(
"Unsupported search algorithm.");
180 unsigned int idx = elm->index();
181 unsigned int bulk_idx;
183 if(elm->dim() == dim)
253 storage.shrink_to_fit();
331 if (ele.
dim() == 1) {
335 for(
unsigned int i_elm : candidate_list) {
337 if (elm->dim() == 2) {
443 string t_name = name;
445 unsigned int number_of_intersection_points = 0;
453 file = fopen((t_name.append(
".msh")).c_str(),
"w");
455 fprintf(file,
"$MeshFormat\n");
457 fprintf(file,
"$EndMeshFormat\n");
461 unsigned int idx = 1;
464 fprintf(file,
"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
473 for(
unsigned int k = 0; k < il.
size();k++){
488 fprintf(file,
"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
497 if(elee->dim() == 3){
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){
508 fprintf(file,
"%d 2 2 %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3);
510 }
else if(elee->dim() == 1){
513 fprintf(file,
"%d 1 2 %d %d %d %d\n",elee.id(), elee->region().id(), elee->pid, id1, id2);
522 number_of_elements++;
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);
532 fprintf(file,
"$EndElements\n");
539 string t_name = name;
541 unsigned int number_of_intersection_points = 0;
549 file = fopen((t_name.append(
".msh")).c_str(),
"w");
551 fprintf(file,
"$MeshFormat\n");
553 fprintf(file,
"$EndMeshFormat\n");
557 unsigned int idx = 1;
560 fprintf(file,
"%d %.16f %.16f %.16f\n", idx, _nod[0], _nod[1], _nod[2]);
585 fprintf(file,
"%d %.16f %.16f %.16f\n", number_of_nodes, global[0], global[1], global[2]);
594 if(elee->dim() == 3){
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){
605 fprintf(file,
"%d 2 2 %d %d %d %d %d\n", elee.id(), elee->region().id(), elee->pid, id1, id2, id3);
610 fprintf(file,
"%d 1 2 %d %d %d %d\n",elee.id(), elee->region().id(), elee->pid, id1, id2);
615 unsigned int last = 0;
621 for(
unsigned int k = 0; k < il.
size();k++){
623 number_of_elements++;
629 if((k+1) == il.
size() && il.
size()){
630 fprintf(file,
"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, last);
632 fprintf(file,
"%d 1 2 1002 0 %d %d\n", number_of_elements, nodes, nodes+1);
638 fprintf(file,
"$EndElements\n");
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.
unsigned int n_points() const
void compute_intersections_22(std::vector< IntersectionLocal< 2, 2 >> &storage)
Classes with algorithms for computation of intersections of meshes.
MixedMeshIntersections(Mesh *mesh)
void print_mesh_to_file_13(std::string name)
Generates a mesh file of the given name, including the intersection.
#define FOR_ELEMENTS(_mesh_, __i)
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
Class represents intersection of two elements.
Class represents an intersection point of simplex<N> and simplex<M>. It contains barycentric coordina...
InspectElementsAlgorithm< 1 > algorithm13_
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...
unsigned int component_counter_
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)
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
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
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.
FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args)
#define START_TIMER(tag)
Starts a timer with specified tag.
Class for O(log N) lookup for intersections with a set of bounding boxes.
unsigned int index(const T *pointer) const
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)
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.
void compute_intersections_BB()
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)
~MixedMeshIntersections()
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...
unsigned int n_nodes() const
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.
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 'debug' record of log.
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.
ElementVector element
Vector of elements of the mesh.
Internal class representing intersection object.
BoundingBox bounding_box()