MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
sub_elem_mesh_refinement.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __mast__sub_elem_mesh_refinement_h__
21 #define __mast__sub_elem_mesh_refinement_h__
22 
23 // MAST includes
24 #include "base/mast_data_types.h"
25 
26 // libMesh includes
27 #include "libmesh/mesh_base.h"
28 #include "libmesh/system.h"
29 
30 
31 namespace MAST {
32 
33  // Forward declerations
34  template <typename ValType> class FieldFunction;
35  class LevelSetIntersection;
36  class SubElemNodeMap;
37 
39  public libMesh::System::Constraint {
40 
41  public:
42 
43  SubElemMeshRefinement(libMesh::MeshBase& mesh,
44  libMesh::System& sys);
45 
46  virtual ~SubElemMeshRefinement();
47 
48  bool initialized() { return _initialized; }
49 
51  bool strong_discontinuity,
52  Real time,
53  unsigned int negative_level_set_subdomain_offset,
54  unsigned int inactive_subdomain_offset,
55  unsigned int level_set_boundary_id);
56 
57  bool clear_mesh();
58 
63  virtual void
64  constrain ();
65 
66  protected:
67 
68  void _process_sub_elements(bool strong_discontinuity,
69  unsigned int negative_level_set_subdomain_offset,
70  unsigned int level_set_boundary_id,
71  libMesh::Elem& e,
72  MAST::LevelSetIntersection& intersect,
73  bool positive_phi,
74  const std::vector<const libMesh::Elem*>& elems);
75 
76  void _process_negative_element(unsigned int negative_level_set_subdomain_offset,
77  unsigned level_set_boundary_id,
78  libMesh::Elem& e,
79  MAST::LevelSetIntersection& intersect);
80 
87  libMesh::Node*
88  _add_node(const libMesh::Point& p,
89  bool strong_disontinuity,
90  bool positive_phi,
91  unsigned int processor_id,
92  const std::pair<const libMesh::Node*, const libMesh::Node*>& bounding_nodes);
93 
94  libMesh::Elem* _add_elem();
95 
97 
99 
101 
103 
105 
106  libMesh::MeshBase& _mesh;
107 
108  libMesh::System& _system;
109 
110  // map for storing new nodes
112 
113  std::set<unsigned int> _negative_level_set_ids;
114  std::vector<libMesh::Node*> _new_nodes;
115  std::vector<libMesh::Elem*> _new_elems;
116  std::vector<std::pair<libMesh::Elem*, unsigned int>> _old_elems;
117  std::set<std::pair<const libMesh::Node*, std::pair<const libMesh::Node*, const libMesh::Node*>>> _hanging_node;
118  };
119 }
120 
121 
122 #endif // __mast__sub_elem_mesh_refinement_h__
bool process_mesh(const MAST::FieldFunction< Real > &phi, bool strong_discontinuity, Real time, unsigned int negative_level_set_subdomain_offset, unsigned int inactive_subdomain_offset, unsigned int level_set_boundary_id)
virtual void constrain()
provides implementation of the libMesh::System::Constraint::constrain() virtual method ...
std::vector< std::pair< libMesh::Elem *, unsigned int > > _old_elems
std::vector< libMesh::Node * > _new_nodes
std::set< unsigned int > _negative_level_set_ids
SubElemMeshRefinement(libMesh::MeshBase &mesh, libMesh::System &sys)
libMesh::Real Real
std::vector< libMesh::Elem * > _new_elems
libMesh::Node * _add_node(const libMesh::Point &p, bool strong_disontinuity, bool positive_phi, unsigned int processor_id, const std::pair< const libMesh::Node *, const libMesh::Node *> &bounding_nodes)
libMesh::Elem * _add_elem()
void _process_negative_element(unsigned int negative_level_set_subdomain_offset, unsigned level_set_boundary_id, libMesh::Elem &e, MAST::LevelSetIntersection &intersect)
std::set< std::pair< const libMesh::Node *, std::pair< const libMesh::Node *, const libMesh::Node * > > > _hanging_node
void _process_sub_elements(bool strong_discontinuity, unsigned int negative_level_set_subdomain_offset, unsigned int level_set_boundary_id, libMesh::Elem &e, MAST::LevelSetIntersection &intersect, bool positive_phi, const std::vector< const libMesh::Elem *> &elems)