Skip to content

Commit

Permalink
Implement IceModelVec3::allocate_copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
ckhroulev committed Aug 17, 2021
1 parent 4eb7027 commit 031c5a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/iceModelVec.hh
Expand Up @@ -495,6 +495,9 @@ public:
void sum_columns(double A, double B, IceModelVec2S &output) const;

void copy_from(const IceModelVec3 &input);

std::shared_ptr<IceModelVec3> allocate_copy() const;

protected:
bool legal_level(double z) const;
};
Expand Down
8 changes: 8 additions & 0 deletions src/util/iceModelVec3.cc
Expand Up @@ -305,5 +305,13 @@ void IceModelVec3::copy_from(const IceModelVec3 &input) {
inc_state_counter();
}

std::shared_ptr<IceModelVec3> IceModelVec3::allocate_copy() const {
auto name = get_name();
auto z_name = metadata().get_z().get_name();
auto z_attrs = metadata().get_z().get_all_strings();

return std::make_shared<IceModelVec3>(grid(), name, z_name, levels(), z_attrs);
}


} // end of namespace pism

0 comments on commit 031c5a5

Please sign in to comment.