Merge pull request #193 from blattms/fix-176

Makes distinction between functions more clear. (#176)
This commit is contained in:
Atgeirr Flø Rasmussen 2014-09-04 08:37:33 +02:00
commit e597bbeca6
9 changed files with 27 additions and 27 deletions

View File

@ -166,7 +166,7 @@ try
if (param.has("init_saturation")) {
initStateBasic(grid->numCells(), &(grid->globalCell())[0],
&(grid->logicalCartesianSize()[0]),
grid->numFaces(), AutoDiffGrid::faceCells(*grid),
grid->numFaces(), UgGridHelpers::faceCells(*grid),
grid->beginFaceCentroids(),
grid->beginCellCentroids(), Dune::CpGrid::dimension,
*props, param, gravity[2], state);
@ -184,7 +184,7 @@ try
OPM_THROW(std::logic_error, "sim_fibo_ad_cp does not support EQUIL initialization.");
} else {
initBlackoilStateFromDeck(grid->numCells(), &(grid->globalCell())[0],
grid->numFaces(), AutoDiffGrid::faceCells(*grid),
grid->numFaces(), UgGridHelpers::faceCells(*grid),
grid->beginFaceCentroids(),
grid->beginCellCentroids(), Dune::CpGrid::dimension,
*props, deck, gravity[2], state);

View File

@ -92,7 +92,7 @@ struct HelperOps
div = ngrad.transpose();
std::vector<Tri> fullngrad_tri;
fullngrad_tri.reserve(2*nf);
typename ADFaceCellTraits<Grid>::Type nb=faceCells(grid);
typename ADFaceCellTraits<Grid>::Type nb=faceCellsToEigen(grid);
for (int i = 0; i < nf; ++i) {
if (nb(i,0) >= 0) {
fullngrad_tri.emplace_back(i, nb(i,0), 1.0);
@ -126,7 +126,7 @@ struct HelperOps
typedef HelperOps::IFaces::Index IFIndex;
const IFIndex nif = h.internal_faces.size();
typename ADFaceCellTraits<Grid>::Type
face_cells = faceCells(g);
face_cells = faceCellsToEigen(g);
assert(nif == ifaceflux.size());
// Define selector structure.

View File

@ -629,7 +629,7 @@ namespace {
// b is row major, so can just copy data.
std::vector<double> b_perf(b.data(), b.data() + nperf * pu.num_phases);
// Extract well connection depths.
const V depth = cellCentroidsZ(grid_);
const V depth = cellCentroidsZToEigen(grid_);
const V pdepth = subset(depth, well_cells);
std::vector<double> perf_depth(pdepth.data(), pdepth.data() + nperf);
// Surface density.

View File

@ -43,14 +43,14 @@ int dimensions(const UnstructuredGrid& grid)
}
*/
Eigen::Array<int, Eigen::Dynamic, 2, Eigen::RowMajor>
faceCells(const UnstructuredGrid& grid)
faceCellsToEigen(const UnstructuredGrid& grid)
{
typedef Eigen::Array<int, Eigen::Dynamic, 2, Eigen::RowMajor> TwoColInt;
return Eigen::Map<TwoColInt>(grid.face_cells, grid.number_of_faces, 2);
}
Eigen::Array<double, Eigen::Dynamic, 1>
cellCentroidsZ(const UnstructuredGrid& grid)
cellCentroidsZToEigen(const UnstructuredGrid& grid)
{
return Eigen::Map<Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >
(grid.cell_centroids, grid.number_of_cells, grid.dimensions).rightCols<1>();
@ -93,7 +93,7 @@ void extractInternalFaces(const UnstructuredGrid& grid,
typedef Eigen::Array<bool, Eigen::Dynamic, 1> OneColBool;
typedef Eigen::Array<int, Eigen::Dynamic, 2, Eigen::RowMajor> TwoColInt;
typedef Eigen::Array<bool, Eigen::Dynamic, 2, Eigen::RowMajor> TwoColBool;
TwoColInt nb = faceCells(grid);
TwoColInt nb = faceCellsToEigen(grid);
// std::cout << "nb = \n" << nb << std::endl;
// Extracts the internal faces of the grid.
// These are stored in internal_faces.
@ -201,9 +201,14 @@ double faceArea(const Dune::CpGrid& grid, int face_index)
namespace AutoDiffGrid
{
ADFaceCellTraits<Dune::CpGrid>::Type
faceCellsToEigen(const Dune::CpGrid& grid)
{
return Opm::AutoDiffGrid::FaceCellsContainerProxy(&grid);
}
Eigen::Array<double, Eigen::Dynamic, 1>
cellCentroidsZ(const Dune::CpGrid& grid)
cellCentroidsZToEigen(const Dune::CpGrid& grid)
{
// Create an Eigen array of appropriate size
int rows=numCells(grid);

View File

@ -41,10 +41,6 @@
namespace Opm
{
namespace UgGridHelpers
{
} //end namespace UgGridHelpers
namespace AutoDiffGrid
{
@ -58,7 +54,7 @@ struct ADFaceCellTraits
/// \brief Get the z coordinates of the cell centroids of a grid.
Eigen::Array<double, Eigen::Dynamic, 1>
cellCentroidsZ(const UnstructuredGrid& grid);
cellCentroidsZToEigen(const UnstructuredGrid& grid);
/// \brief Get the centroid of a cell.
/// \param grid The grid whose cell centroid we query.
@ -396,8 +392,9 @@ namespace AutoDiffGrid
{
/// \brief Get the z coordinates of the cell centroids of a grid.
/// \return The z coordinates of the cell centroids in an Eigen array
Eigen::Array<double, Eigen::Dynamic, 1>
cellCentroidsZ(const Dune::CpGrid& grid);
cellCentroidsZToEigen(const Dune::CpGrid& grid);
/// \brief Get the centroid of a cell.
/// \param grid The grid whose cell centroid we query.
@ -491,11 +488,8 @@ struct ADFaceCellTraits<Dune::CpGrid>
: public Opm::UgGridHelpers::FaceCellTraits<Dune::CpGrid>
{};
/// \brief Get the face to cell mapping of a grid.
inline ADFaceCellTraits<Dune::CpGrid>::Type
faceCells(const Dune::CpGrid& grid)
{
return Opm::UgGridHelpers::faceCells(grid);
}
ADFaceCellTraits<Dune::CpGrid>::Type
faceCellsToEigen(const Dune::CpGrid& grid);
} // end namespace AutoDiffGrid
} //end namespace OPM
@ -507,6 +501,7 @@ namespace AutoDiffGrid
using Opm::UgGridHelpers::SparseTableView;
using Opm::UgGridHelpers::numCells;
using Opm::UgGridHelpers::faceCells;
using Opm::UgGridHelpers::numFaces;
using Opm::UgGridHelpers::dimensions;
using Opm::UgGridHelpers::cartDims;
@ -526,9 +521,9 @@ struct ADFaceCellTraits<UnstructuredGrid>
/// \brief Get the face to cell mapping of a grid.
ADFaceCellTraits<UnstructuredGrid>::Type
faceCells(const UnstructuredGrid& grid);
faceCellsToEigen(const UnstructuredGrid& grid);
}
}
} // end namespace AutoDiffGrid
} //end namespace OPM
#endif

View File

@ -61,7 +61,7 @@ namespace {
std::vector<int> f2hf(2 * numFaces(grid), -1);
Eigen::Array<int, Eigen::Dynamic, 2, Eigen::RowMajor>
face_cells = faceCells(grid);
face_cells = faceCellsToEigen(grid);
typedef typename Opm::UgGridHelpers::Cell2FacesTraits<UnstructuredGrid>::Type
Cell2Faces;

View File

@ -77,7 +77,7 @@ namespace Opm
Opm::estimateCellVelocity(AutoDiffGrid::numCells(grid),
AutoDiffGrid::numFaces(grid),
AutoDiffGrid::beginFaceCentroids(grid),
AutoDiffGrid::faceCells(grid),
UgGridHelpers::faceCells(grid),
AutoDiffGrid::beginCellCentroids(grid),
AutoDiffGrid::beginCellVolumes(grid),
AutoDiffGrid::dimensions(grid),

View File

@ -60,7 +60,7 @@ namespace Opm
Opm::estimateCellVelocity(AutoDiffGrid::numCells(grid),
AutoDiffGrid::numFaces(grid),
AutoDiffGrid::beginFaceCentroids(grid),
AutoDiffGrid::faceCells(grid),
UgGridHelpers::faceCells(grid),
AutoDiffGrid::beginCellCentroids(grid),
AutoDiffGrid::beginCellVolumes(grid),
AutoDiffGrid::dimensions(grid),

View File

@ -185,7 +185,7 @@ namespace Opm
// but for scalar lambda and using TPFA it holds.
const V p1 = Vec(state.pressure().data(), nc, 1);
const V ndp = (ops_.ngrad * p1.matrix()).array();
const V z = cellCentroidsZ(grid_);
const V z = cellCentroidsZToEigen(grid_);
const V ndz = (ops_.ngrad * z.matrix()).array();
assert(num_internal == ndp.size());
const double* density = props_.density();