2014-07-05 13:38:51 +02:00
|
|
|
/*
|
|
|
|
|
Copyright 2014 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
|
|
|
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
|
|
|
|
|
|
FaultFace::FaultFace(size_t nx , size_t ny , size_t nz,
|
|
|
|
|
size_t I1 , size_t I2,
|
|
|
|
|
size_t J1 , size_t J2,
|
|
|
|
|
size_t K1 , size_t K2,
|
2014-12-08 16:34:28 +01:00
|
|
|
FaceDir::DirEnum faceDir)
|
2014-07-05 13:38:51 +02:00
|
|
|
: m_faceDir( faceDir )
|
|
|
|
|
{
|
|
|
|
|
checkCoord(nx , I1,I2);
|
|
|
|
|
checkCoord(ny , J1,J2);
|
|
|
|
|
checkCoord(nz , K1,K2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((faceDir == FaceDir::XPlus) || (faceDir == FaceDir::XMinus))
|
|
|
|
|
if (I1 != I2)
|
|
|
|
|
throw std::invalid_argument("When the face is in X direction we must have I1 == I2");
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:38:51 +02:00
|
|
|
if ((faceDir == FaceDir::YPlus) || (faceDir == FaceDir::YMinus))
|
|
|
|
|
if (J1 != J2)
|
|
|
|
|
throw std::invalid_argument("When the face is in Y direction we must have J1 == J2");
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:38:51 +02:00
|
|
|
if ((faceDir == FaceDir::ZPlus) || (faceDir == FaceDir::ZMinus))
|
|
|
|
|
if (K1 != K2)
|
|
|
|
|
throw std::invalid_argument("When the face is in Z direction we must have K1 == K2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t k=K1; k <= K2; k++)
|
|
|
|
|
for (size_t j=J1; j <= J2; j++)
|
|
|
|
|
for (size_t i=I1; i <= I2; i++) {
|
|
|
|
|
size_t globalIndex = i + j*nx + k*nx*ny;
|
|
|
|
|
m_indexList.push_back( globalIndex );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:38:51 +02:00
|
|
|
void FaultFace::checkCoord(size_t dim , size_t l1 , size_t l2) {
|
|
|
|
|
if (l1 > l2)
|
|
|
|
|
throw std::invalid_argument("Invalid coordinates");
|
|
|
|
|
|
|
|
|
|
if (l2 >= dim)
|
2014-12-08 16:34:28 +01:00
|
|
|
throw std::invalid_argument("Invalid coordinates");
|
2014-07-05 13:38:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<size_t>::const_iterator FaultFace::begin() const {
|
|
|
|
|
return m_indexList.begin();
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:38:51 +02:00
|
|
|
std::vector<size_t>::const_iterator FaultFace::end() const {
|
|
|
|
|
return m_indexList.end();
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:38:51 +02:00
|
|
|
|
|
|
|
|
FaceDir::DirEnum FaultFace::getDir() const {
|
|
|
|
|
return m_faceDir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|