GIT: Resolved conflict

This commit is contained in:
Andrew Heather
2016-12-14 15:56:58 +00:00
779 changed files with 25526 additions and 42273 deletions

View File

@ -64,24 +64,25 @@ Description
libs | Libraries containing implementation | yes |
region | Name of region for multi-region cases | no |
enabled | On/off switch | no | yes
log | Log information to standard output | no | yes
timeStart| Start time | no |
timeEnd | End time | no |
evaluateControl | See time controls below | no | timeStep
evaluateInterval | Steps between output | no |
writeControl | See time controls below | no | timeStep
writeInterval | Steps between output | no |
executeControl | See time controls below | no | timeStep
executeInterval | Steps between each execute phase | no |
writeControl | See time controls below | no | timeStep
writeInterval | Steps between each write phase | no |
\endtable
Time controls:
\table
Option | Description
timeStep | Execute/write every 'writeInterval' time-steps
writeTime | Execute/write every 'writeInterval' output times
adjustableRunTime | Execute/write every 'writeInterval' run time period
runTime | Execute/write every 'writeInterval' run time period
clockTime | Execute/write every 'writeInterval' clock time period
cpuTime | Execute/write every 'writeInterval' CPU time period
none | Execute/write every time-step
timeStep | Execute/write every 'Interval' time-steps
writeTime | Execute/write every 'Interval' output times
adjustableRunTime | Execute/write every 'Interval' run time period
runTime | Execute/write every 'Interval' run time period
clockTime | Execute/write every 'Interval' clock time period
cpuTime | Execute/write every 'Interval' CPU time period
none | Execute/write disabled
\endtable
The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and
@ -91,6 +92,14 @@ Description
libraries and the \c libs entry is used to specify which library should be
loaded.
Each function object has two separate run phases:
- The \c execute phase is meant to be used for updating calculations
or for management tasks.
- The \c write phase is meant for writing the calculated data to disk.
For each phase the respective time controls are provided, as listed above.
Class
Foam::functionObject

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,19 +40,46 @@ namespace functionObjects
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
const Foam::objectRegistry&
Foam::functionObjects::regionFunctionObject::whichSubRegistry
(
const objectRegistry& obr,
const dictionary& dict
)
{
word subName;
if (dict.readIfPresent("subRegion", subName))
{
return obr.lookupObject<objectRegistry>(subName);
}
else
{
return obr;
}
}
const Foam::objectRegistry&
Foam::functionObjects::regionFunctionObject::obr() const
{
return subObr_;
}
bool Foam::functionObjects::regionFunctionObject::writeObject
(
const word& fieldName
)
{
if (obr_.foundObject<regIOobject>(fieldName))
const regIOobject* objPtr =
this->lookupObjectPtr<regIOobject>(fieldName);
if (objPtr)
{
const regIOobject& field = obr_.lookupObject<regIOobject>(fieldName);
Log << " functionObjects::" << type() << " " << name()
<< " writing field: " << field.name() << endl;
<< " writing field: " << objPtr->name() << endl;
field.write();
objPtr->write();
return true;
}
@ -68,13 +95,12 @@ bool Foam::functionObjects::regionFunctionObject::clearObject
const word& fieldName
)
{
if (foundObject<regIOobject>(fieldName))
regIOobject* objPtr = lookupObjectRefPtr<regIOobject>(fieldName);
if (objPtr)
{
const regIOobject& resultObject = lookupObject<regIOobject>(fieldName);
if (resultObject.ownedByRegistry())
if (objPtr->ownedByRegistry())
{
return const_cast<regIOobject&>(resultObject).checkOut();
return objPtr->checkOut();
}
else
{
@ -104,7 +130,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
)
),
subObr_(whichSubRegistry(obr_, dict))
{}
@ -116,7 +143,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
)
:
stateFunctionObject(name, obr.time()),
obr_(obr)
obr_(obr),
subObr_(whichSubRegistry(obr_, dict))
{}

View File

