Skip to content

Commit

Permalink
Add a constructor to IceModelVec2S.
Browse files Browse the repository at this point in the history
This one allocates memory. (Unlike the default constructor, which I
need to remove at some point.)

So far this just makes it possible to allocate IceModelVec2S in one
step instead of two.
  • Loading branch information
ckhroulev committed Mar 24, 2017
1 parent d091592 commit 5b4ad4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/base/util/iceModelVec.hh
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ class IceModelVec2S : public IceModelVec2 {
friend class IceModelVec2Stag;
public:
IceModelVec2S();
IceModelVec2S(IceGrid::ConstPtr grid, const std::string &name,
IceModelVecKind ghostedp, int width = 1);

typedef std::shared_ptr<IceModelVec2S> Ptr;
typedef std::shared_ptr<const IceModelVec2S> ConstPtr;
Expand Down
8 changes: 8 additions & 0 deletions src/base/util/iceModelVec2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ IceModelVec2S::IceModelVec2S() {
m_begin_end_access_use_dof = false;
}

IceModelVec2S::IceModelVec2S(IceGrid::ConstPtr grid, const std::string &name,
IceModelVecKind ghostedp, int width) {
m_begin_end_access_use_dof = false;

create(grid, name, ghostedp, width);
}


IceModelVec2Stag::IceModelVec2Stag()
: IceModelVec2() {
m_dof = 2;
Expand Down

0 comments on commit 5b4ad4a

Please sign in to comment.