this is just the result of ``` find -iname "*.[ch]pp" | xargs sed -i "s/ *$//" find opm/parser/share/keywords -type f | xargs sed -i "s/ *$//" ``` so if it causes conflicts with other patches, the others should get priority. The rationale behind this patch is that some people tell their editor to remove white space which leads to larger than necessary patches...
82 lines
2.6 KiB
C++
82 lines
2.6 KiB
C++
/*
|
|
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,
|
|
FaceDir::DirEnum faceDir)
|
|
: 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");
|
|
|
|
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");
|
|
|
|
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 );
|
|
}
|
|
}
|
|
|
|
|
|
void FaultFace::checkCoord(size_t dim , size_t l1 , size_t l2) {
|
|
if (l1 > l2)
|
|
throw std::invalid_argument("Invalid coordinates");
|
|
|
|
if (l2 >= dim)
|
|
throw std::invalid_argument("Invalid coordinates");
|
|
}
|
|
|
|
|
|
std::vector<size_t>::const_iterator FaultFace::begin() const {
|
|
return m_indexList.begin();
|
|
}
|
|
|
|
std::vector<size_t>::const_iterator FaultFace::end() const {
|
|
return m_indexList.end();
|
|
}
|
|
|
|
|
|
FaceDir::DirEnum FaultFace::getDir() const {
|
|
return m_faceDir;
|
|
}
|
|
|
|
}
|