BUG: dictionary lookup of embedded coordinateSystem fails (fixes #879)

- also fix incorrect documentation in forces functionObject and
  interRegionExplicitPorositySource fvOption.
This commit is contained in:
Mark Olesen 2018-06-16 00:29:41 +02:00
parent b8ec4e12e1
commit 714040678a
3 changed files with 32 additions and 15 deletions

View File

@ -111,8 +111,12 @@ Note
coordinateSystem
{
origin (0 0 0);
e3 (0 0 1);
e1 (1 0 0);
coordinateRotation
{
type axesRotation;
e3 (0 0 1);
e1 (1 0 0);
}
}
\endverbatim
@ -346,11 +350,11 @@ protected:
//- Write binned data
void writeBins();
//- Disallow default bitwise copy construct
forces(const forces&);
//- No copy construct
forces(const forces&) = delete;
//- Disallow default bitwise assignment
void operator=(const forces&);
//- No copy assignment
void operator=(const forces&) = delete;
public:

View File

@ -43,8 +43,13 @@ Description
coordinateSystem
{
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
}
}
}
}

View File

@ -129,9 +129,21 @@ Foam::coordinateSystem::coordinateSystem
{
const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false);
// non-dictionary entry is a lookup into global coordinateSystems
if (entryPtr && !entryPtr->isDict())
if (!entryPtr)
{
// No 'coordinateSystem' entry
init(dict, obr);
}
else if (entryPtr->isDict())
{
// 'coordinateSystem' as dictionary entry - use it
init(entryPtr->dict(), obr);
}
else
{
// 'coordinateSystem' as non-dictionary entry
// - this is a lookup into global coordinateSystems
keyType key(entryPtr->stream());
const coordinateSystems& lst = coordinateSystems::New(obr);
@ -152,15 +164,11 @@ Foam::coordinateSystem::coordinateSystem
<< exit(FatalError);
}
// copy coordinateSystem, but assign the name as the typeName
// Copy from coordinateSystem, but assign the name as the typeName
// to avoid strange things in writeDict()
operator=(lst[index]);
name_ = typeName_();
}
else
{
init(dict, obr);
}
}