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

#include <ElementIDInterface.h>

Inheritance diagram for ElementIDInterface:
[legend]

Public Member Functions

 ElementIDInterface (const MooseObject *moose_object)
 
 ElementIDInterface (const ElementIDInterface &object, const Moose::Kokkos::FunctorCopy &key)
 Special constructor used for Kokkos functor copy during parallel dispatch. More...
 
virtual ~ElementIDInterface ()
 
virtual unsigned int getElementIDIndex (const std::string &id_parameter_name, unsigned int comp=0) const
 Gets index of an element integer with a parameter of the object derived from this interface. More...
 
virtual unsigned int getElementIDIndexByName (const std::string &id_name) const
 Return the accessing integer for an extra element integer with its name. More...
 
virtual const dof_id_typegetElementID (const std::string &id_parameter_name, unsigned int comp=0) const
 Gets an element integer with a parameter of the object derived from this interface. More...
 
virtual const dof_id_typegetElementIDNeighbor (const std::string &id_parameter_name, unsigned int comp=0) const
 Gets a neighbor element integer with a parameter of the object derived from this interface. More...
 
virtual const dof_id_typegetElementIDByName (const std::string &id_name) const
 Gets an element integer with the element integer name. More...
 
virtual const dof_id_typegetElementIDNeighborByName (const std::string &id_name) const
 Gets a neighbor element integer with the element integer name. More...
 
bool hasElementID (const std::string &id_name) const
 Whether mesh has an element integer with a given name. More...
 
dof_id_type maxElementID (unsigned int elem_id_index) const
 Return the maximum element ID for an element integer with its index. More...
 
dof_id_type minElementID (unsigned int elem_id_index) const
 Return the minimum element ID for an element integer with its index. More...
 
bool areElemIDsIdentical (const std::string &id_name1, const std::string &id_name2) const
 Whether two element integers are identical for all elements. More...
 
std::unordered_map< dof_id_type, std::set< dof_id_type > > getElemIDMapping (const std::string &id_name1, const std::string &id_name2) const
 Get the mapping from IDs of one extra element integer to another given the two integer names. More...
 
std::set< dof_id_typegetAllElemIDs (unsigned int elem_id_index) const
 Return all the unique element IDs for an element integer with its index on the entire domain. More...
 
std::set< dof_id_typegetElemIDsOnBlocks (unsigned int elem_id_index, const std::set< SubdomainID > &blks) const
 Return all the unique element IDs for an extra element integer with its index on a set of subdomains. More...
 
dof_id_type getElementID (const Elem *elem, unsigned int elem_id_index) const
 Get an element integer for an element. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Private Attributes

const InputParameters_obj_parameters
 Reference to the object's input parameters. More...
 
std::shared_ptr< MooseMesh > & _id_mesh
 References to the mesh and displaced mesh (currently in the ActionWarehouse) More...
 
const std::string & _ei_name
 Name of the object using this interface. More...
 

Detailed Description

Definition at line 23 of file ElementIDInterface.h.

Constructor & Destructor Documentation

◆ ElementIDInterface() [1/2]

ElementIDInterface::ElementIDInterface ( const MooseObject moose_object)

Definition at line 28 of file ElementIDInterface.C.

29  : _obj_parameters(moose_object->parameters()),
30  _id_mesh(moose_object->getMooseApp().actionWarehouse().mesh()),
31  _ei_name(moose_object->name())
32 {
33 }
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:87
std::shared_ptr< MooseMesh > & mesh()
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
const std::string & _ei_name
Name of the object using this interface.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:211
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.

◆ ElementIDInterface() [2/2]

ElementIDInterface::ElementIDInterface ( const ElementIDInterface object,
const Moose::Kokkos::FunctorCopy key 
)

Special constructor used for Kokkos functor copy during parallel dispatch.

Definition at line 36 of file ElementIDInterface.C.

39 {
40 }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)
const std::string & _ei_name
Name of the object using this interface.
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.

◆ ~ElementIDInterface()

virtual ElementIDInterface::~ElementIDInterface ( )
inlinevirtual

Definition at line 37 of file ElementIDInterface.h.

37 {}

Member Function Documentation

◆ areElemIDsIdentical()

bool ElementIDInterface::areElemIDsIdentical ( const std::string &  id_name1,
const std::string &  id_name2 
) const
inline

Whether two element integers are identical for all elements.

Definition at line 111 of file ElementIDInterface.h.

