Commit c2df77e7 authored by Mark Olesen's avatar Mark Olesen

STYLE: use HashTable::iterator::found() for selectors

- use FUNCTION_NAME for IO checks
parent 9a722b9a
......@@ -27,14 +27,9 @@ License
#include "dictionary.H"
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
Foam::autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
(
const word& name,
const dictionary& dict
......@@ -46,10 +41,7 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
// default type is self
word cmType(typeName_());
if (dict.found("type"))
{
dict.lookup("type") >> cmType;
}
dict.readIfPresent("type", cmType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(cmType);
......@@ -57,7 +49,7 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
{
FatalIOErrorInFunction(dict)
<< "Unknown coordinateModification type " << cmType << nl << nl
<< "Valid coordinateModification types are :" << nl
<< "Valid coordinateModification types :" << nl
<< "[default: " << typeName_() << "]"
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
......@@ -67,8 +59,4 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -127,9 +127,7 @@ Foam::Ostream& Foam::operator<<
}
}
// Check state of IOstream
os.check(FUNCTION_NAME);
return os;
}
......
......@@ -115,12 +115,8 @@ public:
const labelledMeshOctreeCubeCoordinates& lcc
) const
{
if (cLabel_ == lcc.cLabel_)
{
return true;
}
return false;
return (cLabel_ == lcc.cLabel_);
}
}
inline bool operator!=
......@@ -144,9 +140,7 @@ public:
os << lcc.cLabel_ << token::SPACE;
os << lcc.coordinates_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -165,9 +159,7 @@ public:
// Read end of labelledMeshOctreeCubeCoordinates
is.readEnd("labelledMeshOctreeCubeCoordinates");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -121,11 +121,19 @@ public:
const labelPair& op = lpp.pair_;
if ((pair_.first() == op.first()) && (pair_.second() == op.second()))
if
(
(pair_.first() == op.first())
&& (pair_.second() == op.second())
)
{
return true;
}
if ((pair_.first() == op.second()) && (pair_.second() == op.first()))
if
(
(pair_.first() == op.second())
&& (pair_.second() == op.first())
)
{
return true;
}
......@@ -186,9 +194,7 @@ public:
os << lpp.pLabel_ << token::SPACE;
os << lpp.pair_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -207,9 +213,7 @@ public:
// Read end of labelledPair
is.readEnd("labelledPair");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -119,12 +119,7 @@ public:
inline bool operator==(const labelledPoint& lp) const
{
if (pLabel_ == lp.pLabel_)
{
return true;
}
return false;
return (pLabel_ == lp.pLabel_);
}
inline bool operator!=(const labelledPoint& lp) const
......@@ -141,9 +136,7 @@ public:
os << lp.pLabel_ << token::SPACE;
os << lp.coords_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -158,9 +151,7 @@ public:
// Read end of labelledPoint
is.readEnd("labelledPoint");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -107,12 +107,7 @@ public:
inline bool operator==(const refLabelledPoint& lp) const
{
if (objectLabel_ == lp.objectLabel_)
{
return true;
}
return false;
return (objectLabel_ == lp.objectLabel_);
}
inline bool operator!=(const refLabelledPoint& lp) const
......@@ -129,9 +124,7 @@ public:
os << lp.objectLabel_ << token::SPACE;
os << lp.p_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -146,9 +139,7 @@ public:
// Read end of refLabelledPoint
is.readEnd("refLabelledPoint");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -158,9 +158,7 @@ public:
os << lps.coords_ << token::SPACE;
os << lps.weight_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -176,9 +174,7 @@ public:
// Read end of labelledPointScalar
is.readEnd("labelledPointScalar");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -132,9 +132,7 @@ public:
os << lps.pLabel_ << token::SPACE;
os << lps.lps_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -149,9 +147,7 @@ public:
// Read end of refLabelledPointScalar
is.readEnd("refLabelledPointScalar");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -171,9 +171,7 @@ public:
os << ls.sLabel_ << token::SPACE;
os << ls.value_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -188,9 +186,7 @@ public:
// Read end of labelledScalar
is.readEnd("labelledScalar");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -155,9 +155,7 @@ public:
os << scc.sValue_ << token::SPACE;
os << scc.coordinates_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -176,9 +174,7 @@ public:
// Read end of meshOctreCubeCoordinatesScalar
is.readEnd("meshOctreCubeCoordinatesScalar");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -89,10 +89,9 @@ public:
return pts_[i];
}
inline bool operator != (const parPartTet& /*ptf*/) const
inline bool operator!=(const parPartTet& /*ptf*/) const
{
NotImplemented;
return true;
}
......@@ -108,7 +107,6 @@ public:
os << ppt.pts_[3];
os << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -126,9 +124,7 @@ public:
// Read end of parHelper
is.readEnd("parPartTet");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -121,7 +121,6 @@ public:
os << ptf.globalLabels_[2] << token::SPACE;
os << ptf.triPoints_ << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -139,9 +138,7 @@ public:
// Read end of parHelper
is.readEnd("parTriFace");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
......@@ -30,11 +30,11 @@ License
#include "IOPtrList.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebugWithName
(
IOPtrList<boundaryPatchBase>,
......@@ -44,33 +44,34 @@ defineTemplateTypeNameAndDebugWithName
defineTypeNameAndDebug(boundaryPatchBase, 0);
defineRunTimeSelectionTable(boundaryPatchBase, dictionary);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
autoPtr<boundaryPatchBase> boundaryPatchBase::New
Foam::autoPtr<Foam::boundaryPatchBase> Foam::boundaryPatchBase::New
(
const word& name,
const dictionary& dict
)
{
word type(dict.lookup("type"));
// check the type of processor. Allowed types are processor and patch
// Check patch type - allowed types are processor and patch
// Other patch types are treated as ordinary patches
if (type != "processor")
{
type = "patch";
}
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(type);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(type);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown boundaryPatchBase type " << type << nl << nl
<< "Valid boundaryPatchBase types are :" << nl
<< "Valid boundaryPatchBase types:" << nl
<< "[default: " << typeName_() << "]"
<< dictionaryConstructorTablePtr_->toc()
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
......@@ -78,7 +79,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
}
autoPtr<boundaryPatchBase> boundaryPatchBase::New
Foam::autoPtr<Foam::boundaryPatchBase> Foam::boundaryPatchBase::New
(
Istream& is
)
......@@ -90,9 +91,9 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
boundaryPatchBase::boundaryPatchBase
Foam::boundaryPatchBase::boundaryPatchBase
(
const word& n,
const word& t,
......@@ -107,32 +108,29 @@ boundaryPatchBase::boundaryPatchBase
{}
boundaryPatchBase::boundaryPatchBase(const word& name, const dictionary& dict)
Foam::boundaryPatchBase::boundaryPatchBase
(
const word& name,
const dictionary& dict
)
:
name_(name),
type_(),
nFaces_(),
startFace_()
{
word type(dict.lookup("type"));
type_ = type;
nFaces_ = readLabel(dict.lookup("nFaces"));
startFace_ = readLabel(dict.lookup("startFace"));
}
type_(dict.lookup("type")),
nFaces_(readLabel(dict.lookup("nFaces"))),
startFace_(readLabel(dict.lookup("startFace")))
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const boundaryPatchBase& wpb)
Foam::Ostream&
Foam::operator<<(Foam::Ostream& os, const Foam::boundaryPatchBase& obj)
{
wpb.write(os);
obj.write(os);
os.check(FUNCTION_NAME);
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -251,7 +251,6 @@ inline Istream& operator>>(Istream& is, meshSubset& sel)
}
is.check(FUNCTION_NAME);
return is;
}
......
......@@ -120,9 +120,7 @@ inline Ostream& operator<<
os << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......@@ -146,9 +144,7 @@ inline Istream& operator>>
// Read end of meshOctreeCubeBasic
is.readEnd("meshOctreeCubeBasic");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
......
......@@ -613,9 +613,7 @@ inline Istream& operator>>
// Read end of meshOctreeCubeCoordinates
is.readEnd("meshOctreeCubeCoordinates");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
......@@ -638,9 +636,7 @@ inline Ostream& operator<<
os << token::END_LIST;
// Check state of Ostream
os.check(FUNCTION_NAME);
return os;
}
......
......@@ -27,14 +27,9 @@ License
#include "dictionary.H"
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<Foam::objectRefinement> Foam::objectRefinement::New
Foam::autoPtr<Foam::objectRefinement> Foam::objectRefinement::New
(
const word& name,
const dictionary& dict
......@@ -44,20 +39,17 @@ autoPtr<Foam::objectRefinement> Foam::objectRefinement::New
<< "constructing objectRefinement"
<< endl;
// default type is self
// Default type is self
word refType(typeName_());
if (dict.found("type"))
{
dict.lookup("type") >> refType;
}
dict.readIfPresent("type", refType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(refType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown objectRefinement type " << refType << nl << nl
<< "Valid objectRefinement types are :" << nl
<< "Valid objectRefinement types :" << nl
<< "[default: " << typeName_() << "]"
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
......@@ -67,8 +59,4 @@ autoPtr<Foam::objectRefinement> Foam::objectRefinement::New
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -164,9 +164,7 @@ public:
// Read end of parMapperHelper
is.readEnd("parMapperHelper");
// Check state of Istream
is.check(FUNCTION_NAME);
return is;
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment