IOSS 2.0
Loading...
Searching...
No Matches
Ioexnl_DecompositionData.h
Go to the documentation of this file.
1/*
2 * Copyright(C) 1999-2024 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8#pragma once
9
10#include <exodusII.h>
11#if defined PARALLEL_AWARE_EXODUS
12
13#include "Ioss_CodeTypes.h"
14#include <string>
15#include <vector>
16
17#include "ioexnl_export.h"
18
19#include "Ioss_Decomposition.h"
20
21namespace Ioss {
22 class Field;
23 class Map;
24 class PropertyManager;
25} // namespace Ioss
26namespace Ioexnl {
27
28 class IOEXNL_EXPORT DecompositionDataBase
29 {
30 public:
31 DecompositionDataBase(Ioss_MPI_Comm comm) : comm_(comm) {}
32 DecompositionDataBase(const DecompositionDataBase &) = delete;
33 DecompositionDataBase &operator=(const DecompositionDataBase &) = delete;
34
35 virtual ~DecompositionDataBase() = default;
36 IOSS_NODISCARD virtual int int_size() const = 0;
37 IOSS_NODISCARD virtual size_t ioss_node_count() const = 0;
38 IOSS_NODISCARD virtual size_t ioss_elem_count() const = 0;
39
40 IOSS_NODISCARD virtual int spatial_dimension() const = 0;
41 IOSS_NODISCARD virtual size_t global_node_count() const = 0;
42 IOSS_NODISCARD virtual size_t global_elem_count() const = 0;
43
44 IOSS_NODISCARD virtual size_t decomp_node_offset() const = 0;
45 IOSS_NODISCARD virtual size_t decomp_node_count() const = 0;
46 IOSS_NODISCARD virtual size_t decomp_elem_offset() const = 0;
47 IOSS_NODISCARD virtual size_t decomp_elem_count() const = 0;
48
49 Ioss_MPI_Comm comm_;
50
51 int m_processor{0};
52 int m_processorCount{0};
53
54 std::vector<Ioss::BlockDecompositionData> el_blocks;
55 std::vector<Ioss::SetDecompositionData> node_sets;
56 std::vector<Ioss::SetDecompositionData> side_sets;
57 };
58
59 template <typename INT> class DecompositionData : public DecompositionDataBase
60 {
61 public:
62 DecompositionData(const Ioss::PropertyManager &props, Ioss_MPI_Comm communicator);
63 ~DecompositionData() = default;
64
65 IOSS_NODISCARD int int_size() const { return sizeof(INT); }
66
67 IOSS_NODISCARD int spatial_dimension() const { return m_decomposition.m_spatialDimension; }
68
69 IOSS_NODISCARD size_t global_node_count() const { return m_decomposition.global_node_count(); }
70 IOSS_NODISCARD size_t global_elem_count() const { return m_decomposition.global_elem_count(); }
71
72 IOSS_NODISCARD size_t ioss_node_count() const { return m_decomposition.ioss_node_count(); }
73 IOSS_NODISCARD size_t ioss_elem_count() const { return m_decomposition.ioss_elem_count(); }
74
75 IOSS_NODISCARD size_t decomp_node_offset() const { return m_decomposition.file_node_offset(); }
76 IOSS_NODISCARD size_t decomp_node_count() const { return m_decomposition.file_node_count(); }
77 IOSS_NODISCARD size_t decomp_elem_offset() const { return m_decomposition.file_elem_offset(); }
78 IOSS_NODISCARD size_t decomp_elem_count() const { return m_decomposition.file_elem_count(); }
79
80 void create_implicit_global_map(const std::vector<int> &owning_proc,
81 std::vector<int64_t> &global_implicit_map, Ioss::Map &node_map,
82 int64_t *locally_owned_count, int64_t *processor_offset);
83
84 private:
85 void simple_decompose(const std::string &method, const std::vector<INT> &element_dist)
86 {
87 m_decomposition.simple_decompose(method, element_dist);
88 }
89
90 void simple_node_decompose(const std::string &method, const std::vector<INT> &node_dist);
91
92 template <typename T>
93 int handle_sset_df(int filePtr, ex_entity_id id, const Ioss::Field &field, T *ioss_data) const;
94
95 IOSS_NODISCARD bool i_own_node(size_t node) const
96 {
97 // T/F if the node with global index `node` is owned by this processors ioss-decomp.
98 return m_decomposition.i_own_node(node);
99 }
100
101 IOSS_NODISCARD bool i_own_elem(size_t elem) const
102 // T/F if the element with global index `elem` is owned by this processors ioss-decomp.
103 {
104 return m_decomposition.i_own_elem(elem);
105 }
106
107 // global_index is 1-based index into global list of nodes [1..global_node_count]
108 // return value is 1-based index into local list of nodes on this
109 // processor (ioss-decomposition)
110 IOSS_NODISCARD size_t node_global_to_local(size_t global_index) const
111 {
112 return m_decomposition.node_global_to_local(global_index);
113 }
114
115 IOSS_NODISCARD size_t elem_global_to_local(size_t global_index) const
116 {
117 return m_decomposition.elem_global_to_local(global_index);
118 }
119
120 void build_global_to_local_elem_map()
121 {
122 return m_decomposition.build_global_to_local_elem_map();
123 }
124
125 void get_shared_node_list() { m_decomposition.get_shared_node_list(); }
126
127 void get_local_node_list() { m_decomposition.get_local_node_list(); }
128
129 public:
130 Ioss::Decomposition<INT> m_decomposition;
131 };
132} // namespace Ioexnl
133#endif
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
Definition Ioss_Decomposition.h:180
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
Definition Ioss_Map.h:46
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
A namespace for the exodus database format.
Definition Ioexnl_BaseDatabaseIO.C:93
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40