Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate pressure routines, improve VL+CT & Grackle compatability #173

Merged
merged 13 commits into from
Jun 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Propagated renaming of field::values_view->field::view to EnzoFieldAd…
…aptor
mabruzzo committed Jun 2, 2022

Verified

This commit was signed with the committer’s verified signature.
TotalWipeOut Kevin Hamilton
commit 11544543459d82d1f9a47bcfd06444d8fdf29301
18 changes: 9 additions & 9 deletions src/Enzo/enzo_EnzoComputePressure.cpp
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ void EnzoComputePressure::compute_pressure

using RdOnlyEFltArr = CelloArray<const enzo_float, 3>;

const RdOnlyEFltArr d = fadaptor.values_view("density");
const RdOnlyEFltArr d = fadaptor.view("density");

enzo_float gm1 = gamma - 1.0;

@@ -184,7 +184,7 @@ void EnzoComputePressure::compute_pressure

if (dual_energy) {

const RdOnlyEFltArr ie = fadaptor.values_view("internal_energy");
const RdOnlyEFltArr ie = fadaptor.view("internal_energy");

auto loop_body = [=](int iz, int iy, int ix)
{ p(iz,iy,ix) = gm1 * d(iz,iy,ix) * ie(iz,iy,ix); };
@@ -193,22 +193,22 @@ void EnzoComputePressure::compute_pressure
} else { // not using dual energy formalism

const int rank = cello::rank();
const RdOnlyEFltArr te = fadaptor.values_view("total_energy");
const RdOnlyEFltArr te = fadaptor.view("total_energy");

// fetch velocity arrays
const RdOnlyEFltArr vx = fadaptor.values_view("velocity_x");
const RdOnlyEFltArr vx = fadaptor.view("velocity_x");
const RdOnlyEFltArr vy = (rank >= 2)
? fadaptor.values_view("velocity_y") : RdOnlyEFltArr();
? fadaptor.view("velocity_y") : RdOnlyEFltArr();
const RdOnlyEFltArr vz = (rank >= 3)
? fadaptor.values_view("velocity_z") : RdOnlyEFltArr();
? fadaptor.view("velocity_z") : RdOnlyEFltArr();

// fetch bfield arrays
const RdOnlyEFltArr bx = (mhd)
? fadaptor.values_view("bfield_x") : RdOnlyEFltArr();
? fadaptor.view("bfield_x") : RdOnlyEFltArr();
const RdOnlyEFltArr by = (mhd & (rank >= 2))
? fadaptor.values_view("bfield_y") : RdOnlyEFltArr();
? fadaptor.view("bfield_y") : RdOnlyEFltArr();
const RdOnlyEFltArr bz = (mhd & (rank >= 3))
? fadaptor.values_view("bfield_z") : RdOnlyEFltArr();
? fadaptor.view("bfield_z") : RdOnlyEFltArr();

if (rank == 1) {

15 changes: 7 additions & 8 deletions src/Enzo/enzo_EnzoFieldAdaptor.hpp
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
///
/// The unorthodox implementation, strategy was chosen to try to minimize the
/// cost of using this wrapper. A particular goal was to facillitate the
/// `values_view` & `ptr_grackle` methods of `ArrayWrapper` & `BlockWrapper`
/// `view` & `ptr_grackle` methods of `ArrayWrapper` & `BlockWrapper`
/// to be inlined. (This would not be possible if the methods were implemented
/// and called as virtual methods).

@@ -33,7 +33,7 @@ namespace enzo_field_adaptor_detail {

ArrayMapWrapper(const EnzoEFltArrayMap& array_map);

inline CelloArray<const enzo_float, 3> values_view(const std::string& name)
inline CelloArray<const enzo_float, 3> view(const std::string& name)
const noexcept
{ return array_map_[name]; }

@@ -64,11 +64,10 @@ namespace enzo_field_adaptor_detail {
public:
BlockWrapper(Block* block, int index_history);

inline CelloArray<const enzo_float, 3> values_view(const std::string& name)
inline CelloArray<const enzo_float, 3> view(const std::string& name)
const noexcept
{
return field_.values_view<enzo_float> (name, ghost_choice::include,
index_history_);
return field_.view<enzo_float>(name,ghost_choice::include,index_history_);
}

inline const enzo_float* ptr_grackle(const std::string& name) const noexcept
@@ -210,13 +209,13 @@ class EnzoFieldAdaptor {
/// When a Field is being wrapped, the ghost zones are always excluded
/// (if we want to make this configurable in the future, the choice should be
/// passed to the appropriate constructor)
inline CelloArray<const enzo_float, 3> values_view(const std::string& name)
inline CelloArray<const enzo_float, 3> view(const std::string& name)
const noexcept
{
if (holds_block_){
return reinterpret_cast<BlockWrapper*>(wrapper_)->values_view(name);
return reinterpret_cast<BlockWrapper*>(wrapper_)->view(name);
} else {
return reinterpret_cast<ArrayMapWrapper*>(wrapper_)->values_view(name);
return reinterpret_cast<ArrayMapWrapper*>(wrapper_)->view(name);
}
}