ENH: cyclicPolyPatch : have checking on dictionary construction

This commit is contained in:
mattijs
2010-05-17 17:09:35 +01:00
parent e1e4098600
commit b903ed35d4

View File

@ -467,7 +467,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
) )
: :
coupledPolyPatch(name, dict, index, bm), coupledPolyPatch(name, dict, index, bm),
neighbPatchName_(dict.lookup("neighbourPatch")), neighbPatchName_(dict.lookupOrDefault("neighbourPatch", word::null)),
neighbPatchID_(-1), neighbPatchID_(-1),
transform_(UNKNOWN), transform_(UNKNOWN),
rotationAxis_(vector::zero), rotationAxis_(vector::zero),
@ -476,12 +476,30 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
coupledPointsPtr_(NULL), coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL) coupledEdgesPtr_(NULL)
{ {
if (neighbPatchName_ == word::null)
{
FatalIOErrorIn
(
"cyclicPolyPatch::cyclicPolyPatch\n"
"(\n"
" const word& name,\n"
" const dictionary& dict,\n"
" const label index,\n"
" const polyBoundaryMesh& bm\n"
")",
dict
) << "No \"neighbourPatch\" provided." << endl
<< "Is your mesh uptodate with split cyclics?" << endl
<< "Run foamUpgradeCyclics to convert mesh and fields"
<< " to split cyclics." << exit(FatalIOError);
}
if (neighbPatchName_ == name) if (neighbPatchName_ == name)
{ {
FatalErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)") FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict)
<< "Neighbour patch name " << neighbPatchName_ << "Neighbour patch name " << neighbPatchName_
<< " cannot be the same as this patch " << name << " cannot be the same as this patch " << name
<< exit(FatalError); << exit(FatalIOError);
} }
if (dict.found("transform")) if (dict.found("transform"))