www.mooseframework.org
ElementPairLocator.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
10 #pragma once
11 
12 #include <list>
13 
14 // MOOSE includes
15 #include "Moose.h"
16 #include "DataIO.h"
17 #include "ElementPairInfo.h"
18 
19 #include "libmesh/vector_value.h"
20 #include "libmesh/point.h"
21 
22 // libMesh forward declarations
23 namespace libMesh
24 {
25 class Node;
26 class Elem;
27 }
28 
35 {
36 public:
37  ElementPairLocator(unsigned int interface_id) : _elem_pairs(NULL)
38  {
39  _interface_id = interface_id;
40  }
41 
42  virtual ~ElementPairLocator() {}
43 
44  typedef std::list<std::pair<const Elem *, const Elem *>> ElementPairList;
45 
46  virtual void reinit(){};
47 
48  virtual void update(){};
49 
50  const ElementPairList & getElemPairs() const
51  {
52  if (_elem_pairs == NULL)
53  mooseError("_elem_pairs has not yet been initialized and it needs to be initialized by a "
54  "derived class");
55  return *_elem_pairs;
56  }
57 
58  const ElementPairInfo & getElemPairInfo(std::pair<const Elem *, const Elem *> elem_pair) const
59  {
60  std::map<std::pair<const Elem *, const Elem *>, ElementPairInfo>::const_iterator it =
61  _element_pair_info.find(elem_pair);
62  if (it == _element_pair_info.end())
63  mooseError("Could not find ElemenPairInfo for specified element pair");
64  return it->second;
65  }
66 
67 protected:
69  std::map<std::pair<const Elem *, const Elem *>, ElementPairInfo> _element_pair_info;
70  unsigned int _interface_id;
71 };
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:284
const ElementPairInfo & getElemPairInfo(std::pair< const Elem *, const Elem *> elem_pair) const
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const ElementPairList * _elem_pairs
const ElementPairList & getElemPairs() 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
std::map< std::pair< const Elem *, const Elem * >, ElementPairInfo > _element_pair_info