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

Kynema-SGF API: /home/runner/work/kynema-sgf/kynema-sgf/src/utilities/sampling/PlaneSampler.H Source File
Kynema-SGF API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
PlaneSampler.H
Go to the documentation of this file.
1#ifndef PLANESAMPLER_H
2#define PLANESAMPLER_H
3
5#include "AMReX_REAL.H"
6
7using namespace amrex::literals;
8
9namespace kynema_sgf::sampling {
10
29class PlaneSampler : public SamplerBase::Register<PlaneSampler>
30{
31public:
32 static std::string identifier() { return "PlaneSampler"; }
33
34 explicit PlaneSampler(const CFDSim& /*unused*/);
35
36 ~PlaneSampler() override;
37
42 void initialize(const std::string& key) override;
43
45 void check_bounds() override;
46
48 void sampling_locations(SampleLocType& /*sample_locs*/) const override;
49
53 SampleLocType& /*sample_locs*/,
54 const amrex::Box& /*box*/) const override;
55
56 void output_locations(SampleLocType& sample_locs) const override
57 {
58 sampling_locations(sample_locs);
59 }
60
61 void
62 define_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override;
63 void
64 populate_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override;
65
66 void populate_info_file(std::ostream& fh) const override;
67
69 [[nodiscard]] std::string label() const override { return m_label; }
70 std::string& label() override { return m_label; }
71
73 [[nodiscard]] std::string sampletype() const override
74 {
75 return identifier();
76 }
77
79 [[nodiscard]] int id() const override { return m_id; }
80 int& id() override { return m_id; }
81
83 [[nodiscard]] long num_points() const override { return m_npts; }
84
86 [[nodiscard]] long num_output_points() const override { return m_npts; }
87
88private:
89 const CFDSim& m_sim;
90
91 amrex::Vector<amrex::Real> m_axis1;
92 amrex::Vector<amrex::Real> m_axis2;
93 amrex::Vector<amrex::Real> m_origin;
94 amrex::Vector<amrex::Real> m_offset_vector{0.0_rt, 0.0_rt, 0.0_rt};
95 amrex::Vector<amrex::Real> m_poffsets;
96 amrex::Vector<int> m_npts_dir;
97
98 std::string m_label;
99
100 int m_id{-1};
101 int m_npts{0};
103};
104
105} // namespace kynema_sgf::sampling
106
107#endif /* PLANESAMPLER_H */
Definition CFDSim.H:55
long num_output_points() const override
Number of output probe locations (after data reduction etc.)
Definition PlaneSampler.H:86
amrex::Vector< amrex::Real > m_origin
Definition PlaneSampler.H:93
void populate_netcdf_metadata(const ncutils::NCGroup &) const override
Definition PlaneSampler.cpp:192
int m_id
Definition PlaneSampler.H:100
amrex::Vector< amrex::Real > m_axis1
Definition PlaneSampler.H:91
static std::string identifier()
Definition PlaneSampler.H:32
void initialize(const std::string &key) override
Definition PlaneSampler.cpp:17
void output_locations(SampleLocType &sample_locs) const override
Definition PlaneSampler.H:56
bool m_snap_to_cell_center
Definition PlaneSampler.H:102
std::string m_label
Definition PlaneSampler.H:98
int id() const override
Unique identifier for this set of probe locations.
Definition PlaneSampler.H:79
amrex::Vector< int > m_npts_dir
Definition PlaneSampler.H:96
amrex::Vector< amrex::Real > m_offset_vector
Definition PlaneSampler.H:94
std::string label() const override
Name of this sampling object.
Definition PlaneSampler.H:69
int & id() override
Definition PlaneSampler.H:80
void sampling_locations(SampleLocType &) const override
Populate and return a vector of probe locations to be sampled.
Definition PlaneSampler.cpp:123
void populate_info_file(std::ostream &fh) const override
Definition PlaneSampler.cpp:204
int m_npts
Definition PlaneSampler.H:101
const CFDSim & m_sim
Definition PlaneSampler.H:89
long num_points() const override
Number of probe locations along the line.
Definition PlaneSampler.H:83
void define_netcdf_metadata(const ncutils::NCGroup &) const override
Definition PlaneSampler.cpp:179
amrex::Vector< amrex::Real > m_poffsets
Definition PlaneSampler.H:95
std::string & label() override
Definition PlaneSampler.H:70
void check_bounds() override
Check and fix the bounds of the sampler so the probes are in the domain.
Definition PlaneSampler.cpp:59
amrex::Vector< amrex::Real > m_axis2
Definition PlaneSampler.H:92
std::string sampletype() const override
Type of this sampling object.
Definition PlaneSampler.H:73
PlaneSampler(const CFDSim &)
Definition PlaneSampler.cpp:13
Representation of a NetCDF group.
Definition nc_interface.H:162
Definition DTUSpinnerSampler.cpp:19
Definition SamplerBase.H:20