GIT: Resolved conflict

This commit is contained in:
Andrew Heather
2015-12-09 09:32:38 +00:00
246 changed files with 4020 additions and 788 deletions

View File

@ -525,7 +525,7 @@ int main(int argc, char *argv[])
Info<< "Created zone " << name
<< " at index " << zoneID
<< " with " << n << " faces" << endl;
<< " with " << returnReduce(n, sumOp<label>()) << " faces" << endl;
mesh.faceZones().set
(

View File

@ -504,6 +504,11 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
#include "addRegionOption.H"
#include "addDictOption.H"
Foam::argList::addBoolOption
(
"writeObj",
"write obj files showing the cyclic matching process"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
@ -515,12 +520,13 @@ int main(int argc, char *argv[])
#include "createNamedPolyMesh.H"
const bool writeObj = args.optionFound("writeObj");
const word oldInstance = mesh.pointsInstance();
const word dictName("createPatchDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
Info<< "Reading " << dictIO.instance()/dictIO.name() << nl << endl;
IOdictionary dict(dictIO);
@ -534,7 +540,10 @@ int main(int argc, char *argv[])
patches.checkParallelSync(true);
dumpCyclicMatch("initial_", mesh);
if (writeObj)
{
dumpCyclicMatch("initial_", mesh);
}
// Read patch construct info from dictionary
PtrList<dictionary> patchSources(dict.lookup("patches"));
@ -753,7 +762,10 @@ int main(int argc, char *argv[])
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, true);
mesh.movePoints(map().preMotionPoints());
dumpCyclicMatch("coupled_", mesh);
if (writeObj)
{
dumpCyclicMatch("coupled_", mesh);
}
// Synchronise points.
if (!pointSync)
@ -864,7 +876,10 @@ int main(int argc, char *argv[])
filterPatches(mesh, addedPatchNames);
dumpCyclicMatch("final_", mesh);
if (writeObj)
{
dumpCyclicMatch("final_", mesh);
}
// Set the precision of the points data to 10

View File

@ -96,6 +96,8 @@ int main(int argc, char *argv[])
Info<< "Writing points into directory " << points.path() << nl << endl;
points.write();
Info<< nl << "End" << nl << endl;
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -62,7 +62,6 @@ int main(int argc, char *argv[])
"merge two meshes"
);
argList::noParallel();
#include "addOverwriteOption.H"
argList::validArgs.append("masterCase");
@ -97,6 +96,18 @@ int main(int argc, char *argv[])
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
// Since we don't use argList processor directory detection, add it to
// the casename ourselves so it triggers the logic inside TimePath.
const fileName& cName = args.caseName();
std::string::size_type pos = cName.find("processor");
if (pos != string::npos && pos != 0)
{
fileName processorName = cName.substr(pos, cName.size()-pos);
masterCase += '/' + processorName;
addCase += '/' + processorName;
}
getRootCase(masterCase);
getRootCase(addCase);

View File

@ -242,8 +242,6 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
}
// Mirror boundary faces patch by patch
labelList newToOldPatch(boundary().size(), -1);
labelList newPatchSizes(boundary().size(), -1);
labelList newPatchStarts(boundary().size(), -1);

View File

@ -67,7 +67,7 @@ int main(int argc, char *argv[])
Info<< "Writing mirrored mesh" << endl;
mesh.mirrorMesh().write();
Info<< "End" << endl;
Info<< "End" << nl << endl;
return 0;
}

View File

@ -877,6 +877,55 @@ int main(int argc, char *argv[])
ReadFields(pointMesh::New(mesh), objects, ptFlds);
// Read sets
PtrList<cellSet> cellSets;
PtrList<faceSet> faceSets;
PtrList<pointSet> pointSets;
if (renumberSets)
{
// Read sets
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
{
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
if (cSets.size())
{
Info<< "Reading cellSets:" << endl;
forAllConstIter(IOobjectList, cSets, iter)
{
cellSets.append(new cellSet(*iter()));
Info<< " " << cellSets.last().name() << endl;
}
}
}
{
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
if (fSets.size())
{
Info<< "Reading faceSets:" << endl;
forAllConstIter(IOobjectList, fSets, iter)
{
faceSets.append(new faceSet(*iter()));
Info<< " " << faceSets.last().name() << endl;
}
}
}
{
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
if (pSets.size())
{
Info<< "Reading pointSets:" << endl;
forAllConstIter(IOobjectList, pSets, iter)
{
pointSets.append(new pointSet(*iter()));
Info<< " " << pointSets.last().name() << endl;
}
}
}
}
>>>>>>> develop
Info<< endl;
// From renumbering:
@ -1387,61 +1436,25 @@ int main(int argc, char *argv[])
).write();
}
// Renumber sets if required
if (renumberSets)
{
Info<< endl;
// Read sets
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
forAll(cellSets, i)
{
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
if (cSets.size())
{
Info<< "Renumbering cellSets:" << endl;
forAllConstIter(IOobjectList, cSets, iter)
{
cellSet cs(*iter());
Info<< " " << cs.name() << endl;
cs.updateMesh(map());
cs.instance() = mesh.facesInstance();
cs.write();
}
}
cellSets[i].updateMesh(map());
cellSets[i].instance() = mesh.facesInstance();
cellSets[i].write();
}
forAll(faceSets, i)
{
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
if (fSets.size())
{
Info<< "Renumbering faceSets:" << endl;
forAllConstIter(IOobjectList, fSets, iter)
{
faceSet fs(*iter());
Info<< " " << fs.name() << endl;
fs.updateMesh(map());
fs.instance() = mesh.facesInstance();
fs.write();
}
}
faceSets[i].updateMesh(map());
faceSets[i].instance() = mesh.facesInstance();
faceSets[i].write();
}
forAll(pointSets, i)
{
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
if (pSets.size())
{
Info<< "Renumbering pointSets:" << endl;
forAllConstIter(IOobjectList, pSets, iter)
{
pointSet ps(*iter());
Info<< " " << ps.name() << endl;
ps.updateMesh(map());
ps.instance() = mesh.facesInstance();
ps.write();
}
}
pointSets[i].updateMesh(map());
pointSets[i].instance() = mesh.facesInstance();
pointSets[i].write();
}
}

