MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
pncsubmesh.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_PNCSUBMESH
13#define MFEM_PNCSUBMESH
14
16
17#ifdef MFEM_USE_MPI
18
19#include "../pncmesh.hpp"
20#include "psubmesh.hpp"
21#include "submesh_utils.hpp"
22#include <unordered_map>
23
24namespace mfem
25{
26
27/**
28 * @brief Class representing a Parallel Nonconformal SubMesh. This is only used
29 * by ParSubMesh.
30 */
31class ParNCSubMesh : public ParNCMesh
32{
33 friend class ParSubMesh; ///< Only ParSubMesh can use methods in this class
34public:
35 using From = SubMesh::From; ///< Convenience type alias
36 /**
37 * @brief Check if NCMesh @a m is a ParNCSubMesh.
38 *
39 * @param m The input Mesh
40 */
41 static bool IsParNCSubMesh(const NCMesh *m)
42 {
43 return dynamic_cast<const ParNCSubMesh *>(m) != nullptr;
44 }
45 /// Get the parent ParNCMesh object
46 const ParNCMesh* GetParent() const
47 {
48 return parent_;
49 }
50
51protected:
52 /// protected constructor
53 ParNCSubMesh(ParSubMesh& submesh, const ParNCMesh &parent, From from,
54 const Array<int> &attributes);
55
56 /// The parent ParNCMesh. Not owned.
58
59 /// Mapping from submesh element nc ids (index of the array), to the parent
60 /// element ids. If from a boundary, these map to faces in the parent.
62
63 /// Mapping from ParNCSubMesh node ids (index of the array), to the parent
64 /// NCMesh node ids.
66
67 /// Mapping from parent NCMesh node ids to submesh NCMesh node ids.
68 // Inverse map of parent_node_ids_.
69 std::unordered_map<int, int> parent_to_submesh_node_ids_;
70
71 /// Mapping from parent NCMesh element ids to submesh NCMesh element ids.
72 // Inverse map of parent_element_ids_.
73 std::unordered_map<int, int> parent_to_submesh_element_ids_;
74
75 // Helper friend methods for construction.
77 (ParNCSubMesh &submesh, const Array<int> &attributes);
79 (ParNCSubMesh &submesh, const Array<int> &attributes);
80
81 /**
82 * @brief Accessor for parent nodes
83 * @details Required to bypass access protection in parent class.
84 *
85 * @return const HashTable<Node>&
86 */
87 const HashTable<Node> &ParentNodes() const { return parent_->nodes; }
88
89 /**
90 * @brief Accessor for parent faces
91 * @details Required to bypass access protection in parent class.
92 *
93 * @return const HashTable<Face>&
94 */
95 const HashTable<Face> &ParentFaces() const { return parent_->faces; }
96};
97
98} // namespace mfem
99
100#endif // MFEM_USE_MPI
101
102#endif // MFEM_PNCSUBMESH
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
Definition ncmesh.hpp:140
HashTable< Node > nodes
Definition ncmesh.hpp:619
HashTable< Face > faces
Definition ncmesh.hpp:620
friend class ParNCSubMesh
Definition ncmesh.hpp:1352
A parallel extension of the NCMesh class.
Definition pncmesh.hpp:63
Class representing a Parallel Nonconformal SubMesh. This is only used by ParSubMesh.
Array< int > parent_node_ids_
static bool IsParNCSubMesh(const NCMesh *m)
Check if NCMesh m is a ParNCSubMesh.
Array< int > parent_element_ids_
SubMesh::From From
Convenience type alias.
const HashTable< Face > & ParentFaces() const
Accessor for parent faces.
const ParNCMesh * parent_
The parent ParNCMesh. Not owned.
const HashTable< Node > & ParentNodes() const
Accessor for parent nodes.
const ParNCMesh * GetParent() const
Get the parent ParNCMesh object.
std::unordered_map< int, int > parent_to_submesh_element_ids_
Mapping from parent NCMesh element ids to submesh NCMesh element ids.
std::unordered_map< int, int > parent_to_submesh_node_ids_
Mapping from parent NCMesh node ids to submesh NCMesh node ids.
Subdomain representation of a topological parent in another ParMesh.
Definition psubmesh.hpp:54
From
Indicator from which part of the parent Mesh the SubMesh is created.
Definition submesh.hpp:49
void ConstructFaceTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a surface submesh, from an existing nonconform...
void ConstructVolumeTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a volume submesh, from an existing nonconforma...