https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CacheChangedListsThread.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12#include "libmesh/elem.h"
13
18
19// Splitting Constructor
24
26
27void
29{
31 {
32 // When we p-refine an active child element this can lead to p-refinement of the parent as well.
33 // We don't care about inactive parents
34 if (elem->active())
35 {
36 if (elem->p_refinement_flag() == Elem::JUST_REFINED)
37 _refined_elements.push_back(elem);
38 else if (elem->p_refinement_flag() == Elem::JUST_COARSENED)
39 _coarsened_elements.push_back(elem);
40 }
41 }
42 else
43 {
44 // Cache any parents of local elements that have just been refined
45 // away.
46 //
47 // The parent itself might *not* be local, because only some of its
48 // new children are. Make sure to cache every such case exactly once.
49 if (elem->refinement_flag() == Elem::JUST_REFINED)
50 {
51 const Elem * const parent = elem->parent();
52 const unsigned int child_num = parent->which_child_am_i(elem);
53
54 bool im_the_lowest_local_child = true;
55 for (const auto c : make_range(child_num))
56 if (parent->child_ptr(c) && parent->child_ptr(c) != remote_elem &&
57 parent->child_ptr(c)->processor_id() == elem->processor_id())
58 im_the_lowest_local_child = false;
59
60 if (im_the_lowest_local_child)
61 _refined_elements.push_back(parent);
62 }
63
64 else if (elem->refinement_flag() == Elem::JUST_COARSENED)
65 {
66 if (elem->has_children())
67 {
68 _coarsened_elements.push_back(elem);
69
70 std::vector<const Elem *> & children = _coarsened_element_children[elem];
71
72 for (unsigned int child = 0; child < elem->n_children(); child++)
73 children.push_back(elem->child_ptr(child));
74 }
75 }
76 }
77}
78
79void
89
90bool
92{
93 return false;
94}
std::vector< const Elem * > _refined_elements
The elements that were just refined.
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to children elements for elements that were just coarsened.
std::vector< const Elem * > _coarsened_elements
The elements that were just coarsened.
void join(const CacheChangedListsThread &y)
bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const override
Whether to compute the internal side for the provided element-neighbor pair.
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
CacheChangedListsThread(MooseMesh &mesh)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we're doing includes p-refinement.
Definition MooseMesh.h:1504
Base class for assembly-like calculations.
processor_id_type processor_id() const
const Elem * child_ptr(unsigned int i) const
MeshBase & mesh