Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 : 29 : /** 30 : * This is the ElementPairLocator class. This is a base class that 31 : * finds the element pairs for ElementElementConstraint 32 : */ 33 : 34 : class ElementPairLocator 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 0 : const ElementPairList & getElemPairs() const 51 : { 52 0 : if (_elem_pairs == NULL) 53 0 : mooseError("_elem_pairs has not yet been initialized and it needs to be initialized by a " 54 : "derived class"); 55 0 : return *_elem_pairs; 56 : } 57 : 58 0 : 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 0 : _element_pair_info.find(elem_pair); 62 0 : if (it == _element_pair_info.end()) 63 0 : mooseError("Could not find ElemenPairInfo for specified element pair"); 64 0 : return it->second; 65 : } 66 : 67 : protected: 68 : const ElementPairList * _elem_pairs; 69 : std::map<std::pair<const Elem *, const Elem *>, ElementPairInfo> _element_pair_info; 70 : unsigned int _interface_id; 71 : };