https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ProjectMaterialProperties Class Reference

#include <ProjectMaterialProperties.h>

Inheritance diagram for ProjectMaterialProperties:
[legend]

Public Member Functions

 ProjectMaterialProperties (bool refine, FEProblemBase &fe_problem, MaterialPropertyStorage &material_props, MaterialPropertyStorage &bnd_material_props, std::vector< std::vector< std::unique_ptr< Assembly >>> &assembly)
 
 ProjectMaterialProperties (ProjectMaterialProperties &x, Threads::split split)
 
virtual ~ProjectMaterialProperties ()
 
virtual void subdomainChanged () override
 Called every time the current subdomain changes (i.e. More...
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called when doing boundary assembling. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side) override
 Called when doing internal edge assembling. More...
 
void join (const ProjectMaterialProperties &)
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing () override
 Whether or not the loop should continue. More...
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly. More...
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side. More...
 
virtual void preBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr) override
 Called before the boundary assembly. More...
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e. More...
 
virtual void operator() (const ConstElemPointerRange &range, bool bypass_threading=false)
 
virtual void pre ()
 Called before the element range loop. More...
 
virtual void post ()
 Called after the element range loop. More...
 
virtual void postElement (const Elem *elem)
 Called after the element assembly is done (including surface assembling) More...
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. More...
 
virtual void onExternalSide (const Elem *elem, unsigned int side)
 Called when iterating over external sides (no side neighbor) More...
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing interface assembling. More...
 

Protected Member Functions

void prepareElement (const Elem *elem)
 
void clearVarsAndMaterials ()
 
