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 "ElementSubdomainModifier.h" 13 : 14 : /** 15 : * Modifies element subdomains only at a given list of times 16 : */ 17 : class TimedElementSubdomainModifier : public ElementSubdomainModifier 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : 22 : TimedElementSubdomainModifier(const InputParameters & parameters); 23 : 24 : virtual void initialize() override; 25 : 26 : protected: 27 : /** 28 : * Requests a vector of all times from the inheriting class 29 : * (these do not have to be sorted and may have duplicates). 30 : * @returns Unsorted vector of times. 31 : */ 32 : virtual std::vector<Real> getTimes() = 0; 33 : 34 : /// storage for the times including their original index. 35 : struct TimeIndexPair 36 : { 37 : Real time; 38 : std::size_t index; 39 : 40 2856 : bool operator<(const TimeIndexPair & a) const 41 : { 42 2856 : if (time == a.time) 43 1984 : return index < a.index; 44 : else 45 872 : return time < a.time; 46 : } 47 : }; 48 : 49 : /// Times and subdomain changes to make 50 : std::set<TimeIndexPair> _times_and_indices; 51 : };