112  {
113  return _id_mesh->areElemIDsIdentical(id_name1, id_name2);
114  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ getAllElemIDs()

std::set<dof_id_type> ElementIDInterface::getAllElemIDs ( unsigned int  elem_id_index) const
inline

Return all the unique element IDs for an element integer with its index on the entire domain.

Definition at line 128 of file ElementIDInterface.h.

129  {
130  return _id_mesh->getAllElemIDs(elem_id_index);
131  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ getElementID() [1/2]

const dof_id_type & ElementIDInterface::getElementID ( const std::string &  id_parameter_name,
unsigned int  comp = 0 
) const
virtual

Gets an element integer with a parameter of the object derived from this interface.

Parameters
id_parameter_nameName of object parameter
compComponent number for vector of integer names
Returns
Integer for the current element

Reimplemented in Material.

Definition at line 80 of file ElementIDInterface.C.

Referenced by Material::getElementID().

81 {
82  auto id = getElementIDIndex(id_parameter_name, comp);
83 
84  auto & _subproblem = *_obj_parameters.getCheckedPointerParam<SubProblem *>("_subproblem");
85 
86  auto tid = _obj_parameters.get<THREAD_ID>("_tid");
87 
88  auto & assembly = _subproblem.assembly(tid, 0);
89 
90  return assembly.extraElemID(id);
91 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
virtual unsigned int getElementIDIndex(const std::string &id_parameter_name, unsigned int comp=0) const
Gets index of an element integer with a parameter of the object derived from this interface...
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ getElementID() [2/2]

dof_id_type ElementIDInterface::getElementID ( const Elem *  elem,
unsigned int  elem_id_index 
) const
inline

Get an element integer for an element.

Definition at line 146 of file ElementIDInterface.h.

147  {
148  if (elem_id_index == elem->n_extra_integers())
149  return elem->subdomain_id();
150 
151  return elem->get_extra_integer(elem_id_index);
152  }

◆ getElementIDByName()

const dof_id_type & ElementIDInterface::getElementIDByName ( const std::string &  id_name) const
virtual

Gets an element integer with the element integer name.

Parameters
id_nameName of element integer
Returns
Integer for the current element

Reimplemented in Material.

Definition at line 109 of file ElementIDInterface.C.

Referenced by Material::getElementIDByName().

110 {
111  auto id = getElementIDIndexByName(id_name);
112 
113  auto & _subproblem = *_obj_parameters.getCheckedPointerParam<SubProblem *>("_subproblem");
114 
115  auto tid = _obj_parameters.get<THREAD_ID>("_tid");
116 
117  auto & assembly = _subproblem.assembly(tid, 0);
118 
119  return assembly.extraElemID(id);
120 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.
virtual unsigned int getElementIDIndexByName(const std::string &id_name) const
Return the accessing integer for an extra element integer with its name.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ getElementIDIndex()

unsigned int ElementIDInterface::getElementIDIndex ( const std::string &  id_parameter_name,
unsigned int  comp = 0 
) const
virtual

Gets index of an element integer with a parameter of the object derived from this interface.

Parameters
id_parameter_nameName of object parameter
compComponent number for vector of integer names
Returns
Index of the element integer

Definition at line 44 of file ElementIDInterface.C.

Referenced by getElementID(), and getElementIDNeighbor().

46 {
47  auto & p = _obj_parameters.get<std::vector<ExtraElementIDName>>(id_parameter_name);
48  if (comp >= p.size())
49  mooseError(id_parameter_name, " does not have enough integer names");
50 
51  return getElementIDIndexByName(p[comp]);
52 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.
virtual unsigned int getElementIDIndexByName(const std::string &id_name) const
Return the accessing integer for an extra element integer with its name.

◆ getElementIDIndexByName()

unsigned int ElementIDInterface::getElementIDIndexByName ( const std::string &  id_name) const
virtual

Return the accessing integer for an extra element integer with its name.

Parameters
id_nameName of element integer
Returns
Index of the element integer

Definition at line 55 of file ElementIDInterface.C.

Referenced by ExtraIDIntegralVectorPostprocessor::ExtraIDIntegralVectorPostprocessor(), getElementIDByName(), getElementIDIndex(), and getElementIDNeighborByName().

56 {
57  if (!_id_mesh.get())
58  mooseError("Mesh is not available for getting element integers");
59 
60  auto & mesh_base = _id_mesh->getMesh();
61 
62  if (id_name == "subdomain_id")
63  {
64  if (mesh_base.has_elem_integer(id_name))
65  mooseError("MOOSE does not allow 'subdomain_id' element integer in a mesh. 'subdomain_id' is "
66  "reserved for element subdomain ID");
67  return mesh_base.n_elem_integers();
68  }
69 
70  if (!mesh_base.has_elem_integer(id_name))
71  mooseError(
72  "Mesh does not have an element integer names as ", id_name, " but required by ", _ei_name);
73 
74  auto id = mesh_base.get_elem_integer_index(id_name);
75 
76  return id;
77 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)
const std::string & _ei_name
Name of the object using this interface.

◆ getElementIDNeighbor()

const dof_id_type & ElementIDInterface::getElementIDNeighbor ( const std::string &  id_parameter_name,
unsigned int  comp = 0 
) const
virtual

Gets a neighbor element integer with a parameter of the object derived from this interface.

Parameters
id_parameter_nameName of object parameter
compComponent number for vector of integer names
Returns
Integer for the neighbor element

Reimplemented in Material.

Definition at line 94 of file ElementIDInterface.C.

Referenced by Material::getElementID(), and Material::getElementIDNeighbor().

96 {
97  auto id = getElementIDIndex(id_parameter_name, comp);
98 
99  auto & _subproblem = *_obj_parameters.getCheckedPointerParam<SubProblem *>("_subproblem");
100 
101  auto tid = _obj_parameters.get<THREAD_ID>("_tid");
102 
103  auto & assembly = _subproblem.assembly(tid, 0);
104 
105  return assembly.extraElemIDNeighbor(id);
106 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
virtual unsigned int getElementIDIndex(const std::string &id_parameter_name, unsigned int comp=0) const
Gets index of an element integer with a parameter of the object derived from this interface...
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ getElementIDNeighborByName()

const dof_id_type & ElementIDInterface::getElementIDNeighborByName ( const std::string &  id_name) const
virtual

Gets a neighbor element integer with the element integer name.

Parameters
id_nameName of element integer
Returns
Integer for the neighbor element

Reimplemented in Material.

Definition at line 123 of file ElementIDInterface.C.

Referenced by Material::getElementIDByName(), and Material::getElementIDNeighborByName().

124 {
125  auto id = getElementIDIndexByName(id_name);
126 
127  auto & _subproblem = *_obj_parameters.getCheckedPointerParam<SubProblem *>("_subproblem");
128 
129  auto tid = _obj_parameters.get<THREAD_ID>("_tid");
130 
131  auto & assembly = _subproblem.assembly(tid, 0);
132 
133  return assembly.extraElemIDNeighbor(id);
134 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
const InputParameters & _obj_parameters
Reference to the object&#39;s input parameters.
virtual unsigned int getElementIDIndexByName(const std::string &id_name) const
Return the accessing integer for an extra element integer with its name.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
unsigned int THREAD_ID
Definition: MooseTypes.h:209

◆ getElemIDMapping()

std::unordered_map<dof_id_type, std::set<dof_id_type> > ElementIDInterface::getElemIDMapping ( const std::string &  id_name1,
const std::string &  id_name2 
) const
inline

Get the mapping from IDs of one extra element integer to another given the two integer names.

Definition at line 120 of file ElementIDInterface.h.

121  {
122  return _id_mesh->getElemIDMapping(id_name1, id_name2);
123  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ getElemIDsOnBlocks()

std::set<dof_id_type> ElementIDInterface::getElemIDsOnBlocks ( unsigned int  elem_id_index,
const std::set< SubdomainID > &  blks 
) const
inline

Return all the unique element IDs for an extra element integer with its index on a set of subdomains.

Definition at line 137 of file ElementIDInterface.h.

139  {
140  return _id_mesh->getElemIDsOnBlocks(elem_id_index, blks);
141  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ hasElementID()

bool ElementIDInterface::hasElementID ( const std::string &  id_name) const
inline

Whether mesh has an element integer with a given name.

Definition at line 90 of file ElementIDInterface.h.

90 { return _id_mesh->hasElementID(id_name); }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ maxElementID()

dof_id_type ElementIDInterface::maxElementID ( unsigned int  elem_id_index) const
inline

Return the maximum element ID for an element integer with its index.

Definition at line 95 of file ElementIDInterface.h.

96  {
97  return _id_mesh->maxElementID(elem_id_index);
98  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ minElementID()

dof_id_type ElementIDInterface::minElementID ( unsigned int  elem_id_index) const
inline

Return the minimum element ID for an element integer with its index.

Definition at line 103 of file ElementIDInterface.h.

104  {
105  return _id_mesh->minElementID(elem_id_index);
106  }
std::shared_ptr< MooseMesh > & _id_mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)

◆ validParams()

InputParameters ElementIDInterface::validParams ( )
static

Definition at line 23 of file ElementIDInterface.C.

24 {
25  return emptyInputParameters();
26 }
InputParameters emptyInputParameters()

Member Data Documentation

◆ _ei_name

const std::string& ElementIDInterface::_ei_name
private

Name of the object using this interface.

Definition at line 162 of file ElementIDInterface.h.

Referenced by getElementIDIndexByName().

◆ _id_mesh

std::shared_ptr<MooseMesh>& ElementIDInterface::_id_mesh
private

References to the mesh and displaced mesh (currently in the ActionWarehouse)

Definition at line 159 of file ElementIDInterface.h.

Referenced by areElemIDsIdentical(), getAllElemIDs(), getElementIDIndexByName(), getElemIDMapping(), getElemIDsOnBlocks(), hasElementID(), maxElementID(), and minElementID().

◆ _obj_parameters

const InputParameters& ElementIDInterface::_obj_parameters
private

Reference to the object's input parameters.

Definition at line 156 of file ElementIDInterface.h.

Referenced by getElementID(), getElementIDByName(), getElementIDIndex(), getElementIDNeighbor(), and getElementIDNeighborByName().


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