www.mooseframework.org
ElementPairLocator.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef ELEMENTPAIRLOCATOR_H
16 #define ELEMENTPAIRLOCATOR_H
17 
18 #include <list>
19 
20 // MOOSE includes
21 #include "Moose.h"
22 #include "DataIO.h"
23 #include "ElementPairInfo.h"
24 
25 #include "libmesh/vector_value.h"
26 #include "libmesh/point.h"
27 
28 // libMesh forward declarations
29 namespace libMesh
30 {
31 class Node;
32 class Elem;
33 }
34 
41 {
42 public:
43  ElementPairLocator(unsigned int interface_id) : _elem_pairs(NULL)
44  {
45  _interface_id = interface_id;
46  }
47 
48  virtual ~ElementPairLocator() {}
49 
50  typedef std::list<std::pair<const Elem *, const Elem *>> ElementPairList;
51 
52  virtual void reinit(){};
53 
54  virtual void update(){};
55 
56  const ElementPairList & getElemPairs() const
57  {
58  if (_elem_pairs == NULL)
59  mooseError("_elem_pairs has not yet been initialized and it needs to be initialized by a "
60  "derived class");
61  return *_elem_pairs;
62  }
63 
64  const ElementPairInfo & getElemPairInfo(std::pair<const Elem *, const Elem *> elem_pair) const
65  {
66  std::map<std::pair<const Elem *, const Elem *>, ElementPairInfo>::const_iterator it =
67  _element_pair_info.find(elem_pair);
68  if (it == _element_pair_info.end())
69  mooseError("Could not find ElemenPairInfo for specified element pair");
70  return it->second;
71  }
72 
73 protected:
74  const ElementPairList * _elem_pairs;
75  std::map<std::pair<const Elem *, const Elem *>, ElementPairInfo> _element_pair_info;
76  unsigned int _interface_id;
77 };
78 
79 #endif // ELEMENTPAIRLOCATOR_H
virtual void reinit()
virtual void update()
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const ElementPairList * _elem_pairs
const ElementPairInfo & getElemPairInfo(std::pair< const Elem *, const Elem * > elem_pair) const
ElementPairLocator(unsigned int interface_id)
This is the ElementPairLocator class.
This is the ElementPairInfo class.
std::list< std::pair< const Elem *, const Elem * > > ElementPairList
unsigned int _interface_id
const ElementPairList & getElemPairs() const
std::map< std::pair< const Elem *, const Elem * >, ElementPairInfo > _element_pair_info