void printExecutionOrdering (const std::vector< T * > &objs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 Routine to output the ordering of objects within a vector of pointers to these objects. More...
 
void printExecutionOrdering (const std::vector< std::shared_ptr< T >> &objs_ptrs, const bool print_header=true, const std::string &line_prefix="[DBG]") const
 
virtual void printGeneralExecutionInformation () const
 Print information about the loop ordering. More...
 
virtual void printBlockExecutionInformation () const
 Print information about the particular ordering of objects on each block. More...
 
virtual void printBoundaryExecutionInformation (const unsigned int) const
 Print information about the particular ordering of objects on each boundary. More...
 
void resetExecPrintedSets () const
 Resets the set of blocks and boundaries visited. More...
 

Protected Attributes

bool _refine
 Whether or not you are projecting refinements. Set to false for coarsening. More...
 
FEProblemBase_fe_problem
 
MaterialPropertyStorage_material_props
 
MaterialPropertyStorage_bnd_material_props
 
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly
 
bool _need_internal_side_material
 
const MaterialWarehouse_materials
 Materials warehouse. More...
 
const MaterialWarehouse_discrete_materials
 Discrete materials warehouse. More...
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element. More...
 
SubdomainID _old_subdomain
 The subdomain for the last element. More...
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor. More...
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor. More...
 
std::set< SubdomainID_blocks_exec_printed
 Keep track of which blocks were visited. More...
 
std::set< BoundaryID_boundaries_exec_printed
 Keep track of which boundaries were visited. More...
 

Private Member Functions

bool shouldComputeInternalSide (const Elem &, const Elem &) const override
 Whether to compute the internal side for the provided element-neighbor pair. More...
 

Detailed Description

Definition at line 23 of file ProjectMaterialProperties.h.

Constructor & Destructor Documentation

◆ ProjectMaterialProperties() [1/2]

ProjectMaterialProperties::ProjectMaterialProperties ( bool  refine,
FEProblemBase fe_problem,
MaterialPropertyStorage material_props,
MaterialPropertyStorage bnd_material_props,
std::vector< std::vector< std::unique_ptr< Assembly >>> &  assembly 
)

Definition at line 22 of file ProjectMaterialProperties.C.

29  _refine(refine),
30  _fe_problem(fe_problem),
31  _material_props(material_props),
32  _bnd_material_props(bnd_material_props),
33  _assembly(assembly),
37 {
38 }
MaterialPropertyStorage & _bnd_material_props
const MaterialWarehouse & _discrete_materials
Discrete materials warehouse.
const MaterialWarehouse & getRegularMaterialsWarehouse() const
bool _refine
Whether or not you are projecting refinements. Set to false for coarsening.
const MaterialWarehouse & getDiscreteMaterialWarehouse() const
const MaterialWarehouse & _materials
Materials warehouse.
MaterialPropertyStorage & _material_props
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly

◆ ProjectMaterialProperties() [2/2]

ProjectMaterialProperties::ProjectMaterialProperties ( ProjectMaterialProperties x,
Threads::split  split 
)

Definition at line 41 of file ProjectMaterialProperties.C.

44  _refine(x._refine),
46  _material_props(x._material_props),
47  _bnd_material_props(x._bnd_material_props),
48  _assembly(x._assembly),
49  _need_internal_side_material(x._need_internal_side_material),
50  _materials(x._materials),
51  _discrete_materials(x._discrete_materials)
52 {
53 }
FEProblemBase & _fe_problem
MaterialPropertyStorage & _bnd_material_props
const MaterialWarehouse & _discrete_materials
Discrete materials warehouse.
bool _refine
Whether or not you are projecting refinements. Set to false for coarsening.
const MaterialWarehouse & _materials
Materials warehouse.
MaterialPropertyStorage & _material_props
tbb::split split
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly

◆ ~ProjectMaterialProperties()

ProjectMaterialProperties::~ProjectMaterialProperties ( )
virtual

Definition at line 55 of file ProjectMaterialProperties.C.

55 {}

Member Function Documentation

◆ caughtMooseException()

void ThreadedElementLoop< ConstElemPointerRange >::caughtMooseException ( MooseException e)
overridevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 105 of file ThreadedElementLoop.h.

106 {
107  Threads::spin_mutex::scoped_lock lock(threaded_element_mutex);
108 
109  std::string what(e.what());
111 }
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
static Threads::spin_mutex threaded_element_mutex
This mutex is used by all derived classes of the ThreadedElementLoop.

◆ clearVarsAndMaterials()

void ThreadedElementLoop< ConstElemPointerRange >::clearVarsAndMaterials ( )
protectedinherited

Definition at line 195 of file ThreadedElementLoop.h.

196 {
199 }
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
virtual void clearActiveElementalMooseVariables(const THREAD_ID tid) override
Clear the active elemental MooseVariableFEBase.

◆ join()

void ProjectMaterialProperties::join ( const ProjectMaterialProperties )

Definition at line 246 of file ProjectMaterialProperties.C.

247 {
248 }

◆ keepGoing()

virtual bool ThreadedElementLoop< ConstElemPointerRange >::keepGoing ( )
inlineoverridevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 45 of file ThreadedElementLoop.h.

45 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.

◆ neighborSubdomainChanged()

void ThreadedElementLoop< ConstElemPointerRange >::neighborSubdomainChanged ( )
overridevirtualinherited

Called every time the neighbor subdomain changes (i.e.

the subdomain of this neighbor is not the same as the subdomain of the last neighbor). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 139 of file ThreadedElementLoop.h.

140 {
143 }
Base class for assembly-like calculations.
virtual void neighborSubdomainSetup(SubdomainID subdomain, const THREAD_ID tid)

◆ onBoundary()

void ProjectMaterialProperties::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtual

Called when doing boundary assembling.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 138 of file ProjectMaterialProperties.C.

142 {
145  {
146  _assembly[_tid][0]->reinit(elem, side);
147 
148  if (_refine)
149  {
150  if (_mesh.doingPRefinement())
151  {
152  const auto & p_refinement_map = _mesh.getPRefinementSideMap(*elem);
154  p_refinement_map,
155  *_assembly[_tid][0]->qRule(),
156  *_assembly[_tid][0]->qRuleFace(),
157  _tid,
158  *elem,
159  side);
160  }
161  else
162  {
163  const std::vector<std::vector<QpMap>> & refinement_map =
164  _mesh.getRefinementMap(*elem, side, -1, side);
165 
168  refinement_map,
169  *_assembly[_tid][0]->qRule(),
170  *_assembly[_tid][0]->qRuleFace(),
171  _bnd_material_props, // Passing in the same properties to do side_to_side projection
172  _tid,
173  *elem,
174  side,
175  -1,
176  side); // Gets us side to side projection
177  }
178  }
179  else
180  {
181  if (_mesh.doingPRefinement())
182  {
183  const auto & p_coarsening_map = _mesh.getPCoarseningSideMap(*elem);
185  p_coarsening_map,
186  *_assembly[_tid][0]->qRule(),
187  *_assembly[_tid][0]->qRuleFace(),
188  _tid,
189  *elem,
190  side);
191  }
192  else
193  {
194  const std::vector<std::pair<unsigned int, QpMap>> & coarsening_map =
195  _mesh.getCoarseningMap(*elem, side);
196 
199  *_assembly[_tid][0]->qRule(),
200  *_assembly[_tid][0]->qRuleFace(),
201  _tid,
202  *elem,
203  side);
204  }
205  }
206  }
207 }
const std::vector< QpMap > & getPCoarseningSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the coarse level which qp on the previo...
Definition: MooseMesh.C:4365
const std::vector< std::pair< unsigned int, QpMap > > & getCoarseningMap(const Elem &elem, int input_side)
Get the coarsening map for a given element type.
Definition: MooseMesh.C:2574
const std::vector< std::vector< QpMap > > & getRefinementMap(const Elem &elem, int parent_side, int child, int child_side)
Get the refinement map for a given element type.
Definition: MooseMesh.C:2510
MaterialPropertyStorage & _bnd_material_props
bool needBoundaryMaterialOnSide(BoundaryID bnd_id, const THREAD_ID tid)
These methods are used to determine whether stateful material properties need to be stored on interna...
bool _refine
Whether or not you are projecting refinements. Set to false for coarsening.
void prolongStatefulProps(processor_id_type pid, const std::vector< std::vector< QpMap >> &refinement_map, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, MaterialPropertyStorage &parent_material_props, const THREAD_ID tid, const Elem &elem, const int input_parent_side, const int input_child, const int input_child_side)
Creates storage for newly created elements from mesh Adaptivity.
const std::vector< QpMap > & getPRefinementSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the refined level which qp on the previ...
Definition: MooseMesh.C:4353
void updateStatefulPropsForPRefinement(const processor_id_type pid, const std::vector< QpMap > &p_refinement_map, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, const THREAD_ID tid, const Elem &elem, const int input_side)
Based on the p-refinement flag of elem, either prolong (for refinement) or restrict (for coarsening) ...
const std::vector< const Elem * > & coarsenedElementChildren(const Elem *elem) const
Get the newly removed children element ids for an element that was just coarsened.
Definition: MooseMesh.C:940
void restrictStatefulProps(const std::vector< std::pair< unsigned int, QpMap >> &coarsening_map, const std::vector< const Elem *> &coarsened_element_children, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, const THREAD_ID tid, const Elem &elem, int input_side=-1)
Creates storage for newly created elements from mesh Adaptivity.
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we&#39;re doing is p-refinement.
Definition: MooseMesh.h:1347
processor_id_type processor_id() const
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly

