https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
60bool pointOnLine(const Real px,
61 const Real py,
62 const Real param_1,
63 const Real param_2,
64 const Real param_3,
65 const Real dis_tol = libMesh::TOLERANCE);
66
78bool lineSideDeterminator(const Real px,
79 const Real py,
80 const Real param_1,
81 const Real param_2,
82 const Real param_3,
83 const bool direction_param,
84 const Real dis_tol = libMesh::TOLERANCE);
85
96Point twoLineIntersection(const Real param_11,
97 const Real param_12,
98 const Real param_13,
99 const Real param_21,
100 const Real param_22,
101 const Real param_23);
102
113Point twoPointandLineIntersection(const Point & pt1,
114 const Point & pt2,
115 const Real param_1,
116 const Real param_2,
117 const Real param_3);
118
128bool
130 const std::set<subdomain_id_type> & subdomain_ids_set,
131 const subdomain_id_type tri_elem_subdomain_shift = Moose::INVALID_BLOCK_ID,
132 const SubdomainName tri_elem_subdomain_name_suffix = "tri");
133
139std::vector<std::pair<Real, unsigned int>> vertex_angles(const Elem & elem);
140
146std::vector<std::pair<Real, unsigned int>> vertex_distances(const Elem & elem);
147
160 const dof_id_type elem_id,
161 const unsigned short node_shift,
162 const dof_id_type nid_3,
163 const dof_id_type nid_4,
164 const subdomain_id_type single_elem_side_id,
165 const subdomain_id_type double_elem_side_id);
166
178 const dof_id_type elem_id,
179 const unsigned short node_shift,
180 const dof_id_type nid_m,
181 const subdomain_id_type first_elem_side_id,
182 const subdomain_id_type second_elem_side_id);
183
191 const dof_id_type elem_id,
192 const subdomain_id_type tri_elem_subdomain_shift);
193
204 const std::vector<Real> & cut_line_params,
205 const dof_id_type tri_subdomain_id_shift,
206 const SubdomainName tri_elem_subdomain_name_suffix);
207
218 const std::vector<Real> & cut_line_params,
219 const subdomain_id_type block_id_to_remove,
220 const boundary_id_type new_boundary_id);
221
238 const std::vector<Real> & cut_line_params,
239 const dof_id_type tri_subdomain_id_shift,
240 const SubdomainName tri_elem_subdomain_name_suffix,
241 const subdomain_id_type block_id_to_remove,
242 const boundary_id_type new_boundary_id,
243 const bool improve_boundary_tri_elems = false);
244
251 const boundary_id_type boundary_to_improve);
252
267 const dof_id_type node_id_0,
268 const dof_id_type node_id_1,
269 const dof_id_type node_id_2,
270 const subdomain_id_type subdomain_id,
271 const std::vector<dof_id_type> & extra_elem_ids,
272 const std::vector<boundary_id_type> & boundary_ids_for_side_1 = std::vector<boundary_id_type>(),
273 const std::vector<boundary_id_type> & boundary_ids_for_side_0 = std::vector<boundary_id_type>(),
274 const std::vector<boundary_id_type> & boundary_ids_for_side_2 =
275 std::vector<boundary_id_type>());
276
289 const dof_id_type elem_id,
290 const dof_id_type node_id_0,
291 const dof_id_type node_id_1,
292 unsigned short & side_id,
293 bool & is_inverse);
294}
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.
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.
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...
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,...
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.
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...
bool pointOnLine(const Real px, const Real py, const Real param_1, const Real param_2, const Real param_3, const Real dis_tol=libMesh::TOLERANCE)
Determines whether a point on XY-plane is on a given line, to within a tolerance.
std::vector< std::pair< Real, unsigned int > > vertex_distances(const Elem &elem)
Calculates the distances between the vertices of a given 2D element.
std::vector< std::pair< Real, unsigned int > > vertex_angles(const Elem &elem)
Calculates the internal angles of a given 2D element.
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.
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.
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 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 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.
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...
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.
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20
static constexpr Real TOLERANCE