mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -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>
|
template<class Graph>
|
||||||
std::vector<std::size_t>
|
std::vector<std::size_t>
|
||||||
reorderVerticesPreserving(const std::vector<int>& colors, int noColors,
|
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)
|
const Graph& graph)
|
||||||
{
|
{
|
||||||
std::vector<std::size_t> colorIndex(noColors, 0);
|
std::vector<std::size_t> colorIndex(noColors, 0);
|
||||||
@ -203,7 +203,7 @@ reorderVerticesPreserving(const std::vector<int>& colors, int noColors,
|
|||||||
template<class Graph>
|
template<class Graph>
|
||||||
std::vector<std::size_t>
|
std::vector<std::size_t>
|
||||||
reorderVerticesSpheres(const std::vector<int>& colors, int noColors,
|
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,
|
const Graph& graph,
|
||||||
typename Graph::VertexDescriptor root)
|
typename Graph::VertexDescriptor root)
|
||||||
{
|
{
|
||||||
|
@ -168,14 +168,14 @@ namespace Opm
|
|||||||
|
|
||||||
struct RealReorderer : public Reorderer
|
struct RealReorderer : public Reorderer
|
||||||
{
|
{
|
||||||
RealReorderer(std::vector<std::size_t> ordering)
|
RealReorderer(const std::vector<std::size_t>& ordering)
|
||||||
: ordering_(ordering)
|
: ordering_(&ordering)
|
||||||
{}
|
{}
|
||||||
virtual std::size_t operator[](std::size_t i) const
|
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
|
struct IdentityFunctor
|
||||||
|
Loading…
Reference in New Issue
Block a user