Skip to content

Commit

Permalink
fix netcdf build
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Sep 11, 2024
1 parent eb9bb08 commit fc43780
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion amr-wind/utilities/sampling/DTUSpinnerSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ void DTUSpinnerSampler::output_netcdf_data(
std::vector<size_t> count{1, 0, AMREX_SPACEDIM};
std::vector<size_t> starti{nt, 0};
std::vector<size_t> counti{1, 0};
SampleLocType locs;
SampleLocType sample_locs;
sampling_locations(sample_locs);

auto xyz = grp.var("points");
Expand All @@ -516,6 +516,7 @@ void DTUSpinnerSampler::output_netcdf_data(
count[1] = num_points();
counti[1] = num_points();

const auto& locs = sample_locs.locations();
xyz.put(locs[0].data(), start, count);

auto n_samples = m_beam_points * m_ntotal;
Expand Down
3 changes: 2 additions & 1 deletion amr-wind/utilities/sampling/FreeSurfaceSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,11 @@ void FreeSurfaceSampler::output_netcdf_data(
// Write the coordinates every time
std::vector<size_t> start{nt, 0, 0};
std::vector<size_t> count{1, 0, AMREX_SPACEDIM};
SampleLocType locs;
SampleLocType sample_locs;
sampling_locations(sample_locs);
auto xyz = grp.var("points");
count[1] = num_output_points();
const auto& locs = sample_locs.locations();
xyz.put(locs[0].data(), start, count);
}
#else
Expand Down
3 changes: 2 additions & 1 deletion amr-wind/utilities/sampling/LidarSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ void LidarSampler::output_netcdf_data(
// Write the coordinates every time
std::vector<size_t> start{nt, 0, 0};
std::vector<size_t> count{1, 0, AMREX_SPACEDIM};
SampleLocType locs;
SampleLocType sample_locs;
sampling_locations(sample_locs);
auto xyz = grp.var("points");
count[1] = num_points();
const auto& locs = sample_locs.locations();
xyz.put(locs[0].data(), start, count);
}
#else
Expand Down
6 changes: 4 additions & 2 deletions amr-wind/utilities/sampling/RadarSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,11 @@ void RadarSampler::output_netcdf_data(
std::vector<size_t> start{nt, 0, 0};
std::vector<size_t> count{1, 0, AMREX_SPACEDIM};

SampleLocType locs;
SampleLocType sample_locs;
cone_axis_locations(sample_locs);
count[1] = num_output_points();
auto xyz = grp.var("points");
const auto& locs = sample_locs.locations();
xyz.put(locs[0].data(), start, count);

if (m_output_cone_points) {
Expand All @@ -556,7 +557,8 @@ void RadarSampler::output_netcdf_data(
sampling_locations(conelocs);
cone_count[1] = num_points();
auto cone_xyz = grp.var("conepoints");
cone_xyz.put(conelocs[0].data(), cone_start, cone_count);
const auto& clocs = sample_locs.locations();
cone_xyz.put(clocs[0].data(), cone_start, cone_count);
}
}

Expand Down
3 changes: 2 additions & 1 deletion amr-wind/utilities/sampling/Sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,14 @@ void Sampling::prepare_netcdf_file()
{
const std::vector<size_t> start{0, 0};
std::vector<size_t> count{0, AMREX_SPACEDIM};
SampleLocType locs;
for (const auto& obj : m_samplers) {
auto grp = ncf.group(obj->label());
obj->populate_netcdf_metadata(grp);
SampleLocType sample_locs;
obj->output_locations(sample_locs);
auto xyz = grp.var("coordinates");
count[0] = obj->num_output_points();
const auto& locs = sample_locs.locations();
xyz.put(locs[0].data(), start, count);
}
}
Expand Down

0 comments on commit fc43780

Please sign in to comment.