Merge pull request #2 from bska/master-refactor-for-cpgrid-support

Fix build in !HAVE_DUNE_CORNERPOINT case
This commit is contained in:
Markus Blatt 2014-04-14 23:12:19 +02:00
commit 9afa1d3834
2 changed files with 26 additions and 12 deletions

View File

@ -1,13 +1,9 @@
#include "config.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <opm/core/linalg/blas_lapack.h>
#include <opm/core/pressure/tpfa/trans_tpfa.h>
#include <opm/core/grid/GridHelpers.hpp>
#include <cmath>
namespace Dune
{
class CpGrid;
@ -25,6 +21,7 @@ double faceArea(const Dune::CpGrid&, int);
namespace
{
#ifdef HAVE_DUNE_CORNERPOINT
const double* multiplyFaceNormalWithArea(const Dune::CpGrid& grid, int face_index, const double* in)
{
int d=Opm::UgGridHelpers::dimensions(grid);
@ -36,15 +33,16 @@ const double* multiplyFaceNormalWithArea(const Dune::CpGrid& grid, int face_inde
return out;
}
inline const double* multiplyFaceNormalWithArea(const UnstructuredGrid&, int, const double* in)
{
return in;
}
inline void maybeFreeFaceNormal(const Dune::CpGrid&, const double* array)
{
delete[] array;
}
#endif // HAVE_DUNE_CORNERPOINT
inline const double* multiplyFaceNormalWithArea(const UnstructuredGrid&, int, const double* in)
{
return in;
}
inline void maybeFreeFaceNormal(const UnstructuredGrid&, const double*)
{}
@ -106,7 +104,7 @@ tpfa_htrans_compute(const Grid* G, const double *perm, double *htrans)
assert (denom > 0);
htrans[i] /= denom;
htrans[i] = fabs(htrans[i]);
htrans[i] = std::abs(htrans[i]);
}
// Move to next cell centroid.
cc = increment(cc, 1, d);

View File

@ -20,6 +20,8 @@
#ifndef OPM_INITSTATE_HEADER_INCLUDED
#define OPM_INITSTATE_HEADER_INCLUDED
#include <opm/parser/eclipse/Deck/Deck.hpp> // DeckConstPtr
struct UnstructuredGrid;
namespace Opm
@ -225,6 +227,20 @@ namespace Opm
const EclipseGridParser& deck,
const double gravity,
State& state);
/// Initialize a blackoil state from input deck.
template <class FaceCells, class FCI, class CCI, class Props, class State>
void initBlackoilStateFromDeck(int number_of_cells,
const int* global_cell,
int number_of_faces,
FaceCells face_cells,
FCI begin_face_centroids,
CCI begin_cell_centroids,
int dimensions,
const Props& props,
Opm::DeckConstPtr newParserDeck,
const double gravity,
State& state);
} // namespace Opm
#include <opm/core/simulator/initState_impl.hpp>