View File

@ -285,7 +285,8 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< nl << "end" << endl;
Info<< nl << "End" << nl << endl;
return 0;
}

View File

@ -499,7 +499,7 @@ int main(int argc, char *argv[])
// Write fields
runTime.write();
Info<< nl << "end" << endl;
Info<< nl << "End" << nl << endl;
return 0;
}

View File

@ -41,11 +41,86 @@ Description
#include "cellSet.H"
#include "IOobjectList.H"
#include "volFields.H"
#include "topoDistanceData.H"
#include "FaceCellWave.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
// Count number of faces in exposedPatchIDs
label nFaces = 0;
forAll(patchIDs, i)
{
const polyPatch& pp = pbm[patchIDs[i]];
nFaces += pp.size();
}
// Field on cells and faces.
List<topoDistanceData> cellData(mesh.nCells());
List<topoDistanceData> faceData(mesh.nFaces());
// Start of changes
labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces);
nFaces = 0;
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& pp = pbm[patchI];
forAll(pp, i)
{
patchFaces[nFaces] = pp.start()+i;
patchData[nFaces] = topoDistanceData(patchI, 0);
nFaces++;
}
}
// Propagate information inwards
FaceCellWave<topoDistanceData> deltaCalc
(
mesh,
patchFaces,
patchData,
faceData,
cellData,
mesh.globalData().nTotalCells()+1
);
// And extract
labelList nearest(mesh.nFaces());
bool haveWarned = false;
forAll(faceData, faceI)
{
if (!faceData[faceI].valid(deltaCalc.data()))
{
if (!haveWarned)
{
WarningIn("meshRefinement::nearestPatch(..)")
<< "Did not visit some faces, e.g. face " << faceI
<< " at " << mesh.faceCentres()[faceI] << endl
<< "Using patch " << patchIDs[0] << " as nearest"
<< endl;
haveWarned = true;
}
nearest[faceI] = patchIDs[0];
}
else
{
nearest[faceI] = faceData[faceI].data();
}
}
return nearest;
}
template<class Type>
void subsetVolFields
@ -150,6 +225,40 @@ void subsetPointFields
}
template<class Type>
void subsetDimensionedFields
(
const fvMeshSubset& subsetter,
const wordList& fieldNames,
PtrList<DimensionedField<Type, volMesh> >& subFields
)
{
const fvMesh& baseMesh = subsetter.baseMesh();
forAll(fieldNames, i)
{
const word& fieldName = fieldNames[i];
Info<< "Subsetting field " << fieldName << endl;
DimensionedField<Type, volMesh> fld
(
IOobject
(
fieldName,
baseMesh.time().timeName(),
baseMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
baseMesh
);
subFields.set(i, subsetter.interpolate(fld));
}
}
int main(int argc, char *argv[])
{
@ -169,6 +278,13 @@ int main(int argc, char *argv[])
"'oldInternalFaces'"
);
argList::addOption
(
"patches",
"names",
"add exposed internal faces to nearest of specified patches"
" instead of to 'oldInternalFaces'"
);
argList::addOption
(
"resultTime",
"time",
@ -207,15 +323,19 @@ int main(int argc, char *argv[])
// Create mesh subsetting engine
fvMeshSubset subsetter(mesh);
label patchI = -1;
labelList exposedPatchIDs;
if (args.optionFound("patch"))
{
const word patchName = args["patch"];
patchI = mesh.boundaryMesh().findPatchID(patchName);
exposedPatchIDs = labelList
(
1,
mesh.boundaryMesh().findPatchID(patchName)
);
if (patchI == -1)
if (exposedPatchIDs[0] == -1)
{
FatalErrorInFunction
<< nl << "Valid patches are " << mesh.boundaryMesh().names()
@ -225,17 +345,53 @@ int main(int argc, char *argv[])
Info<< "Adding exposed internal faces to patch " << patchName << endl
<< endl;
}
else if (args.optionFound("patches"))
{
const wordReList patchNames(args.optionRead<wordReList>("patches"));
exposedPatchIDs = mesh.boundaryMesh().patchSet(patchNames).sortedToc();
Info<< "Adding exposed internal faces to nearest of patches "
<< patchNames << endl << endl;
}
else
{
Info<< "Adding exposed internal faces to a patch called"
<< " \"oldInternalFaces\" (created if necessary)" << endl
<< endl;
exposedPatchIDs = labelList(1, label(-1));
}
cellSet currentSet(mesh, setName);
subsetter.setLargeCellSubset(currentSet, patchI, true);
if (exposedPatchIDs.size() == 1)
{
subsetter.setLargeCellSubset(currentSet, exposedPatchIDs[0], true);
}
else
{
// Find per face the nearest patch
labelList nearestExposedPatch(nearestPatch(mesh, exposedPatchIDs));
labelList region(mesh.nCells(), 0);
forAllConstIter(cellSet, currentSet, iter)
{
region[iter.key()] = 1;
}
labelList exposedFaces(subsetter.getExposedFaces(region, 1, true));
subsetter.setLargeCellSubset
(
region,
1,
exposedFaces,
UIndirectList<label>(nearestExposedPatch, exposedFaces)(),
true
);
}
IOobjectList objects(mesh, runTime.timeName());
@ -361,6 +517,42 @@ int main(int argc, char *argv[])
subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
// Read dimensioned fields and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typedef volScalarField::DimensionedInternalField dimScalType;
wordList scalarDimNames(objects.names(dimScalType::typeName));
PtrList<dimScalType> scalarDimFlds(scalarDimNames.size());
subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds);
typedef volVectorField::DimensionedInternalField dimVecType;
wordList vectorDimNames(objects.names(dimVecType::typeName));
PtrList<dimVecType> vectorDimFlds(vectorDimNames.size());
subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
typedef volSphericalTensorField::DimensionedInternalField dimSphereType;
wordList sphericalTensorDimNames(objects.names(dimSphereType::typeName));
PtrList<dimSphereType> sphericalTensorDimFlds
(
sphericalTensorDimNames.size()
);
subsetDimensionedFields
(
subsetter,
sphericalTensorDimNames,
sphericalTensorDimFlds
);
typedef volSymmTensorField::DimensionedInternalField dimSymmTensorType;
wordList symmTensorDimNames(objects.names(dimSymmTensorType::typeName));
PtrList<dimSymmTensorType> symmTensorDimFlds(symmTensorDimNames.size());
subsetDimensionedFields(subsetter, symmTensorDimNames, symmTensorDimFlds);
typedef volTensorField::DimensionedInternalField dimTensorType;
wordList tensorDimNames(objects.names(dimTensorType::typeName));
PtrList<dimTensorType> tensorDimFlds(tensorDimNames.size());
subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
// Write mesh and fields to new time
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -461,6 +653,33 @@ int main(int argc, char *argv[])
pointTensorFlds[i].write();
}
// DimensionedFields
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)
{
sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]);
sphericalTensorDimFlds[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<< "\nEnd\n" << endl;

View File

@ -372,19 +372,22 @@ FoamFile
// // is the master side)
// }
//
// // Select based on surface. Orientation from normals on surface
// // Select based on faceSet, using supplied normal to determine orientation
// source setAndNormalToFaceZone;
// sourceInfo
// {
// name fz0;
// type faceZoneSet;
// action new;
// source searchableSurfaceToFaceZone;
// sourceInfo
// {
// surface searchableSphere;
// centre (0.05 0.05 0.005);
// radius 0.025;
// //name sphere.stl; // Optional name if surface triSurfaceMesh
// }
// faceSet f0; // name of faceSet
// normal (1 0 0); // normal orientation
// }
//
// // Select based on surface. Orientation from normals on surface
// source searchableSurfaceToFaceZone;
// sourceInfo
// {
// surface searchableSphere;
// centre (0.05 0.05 0.005);
// radius 0.025;
// //name sphere.stl; // Optional name if surface triSurfaceMesh
// }
//
//
@ -413,7 +416,7 @@ actions
name c0;
type cellSet;
action new;
source labelToCell;
source labelToCell;
sourceInfo
{
value (12 13 56);

View File

@ -308,6 +308,8 @@ int main(int argc, char *argv[])
Info<< "Writing points into directory " << points.path() << nl << endl;
points.write();
Info<< nl << "End" << nl << endl;
return 0;
}