Chi-Tech
AAH_FLUDSCommonData.h
Go to the documentation of this file.
1#ifndef CHITECH_AAH_FLUDSCOMMONDATA_H
2#define CHITECH_AAH_FLUDSCOMMONDATA_H
3
4#include "FLUDSCommonData.h"
5#include <cstddef>
6#include <cstdint>
7#include <set>
8
9namespace chi_mesh
10{
11class GridFaceHistogram;
12class Cell;
13class CellFace;
14}
15
17{
18
19// face_slot index, vertex ids
20typedef std::pair<int, std::vector<uint64_t>> CompactFaceView;
21
22// cell_global_id, faces
23typedef std::pair<int, std::vector<CompactFaceView>> CompactCellView;
24
25class SPDS;
26
28{
29public:
31 {
32 int slot_address = 0;
33 short* upwind_dof_mapping = nullptr;
34
35 void Setup(const std::pair<int, std::vector<short>>& input)
36 {
37 slot_address = input.first;
38 upwind_dof_mapping = new short[input.second.size()];
39 std::copy(input.second.begin(), input.second.end(), upwind_dof_mapping);
40 }
41
43 }; // TODO: Make common
44public:
45 explicit AAH_FLUDSCommonData(
46 const std::vector<CellFaceNodalMapping>& grid_nodal_mappings,
47 const SPDS& spds,
48 const chi_mesh::GridFaceHistogram& grid_face_histogram);
49
50protected:
51 friend class AAH_FLUDS;
52 int largest_face = 0;
53 size_t num_face_categories = 0; // Number of face categories
54 std::vector<size_t> local_psi_stride; // Group-angle-faceDOF stride per cat
55 std::vector<size_t> local_psi_max_elements; // Number of faces in each cat
56 size_t delayed_local_psi_stride = 0; // Group-angle-faceDOF stride delayed cat
57 size_t delayed_local_psi_max_elements = 0; // Number of faces in delayed cat
58
59 // local_psi_n_block_stride[fc]. Given face category fc, the value is
60 // total number of faces that store information in this category's buffer
61 // per angle
62 std::vector<size_t> local_psi_n_block_stride;
63 std::vector<size_t> local_psi_Gn_block_strideG;
66
67 // Very small vector listing the boundaries this location depends on
68 std::vector<int> boundary_dependencies;
69
70 // This is a small vector [deplocI] that holds the number of
71 // face dofs for each dependent location.
72 std::vector<int> deplocI_face_dof_count;
73
74 // This is a vector [dependent_location][unordered_cell_index]
75 // that holds an AlphaPair. AlphaPair-first is the cell's global_id
76 // and AlphaPair-second holds a number of BetaPairs. Each BetaPair
77 // comprises BetaPair-first = face_slot_index (the location of this
78 // faces data in the psi vector, and then a vector of vertex indexes
79 // that can be used for dof_mapping.
80 // Filled during slot-dynamics.
81 // Cleared after beta-pass.
82 std::vector<std::vector<CompactCellView>> deplocI_cell_views;
83
84 // This is a vector [cell_sweep_order_index][outgoing_face_count]
85 // which holds the slot address in the local psi vector where the first
86 // face dof will store its data
88
89 // This is a vector [cell_sweep_order_index][outgoing_face_count]
90 // which holds the face categorization for the face. i.e. the local
91 // psi vector that hold faces of the same category.
93
94 // This is a vector [cell_sweep_order_index][incoming_face_count]
95 // which holds the face categorization for the face. i.e. the local
96 // psi vector that hold faces of the same category.
98
99 // This is a vector [cell_sweep_order_index][incoming_face_count]
100 // that will hold a structure. struct.slot_address holds the slot address
101 // where this face's upwind data is stored. struct.upwind_dof_mapping is
102 // a mapping of each of this face's dofs to the upwinded face's dofs
103private:
104 std::vector<INCOMING_FACE_INFO*> so_cell_inco_face_dof_indices;
105
106 // This is a vector [non_local_outgoing_face_count]
107 // that maps a face to a dependent location and associated slot index
108 std::vector<std::pair<int, int>> nonlocal_outb_face_deplocI_slot;
109
110private:
111 // This is a vector [predecessor_location][unordered_cell_index]
112 // that holds an AlphaPair. AlphaPair-first is the cell's global_id
113 // and AlphaPair-second holds a number of BetaPairs. Each BetaPair
114 // comprises BetaPair-first = face_slot_index (the location of this
115 // faces data in the psi vector, and then a vector of vertex indexes
116 // that can be used for dof_mapping.
117 // Filled in beta-pass
118 // Cleared after beta-pass.
119 std::vector<std::vector<CompactCellView>> prelocI_cell_views;
120 std::vector<std::vector<CompactCellView>> delayed_prelocI_cell_views;
121
122 // This is a small vector [prelocI] that holds the number of
123 // face dofs for each predecessor location.
124 std::vector<int> prelocI_face_dof_count;
126
127 // This is a vector [nonlocal_inc_face_counter] containing
128 // AlphaPairs. AlphaPair-first is the prelocI index and
129 // AlphaPair-second is a BetaPair. The BetaPair-first is the slot where
130 // the face storage begins and BetaPair-second is a dof mapping
131 std::vector<std::pair<int, std::pair<int, std::vector<int>>>>
133
134 std::vector<std::pair<int, std::pair<int, std::vector<int>>>>
136
137 // 00
138 void InitializeAlphaElements(const SPDS& spds,
139 const GridFaceHistogram& grid_face_histogram);
140 // 00a
141 void SlotDynamics(const chi_mesh::Cell& cell,
142 const SPDS& spds,
143 const GridFaceHistogram& grid_face_histogram,
144 std::vector<std::vector<std::pair<int, short>>>& lock_boxes,
145 std::vector<std::pair<int, short>>& delayed_lock_box,
146 std::set<int>& location_boundary_dependency_set);
147 void AddFaceViewToDepLocI(int deplocI,
148 int cell_g_index,
149 int face_slot,
150 const chi_mesh::CellFace& face);
151 // 00b
152 void LocalIncidentMapping(const chi_mesh::Cell& cell,
153 const SPDS& spds,
154 std::vector<int>& local_so_cell_mapping);
155 // 01
156 void InitializeBetaElements(const SPDS& spds, int tag_index = 0);
157 // 01a
158 static void SerializeCellInfo(std::vector<CompactCellView>& cell_views,
159 std::vector<int>& face_indices,
160 int num_face_dofs);
161 static void DeSerializeCellInfo(std::vector<CompactCellView>& cell_views,
162 std::vector<int>* face_indices,
163 int& num_face_dofs);
164 // 01b
165 void NonLocalIncidentMapping(const chi_mesh::Cell& cell, const SPDS& spds);
166};
167
168} // namespace chi_mesh::sweep_management
169
170#endif // CHITECH_AAH_FLUDSCOMMONDATA_H
AAH_FLUDSCommonData(const std::vector< CellFaceNodalMapping > &grid_nodal_mappings, const SPDS &spds, const chi_mesh::GridFaceHistogram &grid_face_histogram)
void AddFaceViewToDepLocI(int deplocI, int cell_g_index, int face_slot, const chi_mesh::CellFace &face)
std::vector< INCOMING_FACE_INFO * > so_cell_inco_face_dof_indices
std::vector< std::vector< CompactCellView > > delayed_prelocI_cell_views
void LocalIncidentMapping(const chi_mesh::Cell &cell, const SPDS &spds, std::vector< int > &local_so_cell_mapping)
void NonLocalIncidentMapping(const chi_mesh::Cell &cell, const SPDS &spds)
std::vector< std::vector< CompactCellView > > prelocI_cell_views
std::vector< std::pair< int, std::pair< int, std::vector< int > > > > nonlocal_inc_face_prelocI_slot_dof
std::vector< std::pair< int, int > > nonlocal_outb_face_deplocI_slot
void SlotDynamics(const chi_mesh::Cell &cell, const SPDS &spds, const GridFaceHistogram &grid_face_histogram, std::vector< std::vector< std::pair< int, short > > > &lock_boxes, std::vector< std::pair< int, short > > &delayed_lock_box, std::set< int > &location_boundary_dependency_set)
void InitializeBetaElements(const SPDS &spds, int tag_index=0)
std::vector< std::vector< CompactCellView > > deplocI_cell_views
std::vector< std::pair< int, std::pair< int, std::vector< int > > > > delayed_nonlocal_inc_face_prelocI_slot_dof
static void SerializeCellInfo(std::vector< CompactCellView > &cell_views, std::vector< int > &face_indices, int num_face_dofs)
static void DeSerializeCellInfo(std::vector< CompactCellView > &cell_views, std::vector< int > *face_indices, int &num_face_dofs)
void InitializeAlphaElements(const SPDS &spds, const GridFaceHistogram &grid_face_histogram)
std::pair< int, std::vector< uint64_t > > CompactFaceView
std::pair< int, std::vector< CompactFaceView > > CompactCellView
void Setup(const std::pair< int, std::vector< short > > &input)