@ -27,6 +27,8 @@ Class
Description
Specialization of Foam::functionObject for a region and providing a
reference to the region Foam::objectRegistry.
Also provides support for referencing a sub-region, which is typically
needed when dealing with surfMesh and their fields.
See also
Foam::functionObjects::stateFunctionObject
@ -68,18 +70,51 @@ protected:
//- Reference to the region objectRegistry
const objectRegistry& obr_;
//- Optional reference to the sub-region objectRegistry.
// If a sub-region is not in effect, this reference is identical
// to the usual region objectRegistry.
const objectRegistry& subObr_;
// Protected member functions
//- Find field in the objectRegistry
//- Selector for alternative sub-registry,
// when the keyword %subRegion is present in the dictionary
static const objectRegistry& whichSubRegistry
(
const objectRegistry& obr,
const dictionary& dict
);
//- The region or sub-region registry being used
const objectRegistry& obr() const;
//- Find object (eg, a field) in the (sub) objectRegistry
template<class ObjectType>
bool foundObject(const word& fieldName) const;
//- Lookup field from the objectRegistry
//- Lookup and return object (eg, a field) from the (sub) objectRegistry
template<class ObjectType>
const ObjectType& lookupObject(const word& fieldName) const;
//- Store the given field in the objectRegistry under the given name
//- Lookup and return object (eg, a field) from the (sub) objectRegistry
template<class ObjectType>
ObjectType& lookupObjectRef(const word& fieldName) const;
//- Lookup and return pointer to the object,
// otherwise nullptr if the object was not found,
// or had the incorrect type.
template<class ObjectType>
const ObjectType* lookupObjectPtr(const word& fieldName) const;
//- Lookup and return non-const pointer to the object,
// otherwise nullptr if the object was not found,
// or had the incorrect type.
template<class ObjectType>
ObjectType* lookupObjectRefPtr(const word& fieldName) const;
//- Store the given field in the (sub) objectRegistry under the given name
// Note: sets the fieldName to tfield().name() if not already set
template<class ObjectType>
bool store
@ -89,10 +124,10 @@ protected:
bool cacheable = false
);
//- Write field if present in objectRegistry
//- Write field if present in the (sub) objectRegistry
bool writeObject(const word& fieldName);
//- Clear field from the objectRegistry if present
//- Clear field from the (sub) objectRegistry if present
bool clearObject(const word& fieldName);
@ -101,10 +136,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
regionFunctionObject(const regionFunctionObject&);
regionFunctionObject(const regionFunctionObject&) = delete;
//- Disallow default bitwise assignment
void operator=(const regionFunctionObject&);
void operator=(const regionFunctionObject&) = delete;
public:

View File

@ -34,7 +34,7 @@ bool Foam::functionObjects::regionFunctionObject::foundObject
const word& fieldName
) const
{
return obr_.foundObject<ObjectType>(fieldName);
return obr().foundObject<ObjectType>(fieldName);
}
@ -44,7 +44,37 @@ const ObjectType& Foam::functionObjects::regionFunctionObject::lookupObject
const word& fieldName
) const
{
return obr_.lookupObject<ObjectType>(fieldName);
return obr().lookupObject<ObjectType>(fieldName);
}
template<class ObjectType>
ObjectType& Foam::functionObjects::regionFunctionObject::lookupObjectRef
(
const word& fieldName
) const
{
return obr().lookupObjectRef<ObjectType>(fieldName);
}
template<class ObjectType>
const ObjectType* Foam::functionObjects::regionFunctionObject::lookupObjectPtr
(
const word& fieldName
) const
{
return obr().lookupObjectPtr<ObjectType>(fieldName);
}
template<class ObjectType>
ObjectType* Foam::functionObjects::regionFunctionObject::lookupObjectRefPtr
(
const word& fieldName
) const
{
return obr().lookupObjectRefPtr<ObjectType>(fieldName);
}
@ -59,7 +89,7 @@ bool Foam::functionObjects::regionFunctionObject::store
if (cacheable && fieldName == tfield().name())
{
WarningInFunction
<< "Cannot store cache-able field with the named used in the cache."
<< "Cannot store cache-able field with the name used in the cache."
<< nl
<< " Either choose a different name or cache the field"
<< " and use the 'writeObjects' functionObject."
@ -72,8 +102,8 @@ bool Foam::functionObjects::regionFunctionObject::store
{
const ObjectType& field = lookupObject<ObjectType>(fieldName);
// If there is a result field already registered assign to the new
// result field otherwise transfer ownership of the new result field to
// If there is a result field already registered, assign to the new
// result field. Otherwise transfer ownership of the new result field to
// the object registry
if (&field != &tfield())
{
@ -81,7 +111,7 @@ bool Foam::functionObjects::regionFunctionObject::store
}
else
{
obr_.objectRegistry::store(tfield.ptr());
obr().objectRegistry::store(tfield.ptr());
}
}
else
@ -95,7 +125,7 @@ bool Foam::functionObjects::regionFunctionObject::store
fieldName = tfield().name();
}
obr_.objectRegistry::store(tfield.ptr());
obr().objectRegistry::store(tfield.ptr());
}
return true;

View File

@ -77,7 +77,8 @@ Foam::functionObjects::timeControl::timeControl
),
executeControl_(t, dict, "execute"),
writeControl_(t, dict, "write"),
foPtr_(functionObject::New(name, t, dict_))
foPtr_(functionObject::New(name, t, dict_)),
executeTimeIndex_(-1)
{
readControls();
}
@ -89,6 +90,7 @@ bool Foam::functionObjects::timeControl::execute()
{
if (active() && (postProcess || executeControl_.execute()))
{
executeTimeIndex_ = time_.timeIndex();
foPtr_->execute();
}
@ -100,6 +102,13 @@ bool Foam::functionObjects::timeControl::write()
{
if (active() && (postProcess || writeControl_.execute()))
{
// Ensure written results reflect the current state
if (executeTimeIndex_ != time_.timeIndex())
{
executeTimeIndex_ = time_.timeIndex();
foPtr_->execute();
}
foPtr_->write();
}

View File

@ -99,6 +99,9 @@ class timeControl
//- The functionObject to execute
autoPtr<functionObject> foPtr_;
//- Time index of the last execute call
label executeTimeIndex_;
// Private Member Functions