From a2236fa383619e797fe9278a13826f85426e45ef Mon Sep 17 00:00:00 2001 From: "Joshua E. Hansel" Date: Fri, 31 Mar 2023 13:37:26 -0500 Subject: [PATCH] Added BlockRestrictable::blocksMaxDimension() Refs #23794 --- framework/include/interfaces/BlockRestrictable.h | 8 ++++++++ framework/src/interfaces/BlockRestrictable.C | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/framework/include/interfaces/BlockRestrictable.h b/framework/include/interfaces/BlockRestrictable.h index a0f8fac7ff7a..e74d77d3d4af 100644 --- a/framework/include/interfaces/BlockRestrictable.h +++ b/framework/include/interfaces/BlockRestrictable.h @@ -107,6 +107,11 @@ class BlockRestrictable */ const virtual std::set & blockIDs() const; + /** + * Return the largest mesh dimension of the elements in the blocks for this object + */ + unsigned int blocksMaxDimension() const { return _blk_dim; } + /** * Test if the supplied block name is valid for this object * @param name A SubdomainName to check @@ -248,6 +253,9 @@ class BlockRestrictable /// Name of the object const std::string & _blk_name; + + /// Largest mesh dimension of the elements in the blocks for this object + unsigned int _blk_dim; }; template diff --git a/framework/src/interfaces/BlockRestrictable.C b/framework/src/interfaces/BlockRestrictable.C index aca124541987..69a07131001d 100644 --- a/framework/src/interfaces/BlockRestrictable.C +++ b/framework/src/interfaces/BlockRestrictable.C @@ -163,6 +163,12 @@ BlockRestrictable::initializeBlockRestrictable(const MooseObject * moose_object) moose_object->paramError("block", msg.str()); } } + + // Get the mesh dimension for the blocks + if (blockRestricted()) + _blk_dim = _blk_mesh->getBlocksMaxDimension(_blocks); + else + _blk_dim = _blk_mesh->dimension(); } bool