https://mooseframework.inl.gov
MooseMeshXYCuttingUtils.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "libmesh/mesh_base.h"
13 #include "libmesh/boundary_info.h"
14 #include "libmesh/replicated_mesh.h"
15 
16 #include "MooseUtils.h"
17 #include "MooseTypes.h"
18 #include "FaceInfo.h"
19 
21 {
40  const std::vector<Real> & bdry_pars,
41  const subdomain_id_type block_id_to_remove,
42  const std::set<subdomain_id_type> & subdomain_ids_set,
43  const boundary_id_type trimming_section_boundary_id,
44  const boundary_id_type external_boundary_id,
45  const std::vector<boundary_id_type> & other_boundaries_to_conform =
46  std::vector<boundary_id_type>(),
47  const bool assign_ext_to_new = false,
48  const bool side_to_remove = true);
49 
61 bool lineSideDeterminator(const Real px,
62  const Real py,
63  const Real param_1,
64  const Real param_2,
65  const Real param_3,
66  const bool direction_param,
67  const Real dis_tol = libMesh::TOLERANCE);
68 
79 Point twoLineIntersection(const Real param_11,
80  const Real param_12,
81  const Real param_13,
82  const Real param_21,
83  const Real param_22,
84  const Real param_23);
85 
96 Point twoPointandLineIntersection(const Point & pt1,
97  const Point & pt2,
98  const Real param_1,
99  const Real param_2,
100  const Real param_3);
101 
111 bool
113  const std::set<subdomain_id_type> & subdomain_ids_set,
114  const subdomain_id_type tri_elem_subdomain_shift = Moose::INVALID_BLOCK_ID,
115  const SubdomainName tri_elem_subdomain_name_suffix = "tri");
116 
122 std::vector<std::pair<Real, unsigned int>> vertex_angles(const Elem & elem);
123 
129 std::vector<std::pair<Real, unsigned int>> vertex_distances(const Elem & elem);
130 
143  const dof_id_type elem_id,
144  const unsigned short node_shift,
145  const dof_id_type nid_3,
146  const dof_id_type nid_4,
147  const subdomain_id_type single_elem_side_id,
148  const subdomain_id_type double_elem_side_id);
149 
161  const dof_id_type elem_id,
162  const unsigned short node_shift,
163  const dof_id_type nid_m,
164  const subdomain_id_type first_elem_side_id,
165  const subdomain_id_type second_elem_side_id);
166 
174  const dof_id_type elem_id,
175  const subdomain_id_type tri_elem_subdomain_shift);
176 
187  const std::vector<Real> & cut_line_params,
188  const dof_id_type tri_subdomain_id_shift,
189  const SubdomainName tri_elem_subdomain_name_suffix);
190 
201  const std::vector<Real> & cut_line_params,
202  const subdomain_id_type block_id_to_remove,
203  const boundary_id_type new_boundary_id);
204 
221  const std::vector<Real> & cut_line_params,
222  const dof_id_type tri_subdomain_id_shift,
223  const SubdomainName tri_elem_subdomain_name_suffix,
224  const subdomain_id_type block_id_to_remove,
225  const boundary_id_type new_boundary_id,
226  const bool improve_boundary_tri_elems = false);
227 
234  const boundary_id_type boundary_to_improve);
235 
250  const dof_id_type node_id_0,
251  const dof_id_type node_id_1,
252  const dof_id_type node_id_2,
253  const subdomain_id_type subdomain_id,
254  const std::vector<dof_id_type> & extra_elem_ids,
255  const std::vector<boundary_id_type> & boundary_ids_for_side_1 = std::vector<boundary_id_type>(),
256  const std::vector<boundary_id_type> & boundary_ids_for_side_0 = std::vector<boundary_id_type>(),
257  const std::vector<boundary_id_type> & boundary_ids_for_side_2 =
258  std::vector<boundary_id_type>());
259 
272  const dof_id_type elem_id,
273  const dof_id_type node_id_0,
274  const dof_id_type node_id_1,
275  unsigned short & side_id,
276  bool & is_inverse);
277 }
void triElemSplitter(libMesh::ReplicatedMesh &mesh, const dof_id_type elem_id, const unsigned short node_shift, const dof_id_type nid_3, const dof_id_type nid_4, const subdomain_id_type single_elem_side_id, const subdomain_id_type double_elem_side_id)
Split a TRI3 element into three TRI3 elements based on two nodes on the two sides of the triangle...
void boundaryTriElemImprover(libMesh::ReplicatedMesh &mesh, const boundary_id_type boundary_to_improve)
Improve the element quality of the boundary TRI3 elements of the given boundary.
void lineRemoverCutElem(libMesh::ReplicatedMesh &mesh, const std::vector< Real > &cut_line_params, const dof_id_type tri_subdomain_id_shift, const SubdomainName tri_elem_subdomain_name_suffix, const subdomain_id_type block_id_to_remove, const boundary_id_type new_boundary_id, const bool improve_boundary_tri_elems=false)
Trim the 2D mesh by removing all the elements on one side of the given line.
std::vector< std::pair< Real, unsigned int > > vertex_angles(const Elem &elem)
Calculates the internal angles of a given 2D element.
Point twoPointandLineIntersection(const Point &pt1, const Point &pt2, const Real param_1, const Real param_2, const Real param_3)
Calculates the intersection Point of a straight line defined by two given points and another straight...
static constexpr Real TOLERANCE
void makeImprovedTriElement(libMesh::ReplicatedMesh &mesh, const dof_id_type node_id_0, const dof_id_type node_id_1, const dof_id_type node_id_2, const subdomain_id_type subdomain_id, const std::vector< dof_id_type > &extra_elem_ids, const std::vector< boundary_id_type > &boundary_ids_for_side_1=std::vector< boundary_id_type >(), const std::vector< boundary_id_type > &boundary_ids_for_side_0=std::vector< boundary_id_type >(), const std::vector< boundary_id_type > &boundary_ids_for_side_2=std::vector< boundary_id_type >())
Make a TRI3 element with the given node ids and subdomain id with boundary information.
const boundary_id_type side_id
MeshBase & mesh
void quadElemSplitter(libMesh::ReplicatedMesh &mesh, const dof_id_type elem_id, const subdomain_id_type tri_elem_subdomain_shift)
Split a QUAD4 element into two TRI3 elements.
void lineRemoverMoveNode(libMesh::ReplicatedMesh &mesh, const std::vector< Real > &bdry_pars, const subdomain_id_type block_id_to_remove, const std::set< subdomain_id_type > &subdomain_ids_set, const boundary_id_type trimming_section_boundary_id, const boundary_id_type external_boundary_id, const std::vector< boundary_id_type > &other_boundaries_to_conform=std::vector< boundary_id_type >(), const bool assign_ext_to_new=false, const bool side_to_remove=true)
Removes all the elements on one side of a given line and deforms the elements intercepted by the line...
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.C:20
int8_t boundary_id_type
std::vector< std::pair< Real, unsigned int > > vertex_distances(const Elem &elem)
Calculates the distances between the vertices of a given 2D element.
bool elemSideLocator(libMesh::ReplicatedMesh &mesh, const dof_id_type elem_id, const dof_id_type node_id_0, const dof_id_type node_id_1, unsigned short &side_id, bool &is_inverse)
Check if there is a side in an element that contains the given pair of nodes; if yes, also find the side id and the direction of the two nodes in the side.
bool quasiTriElementsFixer(libMesh::ReplicatedMesh &mesh, const std::set< subdomain_id_type > &subdomain_ids_set, const subdomain_id_type tri_elem_subdomain_shift=Moose::INVALID_BLOCK_ID, const SubdomainName tri_elem_subdomain_name_suffix="tri")
Fixes degenerate QUAD elements created by the hexagonal mesh trimming by converting them into TRI ele...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool lineSideDeterminator(const Real px, const Real py, const Real param_1, const Real param_2, const Real param_3, const bool direction_param, const Real dis_tol=libMesh::TOLERANCE)
Determines whether a point on XY-plane is on the side of a given line that needs to be removed...
void quadToTriOnLine(libMesh::ReplicatedMesh &mesh, const std::vector< Real > &cut_line_params, const dof_id_type tri_subdomain_id_shift, const SubdomainName tri_elem_subdomain_name_suffix)
Convert all the QUAD4 elements in the mesh that are crossed by the given line into TRI3 elements...
uint8_t dof_id_type
Point twoLineIntersection(const Real param_11, const Real param_12, const Real param_13, const Real param_21, const Real param_22, const Real param_23)
Calculates the intersection Point of two given straight lines.
void lineRemoverCutElemTri(libMesh::ReplicatedMesh &mesh, const std::vector< Real > &cut_line_params, const subdomain_id_type block_id_to_remove, const boundary_id_type new_boundary_id)
Trim the 2D mesh by removing all the elements on one side of the given line.