diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C index 6fdfe07eb1d78d9073ed5d6e81e98404f50e2ccb..b1d9f5f59f3f0f8ecc9fc2fbbad88b78769574c3 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C @@ -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& field = obr_.lookupObject<regIOobject>(fieldName); + const regIOobject* objPtr = + this->lookupObjectPtr<regIOobject>(fieldName); + if (objPtr) + { 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)) {} diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H index e9be6e3487ee72f6ad37584d6b7461ead5b9381c..70be4fccfe2d50267f0c4f9112be21a0fbbc2864 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H @@ -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: diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C index 0cddd5cc569b5a4cbd2e29f4447f3740989953bc..a18bff7070c76e3cac602392969e2c70045f55d2 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C @@ -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); } @@ -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; diff --git a/src/functionObjects/field/PecletNo/PecletNo.C b/src/functionObjects/field/PecletNo/PecletNo.C index da4018b54b3aa19be1dcb4ccc7e44cc55693a26c..c8eb2e8f67a66683e14c72d7f0f214f5f58f8f97 100644 --- a/src/functionObjects/field/PecletNo/PecletNo.C +++ b/src/functionObjects/field/PecletNo/PecletNo.C @@ -157,7 +157,7 @@ Foam::functionObjects::PecletNo::~PecletNo() bool Foam::functionObjects::PecletNo::read(const dictionary& dict) { - dict.readIfPresent("rho", rhoName_); + rhoName_ = dict.lookupOrDefault<word>("rho", "rho"); return true; } diff --git a/src/functionObjects/field/blendingFactor/blendingFactor.C b/src/functionObjects/field/blendingFactor/blendingFactor.C index 3861e809a2d0382108fcd105a326233164d7b4b9..f46374f29c6f2ef6f928b465f1774805966e0a50 100644 --- a/src/functionObjects/field/blendingFactor/blendingFactor.C +++ b/src/functionObjects/field/blendingFactor/blendingFactor.C @@ -117,8 +117,13 @@ bool Foam::functionObjects::blendingFactor::read(const dictionary& dict) writeFile::read(dict); 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 << "tolerance must be in the range 0 to 1. Supplied value: " diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.C b/src/functionObjects/field/fieldAverage/fieldAverage.C index 5ce702d66ae21860c62c831f28fd642f1cb1a9a6..12ffdcd9a5f7f5d989fba9bd62207b4c59367e05 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.C +++ b/src/functionObjects/field/fieldAverage/fieldAverage.C @@ -302,17 +302,39 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict) dict.readIfPresent("periodicRestart", periodicRestart_); dict.lookup("fields") >> faItems_; + const scalar currentTime = obr().time().value(); + if (periodicRestart_) { 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; if (dict.readIfPresent("restartTime", restartTime_)) { - if (restartTime_ < obr_.time().value()) + if (currentTime > restartTime_) { // The restart time is already in the past - ignore restartTime_ = GREAT; diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C index 42f57bb9f718e1ba3a3783691ef82c76cbea9f67..4ebe86bb24b422affbeb238acceb6624e0e013f1 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -97,7 +97,7 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict) dict.lookup("fields") >> fields_; dict.lookup("writeFields") >> writeFields_; - dict.readIfPresent("scaleFactor", scaleFactor_); + scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0); return true; } diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 6278eea50a7466d31c7b77a25ce4fe03e1f58aea..823363316a30d3ee90344987bb794ceceef67526 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -70,7 +70,7 @@ protected: // Protected data - //- Optional scale value + //- Optional scaling factor scalar scaleFactor_; //- Construction dictionary diff --git a/src/functionObjects/field/fluxSummary/fluxSummary.C b/src/functionObjects/field/fluxSummary/fluxSummary.C index cfe7a3e18c2beefe6e6b7192ba7d57b80bc02b85..dc403701a4a160b43f3b69507e1867a0d65de62a 100644 --- a/src/functionObjects/field/fluxSummary/fluxSummary.C +++ b/src/functionObjects/field/fluxSummary/fluxSummary.C @@ -79,21 +79,19 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone DynamicList<List<scalar>>& faceSign ) const { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - - label zonei = mesh.faceZones().findZoneID(faceZoneName); + label zonei = mesh_.faceZones().findZoneID(faceZoneName); if (zonei == -1) { FatalErrorInFunction << "Unable to find faceZone " << faceZoneName - << ". Valid faceZones are: " << mesh.faceZones().names() + << ". Valid faceZones are: " << mesh_.faceZones().names() << exit(FatalError); } faceZoneNames.append(faceZoneName); - const faceZone& fZone = mesh.faceZones()[zonei]; + const faceZone& fZone = mesh_.faceZones()[zonei]; DynamicList<label> faceIDs(fZone.size()); DynamicList<label> facePatchIDs(fZone.size()); @@ -105,15 +103,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone label faceID = -1; label facePatchID = -1; - if (mesh.isInternalFace(facei)) + if (mesh_.isInternalFace(facei)) { faceID = facei; facePatchID = -1; } else { - facePatchID = mesh.boundaryMesh().whichPatch(facei); - const polyPatch& pp = mesh.boundaryMesh()[facePatchID]; + facePatchID = mesh_.boundaryMesh().whichPatch(facei); + const polyPatch& pp = mesh_.boundaryMesh()[facePatchID]; if (isA<coupledPolyPatch>(pp)) { if (refCast<const coupledPolyPatch>(pp).owner()) @@ -170,31 +168,29 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection DynamicList<List<scalar>>& faceSign ) const { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - vector refDir = dir/(mag(dir) + ROOTVSMALL); - label zonei = mesh.faceZones().findZoneID(faceZoneName); + label zonei = mesh_.faceZones().findZoneID(faceZoneName); if (zonei == -1) { FatalErrorInFunction << "Unable to find faceZone " << faceZoneName - << ". Valid faceZones are: " << mesh.faceZones().names() + << ". Valid faceZones are: " << mesh_.faceZones().names() << exit(FatalError); } faceZoneNames.append(faceZoneName); zoneRefDir.append(refDir); - const faceZone& fZone = mesh.faceZones()[zonei]; + const faceZone& fZone = mesh_.faceZones()[zonei]; DynamicList<label> faceIDs(fZone.size()); DynamicList<label> facePatchIDs(fZone.size()); DynamicList<scalar> faceSigns(fZone.size()); - const surfaceVectorField& Sf = mesh.Sf(); - const surfaceScalarField& magSf = mesh.magSf(); + const surfaceVectorField& Sf = mesh_.Sf(); + const surfaceScalarField& magSf = mesh_.magSf(); vector n(Zero); @@ -204,15 +200,15 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZoneAndDirection label faceID = -1; label facePatchID = -1; - if (mesh.isInternalFace(facei)) + if (mesh_.isInternalFace(facei)) { faceID = facei; facePatchID = -1; } else { - facePatchID = mesh.boundaryMesh().whichPatch(facei); - const polyPatch& pp = mesh.boundaryMesh()[facePatchID]; + facePatchID = mesh_.boundaryMesh().whichPatch(facei); + const polyPatch& pp = mesh_.boundaryMesh()[facePatchID]; if (isA<coupledPolyPatch>(pp)) { if (refCast<const coupledPolyPatch>(pp).owner()) @@ -279,27 +275,25 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection DynamicList<List<scalar>>& faceSign ) const { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - vector refDir = dir/(mag(dir) + ROOTVSMALL); - const label cellZonei = mesh.cellZones().findZoneID(cellZoneName); + const label cellZonei = mesh_.cellZones().findZoneID(cellZoneName); if (cellZonei == -1) { FatalErrorInFunction << "Unable to find cellZone " << cellZoneName - << ". Valid zones are: " << mesh.cellZones().names() + << ". Valid zones are: " << mesh_.cellZones().names() << exit(FatalError); } - const label nInternalFaces = mesh.nInternalFaces(); - const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + const label nInternalFaces = mesh_.nInternalFaces(); + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); - labelList cellAddr(mesh.nCells(), -1); - const labelList& cellIDs = mesh.cellZones()[cellZonei]; + labelList cellAddr(mesh_.nCells(), -1); + const labelList& cellIDs = mesh_.cellZones()[cellZonei]; UIndirectList<label>(cellAddr, cellIDs) = identity(cellIDs.size()); - labelList nbrFaceCellAddr(mesh.nFaces() - nInternalFaces, -1); + labelList nbrFaceCellAddr(mesh_.nFaces() - nInternalFaces, -1); forAll(pbm, patchi) { @@ -311,17 +305,17 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection { label facei = pp.start() + i; label nbrFacei = facei - nInternalFaces; - label own = mesh.faceOwner()[facei]; + label own = mesh_.faceOwner()[facei]; nbrFaceCellAddr[nbrFacei] = cellAddr[own]; } } } // Correct boundary values for parallel running - syncTools::swapBoundaryFaceList(mesh, nbrFaceCellAddr); + syncTools::swapBoundaryFaceList(mesh_, nbrFaceCellAddr); // 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> faceLocalPatchIDs(faceIDs.size()); DynamicList<scalar> faceSigns(faceIDs.size()); @@ -329,12 +323,12 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection // Internal faces for (label facei = 0; facei < nInternalFaces; facei++) { - const label own = cellAddr[mesh.faceOwner()[facei]]; - const label nbr = cellAddr[mesh.faceNeighbour()[facei]]; + const label own = cellAddr[mesh_.faceOwner()[facei]]; + const label nbr = cellAddr[mesh_.faceNeighbour()[facei]]; 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; if ((n & refDir) > tolerance_) @@ -362,12 +356,12 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection forAll(pp, 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]; 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; if ((n & refDir) > tolerance_) @@ -391,15 +385,15 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection // Convert into primitivePatch for convenience indirectPrimitivePatch patch ( - IndirectList<face>(mesh.faces(), faceIDs), - mesh.points() + IndirectList<face>(mesh_.faces(), faceIDs), + mesh_.points() ); if (debug) { - OBJstream os(mesh.time().path()/"patch.obj"); + OBJstream os(mesh_.time().path()/"patch.obj"); 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 > calc ( - mesh, + mesh_, patch, changedEdges, changedInfo, @@ -524,9 +518,9 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection // Write OBj of faces to file if (debug) { - OBJstream os(mesh.time().path()/zoneName + ".obj"); - faceList faces(mesh.faces(), regionFaceIDs[regioni]); - os.write(faces, mesh.points(), false); + OBJstream os(mesh_.time().path()/zoneName + ".obj"); + faceList faces(mesh_.faces(), regionFaceIDs[regioni]); + os.write(faces, mesh_.points(), false); } } @@ -552,8 +546,7 @@ void Foam::functionObjects::fluxSummary::initialiseFaceArea() { 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) { @@ -623,9 +616,9 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict) writeFile::read(dict); mode_ = modeTypeNames_.read(dict.lookup("mode")); - phiName_= dict.lookupOrDefault<word>("phi", "phi"); - dict.readIfPresent("scaleFactor", scaleFactor_); - dict.readIfPresent("tolerance", tolerance_); + phiName_ = dict.lookupOrDefault<word>("phi", "phi"); + scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0); + tolerance_ = dict.lookupOrDefault<scalar>("tolerance", 0.8); // Initialise with capacity of 10 faceZones DynamicList<vector> refDir(10); @@ -788,7 +781,7 @@ bool Foam::functionObjects::fluxSummary::write() { const surfaceScalarField& phi = lookupObject<surfaceScalarField>(phiName_); - word flowType = ""; + word flowType; if (phi.dimensions() == dimVolume/dimTime) { flowType = "volumetric"; @@ -801,7 +794,7 @@ bool Foam::functionObjects::fluxSummary::write() { FatalErrorInFunction << "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); } diff --git a/src/functionObjects/field/mapFields/mapFields.H b/src/functionObjects/field/mapFields/mapFields.H index 299a6f5165253b39355bfa1e513db071006d5fde..7fee3cf142d3f51b41023fcf8033af04303a5f67 100644 --- a/src/functionObjects/field/mapFields/mapFields.H +++ b/src/functionObjects/field/mapFields/mapFields.H @@ -50,7 +50,7 @@ Usage \table Property | Description | Required | Default value 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 | patchMapMethod | Patch mapping method | no | <auto> consistent | Mapping meshes have consistent boundaries | yes | @@ -61,7 +61,6 @@ Usage SourceFiles mapFields.C - IOmapFields.H \*---------------------------------------------------------------------------*/ diff --git a/src/functionObjects/field/pressure/pressure.C b/src/functionObjects/field/pressure/pressure.C index 4f73902c89c293675a9e5862a013ab5b128f4953..1344041fb0fe2fdd3d32ee2d2ce8389dbb87af8a 100644 --- a/src/functionObjects/field/pressure/pressure.C +++ b/src/functionObjects/field/pressure/pressure.C @@ -232,8 +232,8 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict) { fieldExpression::read(dict); - dict.readIfPresent("U", UName_); - dict.readIfPresent("rho", rhoName_); + UName_ = dict.lookupOrDefault<word>("U", "U"); + rhoName_ = dict.lookupOrDefault<word>("rho", "rho"); if (rhoName_ == "rhoInf") { diff --git a/src/functionObjects/field/valueAverage/valueAverage.H b/src/functionObjects/field/valueAverage/valueAverage.H index ecb9ebe5f21e164ee447f9c0de6f0d01d1968ee6..83cf3ed170eb1e04aef0f36e19bddb8aa6368408 100644 --- a/src/functionObjects/field/valueAverage/valueAverage.H +++ b/src/functionObjects/field/valueAverage/valueAverage.H @@ -95,7 +95,7 @@ protected: // Protected data - //- Name of function object to retrueve data from + //- Name of function object to retrieve data from word functionObjectName_; //- List of fields on which to operate diff --git a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C index 221f1fea638885b5c35016faefa947426415abda..f4abd527f7e957ba462250c62cf91a9dcb715398 100644 --- a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -256,8 +256,6 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict) if (writeFields_) { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - volVectorField* forceCoeffPtr ( new volVectorField @@ -265,12 +263,12 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict) IOobject ( fieldName("forceCoeff"), - mesh.time().timeName(), - mesh, + mesh_.time().timeName(), + mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), - mesh, + mesh_, dimensionedVector("0", dimless, Zero) ) ); @@ -284,12 +282,12 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict) IOobject ( fieldName("momentCoeff"), - mesh.time().timeName(), - mesh, + mesh_.time().timeName(), + mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), - mesh, + mesh_, dimensionedVector("0", dimless, Zero) ) ); diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C index bd026f2b91e68eafa22e34441bcc74c8a9f6e84a..2c21271939d7da5ec56115b36e6aca64da0d69b0 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C @@ -212,14 +212,14 @@ void Foam::ensightSurfaceReader::readCase(IFstream& is) } // Start reading time information - readLine(is, buffer); // time set: 1 + readLine(is, buffer); // time set: <int> readLine(is, buffer); - readFromLine(3, buffer, nTimeSteps_); + readFromLine(3, buffer, nTimeSteps_); // number of steps: <int> readLine(is, buffer); - readFromLine(3, buffer, timeStartIndex_); + readFromLine(3, buffer, timeStartIndex_); // filename start number: <int> readLine(is, buffer); - readFromLine(2, buffer, timeIncrement_); + readFromLine(2, buffer, timeIncrement_); // filename increment: <int> if (debug) { @@ -369,7 +369,7 @@ const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry() // Read faces - may be a mix of tris, quads and polys DynamicList<face> faces(ceil(nPoints/3)); - DynamicList<Tuple2<string, label> > schema(faces.size()); + DynamicList<Tuple2<string, label>> schema(faces.size()); string faceType = ""; label nFace = 0; 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 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 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 ( 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 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 fieldIndex, diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H index 0ba7e1c49b7ef30f84ad003c72a6c5c5b1e79eb8..75c760341ab39505fb39a79a3af03fdc954816d8 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H @@ -86,7 +86,7 @@ protected: //- Pointer to the surface autoPtr<meshedSurface> surfPtr_; - List<Tuple2<string, label> > schema_; + List<Tuple2<string, label>> schema_; // Protected Member Functions @@ -126,7 +126,7 @@ protected: //- Helper function to return a field template<class Type> - tmp<Field<Type> > readField + tmp<Field<Type>> readField ( const label timeIndex, const label fieldIndex @@ -160,7 +160,7 @@ public: virtual wordList fieldNames(const label timeIndex) const; //- Return a scalar field at a given time - virtual tmp<Field<scalar> > field + virtual tmp<Field<scalar>> field ( const label timeIndex, const label fieldIndex, @@ -168,7 +168,7 @@ public: ) const; //- Return a scalar field at a given time - virtual tmp<Field<vector> > field + virtual tmp<Field<vector>> field ( const label timeIndex, const label fieldIndex, @@ -176,7 +176,7 @@ public: ) const; //- Return a sphericalTensor field at a given time - virtual tmp<Field<sphericalTensor> > field + virtual tmp<Field<sphericalTensor>> field ( const label timeIndex, const label fieldIndex, @@ -184,7 +184,7 @@ public: ) const; //- Return a symmTensor field at a given time - virtual tmp<Field<symmTensor> > field + virtual tmp<Field<symmTensor>> field ( const label timeIndex, const label fieldIndex, @@ -192,7 +192,7 @@ public: ) const; //- Return a tensor field at a given time - virtual tmp<Field<tensor> > field + virtual tmp<Field<tensor>> field ( const label timeIndex, const label fieldIndex, diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C index 5b8b3f555921e9e19fcede384aaa7c169a06c6ac..df6f466390ec49461bfdcfd23042d111375caf65 100644 --- a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C +++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C @@ -57,7 +57,7 @@ void Foam::ensightSurfaceReader::readFromLine template<class Type> -Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField +Foam::tmp<Foam::Field<Type>> Foam::ensightSurfaceReader::readField ( const label timeIndex, const label fieldIndex @@ -126,7 +126,7 @@ Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField is.read(iValue); // 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(); 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(); for diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL index 2e7e3d5803a03aca10d5eb9007601c89cd930186..ae1df01de8968b8ba24883a191a2a22a08b5cce3 100644 --- a/wmake/rules/General/CGAL +++ b/wmake/rules/General/CGAL @@ -12,4 +12,5 @@ CGAL_LIBS = \ -L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ -L$(CGAL_ARCH_PATH)/lib \ -L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ - -lCGAL + -lCGAL \ + -lmpfr diff --git a/wmake/scripts/AllwmakeParseArguments b/wmake/scripts/AllwmakeParseArguments index a985064effb564da3a768fac92f73e0d2bfda98a..e4abb9aabc9836b6c63e28c55d93bb7ef4e9e82c 100644 --- a/wmake/scripts/AllwmakeParseArguments +++ b/wmake/scripts/AllwmakeParseArguments @@ -46,6 +46,10 @@ Usage: $Script [OPTIONS] Executing $Script is equivalent to wmake -all [OPTIONS] + +With these additional options: + -l | -log + USAGE wmake -help @@ -57,8 +61,7 @@ USAGE # Parse the arguments and options #------------------------------------------------------------------------------ -fromWmake= -qOpt= +unset fromWmake optLog optQueue for arg in "$@" do @@ -70,17 +73,20 @@ do usage exit 0 ;; - # Check if called from wmake to avoid recusion -fromWmake) - fromWmake="fromWmake" + # If called from wmake (to avoid recursion) + fromWmake=true + ;; + -l | -log) + optLog=true + continue # Permanently remove arg ;; - -q) - qOpt="-q" - # Permanently remove arg - continue + -q | -queue) + optQueue="-q" + continue # Permanently remove arg ;; - # Target type lib | libo | libso | dep | objects) + # Target type targetType=$arg ;; esac @@ -96,11 +102,13 @@ done if [ -z "$fromWmake" ] then - exec wmake -all $qOpt $* -else - # Print command - [ -z "$targetType" ] || targetSpace=" " - echo "$Script $targetType$targetSpace$(echo $PWD | sed s%$WM_PROJECT_DIR/%% )" + if [ -z "$optLog" ] + then + exec wmake -all $optQueue $* + else + echo "logging wmake -all output to 'log.Allwmake'" 1>&2 + exec wmake -all $optQueue $* 2>&1 | tee log.Allwmake + fi fi @@ -118,7 +126,8 @@ fi # Cleanup local variables and functions #------------------------------------------------------------------------------ -unset Script usage fromWmake +unset Script fromWmake optLog optQueue +unset -f usage #------------------------------------------------------------------------------