MAST
geom_elem.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
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 
21 #ifndef __mast_geom_elem_h__
22 #define __mast_geom_elem_h__
23 
24 // MAST includes
25 #include "base/mast_data_types.h"
26 
27 // libMesh includes
28 #include "libmesh/elem.h"
29 #include "libmesh/fe_type.h"
30 
31 
32 namespace MAST {
33 
34  // Forward declerations
35  class FEBase;
36  class BoundaryConditionBase;
37  class SystemInitialization;
38 
59  class GeomElem {
60 
61  public:
62  GeomElem();
63 
64  virtual ~GeomElem();
65 
69  virtual const libMesh::Elem&
70  get_reference_elem() const;
71 
75  virtual const libMesh::Elem& get_reference_local_elem() const;
76 
80  virtual const libMesh::Elem& get_quadrature_elem() const;
81 
85  virtual const libMesh::Elem& get_quadrature_local_elem() const;
86 
90  unsigned int dim() const;
91 
95  unsigned int n_sides_quadrature_elem() const;
96 
101  libMesh::FEType get_fe_type(unsigned int i) const;
102 
110  void set_local_y_vector(const RealVectorX& y_vec);
111 
115  virtual void init(const libMesh::Elem& elem,
116  const MAST::SystemInitialization& sys_init);
117 
123  virtual std::unique_ptr<MAST::FEBase>
124  init_fe(bool init_grads,
125  bool init_second_order_derivative,
126  int extra_quadrature_order = 0) const;
127 
128 
134  virtual std::unique_ptr<MAST::FEBase>
135  init_side_fe(unsigned int s,
136  bool init_grads,
137  int extra_quadrature_order = 0) const;
138 
139 
147  virtual void
149  (std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc,
150  std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>& loads) const;
151 
155  virtual void
157  (unsigned int s, std::vector<libMesh::boundary_id_type>& bc_ids) const;
158 
168  bool use_local_elem() const;
169 
170 
171  const RealVectorX&
172  domain_surface_normal() const;
173 
174  void
175  transform_point_to_global_coordinate(const libMesh::Point& local_pt,
176  libMesh::Point& global_pt) const;
177 
178  void
179  transform_vector_to_global_coordinate(const libMesh::Point& local_vec,
180  libMesh::Point& global_vec) const;
181 
182  void
183  transform_vector_to_local_coordinate(const libMesh::Point& global_vec,
184  libMesh::Point& local_vec) const;
185 
186  void
188  RealVectorX& global_vec) const;
189 
190  void
192  RealVectorX& local_vec) const;
193 
199  const RealMatrixX& T_matrix() const;
200 
201  protected:
202 
203 
207  void _init_local_elem();
208 
212  void _init_local_elem_1d();
213 
217  void _init_local_elem_2d();
218 
223 
225 
230  const libMesh::Elem* _ref_elem;
231 
235  libMesh::Elem* _local_elem;
236 
242 
247 
251  std::vector<libMesh::Node*> _local_nodes;
252 
261  };
262 }
263 
264 #endif // __mast_geom_elem_h__
bool _use_local_elem
Definition: geom_elem.h:224
bool use_local_elem() const
Vector and matrix quantities defined on one- and two-dimensional elements that are oriented in two or...
Definition: geom_elem.cpp:314
const MAST::SystemInitialization * _sys_init
system initialization object for this element
Definition: geom_elem.h:222
void _init_local_elem_1d()
initializes the local element
Definition: geom_elem.cpp:380
const libMesh::Elem * _ref_elem
reference element in the mesh for which the data structure is initialized
Definition: geom_elem.h:230
RealVectorX _local_y
the y-axis that is used to define the coordinate system for a 1-D element.
Definition: geom_elem.h:241
void _init_local_elem()
initializes the local element
Definition: geom_elem.cpp:323
RealMatrixX _T_mat
Transformation matrix defines T_ij = V_i^t .
Definition: geom_elem.h:260
void set_local_y_vector(const RealVectorX &y_vec)
for 1D elements the transformed coordinate system attached to the element defines the local x-axis al...
Definition: geom_elem.cpp:119
virtual const libMesh::Elem & get_reference_elem() const
Definition: geom_elem.cpp:54
libMesh::Elem * _local_elem
a local element is created if
Definition: geom_elem.h:235
unsigned int n_sides_quadrature_elem() const
number of sides on quadrature element.
Definition: geom_elem.cpp:101
virtual const libMesh::Elem & get_reference_local_elem() const
Definition: geom_elem.cpp:63
libMesh::FEType get_fe_type(unsigned int i) const
Definition: geom_elem.cpp:110
Matrix< Real, Dynamic, Dynamic > RealMatrixX
const RealMatrixX & T_matrix() const
O.
Definition: geom_elem.cpp:228
RealVectorX _domain_surface_normal
surface normal of the 1D/2D element.
Definition: geom_elem.h:246
Matrix< Real, Dynamic, 1 > RealVectorX
std::vector< libMesh::Node * > _local_nodes
nodes for local element
Definition: geom_elem.h:251
virtual void get_boundary_ids_on_quadrature_elem_side(unsigned int s, std::vector< libMesh::boundary_id_type > &bc_ids) const
Definition: geom_elem.cpp:209
void transform_point_to_global_coordinate(const libMesh::Point &local_pt, libMesh::Point &global_pt) const
Definition: geom_elem.cpp:238
virtual std::unique_ptr< MAST::FEBase > init_side_fe(unsigned int s, bool init_grads, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object for the side with the order of qu...
Definition: geom_elem.cpp:159
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
unsigned int dim() const
Definition: geom_elem.cpp:91
const RealVectorX & domain_surface_normal() const
Definition: geom_elem.cpp:219
virtual void external_side_loads_for_quadrature_elem(std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc, std::map< unsigned int, std::vector< MAST::BoundaryConditionBase * >> &loads) const
From the given list of boundary loads, this identifies the sides of the quadrature element and the lo...
Definition: geom_elem.cpp:175
virtual const libMesh::Elem & get_quadrature_elem() const
Definition: geom_elem.cpp:72
void _init_local_elem_2d()
initializes the local element
Definition: geom_elem.cpp:432
void transform_vector_to_local_coordinate(const libMesh::Point &global_vec, libMesh::Point &local_vec) const
Definition: geom_elem.cpp:275
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
initialize the object for the specified reference elem.
Definition: geom_elem.cpp:128
virtual ~GeomElem()
Definition: geom_elem.cpp:41
virtual const libMesh::Elem & get_quadrature_local_elem() const
Definition: geom_elem.cpp:81
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...
Definition: geom_elem.cpp:142
void transform_vector_to_global_coordinate(const libMesh::Point &local_vec, libMesh::Point &global_vec) const
Definition: geom_elem.cpp:258