26 _initialized (false) {
38 const libMesh::Node& node,
49 libmesh_assert_less_equal(v, 0);
51 std::set<const libMesh::Elem*> elems;
54 elem.find_point_neighbors(node, elems);
62 std::set<const libMesh::Elem*>::const_iterator
66 for ( ; it != end; it++) {
68 const libMesh::Elem& elem = **it;
70 bool negative_phi =
true;
71 for (
unsigned int i=0; i<elem.n_nodes(); i++) {
73 phi(*elem.node_ptr(i), t, v);
101 const libMesh::Node& node,
102 const std::set<const libMesh::Elem*>& elem_neighbors,
127 if (elem_neighbors.size() < 4)
130 std::vector<const libMesh::Elem*>
131 patch_elems(4,
nullptr);
133 std::set<const libMesh::Elem*>::const_iterator
134 e_it = elem_neighbors.begin(),
135 e_end = elem_neighbors.end();
137 std::map<Real, const libMesh::Elem*>
140 for ( ; e_it != e_end; e_it++) {
142 const libMesh::Elem& e = **e_it;
145 libmesh_assert((e.type() == libMesh::QUAD4) || (e.type() == libMesh::QUAD9));
149 p = e.centroid() - node;
151 elem_angle_map[atan2(p(1), p(0))] = &e;
156 std::map<Real, const libMesh::Elem*>::const_iterator
157 el_it = elem_angle_map.begin(),
158 el_end = elem_angle_map.end();
161 for ( ; el_it != el_end; el_it++) {
162 patch_elems[i] = el_it->second;
169 n_periphery_nodes = 8,
171 n_material_levels = 0;
173 std::vector<const libMesh::Node*>
175 periphery_nodes.reserve(n_periphery_nodes);
181 periphery_nodes.push_back(patch_elems[0]->node_ptr(0));
184 p1 = patch_elems[0]->point(1) - node;
185 p2 = patch_elems[1]->point(0) - node;
186 if (p1.norm() < p2.norm())
187 periphery_nodes.push_back(patch_elems[0]->node_ptr(1));
189 periphery_nodes.push_back(patch_elems[1]->node_ptr(0));
192 periphery_nodes.push_back(patch_elems[1]->node_ptr(1));
195 p1 = patch_elems[1]->point(2) - node;
196 p2 = patch_elems[2]->point(1) - node;
197 if (p1.norm() < p2.norm())
198 periphery_nodes.push_back(patch_elems[1]->node_ptr(2));
200 periphery_nodes.push_back(patch_elems[2]->node_ptr(1));
203 periphery_nodes.push_back(patch_elems[2]->node_ptr(2));
206 p1 = patch_elems[2]->point(3) - node;
207 p2 = patch_elems[3]->point(2) - node;
208 if (p1.norm() < p2.norm())
209 periphery_nodes.push_back(patch_elems[2]->node_ptr(3));
211 periphery_nodes.push_back(patch_elems[3]->node_ptr(2));
214 periphery_nodes.push_back(patch_elems[3]->node_ptr(3));
217 p1 = patch_elems[3]->point(0) - node;
218 p2 = patch_elems[0]->point(3) - node;
219 if (p1.norm() < p2.norm())
220 periphery_nodes.push_back(patch_elems[3]->node_ptr(0));
222 periphery_nodes.push_back(patch_elems[0]->node_ptr(3));
224 n_periphery_nodes = periphery_nodes.size();
226 libmesh_assert_equal_to(n_periphery_nodes, 8);
236 phi(*periphery_nodes[0], t, v1);
238 for (
unsigned int i=0; i<n_periphery_nodes; i++) {
240 phi(*periphery_nodes[(i+1)%n_periphery_nodes], t, v2);
242 if ((v1 < 0. && v2 >= 0.) || (v1 >= 0. && v2 < 0.))
249 libmesh_assert_equal_to(n_sign_changes%2, 0);
252 n_material_levels = n_sign_changes/2;
258 if (n_material_levels > 1)
void init(const libMesh::Elem &elem, const libMesh::Node &node, const MAST::FieldFunction< Real > &phi, const Real t)
initialize the patch around node of elem.
bool _quad4_material_levels(const libMesh::Elem &elem, const libMesh::Node &node, const std::set< const libMesh::Elem * > &elem_neighbors, const MAST::FieldFunction< Real > &phi, const Real t)
std::set< const libMesh::Elem * > _elems_to_factor