https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
AttribSysNum Class Referenceabstract

Tracks the libmesh system number that a MooseObject is associated with. More...

#include <Attributes.h>

Inheritance diagram for AttribSysNum:
[legend]

Public Types

typedef unsigned int Key
 

Public Member Functions

void setFrom (Key k)
 
 AttribSysNum (TheWarehouse &w)
 
 AttribSysNum (TheWarehouse &w, unsigned int t)
 
virtual void initFrom (const MooseObject *obj) override
 initFrom reads and stores the desired meta-data from obj for later matching comparisons.
 
virtual bool isMatch (const Attribute &other) const override
 isMatch returns true if the meta-data stored in this attribute is equivalent to that stored in other.
 
virtual bool isEqual (const Attribute &other) const override
 isEqual returns true if the meta-data stored in this attribute is identical to that stored in other.
 
 hashfunc (_val)
 
 clonefunc (AttribSysNum)
 
bool operator== (const Attribute &other) const
 
bool operator!= (const Attribute &other) const
 
unsigned int id () const
 returns the unique attribute ID associated with all attributes that have the same (mose derived) class as this object.
 
virtual std::size_t hash () const =0
 This function must return a deterministic value that is uniquely determined by the data the attribute holds (i.e.
 
virtual std::unique_ptr< Attributeclone () const =0
 clone creates and returns and identical (deep) copy of this attribute - i.e.
 

Private Attributes

unsigned int _val = libMesh::invalid_uint
 
int _id = -1
 

Detailed Description

Tracks the libmesh system number that a MooseObject is associated with.

Definition at line 276 of file Attributes.h.

Member Typedef Documentation

◆ Key

typedef unsigned int AttribSysNum::Key

Definition at line 279 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttribSysNum() [1/2]

AttribSysNum::AttribSysNum ( TheWarehouse w)
inline

Definition at line 282 of file Attributes.h.

282: Attribute(w, "sys_num") {}
Attribute is an abstract class that can be implemented in order to track custom metadata about MooseO...

◆ AttribSysNum() [2/2]

AttribSysNum::AttribSysNum ( TheWarehouse w,
unsigned int  t 
)
inline

Definition at line 283 of file Attributes.h.

283: Attribute(w, "sys_num"), _val(t) {}
unsigned int _val
Definition Attributes.h:291

Member Function Documentation

◆ clone()

virtual std::unique_ptr< Attribute > Attribute::clone ( ) const
pure virtualinherited

clone creates and returns and identical (deep) copy of this attribute - i.e.

the result of clone should return true if passed into isMatch.

Referenced by TheWarehouse::update().

◆ clonefunc()

AttribSysNum::clonefunc ( AttribSysNum  )

◆ hash()

virtual std::size_t Attribute::hash ( ) const
pure virtualinherited

This function must return a deterministic value that is uniquely determined by the data the attribute holds (i.e.

is initialized with). Ideally, the data should be uniformly and randomly distributed across the domain of size_t values - e.g. 1 and 2 should hash to completely unrelated values. Use of std::hash for POD is encouraged. A convenience hash_combine function is also provided to combine the results an existing hash with one or more other values.

Referenced by std::hash< Attribute >::operator()().

◆ hashfunc()

AttribSysNum::hashfunc ( _val  )

◆ id()

unsigned int Attribute::id ( ) const
inlineinherited

returns the unique attribute ID associated with all attributes that have the same (mose derived) class as this object.

This ID is determined at construction time this

Definition at line 68 of file TheWarehouse.h.

68{ return _id; }

Referenced by std::hash< Attribute >::operator()().

◆ initFrom()

void AttribSysNum::initFrom ( const MooseObject obj)
overridevirtual

initFrom reads and stores the desired meta-data from obj for later matching comparisons.

Implements Attribute.

Definition at line 305 of file Attributes.C.

306{
307 auto * sys = obj->getParam<SystemBase *>("_sys");
308
309 if (sys)
310 _val = sys->number();
311}
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406
Base class for a system (of equations)
Definition SystemBase.h:87
unsigned int number() const
Gets the number of this system.

◆ isEqual()

bool AttribSysNum::isEqual ( const Attribute other) const
overridevirtual

isEqual returns true if the meta-data stored in this attribute is identical to that stored in other.

isEqual does not need to check/compare the values from the instances' id() functions.

Implements Attribute.

Definition at line 321 of file Attributes.C.

322{
323 return isMatch(other);
324}
virtual bool isMatch(const Attribute &other) const override
isMatch returns true if the meta-data stored in this attribute is equivalent to that stored in other.
Definition Attributes.C:314

◆ isMatch()

bool AttribSysNum::isMatch ( const Attribute other) const
overridevirtual

isMatch returns true if the meta-data stored in this attribute is equivalent to that stored in other.

This is is for query matching - not exact equivalence. isMatch does not need to check/compare the values from the instances' id() functions.

Implements Attribute.

Definition at line 314 of file Attributes.C.

315{
316 auto a = dynamic_cast<const AttribSysNum *>(&other);
317 return a && (a->_val == _val);
318}
Tracks the libmesh system number that a MooseObject is associated with.
Definition Attributes.h:277

Referenced by isEqual().

◆ operator!=()

bool Attribute::operator!= ( const Attribute other) const
inlineinherited

Definition at line 63 of file TheWarehouse.h.

63{ return !(*this == other); }

◆ operator==()

bool Attribute::operator== ( const Attribute other) const
inlineinherited

Definition at line 59 of file TheWarehouse.h.

60 {
61 return _id == other._id && isEqual(other);
62 }
virtual bool isEqual(const Attribute &other) const =0
isEqual returns true if the meta-data stored in this attribute is identical to that stored in other.

◆ setFrom()

void AttribSysNum::setFrom ( Key  k)
inline

Definition at line 280 of file Attributes.h.

280{ _val = k; }

Member Data Documentation

◆ _id

int Attribute::_id = -1
privateinherited

Definition at line 93 of file TheWarehouse.h.

Referenced by Attribute::id(), and Attribute::operator==().

◆ _val

unsigned int AttribSysNum::_val = libMesh::invalid_uint
private

Definition at line 291 of file Attributes.h.

Referenced by initFrom(), isMatch(), and setFrom().


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