https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NEML2BatchIndexGenerator.h
Go to the documentation of this file.
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 "ElementUserObject.h"
13
14#include <map>
15
21{
22public:
24
26
27 void initialize() override;
28 void execute() override;
29 void threadJoin(const UserObject &) override;
30 void finalize() override;
31
32 void meshChanged() override;
33
35 std::size_t getBatchIndex() const { return _batch_index; }
36
38 std::size_t getBatchIndex(dof_id_type elem_id) const;
39
41 bool isEmpty() const { return _batch_index == 0; }
42
43protected:
46
48 std::size_t _batch_index;
49
51 std::map<dof_id_type, std::size_t> _elem_to_batch_index;
52
54 mutable std::pair<dof_id_type, std::size_t> _elem_to_batch_index_cache;
55};
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
NEML2BatchIndexGenerator iterates over the mesh and generates a map from element ID to batch index wh...
void finalize() override
Finalize.
std::size_t _batch_index
Highest current batch index.
std::map< dof_id_type, std::size_t > _elem_to_batch_index
Map from element IDs to batch indices.
bool isEmpty() const
Whether the batch is empty.
void initialize() override
Called before execute() is ever called so that data can be cleared.
void execute() override
Execute method.
void threadJoin(const UserObject &) override
Must override.
static InputParameters validParams()
std::size_t getBatchIndex() const
Get the current batch index (in almost all cases this is the total batch size)
void meshChanged() override
Called on this object when the mesh changes.
bool _outdated
Whether the batch index map is outdated.
std::pair< dof_id_type, std::size_t > _elem_to_batch_index_cache
cache the index for the current element
Base class for user-specific data.
Definition UserObject.h:20