/home/runner/work/amr-wind/amr-wind/amr-wind/utilities/DerivedQuantity.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/DerivedQuantity.H Source File
AMR-Wind 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
10#include "amr-wind/CFDSim.H"
11
12namespace amr_wind {
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 virtual std::string name() const = 0;
23
24 virtual int num_comp() const = 0;
25
26 virtual void operator()(ScratchField& fld, const 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, const int scomp = 0) const;
41
42 void create(const amrex::Vector<std::string>& keys);
43
45 DerivedQty& create(const std::string& key);
46
48 int num_comp() const noexcept;
49
50 bool contains(const std::string& key) const noexcept;
51
53 void
54 var_names(amrex::Vector<std::string>& /*plt_var_names*/) const noexcept;
55
56 void filter(const std::set<std::string>& /*erase*/);
57
58 void filter(const amrex::Vector<std::string>& /*erase*/);
59
60private:
62
64
65 std::unordered_map<std::string, int> m_obj_map;
66};
67
68} // namespace amr_wind
69
70#endif /* DERIVEDQUANTITY_H */
Definition DerivedQuantity.H:16
~DerivedQty() override=default
virtual std::string name() const =0
static std::string base_identifier()
Definition DerivedQuantity.H:18
virtual void var_names(amrex::Vector< std::string > &)
Definition DerivedQuantity.cpp:53
virtual int num_comp() const =0
virtual void operator()(ScratchField &fld, const int scomp=0) const =0
Definition DerivedQuantity.H:32
const FieldRepo & m_repo
Definition DerivedQuantity.H:61
TypeVector m_derived_vec
Definition DerivedQuantity.H:63
amrex::Vector< TypePtr > TypeVector
Definition DerivedQuantity.H:35
bool contains(const std::string &key) const noexcept
Definition DerivedQuantity.cpp:105
std::unordered_map< std::string, int > m_obj_map
Definition DerivedQuantity.H:65
std::unique_ptr< DerivedQty > TypePtr
Definition DerivedQuantity.H:34
void var_names(amrex::Vector< std::string > &) const noexcept
Populate a vector of variable names (for output)
Definition DerivedQuantity.cpp:111
void operator()(ScratchField &fld, const int scomp=0) const
Definition DerivedQuantity.cpp:84
DerivedQtyMgr(const FieldRepo &repo)
Definition DerivedQuantity.cpp:58
void filter(const std::set< std::string > &)
Definition DerivedQuantity.cpp:125
void create(const amrex::Vector< std::string > &keys)
Definition DerivedQuantity.cpp:77
int num_comp() const noexcept
Return the total number of components across all derived quantities.
Definition DerivedQuantity.cpp:96
Definition FieldRepo.H:86
Definition ScratchField.H:30
Definition BCInterface.cpp:7
Definition console_io.cpp:25
Definition Factory.H:65