Skip to content

Commit

Permalink
Merge pull request #2373 from akva2/fix_build_no_mpi
Browse files Browse the repository at this point in the history
fix build without MPI
  • Loading branch information
akva2 authored Feb 28, 2020
2 parents 36761e9 + 2936122 commit 44406ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ebos/eclcpgridvanguard.hh
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public:

cartesianIndexMapper_.reset(new CartesianIndexMapper(*grid_));
this->updateGridView_();
#if HAVE_MPI
if (mpiSize > 1) {
std::vector<int> cartIndices;
cartIndices.reserve(grid_->numCells());
Expand All @@ -219,6 +220,7 @@ public:
static_cast<ParallelEclipseState&>(this->eclState()).setupLocalProps(cartIndices);
static_cast<ParallelEclipseState&>(this->eclState()).switchToDistributedProps();
}
#endif
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion flow/flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int main(int argc, char** argv)
parState = new Opm::ParallelEclipseState(*deck);
eclipseState.reset(parState);
#else
eclipseState.reset(new Opm::EclipseState(*deck);
eclipseState.reset(new Opm::EclipseState(*deck));
#endif
/*
For the time being initializing wells and groups from the
Expand Down
6 changes: 4 additions & 2 deletions opm/simulators/utils/ParallelEclipseState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ ParallelEclipseState::ParallelEclipseState(const Deck& deck)
}


#if HAVE_MPI
std::size_t ParallelEclipseState::packSize(EclMpiSerializer& serializer) const
{
return serializer.packSize(m_tables) +
Expand Down Expand Up @@ -185,6 +186,7 @@ void ParallelEclipseState::unpack(std::vector<char>& buffer, int& position,
serializer.unpack(m_faults, buffer, position);
serializer.unpack(m_title, buffer, position);
}
#endif


const FieldPropsManager& ParallelEclipseState::fieldProps() const
Expand Down Expand Up @@ -231,6 +233,7 @@ void ParallelEclipseState::switchToDistributedProps()
}


#if HAVE_MPI
namespace {


Expand Down Expand Up @@ -294,7 +297,6 @@ void packProps(const std::vector<int>& l2gCell,

void ParallelEclipseState::setupLocalProps(const std::vector<int>& localToGlobal)
{
#if HAVE_MPI
const auto& comm = Dune::MPIHelper::getCollectiveCommunication();
if (comm.rank() == 0) {
extractRootProps(localToGlobal, this->globalFieldProps().keys<int>(),
Expand Down Expand Up @@ -347,8 +349,8 @@ void ParallelEclipseState::setupLocalProps(const std::vector<int>& localToGlobal
Mpi::unpack(m_fieldProps.m_doubleProps[key], buffer, position, comm);
}
}
#endif
}
#endif


} // end namespace Opm
4 changes: 4 additions & 0 deletions opm/simulators/utils/ParallelEclipseState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class ParallelEclipseState : public EclipseState {
//! \details Only called on root process
ParallelEclipseState(const Deck& deck);

#if HAVE_MPI
//! \brief Calculates the size of serialized data.
//! \param serializer The serializer to use
std::size_t packSize(EclMpiSerializer& serializer) const;
Expand All @@ -123,6 +124,7 @@ class ParallelEclipseState : public EclipseState {
//! \param Position in buffer
//! \param serializer The serializer to use
void unpack(std::vector<char>& buffer, int& position, EclMpiSerializer& serializer);
#endif

//! \brief Switch to global field properties.
//! \details Called on root process to use the global field properties
Expand All @@ -133,10 +135,12 @@ class ParallelEclipseState : public EclipseState {
//! setupLocalProps must be called prior to this.
void switchToDistributedProps();

#if HAVE_MPI
//! \brief Setup local properties.
//! \param localToGlobal Map from local cells on calling process to global cartesian cell
//! \details Must be called after grid has been paritioned
void setupLocalProps(const std::vector<int>& localToGlobal);
#endif

//! \brief Returns a const ref to current field properties.
const FieldPropsManager& fieldProps() const override;
Expand Down

0 comments on commit 44406ff

Please sign in to comment.