◆ onElement()

void ProjectMaterialProperties::onElement ( const Elem *  elem)
overridevirtual

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 64 of file ProjectMaterialProperties.C.

65 {
66  // This check mirrors the check in ComputeMaterialsObjectThread::onElement as it must because it
67  // is possible that there are no materials on this element's subdomain, e.g. if we are doing
68  // mortar, in which case the properties will not have been resized in
69  // ComputeMaterialsObjectThread::onElement, and consequently if we were to proceed we would get
70  // bad access errors
71  if (!_materials.hasActiveBlockObjects(elem->subdomain_id(), _tid) &&
72  !_discrete_materials.hasActiveBlockObjects(elem->subdomain_id(), _tid))
73  return;
74 
75  _assembly[_tid][0]->reinit(elem);
76 
77  if (_refine)
78  {
79  if (_mesh.doingPRefinement())
80  {
81  const auto & p_refinement_map = _mesh.getPRefinementMap(*elem);
83  p_refinement_map,
84  *_assembly[_tid][0]->qRule(),
85  *_assembly[_tid][0]->qRuleFace(),
86  _tid,
87  *elem,
88  -1);
89  }
90  else
91  {
92  const std::vector<std::vector<QpMap>> & refinement_map =
93  _mesh.getRefinementMap(*elem, -1, -1, -1);
94 
97  refinement_map,
98  *_assembly[_tid][0]->qRule(),
99  *_assembly[_tid][0]->qRuleFace(),
100  _material_props, // Passing in the same properties to do volume to volume projection
101  _tid,
102  *elem,
103  -1,
104  -1,
105  -1); // Gets us volume projection
106  }
107  }
108  else
109  {
110  if (_mesh.doingPRefinement())
111  {
112  const auto & p_coarsening_map = _mesh.getPCoarseningMap(*elem);
114  p_coarsening_map,
115  *_assembly[_tid][0]->qRule(),
116  *_assembly[_tid][0]->qRuleFace(),
117  _tid,
118  *elem,
119  -1);
120  }
121  else
122  {
123  const std::vector<std::pair<unsigned int, QpMap>> & coarsening_map =
124  _mesh.getCoarseningMap(*elem, -1);
125 
126  _material_props.restrictStatefulProps(coarsening_map,
128  *_assembly[_tid][0]->qRule(),
129  *_assembly[_tid][0]->qRuleFace(),
130  _tid,
131  *elem,
132  -1);
133  }
134  }
135 }
bool hasActiveBlockObjects(THREAD_ID tid=0) const
const std::vector< std::pair< unsigned int, QpMap > > & getCoarseningMap(const Elem &elem, int input_side)
Get the coarsening map for a given element type.
Definition: MooseMesh.C:2574
const std::vector< std::vector< QpMap > > & getRefinementMap(const Elem &elem, int parent_side, int child, int child_side)
Get the refinement map for a given element type.
Definition: MooseMesh.C:2510
const MaterialWarehouse & _discrete_materials
Discrete materials warehouse.
bool _refine
Whether or not you are projecting refinements. Set to false for coarsening.
const MaterialWarehouse & _materials
Materials warehouse.
MaterialPropertyStorage & _material_props
void prolongStatefulProps(processor_id_type pid, const std::vector< std::vector< QpMap >> &refinement_map, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, MaterialPropertyStorage &parent_material_props, const THREAD_ID tid, const Elem &elem, const int input_parent_side, const int input_child, const int input_child_side)
Creates storage for newly created elements from mesh Adaptivity.
const std::vector< QpMap > & getPRefinementMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the refined level which qp on the...
Definition: MooseMesh.C:4347
void updateStatefulPropsForPRefinement(const processor_id_type pid, const std::vector< QpMap > &p_refinement_map, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, const THREAD_ID tid, const Elem &elem, const int input_side)
Based on the p-refinement flag of elem, either prolong (for refinement) or restrict (for coarsening) ...
const std::vector< const Elem * > & coarsenedElementChildren(const Elem *elem) const
Get the newly removed children element ids for an element that was just coarsened.
Definition: MooseMesh.C:940
void restrictStatefulProps(const std::vector< std::pair< unsigned int, QpMap >> &coarsening_map, const std::vector< const Elem *> &coarsened_element_children, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, const THREAD_ID tid, const Elem &elem, int input_side=-1)
Creates storage for newly created elements from mesh Adaptivity.
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we&#39;re doing is p-refinement.
Definition: MooseMesh.h:1347
processor_id_type processor_id() const
const std::vector< QpMap > & getPCoarseningMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the coarse level which qp on the ...
Definition: MooseMesh.C:4359
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly

