GIT: Resolved merge conflict

This commit is contained in:
Andrew Heather
2016-12-12 12:23:45 +00:00
18 changed files with 253 additions and 133 deletions

View File

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

View File

@ -27,6 +27,8 @@ Class
Description Description
Specialization of Foam::functionObject for a region and providing a Specialization of Foam::functionObject for a region and providing a
reference to the region Foam::objectRegistry. 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 See also
Foam::functionObjects::stateFunctionObject Foam::functionObjects::stateFunctionObject
@ -68,18 +70,51 @@ protected:
//- Reference to the region objectRegistry //- Reference to the region objectRegistry
const objectRegistry& obr_; 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 // 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> template<class ObjectType>
bool foundObject(const word& fieldName) const; 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> template<class ObjectType>
const ObjectType& lookupObject(const word& fieldName) const; 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 // Note: sets the fieldName to tfield().name() if not already set
template<class ObjectType> template<class ObjectType>
bool store bool store
@ -89,10 +124,10 @@ protected:
bool cacheable = false bool cacheable = false
); );
//- Write field if present in objectRegistry //- Write field if present in the (sub) objectRegistry
bool writeObject(const word& fieldName); 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); bool clearObject(const word& fieldName);
@ -101,10 +136,10 @@ private:
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
regionFunctionObject(const regionFunctionObject&); regionFunctionObject(const regionFunctionObject&) = delete;
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const regionFunctionObject&); void operator=(const regionFunctionObject&) = delete;
public: public:

View File

@ -34,7 +34,7 @@ bool Foam::functionObjects::regionFunctionObject::foundObject
const word& fieldName const word& fieldName
) const ) 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 word& fieldName
) const ) 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);
} }
@ -72,8 +102,8 @@ bool Foam::functionObjects::regionFunctionObject::store
{ {
const ObjectType& field = lookupObject<ObjectType>(fieldName); const ObjectType& field = lookupObject<ObjectType>(fieldName);
// If there is a result field already registered assign to the new // If there is a result field already registered, assign to the new
// result field otherwise transfer ownership of the new result field to // result field. Otherwise transfer ownership of the new result field to
// the object registry // the object registry
if (&field != &tfield()) if (&field != &tfield())
{ {
@ -81,7 +111,7 @@ bool Foam::functionObjects::regionFunctionObject::store
} }
else else
{ {
obr_.objectRegistry::store(tfield.ptr()); obr().objectRegistry::store(tfield.ptr());
} }
} }
else else
@ -95,7 +125,7 @@ bool Foam::functionObjects::regionFunctionObject::store
fieldName = tfield().name(); fieldName = tfield().name();
} }
obr_.objectRegistry::store(tfield.ptr()); obr().objectRegistry::store(tfield.ptr());
} }
return true; return true;

View File

@ -157,7 +157,7 @@ Foam::functionObjects::PecletNo::~PecletNo()
bool Foam::functionObjects::PecletNo::read(const dictionary& dict) bool Foam::functionObjects::PecletNo::read(const dictionary& dict)
{ {
dict.readIfPresent("rho", rhoName_); rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
return true; return true;
} }

View File

@ -117,8 +117,13 @@ bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
writeFile::read(dict); writeFile::read(dict);
phiName_ = dict.lookupOrDefault<word>("phi", "phi"); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("tolerance", tolerance_);
if ((tolerance_ < 0) || (tolerance_ > 1)) tolerance_ = 0.001;
if
(
dict.readIfPresent("tolerance", tolerance_)
&& (tolerance_ < 0 || tolerance_ > 1)
)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "tolerance must be in the range 0 to 1. Supplied value: " << "tolerance must be in the range 0 to 1. Supplied value: "

View File

