MAST
output_assembly_elem_operations.cpp
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 // MAST includes
22 #include "base/elem_base.h"
24 #include "base/nonlinear_system.h"
25 #include "mesh/geom_elem.h"
26 
27 // libMesh includes
28 #include "libmesh/boundary_info.h"
29 
30 
33 _if_evaluate_on_all_elems(false) {
34 
35 }
36 
37 
39 
40 }
41 
42 
43 
44 
45 void
47 set_participating_subdomains(const std::set<libMesh::subdomain_id_type>& sids) {
48 
49  // this object should be in a clean state before this method is called
50  libmesh_assert(!_sub_domain_ids.size());
51  libmesh_assert(!_elem_subset.size());
52 
53  _sub_domain_ids = sids;
55 }
56 
57 
58 
59 
60 void
62 
63  // this object should be in a clean state before this method is called
64  libmesh_assert(!_sub_domain_ids.size());
65  libmesh_assert(!_elem_subset.size());
66 
68 }
69 
70 
71 void
73 set_participating_elements(const std::set<const libMesh::Elem*>& elems) {
74 
75  // this object should be in a clean state before this method is called
76  libmesh_assert(!_sub_domain_ids.size());
77  libmesh_assert(!_elem_subset.size());
78 
79  _elem_subset = elems;
81 }
82 
83 
84 
85 
86 void
88 set_participating_boundaries(const std::set<libMesh::boundary_id_type>& bids) {
89 
90  libmesh_assert(!_bids.size());
91  _bids = bids;
92 }
93 
94 
95 
96 const std::set<const libMesh::Elem*>&
98 
99  return _elem_subset;
100 }
101 
102 
103 
104 const std::set<libMesh::subdomain_id_type>&
106 
107  return _sub_domain_ids;
108 }
109 
110 
111 
112 const std::set<libMesh::boundary_id_type>&
114 
115  return _bids;
116 }
117 
118 
119 bool
122 
123  const libMesh::Elem &ref_e = elem.get_reference_elem();
124 
125  // three modes are supported:
126  // - evaluate on all elems, in which case every element will be evaluated
127  // - evaluate for all elements with a subdomain id (note that with mesh
128  // adaptivity all childrent inherit the subdomain id of the parent)
129  // - evaluate elements in a group
130 
132  return true;
133  else if (_sub_domain_ids.count(ref_e.subdomain_id()))
134  return true;
135 
136  // in the third case, if mesh adaptivity is used then the current element
137  // might be a child of the original element. In this case we check whether
138  // the parent was specified in the subset.
139  //
140  // check to see if the element has a parent. If yes, then use that element
141  // pointer otherwise use the element given in the function call.
142  const libMesh::Elem
143  *e = ref_e.parent();
144  if (!e) e = &ref_e;
145 
146  if (_elem_subset.count(e))
147  return true;
148  else
149  return false;
150 }
151 
152 
153 bool
156  const unsigned int s) const {
157 
158  std::vector<libMesh::boundary_id_type> bc_ids;
160 
161  std::vector<libMesh::boundary_id_type>::const_iterator
162  bc_it = bc_ids.begin(),
163  bc_end = bc_ids.end();
164 
165  for ( ; bc_it != bc_end; bc_it++)
166  if (_bids.count(*bc_it))
167  return true;
168 
169  // if it gets here, then the side has an id that was not specified
170  // in output object for evaluation
171  return false;
172 }
173 
174 
const std::set< libMesh::subdomain_id_type > & get_participating_subdomains()
void set_participating_subdomains(const std::set< libMesh::subdomain_id_type > &sids)
The output function can be a boundary integrated quantity, volume integrated quantity or a combinatio...
std::set< libMesh::subdomain_id_type > _sub_domain_ids
set of subdomain ids for which data will be processed.
virtual bool if_evaluate_for_element(const MAST::GeomElem &elem) const
checks to see if the object has been told about the subset of elements and if the specified element i...
void set_participating_elements(const std::set< const libMesh::Elem * > &elems)
sets the elements for which this object will evaluate and store the output data.
std::set< libMesh::boundary_id_type > _bids
set of bids for which data will be processed
const std::set< libMesh::boundary_id_type > & get_participating_boundaries()
virtual ~OutputAssemblyElemOperations()
virtual destructor
virtual const libMesh::Elem & get_reference_elem() const
Definition: geom_elem.cpp:54
virtual bool if_evaluate_for_boundary(const MAST::GeomElem &elem, const unsigned int s) const
checks to see if the specified side of the element needs evaluation of the output contribution...
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
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
bool _if_evaluate_on_all_elems
if true, evaluates on all elements.
const std::set< const libMesh::Elem * > & get_participating_elements() const
void set_participating_elements_to_all()
This will allow volume contribution from all elements.
void set_participating_boundaries(const std::set< libMesh::boundary_id_type > &bids)
The assembly will integration over boudnaries with ids specified in bids.
std::set< const libMesh::Elem * > _elem_subset
set of elements for which the data will be stored.