◆ onExternalSide()

void ThreadedElementLoopBase< ConstElemPointerRange >::onExternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when iterating over external sides (no side neighbor)

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Definition at line 393 of file ThreadedElementLoopBase.h.

394 {
395 }

◆ onInterface()

void ThreadedElementLoopBase< ConstElemPointerRange >::onInterface ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing interface assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
bnd_id- ID of the interface we are at

Definition at line 399 of file ThreadedElementLoopBase.h.

402 {
403 }

◆ onInternalSide()

void ProjectMaterialProperties::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtual

Called when doing internal edge assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 210 of file ProjectMaterialProperties.C.

211 {
213  _refine) // If we're refining then we need to also project "internal" child sides.
214  {
215  mooseError("I'm pretty sure we're not handling stateful material property prolongation or "
216  "restriction correctly on internal sides");
217  for (unsigned int child = 0; child < elem->n_children(); child++)
218  {
219  const Elem * child_elem = elem->child_ptr(child);
220 
221  for (unsigned int side = 0; side < child_elem->n_sides(); side++)
222  {
223  if (!elem->is_child_on_side(child, side)) // Otherwise we already projected it
224  {
225  const std::vector<std::vector<QpMap>> & refinement_map =
226  _mesh.getRefinementMap(*elem, -1, child, side);
227 
230  refinement_map,
231  *_assembly[_tid][0]->qRule(),
232  *_assembly[_tid][0]->qRuleFace(),
233  _material_props, // Passing in the same properties to do side_to_side projection
234  _tid,
235  *elem,
236  -1,
237  child,
238  side); // Gets us volume to side projection
239  }
240  }
241  }
242  }
243 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const std::vector< std::vector< QpMap > > & getRefinementMap(const Elem &elem, int parent_side, int child, int child_side)
Get the refinement map for a given element type.
Definition: MooseMesh.C:2510
MaterialPropertyStorage & _bnd_material_props
bool _refine
Whether or not you are projecting refinements. Set to false for coarsening.
MaterialPropertyStorage & _material_props
void prolongStatefulProps(processor_id_type pid, const std::vector< std::vector< QpMap >> &refinement_map, const libMesh::QBase &qrule, const libMesh::QBase &qrule_face, MaterialPropertyStorage &parent_material_props, const THREAD_ID tid, const Elem &elem, const int input_parent_side, const int input_child, const int input_child_side)
Creates storage for newly created elements from mesh Adaptivity.
processor_id_type processor_id() const
std::vector< std::vector< std::unique_ptr< Assembly > > > & _assembly

