Skip to content

Commit

Permalink
Add template parameter to createGlobal function of the class GlobalPe…
Browse files Browse the repository at this point in the history
…rfContainerFactory
  • Loading branch information
lisajulia committed Sep 13, 2024
1 parent 6e0d94c commit 7bd85b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions opm/simulators/wells/ParallelWellInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,11 @@ int GlobalPerfContainerFactory<Scalar>::globalToLocal(int globalIndex) const {
}

template<class Scalar>
std::vector<Scalar> GlobalPerfContainerFactory<Scalar>::
createGlobal(const std::vector<Scalar>& local_perf_container,
template<class Value>
std::vector<Value> GlobalPerfContainerFactory<Scalar>::
createGlobal(const std::vector<Value>& local_perf_container,
std::size_t num_components) const
{
// Could be become templated later.
using Value = Scalar;

if (comm_.size() > 1)
{
std::vector<Value> global_recv(perf_ecl_index_.size() * num_components);
Expand Down Expand Up @@ -191,6 +189,9 @@ createGlobal(const std::vector<Scalar>& local_perf_container,
return local_perf_container;
}
}
// Explicit instantiation of the template class and member function for specific types
template std::vector<int> Opm::GlobalPerfContainerFactory<double>::createGlobal<int>(const std::vector<int>&, std::size_t) const;
template std::vector<double> Opm::GlobalPerfContainerFactory<double>::createGlobal<double>(const std::vector<double>&, std::size_t) const;

template<class Scalar>
void GlobalPerfContainerFactory<Scalar>::
Expand Down
3 changes: 2 additions & 1 deletion opm/simulators/wells/ParallelWellInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class GlobalPerfContainerFactory
/// \param num_components the number of components per perforation.
/// \return A container with values attached to all perforations of a well.
/// Values are ordered by the index of the perforation in the ECL schedule.
std::vector<Scalar> createGlobal(const std::vector<Scalar>& local_perf_container,
template<class Value>
std::vector<Value> createGlobal(const std::vector<Value>& local_perf_container,
std::size_t num_components) const;

/// \brief Copies the values of the global perforation to the local representation
Expand Down

0 comments on commit 7bd85b8

Please sign in to comment.