mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 10:40:21 -06:00
Prevent unnecessary copies of vectors using references.
This commit is contained in:
parent
458cd8768f
commit
f850f04c93
@ -183,7 +183,7 @@ colorVerticesWelshPowell(const Graph& graph)
|
||||
template<class Graph>
|
||||
std::vector<std::size_t>
|
||||
reorderVerticesPreserving(const std::vector<int>& colors, int noColors,
|
||||
const std::vector<std::size_t> verticesPerColor,
|
||||
const std::vector<std::size_t>& verticesPerColor,
|
||||
const Graph& graph)
|
||||
{
|
||||
std::vector<std::size_t> colorIndex(noColors, 0);
|
||||
@ -203,7 +203,7 @@ reorderVerticesPreserving(const std::vector<int>& colors, int noColors,
|
||||
template<class Graph>
|
||||
std::vector<std::size_t>
|
||||
reorderVerticesSpheres(const std::vector<int>& colors, int noColors,
|
||||
const std::vector<std::size_t> verticesPerColor,
|
||||
const std::vector<std::size_t>& verticesPerColor,
|
||||
const Graph& graph,
|
||||
typename Graph::VertexDescriptor root)
|
||||
{
|
||||
|
@ -168,14 +168,14 @@ namespace Opm
|
||||
|
||||
struct RealReorderer : public Reorderer
|
||||
{
|
||||
RealReorderer(std::vector<std::size_t> ordering)
|
||||
: ordering_(ordering)
|
||||
RealReorderer(const std::vector<std::size_t>& ordering)
|
||||
: ordering_(&ordering)
|
||||
{}
|
||||
virtual std::size_t operator[](std::size_t i) const
|
||||
{
|
||||
return ordering_[i];
|
||||
return (*ordering_)[i];
|
||||
}
|
||||
std::vector<std::size_t> ordering_;
|
||||
const std::vector<std::size_t>* ordering_;
|
||||
};
|
||||
|
||||
struct IdentityFunctor
|
||||
|
Loading…
Reference in New Issue
Block a user