◆ operator()()

void ThreadedElementLoopBase< ConstElemPointerRange >::operator() ( const ConstElemPointerRange range,
bool  bypass_threading = false 
)
virtualinherited

Definition at line 223 of file ThreadedElementLoopBase.h.

224 {
225  try
226  {
227  try
228  {
229  ParallelUniqueId puid;
230  _tid = bypass_threading ? 0 : puid.id;
231 
232  pre();
234 
237  typename RangeType::const_iterator el = range.begin();
238  for (el = range.begin(); el != range.end(); ++el)
239  {
240  if (!keepGoing())
241  break;
242 
243  const Elem * elem = *el;
244 
245  preElement(elem);
246 
248  _subdomain = elem->subdomain_id();
249  if (_subdomain != _old_subdomain)
250  {
253  }
254 
255  onElement(elem);
256 
257  if (_mesh.interiorLowerDBlocks().count(elem->subdomain_id()) > 0 ||
258  _mesh.boundaryLowerDBlocks().count(elem->subdomain_id()) > 0)
259  {
260  postElement(elem);
261  continue;
262  }
263 
264  for (unsigned int side = 0; side < elem->n_sides(); side++)
265  {
266  std::vector<BoundaryID> boundary_ids = _mesh.getBoundaryIDs(elem, side);
267  const Elem * lower_d_elem = _mesh.getLowerDElem(elem, side);
268 
269  if (boundary_ids.size() > 0)
270  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
271  it != boundary_ids.end();
272  ++it)
273  {
274  preBoundary(elem, side, *it, lower_d_elem);
276  onBoundary(elem, side, *it, lower_d_elem);
277  }
278 
279  const Elem * neighbor = elem->neighbor_ptr(side);
280  if (neighbor)
281  {
282  preInternalSide(elem, side);
283 
285  _neighbor_subdomain = neighbor->subdomain_id();
288 
289  if (shouldComputeInternalSide(*elem, *neighbor))
290  onInternalSide(elem, side);
291 
292  if (boundary_ids.size() > 0)
293  for (std::vector<BoundaryID>::iterator it = boundary_ids.begin();
294  it != boundary_ids.end();
295  ++it)
296  onInterface(elem, side, *it);
297 
298  postInternalSide(elem, side);
299  }
300  else
301  onExternalSide(elem, side);
302  } // sides
303 
304  postElement(elem);
305  } // range
306 
307  post();
309  }
310  catch (libMesh::LogicError & e)
311  {
312  mooseException("We caught a libMesh error in ThreadedElementLoopBase:", e.what());
313  }
314  catch (MetaPhysicL::LogicError & e)
315  {
317  }
318  }
319  catch (MooseException & e)
320  {
322  }
323 }
virtual void onExternalSide(const Elem *elem, unsigned int side)
Called when iterating over external sides (no side neighbor)
virtual bool keepGoing()
Whether or not the loop should continue.
void resetExecPrintedSets() const
Resets the set of blocks and boundaries visited.
virtual bool shouldComputeInternalSide(const Elem &elem, const Elem &neighbor) const
Whether to compute the internal side for the provided element-neighbor pair.
virtual void onElement(const Elem *elem)
Assembly of the element (not including surface assembly)
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition: MooseMesh.h:1403
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error
Definition: MooseError.C:112
virtual void printBoundaryExecutionInformation(const unsigned int) const
Print information about the particular ordering of objects on each boundary.
virtual void pre()
Called before the element range loop.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition: MooseMesh.C:1698
virtual void subdomainChanged()
Called every time the current subdomain changes (i.e.
virtual void neighborSubdomainChanged()
Called every time the neighbor subdomain changes (i.e.
virtual void preInternalSide(const Elem *elem, unsigned int side)
Called before evaluations on an element internal side.
virtual void postInternalSide(const Elem *elem, unsigned int side)
Called after evaluations on an element internal side.
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.C:20
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called when doing boundary assembling.
virtual void postElement(const Elem *elem)
Called after the element assembly is done (including surface assembling)
virtual void printGeneralExecutionInformation() const
Print information about the loop ordering.
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Called when doing interface assembling.
SubdomainID _old_neighbor_subdomain
The subdomain for the last neighbor.
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition: MooseMesh.h:1407
virtual void onInternalSide(const Elem *elem, unsigned int side)
Called when doing internal edge assembling.
const_iterator end() const
Provides a way for users to bail out of the current solve.
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
const_iterator begin() const
SubdomainID _subdomain
The subdomain for the current element.
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side. ...
SubdomainID _old_subdomain
The subdomain for the last element.
virtual void post()
Called after the element range loop.
virtual void printBlockExecutionInformation() const
Print information about the particular ordering of objects on each block.
virtual void preElement(const Elem *elem)
Called before the element assembly.
virtual void preBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id, const Elem *lower_d_elem=nullptr)
Called before the boundary assembly.
SubdomainID _neighbor_subdomain
The subdomain for the current neighbor.

◆ post()

void ThreadedElementLoopBase< ConstElemPointerRange >::post ( )
virtualinherited

Called after the element range loop.

Definition at line 333 of file ThreadedElementLoopBase.h.

334 {
335 }

◆ postElement()

void ThreadedElementLoopBase< ConstElemPointerRange >::postElement ( const Elem *  elem)
virtualinherited

Called after the element assembly is done (including surface assembling)

Parameters
elem- active element

Definition at line 351 of file ThreadedElementLoopBase.h.

352 {
353 }

◆ postInternalSide()

void ThreadedElementLoopBase< ConstElemPointerRange >::postInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called after evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Definition at line 381 of file ThreadedElementLoopBase.h.

382 {
383 }

◆ pre()

void ThreadedElementLoopBase< ConstElemPointerRange >::pre ( )
virtualinherited

Called before the element range loop.

Definition at line 327 of file ThreadedElementLoopBase.h.

328 {
329 }

◆ preBoundary()

void ThreadedElementLoop< ConstElemPointerRange >::preBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
const Elem *  lower_d_elem = nullptr 
)
overridevirtualinherited

