Line data Source code
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/elem.h" 13 : #include "libmesh/point.h" 14 : 15 : namespace MeshTraversingUtils 16 : { 17 : /** 18 : * Determines whether the given element's subdomain id is in the given subdomain_id_list. 19 : * @param elem pointer to the element to consider 20 : * @param subdomain_id_list vector of subdomains to consider 21 : */ 22 : inline bool 23 1055700 : elementSubdomainIdInList(const Elem * const elem, 24 : const std::vector<subdomain_id_type> & subdomain_id_list) 25 : { 26 1055700 : return std::find(subdomain_id_list.begin(), subdomain_id_list.end(), elem->subdomain_id()) != 27 2111400 : subdomain_id_list.end(); 28 : } 29 : 30 : /** 31 : * Determines whether two normal vectors are within normal_tol of each other. 32 : * @param normal_1 The first normal vector to compare to normal_2. 33 : * @param normal_2 The second normal vector to compare to normal_1. 34 : * @param tol The comparison tolerance. 35 : * @return A bool indicating whether 1 - dot(normal_1, normal_2) <= tol. 36 : */ 37 : inline bool 38 2109297 : normalsWithinTol(const Point & normal_1, const Point & normal_2, const Real tol) 39 : { 40 2109297 : return (1.0 - normal_1 * normal_2) <= tol; 41 : } 42 : }