MRG: resolved merge conflicts from merge from develop branch

This commit is contained in:
Andrew Heather
2017-05-19 16:29:54 +01:00
308 changed files with 2914 additions and 1667 deletions

View File

@ -90,7 +90,7 @@ Foam::cellSizeAndAlignmentControl::New
cellSizeAndAlignmentControlTypeName
);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown cellSizeAndAlignmentControl type "

View File

@ -133,7 +133,7 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(cellSizeFunctionTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown cellSizeFunction type "

View File

@ -71,7 +71,7 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(cellSizeCalculationTypeTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown cellSizeCalculationType type "

View File

@ -75,7 +75,7 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(surfaceCellSizeFunctionTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown surfaceCellSizeFunction type "

View File

@ -68,7 +68,7 @@ autoPtr<faceAreaWeightModel> faceAreaWeightModel::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(faceAreaWeightModelTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown faceAreaWeightModel type "

View File

@ -94,7 +94,7 @@ autoPtr<initialPointsMethod> initialPointsMethod::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(initialPointsMethodTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown initialPointsMethod type "

View File

@ -71,7 +71,7 @@ autoPtr<relaxationModel> relaxationModel::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(relaxationModelTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown relaxationModel type "

View File

@ -48,7 +48,7 @@ Foam::searchableSurfaceFeatures::New
dictConstructorTable::iterator cstrIter =
dictConstructorTablePtr_->find(searchableSurfaceFeaturesType);
if (cstrIter == dictConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown searchableSurfaceFeatures type "

View File

@ -71,7 +71,7 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(sampleType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown faceSelection type "

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -112,7 +112,7 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
{
WarningInFunction
<< "Did not visit some faces, e.g. face " << faceI
<< " at " << mesh.faceCentres()[faceI] << endl
<< " at " << mesh.faceCentres()[faceI] << nl
<< "Using patch " << patchIDs[0] << " as nearest"
<< endl;
haveWarned = true;
@ -129,57 +129,38 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
}
template<class Type>
void subsetVolFields
//
// Subset field-type, availability information cached
// in the availableFields hashtable.
//
template<class Type, template<class> class PatchField, class GeoMesh>
void subsetFields
(
const fvMeshSubset& subsetter,
const wordList& fieldNames,
PtrList<GeometricField<Type, fvPatchField, volMesh>>& subFields
HashTable<wordHashSet>& availableFields,
PtrList<GeometricField<Type, PatchField, GeoMesh>>& subFields
)
{
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
const word fieldType = FieldType::typeName;
const wordList fieldNames = availableFields(fieldType).sortedToc();
subFields.setSize(fieldNames.size());
const fvMesh& baseMesh = subsetter.baseMesh();
if (fieldNames.empty())
{
return;
}
Info<< "Subsetting " << fieldType << " (";
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
if (i) Info<< ' ';
Info<< fieldName;
Info<< "Subsetting field " << fieldName << endl;
GeometricField<Type, fvPatchField, volMesh> fld
(
IOobject
(
fieldName,
baseMesh.time().timeName(),
baseMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
baseMesh
);
subFields.set(i, subsetter.interpolate(fld));
}
}
template<class Type>
void subsetSurfaceFields
(
const fvMeshSubset& subsetter,
const wordList& fieldNames,
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& subFields
)
{
const fvMesh& baseMesh = subsetter.baseMesh();
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
Info<< "Subsetting field " << fieldName << endl;
GeometricField<Type, fvsPatchField, surfaceMesh> fld
FieldType fld
(
IOobject
(
@ -193,7 +174,11 @@ void subsetSurfaceFields
);
subFields.set(i, subsetter.interpolate(fld));
// Subsetting adds 'subset' prefix - rename to match original.
subFields[i].rename(fieldName);
}
Info<< ")" << nl;
}
@ -202,19 +187,30 @@ void subsetPointFields
(
const fvMeshSubset& subsetter,
const pointMesh& pMesh,
const wordList& fieldNames,
HashTable<wordHashSet>& availableFields,
PtrList<GeometricField<Type, pointPatchField, pointMesh>>& subFields
)
{
typedef GeometricField<Type, pointPatchField, pointMesh> FieldType;
const word fieldType = FieldType::typeName;
const wordList fieldNames = availableFields(fieldType).sortedToc();
subFields.setSize(fieldNames.size());
const fvMesh& baseMesh = subsetter.baseMesh();
if (fieldNames.empty())
{
return;
}
Info<< "Subsetting " << fieldType << " (";
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
if (i) Info<< ' ';
Info<< fieldName;
Info<< "Subsetting field " << fieldName << endl;
GeometricField<Type, pointPatchField, pointMesh> fld
FieldType fld
(
IOobject
(
@ -228,7 +224,11 @@ void subsetPointFields
);
subFields.set(i, subsetter.interpolate(fld));
// Subsetting adds 'subset' prefix - rename to match original.
subFields[i].rename(fieldName);
}
Info<< ")" << nl;
}
@ -236,19 +236,30 @@ template<class Type>
void subsetDimensionedFields
(
const fvMeshSubset& subsetter,
const wordList& fieldNames,
HashTable<wordHashSet>& availableFields,
PtrList<DimensionedField<Type, volMesh>>& subFields
)
{
typedef DimensionedField<Type, volMesh> FieldType;
const word fieldType = FieldType::typeName;
const wordList fieldNames = availableFields(fieldType).sortedToc();
subFields.setSize(fieldNames.size());
const fvMesh& baseMesh = subsetter.baseMesh();
if (fieldNames.empty())
{
return;
}
Info<< "Subsetting " << fieldType << " (";
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
if (i) Info<< ' ';
Info<< fieldName;
Info<< "Subsetting field " << fieldName << endl;
DimensionedField<Type, volMesh> fld
FieldType fld
(
IOobject
(
@ -262,7 +273,11 @@ void subsetDimensionedFields
);
subFields.set(i, subsetter.interpolate(fld));
// Subsetting adds 'subset' prefix - rename to match original.
subFields[i].rename(fieldName);
}
Info<< ")" << nl;
}
@ -289,7 +304,7 @@ void subsetTopoSets
// Map the data
PackedBoolList isSet(set.maxSize(mesh));
forAllConstIter(labelHashSet, set, iter)
forAllConstIters(set, iter)
{
isSet[iter.key()] = true;
}
@ -359,7 +374,6 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
const word setName = args[1];
word meshInstance = mesh.pointsInstance();
@ -378,7 +392,7 @@ int main(int argc, char *argv[])
}
Info<< "Reading cell set from " << setName << endl << endl;
Info<< "Reading cell set from " << setName << nl << endl;
// Create mesh subsetting engine
fvMeshSubset subsetter(mesh);
@ -389,11 +403,7 @@ int main(int argc, char *argv[])
{
const word patchName = args["patch"];
exposedPatchIDs = labelList
(
1,
mesh.boundaryMesh().findPatchID(patchName)
);
exposedPatchIDs = { mesh.boundaryMesh().findPatchID(patchName) };
if (exposedPatchIDs[0] == -1)
{
@ -402,8 +412,8 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< "Adding exposed internal faces to patch " << patchName << endl
<< endl;
Info<< "Adding exposed internal faces to patch " << patchName
<< nl << endl;
}
else if (args.optionFound("patches"))
{
@ -412,14 +422,14 @@ int main(int argc, char *argv[])
exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc();
Info<< "Adding exposed internal faces to nearest of patches "
<< patchNames << endl << endl;
<< patchNames << nl << endl;
}
else
{
Info<< "Adding exposed internal faces to a patch called"
<< " \"oldInternalFaces\" (created if necessary)" << endl
<< endl;
exposedPatchIDs = labelList(1, label(-1));
exposedPatchIDs = { -1 };
}
@ -431,7 +441,6 @@ int main(int argc, char *argv[])
}
else
{
// Find per face the nearest patch
labelList nearestExposedPatch(nearestPatch(mesh, exposedPatchIDs));
@ -454,77 +463,45 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName());
HashTable<wordHashSet> availableFields = objects.classes();
// Read vol fields and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
wordList scalarNames(objects.names(volScalarField::typeName));
PtrList<volScalarField> scalarFlds(scalarNames.size());
subsetVolFields(subsetter, scalarNames, scalarFlds);
PtrList<volScalarField> scalarFlds;
subsetFields(subsetter, availableFields, scalarFlds);
wordList vectorNames(objects.names(volVectorField::typeName));
PtrList<volVectorField> vectorFlds(vectorNames.size());
subsetVolFields(subsetter, vectorNames, vectorFlds);
PtrList<volVectorField> vectorFlds;
subsetFields(subsetter, availableFields, vectorFlds);
wordList sphericalTensorNames
(
objects.names(volSphericalTensorField::typeName)
);
PtrList<volSphericalTensorField> sphericalTensorFlds
(
sphericalTensorNames.size()
);
subsetVolFields(subsetter, sphericalTensorNames, sphericalTensorFlds);
PtrList<volSphericalTensorField> sphTensorFlds;
subsetFields(subsetter, availableFields, sphTensorFlds);
wordList symmTensorNames(objects.names(volSymmTensorField::typeName));
PtrList<volSymmTensorField> symmTensorFlds(symmTensorNames.size());
subsetVolFields(subsetter, symmTensorNames, symmTensorFlds);
PtrList<volSymmTensorField> symmTensorFlds;
subsetFields(subsetter, availableFields, symmTensorFlds);
wordList tensorNames(objects.names(volTensorField::typeName));
PtrList<volTensorField> tensorFlds(tensorNames.size());
subsetVolFields(subsetter, tensorNames, tensorFlds);
PtrList<volTensorField> tensorFlds;
subsetFields(subsetter, availableFields, tensorFlds);
// Read surface fields and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wordList surfScalarNames(objects.names(surfaceScalarField::typeName));
PtrList<surfaceScalarField> surfScalarFlds(surfScalarNames.size());
subsetSurfaceFields(subsetter, surfScalarNames, surfScalarFlds);
PtrList<surfaceScalarField> surfScalarFlds;
subsetFields(subsetter, availableFields, surfScalarFlds);
wordList surfVectorNames(objects.names(surfaceVectorField::typeName));
PtrList<surfaceVectorField> surfVectorFlds(surfVectorNames.size());
subsetSurfaceFields(subsetter, surfVectorNames, surfVectorFlds);
PtrList<surfaceVectorField> surfVectorFlds;
subsetFields(subsetter, availableFields, surfVectorFlds);
wordList surfSphericalTensorNames
(
objects.names(surfaceSphericalTensorField::typeName)
);
PtrList<surfaceSphericalTensorField> surfSphericalTensorFlds
(
surfSphericalTensorNames.size()
);
subsetSurfaceFields
(
subsetter,
surfSphericalTensorNames,
surfSphericalTensorFlds
);
PtrList<surfaceSphericalTensorField> surfSphTensorFlds;
subsetFields(subsetter, availableFields, surfSphTensorFlds);
wordList surfSymmTensorNames
(
objects.names(surfaceSymmTensorField::typeName)
);
PtrList<surfaceSymmTensorField> surfSymmTensorFlds
(
surfSymmTensorNames.size()
);
subsetSurfaceFields(subsetter, surfSymmTensorNames, surfSymmTensorFlds);
PtrList<surfaceSymmTensorField> surfSymmTensorFlds;
subsetFields(subsetter, availableFields, surfSymmTensorFlds);
wordList surfTensorNames(objects.names(surfaceTensorField::typeName));
PtrList<surfaceTensorField> surfTensorFlds(surfTensorNames.size());
subsetSurfaceFields(subsetter, surfTensorNames, surfTensorFlds);
PtrList<surfaceTensorField> surfTensorFlds;
subsetFields(subsetter, availableFields, surfTensorFlds);
// Read point fields and subset
@ -532,86 +509,39 @@ int main(int argc, char *argv[])
const pointMesh& pMesh = pointMesh::New(mesh);
wordList pointScalarNames(objects.names(pointScalarField::typeName));
PtrList<pointScalarField> pointScalarFlds(pointScalarNames.size());
subsetPointFields(subsetter, pMesh, pointScalarNames, pointScalarFlds);
PtrList<pointScalarField> pointScalarFlds;
subsetPointFields(subsetter, pMesh, availableFields, pointScalarFlds);
wordList pointVectorNames(objects.names(pointVectorField::typeName));
PtrList<pointVectorField> pointVectorFlds(pointVectorNames.size());
subsetPointFields(subsetter, pMesh, pointVectorNames, pointVectorFlds);
PtrList<pointVectorField> pointVectorFlds;
subsetPointFields(subsetter, pMesh, availableFields, pointVectorFlds);
wordList pointSphericalTensorNames
(
objects.names(pointSphericalTensorField::typeName)
);
PtrList<pointSphericalTensorField> pointSphericalTensorFlds
(
pointSphericalTensorNames.size()
);
subsetPointFields
(
subsetter,
pMesh,
pointSphericalTensorNames,
pointSphericalTensorFlds
);
PtrList<pointSphericalTensorField> pointSphTensorFlds;
subsetPointFields(subsetter, pMesh, availableFields, pointSphTensorFlds);
wordList pointSymmTensorNames
(
objects.names(pointSymmTensorField::typeName)
);
PtrList<pointSymmTensorField> pointSymmTensorFlds
(
pointSymmTensorNames.size()
);
subsetPointFields
(
subsetter,
pMesh,
pointSymmTensorNames,
pointSymmTensorFlds
);
PtrList<pointSymmTensorField> pointSymmTensorFlds;
subsetPointFields(subsetter, pMesh, availableFields, pointSymmTensorFlds);
wordList pointTensorNames(objects.names(pointTensorField::typeName));
PtrList<pointTensorField> pointTensorFlds(pointTensorNames.size());
subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
PtrList<pointTensorField> pointTensorFlds;
subsetPointFields(subsetter, pMesh, availableFields, pointTensorFlds);
// Read dimensioned fields and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typedef volScalarField::Internal dimScalType;
wordList scalarDimNames(objects.names(dimScalType::typeName));
PtrList<dimScalType> scalarDimFlds(scalarDimNames.size());
subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds);
PtrList<volScalarField::Internal> scalarDimFlds;
subsetDimensionedFields(subsetter, availableFields, scalarDimFlds);
typedef volVectorField::Internal dimVecType;
wordList vectorDimNames(objects.names(dimVecType::typeName));
PtrList<dimVecType> vectorDimFlds(vectorDimNames.size());
subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
PtrList<volVectorField::Internal> vectorDimFlds;
subsetDimensionedFields(subsetter, availableFields, vectorDimFlds);
typedef volSphericalTensorField::Internal dimSphereType;
wordList sphericalTensorDimNames(objects.names(dimSphereType::typeName));
PtrList<dimSphereType> sphericalTensorDimFlds
(
sphericalTensorDimNames.size()
);
subsetDimensionedFields
(
subsetter,
sphericalTensorDimNames,
sphericalTensorDimFlds
);
PtrList<volSphericalTensorField::Internal> sphTensorDimFlds;
subsetDimensionedFields(subsetter, availableFields, sphTensorDimFlds);
typedef volSymmTensorField::Internal dimSymmTensorType;
wordList symmTensorDimNames(objects.names(dimSymmTensorType::typeName));
PtrList<dimSymmTensorType> symmTensorDimFlds(symmTensorDimNames.size());
subsetDimensionedFields(subsetter, symmTensorDimNames, symmTensorDimFlds);
PtrList<volSymmTensorField::Internal> symmTensorDimFlds;
subsetDimensionedFields(subsetter, availableFields, symmTensorDimFlds);
typedef volTensorField::Internal dimTensorType;
wordList tensorDimNames(objects.names(dimTensorType::typeName));
PtrList<dimTensorType> tensorDimFlds(tensorDimNames.size());
subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
PtrList<volTensorField::Internal> tensorDimFlds;
subsetDimensionedFields(subsetter, availableFields, tensorDimFlds);
// topoSets and subset
@ -620,6 +550,7 @@ int main(int argc, char *argv[])
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
{
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
objects.remove(currentSet);
@ -650,7 +581,6 @@ int main(int argc, char *argv[])
}
// Write mesh and fields to new time
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -668,123 +598,100 @@ int main(int argc, char *argv[])
subsetter.subMesh().setInstance(runTime.timeName());
}
Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()
<< endl;
subsetter.subMesh().write();
processorMeshes::removeFiles(subsetter.subMesh());
// Subsetting adds 'subset' prefix. Rename field to be like original.
// Volume fields
forAll(scalarFlds, i)
{
scalarFlds[i].rename(scalarNames[i]);
scalarFlds[i].write();
}
forAll(vectorFlds, i)
{
vectorFlds[i].rename(vectorNames[i]);
vectorFlds[i].write();
}
forAll(sphericalTensorFlds, i)
forAll(sphTensorFlds, i)
{
sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
sphericalTensorFlds[i].write();
sphTensorFlds[i].write();
}
forAll(symmTensorFlds, i)
{
symmTensorFlds[i].rename(symmTensorNames[i]);
symmTensorFlds[i].write();
}
forAll(tensorFlds, i)
{
tensorFlds[i].rename(tensorNames[i]);
tensorFlds[i].write();
}
// Surface ones.
// Surface fields.
forAll(surfScalarFlds, i)
{
surfScalarFlds[i].rename(surfScalarNames[i]);
surfScalarFlds[i].write();
}
forAll(surfVectorFlds, i)
{
surfVectorFlds[i].rename(surfVectorNames[i]);
surfVectorFlds[i].write();
}
forAll(surfSphericalTensorFlds, i)
forAll(surfSphTensorFlds, i)
{
surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
surfSphericalTensorFlds[i].write();
surfSphTensorFlds[i].write();
}
forAll(surfSymmTensorFlds, i)
{
surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
surfSymmTensorFlds[i].write();
}
forAll(surfTensorNames, i)
forAll(surfTensorFlds, i)
{
surfTensorFlds[i].rename(surfTensorNames[i]);
surfTensorFlds[i].write();
}
// Point ones
// Point fields
forAll(pointScalarFlds, i)
{
pointScalarFlds[i].rename(pointScalarNames[i]);
pointScalarFlds[i].write();
}
forAll(pointVectorFlds, i)
{
pointVectorFlds[i].rename(pointVectorNames[i]);
pointVectorFlds[i].write();
}
forAll(pointSphericalTensorFlds, i)
forAll(pointSphTensorFlds, i)
{
pointSphericalTensorFlds[i].rename(pointSphericalTensorNames[i]);
pointSphericalTensorFlds[i].write();
pointSphTensorFlds[i].write();
}
forAll(pointSymmTensorFlds, i)
{
pointSymmTensorFlds[i].rename(pointSymmTensorNames[i]);
pointSymmTensorFlds[i].write();
}
forAll(pointTensorNames, i)
forAll(pointTensorFlds, i)
{
pointTensorFlds[i].rename(pointTensorNames[i]);
pointTensorFlds[i].write();
}
// DimensionedFields
// Dimensioned fields
forAll(scalarDimFlds, i)
{
scalarDimFlds[i].rename(scalarDimNames[i]);
scalarDimFlds[i].write();
}
forAll(vectorDimFlds, i)
{
vectorDimFlds[i].rename(vectorDimNames[i]);
vectorDimFlds[i].write();
}
forAll(sphericalTensorDimFlds, i)
forAll(sphTensorDimFlds, i)
{
sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]);
sphericalTensorDimFlds[i].write();
sphTensorDimFlds[i].write();
}
forAll(symmTensorDimFlds, i)
{
symmTensorDimFlds[i].rename(symmTensorDimNames[i]);
symmTensorDimFlds[i].write();
}
forAll(tensorDimFlds, i)
{
tensorDimFlds[i].rename(tensorDimNames[i]);
tensorDimFlds[i].write();
}
Info<< "End\n" << endl;
return 0;

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "doxygenXmlParser.H"
#include "wordRe.H"
#include "regExp.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -40,8 +40,8 @@ Foam::doxygenXmlParser::doxygenXmlParser
dictionary(dictionary::null)
{
// Pre-construct and compile regular expressions
const wordRe nameRe(".*.H", wordRe::DETECT);
const wordRe searchStrRe(searchStr, wordRe::DETECT);
const regExp nameRe(".*.H");
const regExp searchStrRe(searchStr);
// Pre-construct constant strings and names to speed-up comparisons
const string slashStartTag('/' + startTag);
@ -163,7 +163,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
(
!exactMatch
&& !found(tName) // not already added
&& wordRe(".*" + tName + ".*", wordRe::DETECT).match(name)
&& regExp(".*" + tName + ".*").match(name)
)
{
dictionary dict(dictionary::null);

View File

@ -37,7 +37,7 @@ Foam::autoPtr<Foam::helpType> Foam::helpType::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(helpTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
// special treatment for -help
// exit without stack trace

View File

@ -23,7 +23,7 @@ if (!fieldsToUse.found(fieldName))
).typeHeaderOk<volScalarField>(false, false)
);
if (variableGood)
if (!variableGood)
{
break;
}

View File

@ -35,36 +35,25 @@ if (timeDirs.size() && !noLagrangian)
cloudPrefix/cloudName
);
// clouds always require "positions"
// Clouds always have "positions"
if (cloudObjs.found("positions"))
{
HashTable<HashTable<word>>::iterator cloudIter =
cloudFields.find(cloudName);
// Save the cloud fields on a per cloud basis
auto fieldsPerCloud = cloudFields(cloudName);
if (cloudIter == cloudFields.end())
forAllConstIters(cloudObjs, fieldIter)
{
// A newly discovered cloud
cloudFields.insert(cloudName, HashTable<word>());
cloudIter = cloudFields.find(cloudName);
}
const IOobject* obj = fieldIter();
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
{
const IOobject& obj = *fieldIter();
// Add field and field type
cloudIter().insert
(
obj.name(),
obj.headerClassName()
);
// Field name/type
fieldsPerCloud.insert(obj->name(), obj->headerClassName());
}
}
}
}
// prune out "positions" again since it gets treated specially
forAllIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
// Prune out "positions" again since it gets treated specially
forAllIters(cloudFields, cloudIter)
{
cloudIter().erase("positions");
}
@ -76,18 +65,13 @@ if (timeDirs.size() && !noLagrangian)
}
// sorted list of cloud names
// Sorted list of cloud names
const wordList cloudNames(cloudFields.sortedToc());
if (cloudNames.size())
{
// complete the echo information
Info<< "(";
forAll(cloudNames, cloudNo)
{
Info<< ' ' << cloudNames[cloudNo];
}
Info<< " ) " << endl;
// Complete the echo information - as flatOutput
cloudNames.writeList(Info) << endl;
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -78,6 +78,7 @@ Note
#include "fvc.H"
#include "volFields.H"
#include "hashedWordList.H"
#include "labelIOField.H"
#include "scalarIOField.H"
@ -190,7 +191,7 @@ int main(int argc, char *argv[])
);
// The volume field types that we handle
const wordList volFieldTypes
const hashedWordList volFieldTypes
{
volScalarField::typeName,
volVectorField::typeName,
@ -207,7 +208,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
// default to binary output, unless otherwise specified
// Default to binary output, unless otherwise specified
const IOstream::streamFormat format =
(
args.optionFound("ascii")
@ -234,7 +235,7 @@ int main(int argc, char *argv[])
}
//
// general (case) output options
// General (case) output options
//
ensightCase::options caseOpts(format);
@ -257,7 +258,7 @@ int main(int argc, char *argv[])
//
// output configuration (geometry related)
// Output configuration (geometry related)
//
ensightMesh::options writeOpts(format);
writeOpts.noPatches(args.optionFound("noPatches"));
@ -313,12 +314,6 @@ int main(int argc, char *argv[])
ensCase.printInfo(Info) << endl;
}
// Set Time to the last time before looking for lagrangian objects
runTime.setTime(timeDirs.last(), timeDirs.size()-1);
IOobjectList objects(mesh, runTime.timeName());
#include "checkMeshMoving.H"
#include "findCloudFields.H"
@ -331,6 +326,40 @@ int main(int argc, char *argv[])
<< timer.cpuTimeIncrement() << " s, "
<< mem.update().size() << " kB" << nl << endl;
// Get the list of supported classes/fields
HashTable<wordHashSet> usableObjects;
{
// Initially all possible objects that are available at the final time
IOobjectList objects(mesh, timeDirs.last().name());
// Categorize by classes, pre-filter on name (if requested)
usableObjects =
(
fieldPatterns.empty()
? objects.classes()
: objects.classes(fieldPatterns)
);
// Limit to types that we explicitly handle
usableObjects.filterKeys(volFieldTypes);
// Force each field-type into existence (simplifies code logic
// and doesn't cost much) and simultaneously remove all
// "*_0" restart fields
for (auto fieldType : volFieldTypes)
{
usableObjects
(
fieldType
).filterKeys
(
[](const word& k){ return k.endsWith("_0"); },
true // prune
);
}
}
// ignore special fields (_0 fields),
// ignore fields we don't handle,
// ignore fields that are not available for all time-steps
@ -362,25 +391,22 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~~~
Info<< "Write volume field (";
forAll(volFieldTypes, typei)
for (auto fieldType : volFieldTypes)
{
const word& fieldType = volFieldTypes[typei];
wordList fieldNames = objects.names(fieldType);
// For convenience, just force each field-type into existence.
// This simplifies code logic and doesn't cost much at all.
wordHashSet& fieldNames = usableObjects(fieldType);
// Filter on name as required
if (!fieldPatterns.empty())
forAllIters(fieldNames, fieldIter)
{
inplaceSubsetStrings(fieldPatterns, fieldNames);
}
forAll(fieldNames, fieldi)
{
const word& fieldName = fieldNames[fieldi];
const word& fieldName = fieldIter.key();
#include "checkData.H"
// Partially complete field?
if (!fieldsToUse[fieldName])
{
fieldNames.erase(fieldIter);
continue;
}
@ -597,7 +623,8 @@ int main(int argc, char *argv[])
}
else
{
// Do not currently handle this type - blacklist for the future.
// Do not currently handle this type
// - blacklist for the future.
fieldsToUse.set(fieldName, false);
}

View File

@ -199,7 +199,7 @@ void print(Ostream& os, const wordList& flds)
labelList getSelectedPatches
(
const polyBoundaryMesh& patches,
const List<wordRe>& excludePatches
const wordRes& excludePatches
)
{
DynamicList<label> patchIDs(patches.size());
@ -219,7 +219,7 @@ labelList getSelectedPatches
Info<< " discarding empty/processor patch " << patchi
<< " " << pp.name() << endl;
}
else if (findStrings(excludePatches, pp.name()))
else if (excludePatches.match(pp.name()))
{
Info<< " excluding patch " << patchi
<< " " << pp.name() << endl;
@ -379,7 +379,7 @@ int main(int argc, char *argv[])
const bool allPatches = args.optionFound("allPatches");
List<wordRe> excludePatches;
wordReList excludePatches;
if (args.optionFound("excludePatches"))
{
args.optionLookup("excludePatches")() >> excludePatches;

View File

@ -55,7 +55,7 @@ namespace Foam
/*---------------------------------------------------------------------------*\
Class vtkPVFoamReader Declaration
Class vtkPVFoamReader Declaration
\*---------------------------------------------------------------------------*/
class vtkPVFoamReader
@ -64,7 +64,7 @@ class vtkPVFoamReader
{
public:
vtkTypeMacro(vtkPVFoamReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
void PrintSelf(ostream&, vtkIndent) VTK_OVERRIDE;
static vtkPVFoamReader* New();
@ -199,7 +199,7 @@ protected:
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
) VTK_OVERRIDE;
//- Get the mesh/fields for a particular time
virtual int RequestData
@ -207,10 +207,10 @@ protected:
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
) VTK_OVERRIDE;
//- Fill in additional port information
virtual int FillOutputPortInformation(int, vtkInformation*);
virtual int FillOutputPortInformation(int, vtkInformation*) VTK_OVERRIDE;
//- The observer to modify this object when array selections are modified
vtkCallbackCommand* SelectionObserver;

View File

@ -62,7 +62,7 @@ class vtkPVblockMeshReader
{
public:
vtkTypeMacro(vtkPVblockMeshReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
void PrintSelf(ostream&, vtkIndent) VTK_OVERRIDE;
static vtkPVblockMeshReader* New();
@ -127,7 +127,7 @@ protected:
vtkInformation* unusedRequest,
vtkInformationVector** unusedInputVector,
vtkInformationVector* outputVector
);
) VTK_OVERRIDE;
//- Get the mesh for a particular time
virtual int RequestData
@ -135,10 +135,10 @@ protected:
vtkInformation* unusedRequest,
vtkInformationVector** unusedInputVector,
vtkInformationVector* outputVector
);
) VTK_OVERRIDE;
//- Fill in additional port information
virtual int FillOutputPortInformation(int, vtkInformation*);
virtual int FillOutputPortInformation(int, vtkInformation*) VTK_OVERRIDE;
// The observer to modify this object when array selections are modified
vtkCallbackCommand* SelectionObserver;

View File

@ -169,7 +169,7 @@ void Foam::boundaryInfo::setType(const label patchI, const word& condition)
return;
}
if (wordRe(".*[Mm]apped.*", wordRe::REGEXP).match(types_[patchI]))
if (regExp(".*[Mm]apped.*").match(types_[patchI]))
{
// ugly hack to avoid overriding mapped types
return;

View File

@ -47,7 +47,7 @@ autoPtr<tabulatedWallFunction> tabulatedWallFunction::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(twfTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown tabulatedWallFunction type " << twfTypeName

View File

@ -67,7 +67,7 @@ Foam::searchableSurfaceModifier::New
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(type);
if (cstrIter == dictionaryConstructorTablePtr_->end())
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown searchableSurfaceModifier type "