Cardinal
MeshTally.h
Go to the documentation of this file.
1 /********************************************************************/
2 /* SOFTWARE COPYRIGHT NOTIFICATION */
3 /* Cardinal */
4 /* */
5 /* (c) 2021 UChicago Argonne, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by UChicago Argonne, LLC */
9 /* Under Contract No. DE-AC02-06CH11357 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* Prepared by Battelle Energy Alliance, LLC */
13 /* Under Contract No. DE-AC07-05ID14517 */
14 /* With the U. S. Department of Energy */
15 /* */
16 /* See LICENSE for full restrictions */
17 /********************************************************************/
18 
19 #pragma once
20 
21 #include "TallyBase.h"
23 
24 #include "openmc/tallies/filter_mesh.h"
25 
26 namespace libMesh
27 {
28 class ReplicatedMesh;
29 }
30 
31 class MeshTally : public TallyBase
32 {
33 public:
34  static InputParameters validParams();
35 
36  MeshTally(const InputParameters & parameters);
37 
43  virtual std::pair<unsigned int, openmc::Filter *> spatialFilter() override;
44 
46  virtual void resetTally() override;
47 
52  virtual void gatherLinkedSum() override;
53 
59  virtual bool addingGlobalTally() const override { return _needs_global_tally && _instance == 0; }
60 
61 protected:
72  virtual Real storeResultsInner(const std::vector<unsigned int> & var_numbers,
73  unsigned int local_score,
74  const std::vector<OMCTensor> & tally_vals,
75  bool norm_by_src_rate = true) override;
84 
94  const std::string * _mesh_template_filename = nullptr;
95 
98 
100  const unsigned int _instance;
101 
103  unsigned int _mesh_index;
104 
106  openmc::MeshFilter * _mesh_filter;
107 
109  openmc::UnstructuredMesh * _mesh_template;
110 
112  const bool _use_dof_map;
113 
120  std::unique_ptr<libMesh::ReplicatedMesh> _libmesh_mesh_copy;
122  std::vector<unsigned int> _bin_to_element_mapping;
123 };
openmc::UnstructuredMesh * _mesh_template
OpenMC unstructured mesh instance for use with mesh tallies.
Definition: MeshTally.h:109
virtual void gatherLinkedSum() override
virtual Real storeResultsInner(const std::vector< unsigned int > &var_numbers, unsigned int local_score, const std::vector< OMCTensor > &tally_vals, bool norm_by_src_rate=true) override
void checkMeshTemplateAndTranslations()
static InputParameters validParams()
virtual std::pair< unsigned int, openmc::Filter * > spatialFilter() override
openmc::MeshFilter * _mesh_filter
OpenMC mesh filter for this unstructured mesh tally.
Definition: MeshTally.h:106
virtual bool addingGlobalTally() const override
Definition: MeshTally.h:59
const unsigned int _instance
The index into an array of mesh translations.
Definition: MeshTally.h:100
Definition: OpenMCBase.h:25
unsigned int _mesh_index
The index of the mesh added by this tally.
Definition: MeshTally.h:103
Definition: TallyBase.h:35
const std::string * _mesh_template_filename
Definition: MeshTally.h:94
Definition: MeshTally.h:31
Point _mesh_translation
The translation to apply to the mesh template.
Definition: MeshTally.h:97
const bool _needs_global_tally
Definition: TallyBase.h:461
std::unique_ptr< libMesh::ReplicatedMesh > _libmesh_mesh_copy
Definition: MeshTally.h:120
std::vector< unsigned int > _bin_to_element_mapping
A mapping between the OpenMC bins (active block restricted elements) and all elements.
Definition: MeshTally.h:122
const bool _use_dof_map
Whether we're using an indirection layer to map between the OpenMC mesh tally and the MOOSE mesh.
Definition: MeshTally.h:112
virtual void resetTally() override
A function to reset the tally. MeshTally overrides this function to delete the OpenMC mesh.
MeshTally(const InputParameters &parameters)