@ -302,17 +302,39 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
dict.readIfPresent("periodicRestart", periodicRestart_); dict.readIfPresent("periodicRestart", periodicRestart_);
dict.lookup("fields") >> faItems_; dict.lookup("fields") >> faItems_;
const scalar currentTime = obr().time().value();
if (periodicRestart_) if (periodicRestart_)
{ {
dict.lookup("restartPeriod") >> restartPeriod_; dict.lookup("restartPeriod") >> restartPeriod_;
Info<< " Restart period " << restartPeriod_
<< nl << endl; if (restartPeriod_ > 0)
{
// Determine the appropriate interval for the next restart
periodIndex_ = 1;
while (currentTime > restartPeriod_*periodIndex_)
{
++periodIndex_;
}
Info<< " Restart period " << restartPeriod_
<< " - next restart at " << (restartPeriod_*periodIndex_)
<< nl << endl;
}
else
{
periodicRestart_ = false;
Info<< " Restart period " << restartPeriod_
<< " - ignored"
<< nl << endl;
}
} }
restartTime_ = GREAT; restartTime_ = GREAT;
if (dict.readIfPresent("restartTime", restartTime_)) if (dict.readIfPresent("restartTime", restartTime_))
{ {
if (restartTime_ < obr_.time().value()) if (currentTime > restartTime_)
{ {
// The restart time is already in the past - ignore // The restart time is already in the past - ignore
restartTime_ = GREAT; restartTime_ = GREAT;

View File

@ -97,7 +97,7 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
dict.lookup("fields") >> fields_; dict.lookup("fields") >> fields_;
dict.lookup("writeFields") >> writeFields_; dict.lookup("writeFields") >> writeFields_;
dict.readIfPresent("scaleFactor", scaleFactor_); scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0);
return true; return true;
} }

View File

@ -70,7 +70,7 @@ protected:
// Protected data // Protected data
//- Optional scale value //- Optional scaling factor
scalar scaleFactor_; scalar scaleFactor_;
//- Construction dictionary //- Construction dictionary

View File

@ -79,21 +79,19 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
DynamicList<List<scalar>>& faceSign DynamicList<List<scalar>>& faceSign
) const ) const
{ {
const fvMesh& mesh = refCast<const fvMesh>(obr_); label zonei = mesh_.faceZones().findZoneID(faceZoneName);
label zonei = mesh.faceZones().findZoneID(faceZoneName);
if (zonei == -1) if (zonei == -1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find faceZone " << faceZoneName << "Unable to find faceZone " << faceZoneName
<< ". Valid faceZones are: " << mesh.faceZones().names() << ". Valid faceZones are: " << mesh_.faceZones().names()
<< exit(FatalError); << exit(FatalError);
} }
faceZoneNames.append(faceZoneName); faceZoneNames.append(faceZoneName);
const faceZone& fZone = mesh.faceZones()[zonei]; const faceZone& fZone = mesh_.faceZones()[zonei];
DynamicList<label> faceIDs(fZone.size()); DynamicList<label> faceIDs(fZone.size());
DynamicList<label> facePatchIDs(fZone.size()); DynamicList<label> facePatchIDs(fZone.size());
@ -105,15 +103,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone
label faceID = -1; label faceID = -1;
label facePatchID = -1; label facePatchID = -1;
if (mesh.isInternalFace(facei)) if (mesh_.isInternalFace(facei))
{ {
faceID = facei; faceID = facei;
facePatchID = -1; facePatchID = -1;
} }
else else
{ {
facePatchID = mesh.boundaryMesh().whichPatch(facei); facePatchID = mesh_.boundaryMesh().whichPatch(facei);
const polyPatch& pp = mesh.boundaryMesh()[facePatchID]; const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp)) if (isA<coupledPolyPatch>(pp))
{ {
if (refCast<const coupledPolyPatch>(pp).owner()) if (refCast<const coupledPolyPatch>(pp).owner())
@ -170,31 +168,29 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
DynamicList<List<scalar>>& faceSign DynamicList<List<scalar>>& faceSign
) const ) const
{ {
const fvMesh& mesh = refCast<const fvMesh>(obr_);
vector refDir = dir/(mag(dir) + ROOTVSMALL); vector refDir = dir/(mag(dir) + ROOTVSMALL);
label zonei = mesh.faceZones().findZoneID(faceZoneName); label zonei = mesh_.faceZones().findZoneID(faceZoneName);
if (zonei == -1) if (zonei == -1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find faceZone " << faceZoneName << "Unable to find faceZone " << faceZoneName
<< ". Valid faceZones are: " << mesh.faceZones().names() << ". Valid faceZones are: " << mesh_.faceZones().names()
<< exit(FatalError); << exit(FatalError);
} }
faceZoneNames.append(faceZoneName); faceZoneNames.append(faceZoneName);
zoneRefDir.append(refDir); zoneRefDir.append(refDir);
const faceZone& fZone = mesh.faceZones()[zonei]; const faceZone& fZone = mesh_.faceZones()[zonei];
DynamicList<label> faceIDs(fZone.size()); DynamicList<label> faceIDs(fZone.size());
DynamicList<label> facePatchIDs(fZone.size()); DynamicList<label> facePatchIDs(fZone.size());
DynamicList<scalar> faceSigns(fZone.size()); DynamicList<scalar> faceSigns(fZone.size());
const surfaceVectorField& Sf = mesh.Sf(); const surfaceVectorField& Sf = mesh_.Sf();
const surfaceScalarField& magSf = mesh.magSf(); const surfaceScalarField& magSf = mesh_.magSf();
vector n(Zero); vector n(Zero);
@ -204,15 +200,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection
label faceID = -1; label faceID = -1;
label facePatchID = -1; label facePatchID = -1;
if (mesh.isInternalFace(facei)) if (mesh_.isInternalFace(facei))
{ {
faceID = facei; faceID = facei;
facePatchID = -1; facePatchID = -1;
} }
else else
{ {
facePatchID = mesh.boundaryMesh().whichPatch(facei); facePatchID = mesh_.boundaryMesh().whichPatch(facei);
const polyPatch& pp = mesh.boundaryMesh()[facePatchID]; const polyPatch& pp = mesh_.boundaryMesh()[facePatchID];
if (isA<coupledPolyPatch>(pp)) if (isA<coupledPolyPatch>(pp))
{ {
if (refCast<const coupledPolyPatch>(pp).owner()) if (refCast<const coupledPolyPatch>(pp).owner())
@ -279,27 +275,25 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
DynamicList<List<scalar>>& faceSign DynamicList<List<scalar>>& faceSign
) const ) const
{ {
const fvMesh& mesh = refCast<const fvMesh>(obr_);
vector refDir = dir/(mag(dir) + ROOTVSMALL); vector refDir = dir/(mag(dir) + ROOTVSMALL);
const label cellZonei = mesh.cellZones().findZoneID(cellZoneName); const label cellZonei = mesh_.cellZones().findZoneID(cellZoneName);
if (cellZonei == -1) if (cellZonei == -1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find cellZone " << cellZoneName << "Unable to find cellZone " << cellZoneName
<< ". Valid zones are: " << mesh.cellZones().names() << ". Valid zones are: " << mesh_.cellZones().names()
<< exit(FatalError); << exit(FatalError);
} }
const label nInternalFaces = mesh.nInternalFaces(); const label nInternalFaces = mesh_.nInternalFaces();
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
labelList cellAddr(mesh.nCells(), -1); labelList cellAddr(mesh_.nCells(), -1);
const labelList& cellIDs = mesh.cellZones()[cellZonei]; const labelList& cellIDs = mesh_.cellZones()[cellZonei];
UIndirectList<label>(cellAddr, cellIDs) = identity(cellIDs.size()); UIndirectList<label>(cellAddr, cellIDs) = identity(cellIDs.size());
labelList nbrFaceCellAddr(mesh.nFaces() - nInternalFaces, -1); labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1);
forAll(pbm, patchi) forAll(pbm, patchi)
{ {
@ -311,17 +305,17 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
{ {
label facei = pp.start() + i; label facei = pp.start() + i;
label nbrFacei = facei - nInternalFaces; label nbrFacei = facei - nInternalFaces;
label own = mesh.faceOwner()[facei]; label own = mesh_.faceOwner()[facei];
nbrFaceCellAddr[nbrFacei] = cellAddr[own]; nbrFaceCellAddr[nbrFacei] = cellAddr[own];
} }
} }
} }
// Correct boundary values for parallel running // Correct boundary values for parallel running
syncTools::swapBoundaryFaceList(mesh, nbrFaceCellAddr); syncTools::swapBoundaryFaceList(mesh_, nbrFaceCellAddr);
// Collect faces // Collect faces
DynamicList<label> faceIDs(floor(0.1*mesh.nFaces())); DynamicList<label> faceIDs(floor(0.1*mesh_.nFaces()));
DynamicList<label> facePatchIDs(faceIDs.size()); DynamicList<label> facePatchIDs(faceIDs.size());
DynamicList<label> faceLocalPatchIDs(faceIDs.size()); DynamicList<label> faceLocalPatchIDs(faceIDs.size());
DynamicList<scalar> faceSigns(faceIDs.size()); DynamicList<scalar> faceSigns(faceIDs.size());
@ -329,12 +323,12 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
// Internal faces // Internal faces
for (label facei = 0; facei < nInternalFaces; facei++) for (label facei = 0; facei < nInternalFaces; facei++)
{ {
const label own = cellAddr[mesh.faceOwner()[facei]]; const label own = cellAddr[mesh_.faceOwner()[facei]];
const label nbr = cellAddr[mesh.faceNeighbour()[facei]]; const label nbr = cellAddr[mesh_.faceNeighbour()[facei]];
if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1))) if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1)))
{ {
vector n = mesh.faces()[facei].normal(mesh.points()); vector n = mesh_.faces()[facei].normal(mesh_.points());
n /= mag(n) + ROOTVSMALL; n /= mag(n) + ROOTVSMALL;
if ((n & refDir) > tolerance_) if ((n & refDir) > tolerance_)
@ -362,12 +356,12 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
forAll(pp, localFacei) forAll(pp, localFacei)
{ {
const label facei = pp.start() + localFacei; const label facei = pp.start() + localFacei;
const label own = cellAddr[mesh.faceOwner()[facei]]; const label own = cellAddr[mesh_.faceOwner()[facei]];
const label nbr = nbrFaceCellAddr[facei - nInternalFaces]; const label nbr = nbrFaceCellAddr[facei - nInternalFaces];
if ((own != -1) && (nbr == -1)) if ((own != -1) && (nbr == -1))
{ {
vector n = mesh.faces()[facei].normal(mesh.points()); vector n = mesh_.faces()[facei].normal(mesh_.points());
n /= mag(n) + ROOTVSMALL; n /= mag(n) + ROOTVSMALL;
if ((n & refDir) > tolerance_) if ((n & refDir) > tolerance_)
@ -391,15 +385,15 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
// Convert into primitivePatch for convenience // Convert into primitivePatch for convenience
indirectPrimitivePatch patch indirectPrimitivePatch patch
( (
IndirectList<face>(mesh.faces(), faceIDs), IndirectList<face>(mesh_.faces(), faceIDs),
mesh.points() mesh_.points()
); );
if (debug) if (debug)
{ {
OBJstream os(mesh.time().path()/"patch.obj"); OBJstream os(mesh_.time().path()/"patch.obj");
faceList faces(patch); faceList faces(patch);
os.write(faces, mesh.points(), false); os.write(faces, mesh_.points(), false);
} }
@ -467,7 +461,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
patchEdgeFaceRegion patchEdgeFaceRegion
> calc > calc
( (
mesh, mesh_,
patch, patch,
changedEdges, changedEdges,
changedInfo, changedInfo,
@ -524,9 +518,9 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
// Write OBj of faces to file // Write OBj of faces to file
if (debug) if (debug)
{ {
OBJstream os(mesh.time().path()/zoneName + ".obj"); OBJstream os(mesh_.time().path()/zoneName + ".obj");
faceList faces(mesh.faces(), regionFaceIDs[regioni]); faceList faces(mesh_.faces(), regionFaceIDs[regioni]);
os.write(faces, mesh.points(), false); os.write(faces, mesh_.points(), false);
} }
} }
@ -552,8 +546,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceArea()
{ {
faceArea_.setSize(faceID_.size(), 0); faceArea_.setSize(faceID_.size(), 0);
const fvMesh& mesh = refCast<const fvMesh>(obr_); const surfaceScalarField& magSf = mesh_.magSf();
const surfaceScalarField& magSf = mesh.magSf();
forAll(faceID_, zonei) forAll(faceID_, zonei)
{ {
@ -623,9 +616,9 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
writeFile::read(dict); writeFile::read(dict);
mode_ = modeTypeNames_.read(dict.lookup("mode")); mode_ = modeTypeNames_.read(dict.lookup("mode"));
phiName_= dict.lookupOrDefault<word>("phi", "phi"); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("scaleFactor", scaleFactor_); scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0);
dict.readIfPresent("tolerance", tolerance_); tolerance_ = dict.lookupOrDefault<scalar>("tolerance", 0.8);
// Initialise with capacity of 10 faceZones // Initialise with capacity of 10 faceZones
DynamicList<vector> refDir(10); DynamicList<vector> refDir(10);
@ -788,7 +781,7 @@ bool Foam::functionObjects::fluxSummary::write()
{ {
const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_); const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_);
word flowType = ""; word flowType;
if (phi.dimensions() == dimVolume/dimTime) if (phi.dimensions() == dimVolume/dimTime)
{ {
flowType = "volumetric"; flowType = "volumetric";
@ -801,7 +794,7 @@ bool Foam::functionObjects::fluxSummary::write()
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported flux field " << phi.name() << " with dimensions " << "Unsupported flux field " << phi.name() << " with dimensions "
<< phi.dimensions() << ". Expected eithe mass flow or volumetric " << phi.dimensions() << ". Expected either mass flow or volumetric "
<< "flow rate" << abort(FatalError); << "flow rate" << abort(FatalError);
} }

View File

@ -50,7 +50,7 @@ Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
type | Type name: mapFields | yes | type | Type name: mapFields | yes |
mapRgion | Name of region to map to | yes | mapRegion | Name of region to map to | yes |
mapMethod | Mapping method | yes | mapMethod | Mapping method | yes |
patchMapMethod | Patch mapping method | no | <auto> patchMapMethod | Patch mapping method | no | <auto>
consistent | Mapping meshes have consistent boundaries | yes | consistent | Mapping meshes have consistent boundaries | yes |
@ -61,7 +61,6 @@ Usage
SourceFiles SourceFiles
mapFields.C mapFields.C
IOmapFields.H
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -232,8 +232,8 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
{ {
fieldExpression::read(dict); fieldExpression::read(dict);
dict.readIfPresent("U", UName_); UName_ = dict.lookupOrDefault<word>("U", "U");
dict.readIfPresent("rho", rhoName_); rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
if (rhoName_ == "rhoInf") if (rhoName_ == "rhoInf")
{ {

View File

@ -95,7 +95,7 @@ protected:
// Protected data // Protected data
//- Name of function object to retrueve data from //- Name of function object to retrieve data from
word functionObjectName_; word functionObjectName_;
//- List of fields on which to operate //- List of fields on which to operate

View File

@ -256,8 +256,6 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
if (writeFields_) if (writeFields_)
{ {
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField* forceCoeffPtr volVectorField* forceCoeffPtr
( (
new volVectorField new volVectorField
@ -265,12 +263,12 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
IOobject IOobject
( (
fieldName("forceCoeff"), fieldName("forceCoeff"),
mesh.time().timeName(), mesh_.time().timeName(),
mesh, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh_,
dimensionedVector("0", dimless, Zero) dimensionedVector("0", dimless, Zero)
) )
); );
@ -284,12 +282,12 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
IOobject IOobject
( (
fieldName("momentCoeff"), fieldName("momentCoeff"),
mesh.time().timeName(), mesh_.time().timeName(),
mesh, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh_,
dimensionedVector("0", dimless, Zero) dimensionedVector("0", dimless, Zero)
) )
); );

View File

@ -212,14 +212,14 @@ void Foam::ensightSurfaceReader::readCase(IFstream& is)
} }
// Start reading time information // Start reading time information
readLine(is, buffer); // time set: 1 readLine(is, buffer); // time set: <int>
readLine(is, buffer); readLine(is, buffer);
readFromLine(3, buffer, nTimeSteps_); readFromLine(3, buffer, nTimeSteps_); // number of steps: <int>
readLine(is, buffer); readLine(is, buffer);
readFromLine(3, buffer, timeStartIndex_); readFromLine(3, buffer, timeStartIndex_); // filename start number: <int>
readLine(is, buffer); readLine(is, buffer);
readFromLine(2, buffer, timeIncrement_); readFromLine(2, buffer, timeIncrement_); // filename increment: <int>
if (debug) if (debug)
{ {
@ -369,7 +369,7 @@ const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry()
// Read faces - may be a mix of tris, quads and polys // Read faces - may be a mix of tris, quads and polys
DynamicList<face> faces(ceil(nPoints/3)); DynamicList<face> faces(ceil(nPoints/3));
DynamicList<Tuple2<string, label> > schema(faces.size()); DynamicList<Tuple2<string, label>> schema(faces.size());
string faceType = ""; string faceType = "";
label nFace = 0; label nFace = 0;
while (is.good()) // (is.peek() != EOF) while (is.good()) // (is.peek() != EOF)
@ -494,7 +494,7 @@ Foam::wordList Foam::ensightSurfaceReader::fieldNames
} }
Foam::tmp<Foam::Field<Foam::scalar> > Foam::ensightSurfaceReader::field Foam::tmp<Foam::Field<Foam::scalar>> Foam::ensightSurfaceReader::field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -505,7 +505,7 @@ Foam::tmp<Foam::Field<Foam::scalar> > Foam::ensightSurfaceReader::field
} }
Foam::tmp<Foam::Field<Foam::vector> > Foam::ensightSurfaceReader::field Foam::tmp<Foam::Field<Foam::vector>> Foam::ensightSurfaceReader::field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -516,7 +516,7 @@ Foam::tmp<Foam::Field<Foam::vector> > Foam::ensightSurfaceReader::field
} }
Foam::tmp<Foam::Field<Foam::sphericalTensor> > Foam::tmp<Foam::Field<Foam::sphericalTensor>>
Foam::ensightSurfaceReader::field Foam::ensightSurfaceReader::field
( (
const label timeIndex, const label timeIndex,
@ -528,7 +528,7 @@ Foam::ensightSurfaceReader::field
} }
Foam::tmp<Foam::Field<Foam::symmTensor> > Foam::ensightSurfaceReader::field Foam::tmp<Foam::Field<Foam::symmTensor>> Foam::ensightSurfaceReader::field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -539,7 +539,7 @@ Foam::tmp<Foam::Field<Foam::symmTensor> > Foam::ensightSurfaceReader::field
} }
Foam::tmp<Foam::Field<Foam::tensor> > Foam::ensightSurfaceReader::field Foam::tmp<Foam::Field<Foam::tensor>> Foam::ensightSurfaceReader::field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,

View File

@ -86,7 +86,7 @@ protected:
//- Pointer to the surface //- Pointer to the surface
autoPtr<meshedSurface> surfPtr_; autoPtr<meshedSurface> surfPtr_;
List<Tuple2<string, label> > schema_; List<Tuple2<string, label>> schema_;
// Protected Member Functions // Protected Member Functions
@ -126,7 +126,7 @@ protected:
//- Helper function to return a field //- Helper function to return a field
template<class Type> template<class Type>
tmp<Field<Type> > readField tmp<Field<Type>> readField
( (
const label timeIndex, const label timeIndex,
const label fieldIndex const label fieldIndex
@ -160,7 +160,7 @@ public:
virtual wordList fieldNames(const label timeIndex) const; virtual wordList fieldNames(const label timeIndex) const;
//- Return a scalar field at a given time //- Return a scalar field at a given time
virtual tmp<Field<scalar> > field virtual tmp<Field<scalar>> field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -168,7 +168,7 @@ public:
) const; ) const;
//- Return a scalar field at a given time //- Return a scalar field at a given time
virtual tmp<Field<vector> > field virtual tmp<Field<vector>> field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -176,7 +176,7 @@ public:
) const; ) const;
//- Return a sphericalTensor field at a given time //- Return a sphericalTensor field at a given time
virtual tmp<Field<sphericalTensor> > field virtual tmp<Field<sphericalTensor>> field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -184,7 +184,7 @@ public:
) const; ) const;
//- Return a symmTensor field at a given time //- Return a symmTensor field at a given time
virtual tmp<Field<symmTensor> > field virtual tmp<Field<symmTensor>> field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,
@ -192,7 +192,7 @@ public:
) const; ) const;
//- Return a tensor field at a given time //- Return a tensor field at a given time
virtual tmp<Field<tensor> > field virtual tmp<Field<tensor>> field
( (
const label timeIndex, const label timeIndex,
const label fieldIndex, const label fieldIndex,

View File

@ -57,7 +57,7 @@ void Foam::ensightSurfaceReader::readFromLine
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField Foam::tmp<Foam::Field<Type>> Foam::ensightSurfaceReader::readField
( (
const label timeIndex, const label timeIndex,
const label fieldIndex const label fieldIndex
@ -126,7 +126,7 @@ Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField
is.read(iValue); is.read(iValue);
// Allocate storage for data as a list per component // Allocate storage for data as a list per component
List<DynamicList<scalar> > values(pTraits<Type>::nComponents); List<DynamicList<scalar>> values(pTraits<Type>::nComponents);
label n = surfPtr_->size(); label n = surfPtr_->size();
forAll(values, cmptI) forAll(values, cmptI)
{ {
@ -164,7 +164,7 @@ Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField
} }
} }
tmp<Field<Type> > tField(new Field<Type>(n, pTraits<Type>::zero)); tmp<Field<Type>> tField(new Field<Type>(n, pTraits<Type>::zero));
Field<Type>& field = tField.ref(); Field<Type>& field = tField.ref();
for for

View File

@ -12,4 +12,5 @@ CGAL_LIBS = \
-L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ -L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-L$(CGAL_ARCH_PATH)/lib \ -L$(CGAL_ARCH_PATH)/lib \
-L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ -L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-lCGAL -lCGAL \
-lmpfr

View File

@ -46,6 +46,10 @@ Usage: $Script [OPTIONS]
Executing $Script is equivalent to Executing $Script is equivalent to
wmake -all [OPTIONS] wmake -all [OPTIONS]
With these additional options:
-l | -log
USAGE USAGE
wmake -help wmake -help
@ -57,8 +61,7 @@ USAGE
# Parse the arguments and options # Parse the arguments and options
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
fromWmake= unset fromWmake optLog optQueue
qOpt=
for arg in "$@" for arg in "$@"
do do
@ -70,17 +73,20 @@ do
usage usage
exit 0 exit 0
;; ;;
# Check if called from wmake to avoid recusion
-fromWmake) -fromWmake)
fromWmake="fromWmake" # If called from wmake (to avoid recursion)
fromWmake=true
;; ;;
-q) -l | -log)
qOpt="-q" optLog=true
# Permanently remove arg continue # Permanently remove arg
continue ;;
-q | -queue)
optQueue="-q"
continue # Permanently remove arg
;; ;;
# Target type
lib | libo | libso | dep | objects) lib | libo | libso | dep | objects)
# Target type
targetType=$arg targetType=$arg
;; ;;
esac esac
@ -96,11 +102,13 @@ done
if [ -z "$fromWmake" ] if [ -z "$fromWmake" ]
then then
exec wmake -all $qOpt $* if [ -z "$optLog" ]
else then
# Print command exec wmake -all $optQueue $*
[ -z "$targetType" ] || targetSpace=" " else
echo "$Script $targetType$targetSpace$(echo $PWD | sed s%$WM_PROJECT_DIR/%% )" echo "logging wmake -all output to 'log.Allwmake'" 1>&2
exec wmake -all $optQueue $* 2>&1 | tee log.Allwmake
fi
fi fi
@ -118,7 +126,8 @@ fi
# Cleanup local variables and functions # Cleanup local variables and functions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset Script usage fromWmake unset Script fromWmake optLog optQueue
unset -f usage
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------