/home/runner/work/kynema-sgf/kynema-sgf/src/utilities/DerivedQuantity.H Source File

Kynema-SGF API: /home/runner/work/kynema-sgf/kynema-sgf/src/utilities/DerivedQuantity.H Source File
Kynema-SGF API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
DerivedQuantity.H
Go to the documentation of this file.
1#ifndef DERIVEDQUANTITY_H
2#define DERIVEDQUANTITY_H
3
4#include <string>
5#include <unordered_map>
6#include <vector>
7
8#include "src/core/Factory.H"
9#include "src/core/CollMgr.H"
10#include "src/CFDSim.H"
11
12namespace kynema_sgf {
13
15 : public Factory<DerivedQty, const FieldRepo&, std::vector<std::string>&>
16{
17public:
18 static std::string base_identifier() { return "DerivedQty"; }
19
20 ~DerivedQty() override = default;
21
22 [[nodiscard]] virtual std::string name() const = 0;
23
24 [[nodiscard]] virtual int num_comp() const = 0;
25
26 virtual void operator()(ScratchField& fld, int scomp = 0) const = 0;
27
28 virtual void var_names(amrex::Vector<std::string>& /*plt_var_names*/);
29};
30
32{
33public:
34 using TypePtr = std::unique_ptr<DerivedQty>;
35 using TypeVector = amrex::Vector<TypePtr>;
36
37 explicit DerivedQtyMgr(const FieldRepo& repo);
38 ~DerivedQtyMgr() = default;
39
40 void operator()(ScratchField& fld, int scomp = 0) const;
41
42 void create(const amrex::Vector<std::string>& keys);
43
45 DerivedQty& create(const std::string& key);
46
48 [[nodiscard]] int num_comp() const;
49
50 [[nodiscard]] bool contains(const std::string& key) const;
51
53 void var_names(amrex::Vector<std::string>& /*plt_var_names*/) const;
54
55 void filter(const std::set<std::string>& /*erase*/);
56
57 void filter(const amrex::Vector<std::string>& /*erase*/);
58
59private:
61
63
64 std::unordered_map<std::string, int> m_obj_map;
65};
66
67} // namespace kynema_sgf
68
69#endif /* DERIVEDQUANTITY_H */
Definition DerivedQuantity.H:16
virtual int num_comp() const =0
virtual std::string name() const =0
static std::string base_identifier()
Definition DerivedQuantity.H:18
virtual void operator()(ScratchField &fld, int scomp=0) const =0
virtual void var_names(amrex::Vector< std::string > &)
Definition DerivedQuantity.cpp:58
~DerivedQty() override=default
const FieldRepo & m_repo
Definition DerivedQuantity.H:60
TypeVector m_derived_vec
Definition DerivedQuantity.H:62
void filter(const std::set< std::string > &)
Definition DerivedQuantity.cpp:129
int num_comp() const
Return the total number of components across all derived quantities.
Definition DerivedQuantity.cpp:101
std::unordered_map< std::string, int > m_obj_map
Definition DerivedQuantity.H:64
DerivedQtyMgr(const FieldRepo &repo)
Definition DerivedQuantity.cpp:63
void create(const amrex::Vector< std::string > &keys)
Definition DerivedQuantity.cpp:82
std::unique_ptr< DerivedQty > TypePtr
Definition DerivedQuantity.H:34
amrex::Vector< TypePtr > TypeVector
Definition DerivedQuantity.H:35
bool contains(const std::string &key) const
Definition DerivedQuantity.cpp:110
void var_names(amrex::Vector< std::string > &) const
Populate a vector of variable names (for output)
Definition DerivedQuantity.cpp:116
void operator()(ScratchField &fld, int scomp=0) const
Definition DerivedQuantity.cpp:89
Definition FieldRepo.H:86
Definition ScratchField.H:30
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:10