MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
level_set_intersected_elem.cpp
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 // MAST includes
23 #include "level_set/sub_cell_fe.h"
24 
25 
27 MAST::GeomElem (),
28 _sub_elem (nullptr),
29 _local_sub_elem (nullptr),
30 _intersection (nullptr) {
31 
32 }
33 
34 
35 
37 
38  if (_local_sub_elem) {
39  delete _local_sub_elem;
40 
41  for (unsigned int i=0; i<_local_subelem_nodes.size(); i++)
42  delete _local_subelem_nodes[i];
43  }
44 }
45 
46 
47 const libMesh::Elem&
49 
50  libmesh_assert(_ref_elem);
51 
52  return *_sub_elem;
53 }
54 
55 
56 const libMesh::Elem&
58 
59  libmesh_assert(_local_elem);
60 
61  return *_local_sub_elem;
62 }
63 
64 
65 bool
67 
68  libmesh_assert(_intersection);
69 
71 }
72 
73 
74 
75 bool
77 
78  libmesh_assert(_intersection);
79 
81 }
82 
83 
84 
85 int
87 
88  libmesh_assert(_intersection);
89 
91 }
92 
93 
94 
95 void
96 MAST::LevelSetIntersectedElem::init(const libMesh::Elem& elem,
97  const MAST::SystemInitialization& sys_init,
98  MAST::LevelSetIntersection& intersection) {
99 
100  libmesh_assert(!_intersection);
101 
102 
103  _intersection = &intersection;
104  _sub_elem = &elem;
105  _ref_elem = &intersection.elem();
106  _sys_init = &sys_init;
107 
108  // initialize the local element if needed. (not implemented yet)
109  //_init_local_elem();
110 }
111 
112 
113 std::unique_ptr<MAST::FEBase>
115  bool init_second_order_derivative,
116  int extra_quadrature_order) const {
117 
118  libmesh_assert(_intersection);
119  std::unique_ptr<MAST::FEBase> fe(new MAST::SubCellFE(*_sys_init, *_intersection));
120  fe->set_extra_quadrature_order(extra_quadrature_order);
121  fe->set_evaluate_second_order_derivatives(init_second_order_derivative);
122 
123  fe->init(*this, init_grads);
124  return fe;
125 }
126 
127 
128 std::unique_ptr<MAST::FEBase>
130  bool init_grads,
131  bool init_second_order_derivative,
132  int extra_quadrature_order) const {
133 
134  libmesh_assert(_intersection);
135  std::unique_ptr<MAST::FEBase> fe(new MAST::SubCellFE(*_sys_init, *_intersection));
136  fe->set_extra_quadrature_order(extra_quadrature_order);
137  fe->set_evaluate_second_order_derivatives(init_second_order_derivative);
138 
139  fe->init_for_side(*this, s, init_grads);
140 
141  return fe;
142 }
143 
unsigned int get_side_on_interface(const libMesh::Elem &e) const
const MAST::SystemInitialization * _sys_init
system initialization object for this element
Definition: geom_elem.h:231
const libMesh::Elem & elem() const
const libMesh::Elem * _ref_elem
reference element in the mesh for which the data structure is initialized
Definition: geom_elem.h:239
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
This method should not get called for this class.
virtual const libMesh::Elem & get_quadrature_local_elem() const
MAST::LevelSetIntersection * _intersection
libMesh::Elem * _local_elem
a local element is created if
Definition: geom_elem.h:244
virtual std::unique_ptr< MAST::FEBase > init_side_fe(unsigned int s, bool init_grads, bool init_second_order_derivative, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object for the side with the order of qu...
bool has_side_on_interface(const libMesh::Elem &e) const
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
virtual const libMesh::Elem & get_quadrature_elem() const
std::vector< libMesh::Node * > _local_subelem_nodes
nodes for local element
This class specializes the MAST::FEBase class for level-set applications where integration is to be p...
Definition: sub_cell_fe.h:40
virtual std::unique_ptr< MAST::FEBase > init_fe(bool init_grads, bool init_second_order_derivative, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object with the order of quadrature rule...