Called before the boundary assembly.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at
lower_d_elem- Lower dimensional element (e.g. Mortar)

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 129 of file ThreadedElementLoop.h.

133 {
135 }
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
Base class for assembly-like calculations.

◆ preElement()

void ThreadedElementLoop< ConstElemPointerRange >::preElement ( const Elem *  elem)
overridevirtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 115 of file ThreadedElementLoop.h.

116 {
118 }
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
Base class for assembly-like calculations.

◆ preInternalSide()

void ThreadedElementLoop< ConstElemPointerRange >::preInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called before evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 122 of file ThreadedElementLoop.h.

123 {
125 }
Base class for assembly-like calculations.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override

◆ prepareElement()

void ThreadedElementLoop< ConstElemPointerRange >::prepareElement ( const Elem *  elem)
protectedinherited

Definition at line 186 of file ThreadedElementLoop.h.

187 {
188  _fe_problem.prepare(elem, this->_tid);
189  _fe_problem.reinitElem(elem, this->_tid);
191 }
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
void reinitMaterials(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true)
SubdomainID _subdomain
The subdomain for the current element.

◆ printBlockExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemPointerRange >::printBlockExecutionInformation ( ) const
inlineprotectedvirtualinherited

Print information about the particular ordering of objects on each block.

