MFEM  v4.5.2
Finite element discretization library
marking.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, 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_MARKING_HPP
13 #define MFEM_MARKING_HPP
14 
15 #include "mfem.hpp"
16 
17 namespace mfem
18 {
19 
20 // Marking operations for elements, faces, dofs, etc, related to shifted
21 // boundary and interface methods.
23 {
24 protected:
25  ParMesh &pmesh; // Mesh whose elements have to be marked.
26  ParFiniteElementSpace *pfes_sltn; // FESpace associated with the solution.
27 
28  // Indicates whether cut-cells will be included in assembly.
29  const bool include_cut_cell;
30  // Indicates whether all the elements have been marked at-least once.
32 
33  // Marking of face dofs by using an averaged continuous GridFunction.
34  const bool func_dof_marking = true;
35  // Alternative implementation of ListShiftedFaceDofs().
36  void ListShiftedFaceDofs2(const Array<int> &elem_marker,
37  Array<int> &sface_dof_list) const;
38 
39 private:
40  int level_set_index;
41 
42 public:
43  /// Element type related to shifted boundaries (not interfaces).
44  /// For more than 1 level-set, we set the marker to CUT+level_set_index
45  /// to discern between different level-sets.
46  enum SBElementType {INSIDE = 0, OUTSIDE = 1, CUT = 2};
47 
49  bool include_cut_cell_)
50  : pmesh(pm), pfes_sltn(&pfes),
51  include_cut_cell(include_cut_cell_), initial_marking_done(false),
52  level_set_index(0) { }
53 
54  /// Mark all the elements in the mesh using the @a SBElementType.
55  /// A point is considered inside when the level set function is positive.
56  /// Assumes the ExchangeFaceNbrData() has been called for pmesh, ls_func.
57  void MarkElements(const ParGridFunction &ls_func, Array<int> &elem_marker);
58 
59  /// List dofs associated with the surrogate boundary.
60  /// If @a include_cut_cell = false, the surrogate boundary includes faces
61  /// between elements cut by the true boundary and the elements that are
62  /// located inside the true domain.
63  /// If @a include_cut_cell = true, the surrogate boundary is the faces
64  /// between elements outside the true domain and the elements cut by the true
65  /// boundary.
66  void ListShiftedFaceDofs(const Array<int> &elem_marker,
67  Array<int> &sface_dof_list) const;
68 
69  /// List the dofs that will be inactive for the computation on the surrogate
70  /// domain. This includes dofs for the elements located outside the true
71  /// domain (and optionally, for the elements cut by the true boundary, if
72  /// @a include_cut_cell = false) minus the dofs that are located on the
73  /// surrogate boundary.
74  void ListEssentialTDofs(const Array<int> &elem_marker,
75  const Array<int> &sface_dof_list,
76  Array<int> &ess_tdof_list,
77  Array<int> &ess_shift_bdr) const;
78 };
79 
80 } // namespace mfem
81 
82 #endif
const bool include_cut_cell
Definition: marking.hpp:29
Abstract parallel finite element space.
Definition: pfespace.hpp:28
void ListShiftedFaceDofs2(const Array< int > &elem_marker, Array< int > &sface_dof_list) const
Definition: marking.cpp:305
ParFiniteElementSpace * pfes_sltn
Definition: marking.hpp:26
void ListEssentialTDofs(const Array< int > &elem_marker, const Array< int > &sface_dof_list, Array< int > &ess_tdof_list, Array< int > &ess_shift_bdr) const
Definition: marking.cpp:202
ShiftedFaceMarker(ParMesh &pm, ParFiniteElementSpace &pfes, bool include_cut_cell_)
Definition: marking.hpp:48
void ListShiftedFaceDofs(const Array< int > &elem_marker, Array< int > &sface_dof_list) const
Definition: marking.cpp:106
const bool func_dof_marking
Definition: marking.hpp:34
Class for parallel grid function.
Definition: pgridfunc.hpp:32
Class for parallel meshes.
Definition: pmesh.hpp:32
void MarkElements(const ParGridFunction &ls_func, Array< int > &elem_marker)
Definition: marking.cpp:17