PRISMS-PF Manual
Loading...
Searching...
No Matches
solution_indexer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan
2// SPDX-License-Identifier: GNU Lesser General Public Version 2.1
3
4#pragma once
5
7
8#include <prismspf/config.h>
9
10#include <vector>
11
13
18template <unsigned int dim, typename number>
20{
21public:
25 SolutionIndexer() = default;
26
30 void
31 init(unsigned int num_fields,
32 const std::vector<GroupSolutionHandler<dim, number> *> &solution_handlers);
33
37 [[nodiscard]] const SolutionVector<number> &
38 get_solution_vector(unsigned int global_index, unsigned int relative_level = 0) const;
42 [[nodiscard]] SolutionVector<number> &
43 get_solution_vector(unsigned int global_index, unsigned int relative_level = 0);
44
48 [[nodiscard]] const SolutionVector<number> &
49 get_old_solution_vector(unsigned int age,
50 unsigned int global_index,
51 unsigned int relative_level = 0) const;
55 [[nodiscard]] SolutionVector<number> &
56 get_old_solution_vector(unsigned int age,
57 unsigned int global_index,
58 unsigned int relative_level = 0);
59
63 [[nodiscard]] const SolveBlock &
64 get_solve_block(unsigned int index) const;
65
69 [[nodiscard]] std::pair<const SolutionLevel<dim, number> *, unsigned int>
70 get_solution_level_and_block_index(unsigned int index,
71 unsigned int relative_level = 0) const;
72
76 [[nodiscard]] unsigned int
77 get_block_index(unsigned int global_index) const;
78
79private:
80 std::vector<GroupSolutionHandler<dim, number> *> solutions;
81};
82
83PRISMS_PF_END_NAMESPACE
Class that manages solution initialization and swapping with old solutions.
Definition group_solution_handler.h:68
std::vector< GroupSolutionHandler< dim, number > * > solutions
Definition solution_indexer.h:80
unsigned int get_block_index(unsigned int global_index) const
Get the block index of a field within its solve group.
Definition solution_indexer.cc:92
SolutionIndexer()=default
Constructor.
const SolveBlock & get_solve_block(unsigned int index) const
Get the solve group of a given field index.
Definition solution_indexer.cc:74
void init(unsigned int num_fields, const std::vector< GroupSolutionHandler< dim, number > * > &solution_handlers)
Initialize the solution indexer.
Definition solution_indexer.cc:15
std::pair< const SolutionLevel< dim, number > *, unsigned int > get_solution_level_and_block_index(unsigned int index, unsigned int relative_level=0) const
Get the matrixfree object of the group a given field index.
Definition solution_indexer.cc:81
const SolutionVector< number > & get_old_solution_vector(unsigned int age, unsigned int global_index, unsigned int relative_level=0) const
Get a solution vector of a given field index at a given age.
Definition solution_indexer.cc:50
const SolutionVector< number > & get_solution_vector(unsigned int global_index, unsigned int relative_level=0) const
Get a solution vector of a given field index.
Definition solution_indexer.cc:32
Structure to hold the attributes of a solve-block.
Definition solve_block.h:59
typename BlockVector< number >::BlockType SolutionVector
Typedef for solution vector.
Definition group_solution_handler.h:35
Definition conditional_ostreams.cc:20