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 : // MOOSE includes 11 : #include "BoundaryNodeIntegrityCheckThread.h" 12 : #include "BoundaryElemIntegrityCheckThread.h" 13 : #include "AuxiliarySystem.h" 14 : #include "NonlinearSystemBase.h" 15 : #include "FEProblemBase.h" 16 : #include "NodalUserObject.h" 17 : #include "MooseMesh.h" 18 : #include "MooseObjectTagWarehouse.h" 19 : 20 : #include "libmesh/threads.h" 21 : #include "libmesh/node.h" 22 : #include "libmesh/mesh_base.h" 23 : 24 : #include <vector> 25 : 26 59571 : BoundaryNodeIntegrityCheckThread::BoundaryNodeIntegrityCheckThread( 27 59571 : FEProblemBase & fe_problem, const TheWarehouse::Query & query) 28 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem), 29 119142 : _aux_sys(fe_problem.getAuxiliarySystem()), 30 59571 : _nodal_aux(_aux_sys.nodalAuxWarehouse()), 31 59571 : _nodal_vec_aux(_aux_sys.nodalVectorAuxWarehouse()), 32 59571 : _nodal_array_aux(_aux_sys.nodalArrayAuxWarehouse()), 33 59571 : _query(query) 34 : { 35 59571 : } 36 : 37 : // Splitting Constructor 38 31 : BoundaryNodeIntegrityCheckThread::BoundaryNodeIntegrityCheckThread( 39 31 : BoundaryNodeIntegrityCheckThread & x, Threads::split split) 40 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split), 41 31 : _aux_sys(x._aux_sys), 42 31 : _nodal_aux(x._nodal_aux), 43 31 : _nodal_vec_aux(x._nodal_vec_aux), 44 31 : _nodal_array_aux(x._nodal_array_aux), 45 31 : _query(x._query) 46 : { 47 31 : } 48 : 49 : void 50 4567735 : BoundaryNodeIntegrityCheckThread::onNode(ConstBndNodeRange::const_iterator & node_it) 51 : { 52 4567735 : const BndNode * const bnode = *node_it; 53 4567735 : const auto boundary_id = bnode->_bnd_id; 54 4567735 : const Node * const node = bnode->_node; 55 : 56 : // We can distribute work just as the actual execution code will 57 4567735 : if (node->processor_id() != _fe_problem.processor_id()) 58 935748 : return; 59 : 60 3631987 : const auto & bnd_name = _fe_problem.mesh().getBoundaryName(boundary_id); 61 : 62 : // uo check 63 3631987 : std::vector<NodalUserObject *> objs; 64 3631987 : _query.clone() 65 3631987 : .condition<AttribThread>(_tid) 66 3631987 : .condition<AttribInterfaces>(Interfaces::NodalUserObject) 67 7263974 : .condition<AttribBoundaries>(boundary_id, true) 68 3631987 : .queryInto(objs); 69 3646529 : for (const auto & uo : objs) 70 14548 : if (uo->checkVariableBoundaryIntegrity()) 71 14548 : boundaryIntegrityCheckError(*uo, uo->checkAllVariables(*node), bnd_name); 72 : 73 10895937 : auto check = [node, boundary_id, &bnd_name, this](const auto & warehouse) 74 : { 75 10895937 : if (!warehouse.hasBoundaryObjects(boundary_id, _tid)) 76 10872342 : return; 77 : 78 23595 : const auto & bnd_objects = warehouse.getBoundaryObjects(boundary_id, _tid); 79 151707 : for (const auto & bnd_object : bnd_objects) 80 : // Skip if this object uses geometric search because coupled variables may be defined on 81 : // paired boundaries instead of the boundary this node is on 82 128115 : if (!bnd_object->requiresGeometricSearch() && bnd_object->checkVariableBoundaryIntegrity()) 83 417 : boundaryIntegrityCheckError(*bnd_object, bnd_object->checkAllVariables(*node), bnd_name); 84 3631981 : }; 85 : 86 3631981 : check(_nodal_aux); 87 3631978 : check(_nodal_vec_aux); 88 3631978 : check(_nodal_array_aux); 89 3631978 : } 90 : 91 : void 92 31 : BoundaryNodeIntegrityCheckThread::join(const BoundaryNodeIntegrityCheckThread & /*y*/) 93 : { 94 31 : }