Definition at line 181 of file ThreadedElementLoopBase.h.

181 {}

◆ printBoundaryExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemPointerRange >::printBoundaryExecutionInformation ( const unsigned  int) const
inlineprotectedvirtualinherited

Print information about the particular ordering of objects on each boundary.

Definition at line 184 of file ThreadedElementLoopBase.h.

184 {}

◆ printExecutionOrdering() [1/2]

void ThreadedElementLoop< ConstElemPointerRange >::printExecutionOrdering ( const std::vector< T *> &  objs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Routine to output the ordering of objects within a vector of pointers to these objects.

These objects must implement the name() routine, and it must return a string or compatible type.

Template Parameters
Tthe object type
Parameters
objsthe vector with all the objects (should be pointers)
objects_typethe name of the type of objects. Defaults to the CPP object name
print_headerwhether to print a header about the timing of execution and the type of objects

Definition at line 148 of file ThreadedElementLoop.h.

151 {
152  if (!objs.size())
153  return;
154 
155  auto & console = _fe_problem.console();
156  const auto objects_type = MooseUtils::prettyCppType(objs[0]);
157  std::vector<MooseObject *> moose_objs;
158  for (auto obj_ptr : objs)
159  moose_objs.push_back(dynamic_cast<MooseObject *>(obj_ptr));
160  const auto names = ConsoleUtils::mooseObjectVectorToString(moose_objs);
161 
162  // Print string with a DBG prefix and with sufficient line breaks
163  std::string message = print_header ? "Executing " + objects_type + " on " +
165  : "";
166  message += (print_header ? "Order of execution:\n" : "") + names;
167  console << ConsoleUtils::formatString(message, line_prefix) << std::endl;
168 }
std::string mooseObjectVectorToString(const std::vector< MooseObject *> &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
Definition: ConsoleUtils.C:598
const std::string & name() const
Definition: MooseEnumItem.h:35
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
Definition: ConsoleUtils.C:582
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1246

◆ printExecutionOrdering() [2/2]

void ThreadedElementLoop< ConstElemPointerRange >::printExecutionOrdering ( const std::vector< std::shared_ptr< T >> &  objs_ptrs,
const bool  print_header = true,
const std::string &  line_prefix = "[DBG]" 
) const
protectedinherited

Definition at line 173 of file ThreadedElementLoop.h.

177 {
178  std::vector<T *> regular_ptrs;
179  for (auto shared_ptr : objs_ptrs)
180  regular_ptrs.push_back(shared_ptr.get());
181  printExecutionOrdering<T>(regular_ptrs, print_header, line_prefix);
182 }

◆ printGeneralExecutionInformation()

virtual void ThreadedElementLoopBase< ConstElemPointerRange >::printGeneralExecutionInformation ( ) const
inlineprotectedvirtualinherited

Print information about the loop ordering.

Definition at line 178 of file ThreadedElementLoopBase.h.

178 {}

◆ resetExecPrintedSets()

void ThreadedElementLoopBase< ConstElemPointerRange >::resetExecPrintedSets ( ) const
protectedinherited

Resets the set of blocks and boundaries visited.

Definition at line 444 of file ThreadedElementLoopBase.h.

445 {
446  _blocks_exec_printed.clear();
447  _boundaries_exec_printed.clear();
448 }
std::set< SubdomainID > _blocks_exec_printed
Keep track of which blocks were visited.
std::set< BoundaryID > _boundaries_exec_printed
Keep track of which boundaries were visited.

◆ shouldComputeInternalSide()

bool ProjectMaterialProperties::shouldComputeInternalSide ( const Elem &  elem,
const Elem &  neighbor 
) const
inlineoverrideprivatevirtual

Whether to compute the internal side for the provided element-neighbor pair.

Typically this will return true if the element id is less than the neighbor id when the elements are equal level, or when the element is more refined than the neighbor, and then false otherwise. One type of loop where the logic will be different is when projecting stateful material properties

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 66 of file ProjectMaterialProperties.h.

68 {
69  return true;
70 }

◆ subdomainChanged()

void ProjectMaterialProperties::subdomainChanged ( )
overridevirtual

Called every time the current subdomain changes (i.e.

the subdomain of this element is not the same as the subdomain of the last element). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemPointerRange >.

Definition at line 58 of file ProjectMaterialProperties.C.

Member Data Documentation

◆ _assembly

std::vector<std::vector<std::unique_ptr<Assembly> > >& ProjectMaterialProperties::_assembly
protected

Definition at line 53 of file ProjectMaterialProperties.h.

Referenced by onBoundary(), onElement(), and onInternalSide().

◆ _blocks_exec_printed

std::set<SubdomainID> ThreadedElementLoopBase< ConstElemPointerRange >::_blocks_exec_printed
mutableprotectedinherited

Keep track of which blocks were visited.

Definition at line 187 of file ThreadedElementLoopBase.h.

◆ _bnd_material_props

MaterialPropertyStorage& ProjectMaterialProperties::_bnd_material_props
protected

Definition at line 52 of file ProjectMaterialProperties.h.

Referenced by onBoundary(), and onInternalSide().

◆ _boundaries_exec_printed

std::set<BoundaryID> ThreadedElementLoopBase< ConstElemPointerRange >::_boundaries_exec_printed
mutableprotectedinherited

Keep track of which boundaries were visited.

Definition at line 190 of file ThreadedElementLoopBase.h.

◆ _discrete_materials

const MaterialWarehouse& ProjectMaterialProperties::_discrete_materials
protected

Discrete materials warehouse.

Definition at line 59 of file ProjectMaterialProperties.h.

Referenced by onElement().

◆ _fe_problem

FEProblemBase& ProjectMaterialProperties::_fe_problem
protected

Definition at line 50 of file ProjectMaterialProperties.h.

Referenced by onBoundary(), and subdomainChanged().

◆ _material_props

MaterialPropertyStorage& ProjectMaterialProperties::_material_props
protected

Definition at line 51 of file ProjectMaterialProperties.h.

Referenced by onElement(), and onInternalSide().

◆ _materials

const MaterialWarehouse& ProjectMaterialProperties::_materials
protected

Materials warehouse.

Definition at line 57 of file ProjectMaterialProperties.h.

Referenced by onElement().

◆ _mesh

Definition at line 162 of file ThreadedElementLoopBase.h.

Referenced by onBoundary(), onElement(), and onInternalSide().

◆ _need_internal_side_material

bool ProjectMaterialProperties::_need_internal_side_material
protected

Definition at line 54 of file ProjectMaterialProperties.h.

Referenced by onInternalSide(), and subdomainChanged().

◆ _neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemPointerRange >::_neighbor_subdomain
protectedinherited

The subdomain for the current neighbor.

Definition at line 172 of file ThreadedElementLoopBase.h.

◆ _old_neighbor_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemPointerRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 175 of file ThreadedElementLoopBase.h.

◆ _old_subdomain

SubdomainID ThreadedElementLoopBase< ConstElemPointerRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 169 of file ThreadedElementLoopBase.h.

◆ _refine

bool ProjectMaterialProperties::_refine
protected

Whether or not you are projecting refinements. Set to false for coarsening.

Definition at line 49 of file ProjectMaterialProperties.h.

Referenced by onBoundary(), onElement(), and onInternalSide().

◆ _subdomain

SubdomainID ThreadedElementLoopBase< ConstElemPointerRange >::_subdomain
protectedinherited

The subdomain for the current element.

Definition at line 166 of file ThreadedElementLoopBase.h.

Referenced by subdomainChanged().

◆ _tid

Definition at line 163 of file ThreadedElementLoopBase.h.

Referenced by onBoundary(), onElement(), onInternalSide(), and subdomainChanged().


The documentation for this class was generated from the following files: