mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add methods sequence() and components().
This commit is contained in:
parent
db7fe12a45
commit
6a23ebe449
@ -29,15 +29,18 @@
|
|||||||
void Opm::TransportModelInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux)
|
void Opm::TransportModelInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux)
|
||||||
{
|
{
|
||||||
// Compute reordered sequence of single-cell problems
|
// Compute reordered sequence of single-cell problems
|
||||||
std::vector<int> sequence(grid.number_of_cells);
|
sequence_.resize(grid.number_of_cells);
|
||||||
std::vector<int> components(grid.number_of_cells + 1);
|
components_.resize(grid.number_of_cells + 1);
|
||||||
int ncomponents;
|
int ncomponents;
|
||||||
time::StopWatch clock;
|
time::StopWatch clock;
|
||||||
clock.start();
|
clock.start();
|
||||||
compute_sequence(&grid, darcyflux, &sequence[0], &components[0], &ncomponents);
|
compute_sequence(&grid, darcyflux, &sequence_[0], &components_[0], &ncomponents);
|
||||||
clock.stop();
|
clock.stop();
|
||||||
std::cout << "Topological sort took: " << clock.secsSinceStart() << " seconds." << std::endl;
|
std::cout << "Topological sort took: " << clock.secsSinceStart() << " seconds." << std::endl;
|
||||||
|
|
||||||
|
// Make vector's size match actual used data.
|
||||||
|
components_.resize(ncomponents + 1);
|
||||||
|
|
||||||
// Invoke appropriate solve method for each interdependent component.
|
// Invoke appropriate solve method for each interdependent component.
|
||||||
for (int comp = 0; comp < ncomponents; ++comp) {
|
for (int comp = 0; comp < ncomponents; ++comp) {
|
||||||
#if 0
|
#if 0
|
||||||
@ -50,11 +53,23 @@ void Opm::TransportModelInterface::reorderAndTransport(const UnstructuredGrid& g
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
const int comp_size = components[comp + 1] - components[comp];
|
const int comp_size = components_[comp + 1] - components_[comp];
|
||||||
if (comp_size == 1) {
|
if (comp_size == 1) {
|
||||||
solveSingleCell(sequence[components[comp]]);
|
solveSingleCell(sequence_[components_[comp]]);
|
||||||
} else {
|
} else {
|
||||||
solveMultiCell(comp_size, &sequence[components[comp]]);
|
solveMultiCell(comp_size, &sequence_[components_[comp]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector<int>& Opm::TransportModelInterface::sequence() const
|
||||||
|
{
|
||||||
|
return sequence_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::vector<int>& Opm::TransportModelInterface::components() const
|
||||||
|
{
|
||||||
|
return components_;
|
||||||
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED
|
#ifndef OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED
|
||||||
#define OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED
|
#define OPM_TRANSPORTMODELINTERFACE_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@ -31,7 +33,8 @@ namespace Opm
|
|||||||
/// method that will have an interface geared to the model's
|
/// method that will have an interface geared to the model's
|
||||||
/// needs. (The solve() method is therefore not virtual in this
|
/// needs. (The solve() method is therefore not virtual in this
|
||||||
/// class.) The reorderAndTransport() method is provided as an aid
|
/// class.) The reorderAndTransport() method is provided as an aid
|
||||||
/// to implementing solve() in subclasses.
|
/// to implementing solve() in subclasses, together with the
|
||||||
|
/// sequence() and components() methods for accessing the ordering.
|
||||||
class TransportModelInterface
|
class TransportModelInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -41,6 +44,11 @@ namespace Opm
|
|||||||
virtual void solveMultiCell(const int num_cells, const int* cells) = 0;
|
virtual void solveMultiCell(const int num_cells, const int* cells) = 0;
|
||||||
protected:
|
protected:
|
||||||
void reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux);
|
void reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux);
|
||||||
|
const std::vector<int>& sequence() const;
|
||||||
|
const std::vector<int>& components() const;
|
||||||
|
private:
|
||||||
|
std::vector<int> sequence_;
|
||||||
|
std::vector<int> components_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user