mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev/
This commit is contained in:
@ -341,7 +341,7 @@ bool doCommand
|
|||||||
parData.nTotalPoints()
|
parData.nTotalPoints()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
/ 10;
|
/ (10*Pstream::nProcs());
|
||||||
|
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|||||||
@ -1081,13 +1081,14 @@ label findCorrespondingZone
|
|||||||
// Determine same zone over all processors.
|
// Determine same zone over all processors.
|
||||||
reduce(zoneI, maxOp<label>());
|
reduce(zoneI, maxOp<label>());
|
||||||
|
|
||||||
|
|
||||||
|
// 2. All of cellZone present?
|
||||||
|
|
||||||
if (zoneI == labelMax)
|
if (zoneI == labelMax)
|
||||||
{
|
{
|
||||||
zoneI = -1;
|
zoneI = -1;
|
||||||
}
|
}
|
||||||
|
else if (zoneI != -1)
|
||||||
// 2. All of cellZone present?
|
|
||||||
if (zoneI != -1)
|
|
||||||
{
|
{
|
||||||
const cellZone& cz = cellZones[zoneI];
|
const cellZone& cz = cellZones[zoneI];
|
||||||
|
|
||||||
@ -1095,10 +1096,13 @@ label findCorrespondingZone
|
|||||||
{
|
{
|
||||||
if (cellRegion[cz[i]] != regionI)
|
if (cellRegion[cz[i]] != regionI)
|
||||||
{
|
{
|
||||||
zoneI = labelMax;
|
zoneI = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If one in error, all should be in error. Note that branch gets taken
|
||||||
|
// on all procs.
|
||||||
|
reduce(zoneI, minOp<label>());
|
||||||
}
|
}
|
||||||
|
|
||||||
return zoneI;
|
return zoneI;
|
||||||
@ -1144,12 +1148,36 @@ int main(int argc, char *argv[])
|
|||||||
const cellZoneMesh& cellZones = mesh.cellZones();
|
const cellZoneMesh& cellZones = mesh.cellZones();
|
||||||
|
|
||||||
|
|
||||||
|
// Collect zone per cell
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// - non-unique zoning
|
||||||
|
// - coupled zones
|
||||||
|
|
||||||
// Existing zoneID
|
// Existing zoneID
|
||||||
labelList zoneID(mesh.nCells(), -1);
|
labelList zoneID(mesh.nCells(), -1);
|
||||||
|
|
||||||
forAll(cellZones, zoneI)
|
forAll(cellZones, zoneI)
|
||||||
{
|
{
|
||||||
setValues(zoneID, cellZones[zoneI], zoneI);
|
const cellZone& cz = cellZones[zoneI];
|
||||||
|
|
||||||
|
forAll(cz, i)
|
||||||
|
{
|
||||||
|
label cellI = cz[i];
|
||||||
|
if (zoneID[cellI] == -1)
|
||||||
|
{
|
||||||
|
zoneID[cellI] = zoneI;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Cell " << cellI << " with cell centre "
|
||||||
|
<< mesh.cellCentres()[cellI]
|
||||||
|
<< " is multiple zones. This is not allowed." << endl
|
||||||
|
<< "It is in zone " << cellZones[zoneID[cellI]].name()
|
||||||
|
<< " and in zone " << cellZones[zoneI].name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Neighbour zoneID.
|
// Neighbour zoneID.
|
||||||
|
|||||||
@ -44,16 +44,24 @@ Description
|
|||||||
}
|
}
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
|
#include "IOPtrList.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTemplateTypeNameAndDebug(IOPtrList<entry>, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
@ -64,6 +72,12 @@ int main(int argc, char *argv[])
|
|||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createNamedMesh.H"
|
# include "createNamedMesh.H"
|
||||||
|
|
||||||
|
fileName regionPrefix = "";
|
||||||
|
if (regionName != fvMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = regionName;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the replacement rules from a dictionary
|
// Get the replacement rules from a dictionary
|
||||||
IOdictionary dict
|
IOdictionary dict
|
||||||
(
|
(
|
||||||
@ -89,38 +103,114 @@ int main(int argc, char *argv[])
|
|||||||
const word& fieldName = fieldIter().keyword();
|
const word& fieldName = fieldIter().keyword();
|
||||||
Info<< "Replacing entries in dictionary " << fieldName << endl;
|
Info<< "Replacing entries in dictionary " << fieldName << endl;
|
||||||
|
|
||||||
// Read dictionary. (disable class type checking so we can load field)
|
// Handle 'boundary' specially:
|
||||||
Info<< "Loading dictionary " << fieldName << endl;
|
// - is PtrList of dictionaries
|
||||||
const word oldTypeName = IOdictionary::typeName;
|
// - is in polyMesh/
|
||||||
const_cast<word&>(IOdictionary::typeName) = word::null;
|
if (fieldName == "boundary")
|
||||||
IOdictionary fieldDict
|
{
|
||||||
(
|
Info<< "Special handling of " << fieldName
|
||||||
IOobject
|
<< " as polyMesh/boundary file." << endl;
|
||||||
|
|
||||||
|
// Read PtrList of dictionary as dictionary.
|
||||||
|
const word oldTypeName = IOPtrList<entry>::typeName;
|
||||||
|
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
|
||||||
|
IOPtrList<entry> dictList
|
||||||
(
|
(
|
||||||
fieldName,
|
IOobject
|
||||||
runTime.timeName(),
|
(
|
||||||
mesh,
|
fieldName,
|
||||||
IOobject::MUST_READ,
|
runTime.findInstance
|
||||||
IOobject::NO_WRITE,
|
(
|
||||||
false
|
regionPrefix/polyMesh::meshSubDir,
|
||||||
)
|
fieldName
|
||||||
);
|
),
|
||||||
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
|
polyMesh::meshSubDir,
|
||||||
// Fake type back to what was in field
|
mesh,
|
||||||
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
|
||||||
|
// Fake type back to what was in field
|
||||||
|
const_cast<word&>(dictList.type()) = dictList.headerClassName();
|
||||||
|
|
||||||
Info<< "Loaded dictionary " << fieldName
|
// Temporary convert to dictionary
|
||||||
<< " with entries " << fieldDict.toc() << endl;
|
dictionary fieldDict;
|
||||||
|
forAll(dictList, i)
|
||||||
|
{
|
||||||
|
fieldDict.add(dictList[i].keyword(), dictList[i].dict());
|
||||||
|
}
|
||||||
|
|
||||||
// Get the replacement dictionary for the field
|
Info<< "Loaded dictionary " << fieldName
|
||||||
const dictionary& replaceDict = fieldIter().dict();
|
<< " with entries " << fieldDict.toc() << endl;
|
||||||
Info<< "Merging entries from " << replaceDict.toc() << endl;
|
|
||||||
|
|
||||||
// Merge the replacements in
|
// Get the replacement dictionary for the field
|
||||||
fieldDict.merge(replaceDict);
|
const dictionary& replaceDict = fieldIter().dict();
|
||||||
|
Info<< "Merging entries from " << replaceDict.toc() << endl;
|
||||||
|
|
||||||
Info<< "Writing modified fieldDict " << fieldName << endl;
|
// Merge the replacements in
|
||||||
fieldDict.regIOobject::write();
|
fieldDict.merge(replaceDict);
|
||||||
|
|
||||||
|
Info<< "fieldDict:" << fieldDict << endl;
|
||||||
|
|
||||||
|
// Convert back into dictList
|
||||||
|
wordList doneKeys(dictList.size());
|
||||||
|
|
||||||
|
label nEntries = fieldDict.size();
|
||||||
|
forAll(dictList, i)
|
||||||
|
{
|
||||||
|
doneKeys[i] = dictList[i].keyword();
|
||||||
|
dictList.set(i, fieldDict.lookupEntry(doneKeys[i]).clone());
|
||||||
|
fieldDict.remove(doneKeys[i]);
|
||||||
|
}
|
||||||
|
// Add remaining entries
|
||||||
|
label sz = dictList.size();
|
||||||
|
dictList.setSize(nEntries);
|
||||||
|
forAllConstIter(dictionary, fieldDict, iter)
|
||||||
|
{
|
||||||
|
dictList.set(sz, iter().clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Writing modified fieldDict " << fieldName << endl;
|
||||||
|
dictList.write();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Read dictionary. (disable class type checking so we can load
|
||||||
|
// field)
|
||||||
|
Info<< "Loading dictionary " << fieldName << endl;
|
||||||
|
const word oldTypeName = IOdictionary::typeName;
|
||||||
|
const_cast<word&>(IOdictionary::typeName) = word::null;
|
||||||
|
IOdictionary fieldDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
|
||||||
|
// Fake type back to what was in field
|
||||||
|
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
|
||||||
|
|
||||||
|
Info<< "Loaded dictionary " << fieldName
|
||||||
|
<< " with entries " << fieldDict.toc() << endl;
|
||||||
|
|
||||||
|
// Get the replacement dictionary for the field
|
||||||
|
const dictionary& replaceDict = fieldIter().dict();
|
||||||
|
Info<< "Merging entries from " << replaceDict.toc() << endl;
|
||||||
|
|
||||||
|
// Merge the replacements in
|
||||||
|
fieldDict.merge(replaceDict);
|
||||||
|
|
||||||
|
Info<< "Writing modified fieldDict " << fieldName << endl;
|
||||||
|
fieldDict.regIOobject::write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|||||||
@ -67,6 +67,7 @@ $(cellSources)/fieldToCell/fieldToCell.C
|
|||||||
$(cellSources)/pointToCell/pointToCell.C
|
$(cellSources)/pointToCell/pointToCell.C
|
||||||
$(cellSources)/shapeToCell/shapeToCell.C
|
$(cellSources)/shapeToCell/shapeToCell.C
|
||||||
$(cellSources)/boxToCell/boxToCell.C
|
$(cellSources)/boxToCell/boxToCell.C
|
||||||
|
$(cellSources)/regionToCell/regionToCell.C
|
||||||
$(cellSources)/rotatedBoxToCell/rotatedBoxToCell.C
|
$(cellSources)/rotatedBoxToCell/rotatedBoxToCell.C
|
||||||
$(cellSources)/labelToCell/labelToCell.C
|
$(cellSources)/labelToCell/labelToCell.C
|
||||||
$(cellSources)/surfaceToCell/surfaceToCell.C
|
$(cellSources)/surfaceToCell/surfaceToCell.C
|
||||||
|
|||||||
Reference in New Issue
Block a user