MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
intersected_elem_homogenization_function.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
24 
25 
26 // libMesh includes
27 #include "libmesh/elem.h"
28 
32 _intersection (nullptr) {
33 
34 }
35 
36 
37 
40 
41 }
42 
43 
44 void
47 
48  libmesh_assert(_analysis_mesh);
49  libmesh_assert(_intersection);
50  libmesh_assert(_elem_volume_fraction.empty());
51 
52  libMesh::MeshBase::const_element_iterator
53  e_it = _analysis_mesh->local_elements_begin(),
54  e_end = _analysis_mesh->local_elements_begin();
55 
56  for ( ; e_it != e_end; e_it++) {
57 
58  _intersection->init(*_level_set, **e_it, 0.,
59  _analysis_mesh->max_elem_id(),
60  _analysis_mesh->max_node_id());
61 
64  }
65 }
66 
67 
68 void
71 
72  libmesh_assert(_analysis_mesh);
73  libmesh_assert(_intersection);
74  libmesh_assert(_elem_volume_fraction_sensitivity.empty());
75 
76  libMesh::MeshBase::const_element_iterator
77  e_it = _analysis_mesh->local_elements_begin(),
78  e_end = _analysis_mesh->local_elements_begin();
79 
80  for ( ; e_it != e_end; e_it++) {
81 
82  const libMesh::Elem* elem = *e_it;
83 
84  _intersection->init(*_level_set, *elem, 0.,
85  _analysis_mesh->max_elem_id(),
86  _analysis_mesh->max_node_id());
87 
88  // iterate over all elements on the positive side and
89  // add compute the sensitivity of the volume
90  const std::vector<const libMesh::Elem *> &
92 
93  std::vector<const libMesh::Elem*>::const_iterator
94  hi_sub_elem_it = elems_hi.begin(),
95  hi_sub_elem_end = elems_hi.end();
96 
97 // for (; hi_sub_elem_it != hi_sub_elem_end; hi_sub_elem_it++ ) {
98 //
99 // const libMesh::Elem* sub_elem = *hi_sub_elem_it;
100 //
101 // MAST::LevelSetIntersectedElem geom_elem;
102 // ops.set_elem_data(elem->dim(), *elem, geom_elem);
103 // geom_elem.init(*sub_elem, *_system, *_intersection);
104 //
105 // ops.init(geom_elem);
106 //
107 // ops.elem_calculations(J!=nullptr?true:false, sub_elem_vec, sub_elem_mat);
108 //
109 // ops.clear_elem();
110 // }
111 
114 
115  _intersection->clear();
116  }
117 }
118 
const std::vector< const libMesh::Elem * > & get_sub_elems_positive_phi() const
void init(const MAST::FieldFunction< Real > &phi, const libMesh::Elem &e, const Real t, unsigned int max_elem_id, unsigned int max_node_id)
virtual void initialize_element_volume_fraction_sensitivity(const MAST::FunctionBase &f)
std::map< const MAST::FunctionBase *, std::map< const libMesh::Elem *, Real > > _elem_volume_fraction_sensitivity
std::map< const libMesh::Elem *, Real > _elem_volume_fraction
virtual void initialize_element_volume_fractions()
computes and stores the volume fraction of each local element
void clear()
clears the data structures