Merge branch 'master' into splitCyclic

Conflicts:
	applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
	applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H
	applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C
	src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C
	src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C
	src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C
	src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H
	src/OpenFOAM/meshes/polyMesh/syncTools/dummyTransform.H
	src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C
	src/edgeMesh/edgeFormats/vtk/VTKedgeFormat.H
	src/mesh/blockMesh/curvedEdges/spline.H
	src/meshTools/PointEdgeWave/PointEdgeWave.C
	src/meshTools/sets/topoSets/faceSet.C
This commit is contained in:
mattijs
2010-01-26 17:11:18 +00:00
1391 changed files with 507189 additions and 62865 deletions

View File

@ -1,7 +1,7 @@
decomposeMesh.C
decomposePar.C
domainDecomposition.C
distributeCells.C
domainDecompositionMesh.C
domainDecompositionDistribute.C
fvFieldDecomposer.C
pointFieldDecomposer.C
lagrangianFieldDecomposer.C

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

View File

@ -87,26 +87,44 @@ int main(int argc, char *argv[])
{
argList::noParallel();
# include "addRegionOption.H"
argList::validOptions.insert("cellDist", "");
argList::validOptions.insert("copyUniform", "");
argList::validOptions.insert("fields", "");
argList::validOptions.insert("filterPatches", "");
argList::validOptions.insert("force", "");
argList::validOptions.insert("ifRequired", "");
argList::addBoolOption("cellDist");
argList::addBoolOption
(
"copyUniform",
"copy any uniform/ directories too"
);
argList::addBoolOption
(
"fields",
"use existing geometry decomposition and convert fields only"
);
argList::addBoolOption
(
"filterPatches",
"remove empty patches when decomposing the geometry"
);
argList::addBoolOption
(
"force",
"remove existing processor*/ subdirs before decomposing the geometry"
);
argList::addBoolOption
(
"ifRequired",
"only decompose geometry if the number of domains has changed"
);
# include "setRootCase.H"
word regionName = fvMesh::defaultRegion;
word regionDir = word::null;
if (args.optionFound("region"))
if (args.optionReadIfPresent("region", regionName))
{
regionName = args.option("region");
regionDir = regionName;
Info<< "Decomposing mesh " << regionName << nl << endl;
}
bool writeCellDist = args.optionFound("cellDist");
bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly = args.optionFound("fields");
@ -125,10 +143,10 @@ int main(int argc, char *argv[])
isDir
(
runTime.path()
/(word("processor") + name(nProcs))
/runTime.constant()
/regionDir
/polyMesh::meshSubDir
/ (word("processor") + name(nProcs))
/ runTime.constant()
/ regionDir
/ polyMesh::meshSubDir
)
)
{

View File

@ -82,7 +82,7 @@ manualCoeffs
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//roots
//(
// "/tmp"
// "/tmp"

View File

@ -38,7 +38,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void domainDecomposition::mark
void Foam::domainDecomposition::mark
(
const labelList& zoneElems,
const label zoneI,
@ -66,7 +66,7 @@ void domainDecomposition::mark
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
domainDecomposition::domainDecomposition(const IOobject& io)
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
:
fvMesh(io),
decompositionDict_
@ -105,13 +105,13 @@ domainDecomposition::domainDecomposition(const IOobject& io)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
domainDecomposition::~domainDecomposition()
Foam::domainDecomposition::~domainDecomposition()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool domainDecomposition::writeDecomposition()
bool Foam::domainDecomposition::writeDecomposition()
{
Info<< "\nConstructing processor meshes" << endl;
@ -165,7 +165,7 @@ bool domainDecomposition::writeDecomposition()
pointField procPoints(curPointLabels.size());
forAll (curPointLabels, pointi)
forAll(curPointLabels, pointi)
{
procPoints[pointi] = meshPoints[curPointLabels[pointi]];
@ -181,7 +181,7 @@ bool domainDecomposition::writeDecomposition()
faceList procFaces(curFaceLabels.size());
forAll (curFaceLabels, facei)
forAll(curFaceLabels, facei)
{
// Mark the original face as used
// Remember to decrement the index by one (turning index)
@ -208,7 +208,7 @@ bool domainDecomposition::writeDecomposition()
procFaceLabels.setSize(origFaceLabels.size());
forAll (origFaceLabels, pointi)
forAll(origFaceLabels, pointi)
{
procFaceLabels[pointi] = pointLookup[origFaceLabels[pointi]];
}
@ -221,7 +221,7 @@ bool domainDecomposition::writeDecomposition()
cellList procCells(curCellLabels.size());
forAll (curCellLabels, celli)
forAll(curCellLabels, celli)
{
const labelList& origCellLabels = meshCells[curCellLabels[celli]];
@ -229,7 +229,7 @@ bool domainDecomposition::writeDecomposition()
curCell.setSize(origCellLabels.size());
forAll (origCellLabels, cellFaceI)
forAll(origCellLabels, cellFaceI)
{
curCell[cellFaceI] = faceLookup[origCellLabels[cellFaceI]];
}
@ -302,7 +302,7 @@ bool domainDecomposition::writeDecomposition()
label nPatches = 0;
forAll (curPatchSizes, patchi)
forAll(curPatchSizes, patchi)
{
// Get the face labels consistent with the field mapping
// (reuse the patch field mappers)
@ -333,7 +333,7 @@ bool domainDecomposition::writeDecomposition()
nPatches++;
}
forAll (curProcessorPatchSizes, procPatchI)
forAll(curProcessorPatchSizes, procPatchI)
{
procPatches[nPatches] =
new processorPolyPatch
@ -386,7 +386,7 @@ forAll(procPatches, patchI)
// Use the pointToZone map to find out the single zone (if any),
// use slow search only for shared points.
forAll (curPointLabels, pointi)
forAll(curPointLabels, pointi)
{
label curPoint = curPointLabels[pointi];
@ -457,7 +457,7 @@ forAll(procPatches, patchI)
// Go through all the zoned faces and find out if they
// belong to a zone. If so, add it to the zone as
// necessary
forAll (curFaceLabels, facei)
forAll(curFaceLabels, facei)
{
// Remember to decrement the index by one (turning index)
//
@ -544,7 +544,7 @@ forAll(procPatches, patchI)
zoneCells[zoneI].setCapacity(cz[zoneI].size() / nProcs_);
}
forAll (curCellLabels, celli)
forAll(curCellLabels, celli)
{
label curCellI = curCellLabels[celli];
@ -607,7 +607,7 @@ forAll(procPatches, patchI)
label nProcPatches = 0;
label nProcFaces = 0;
forAll (procMesh.boundaryMesh(), patchi)
forAll(procMesh.boundaryMesh(), patchi)
{
if
(

View File

@ -26,7 +26,7 @@ Class
Foam::domainDecomposition
Description
Automatic domain decomposition class for FOAM meshes
Automatic domain decomposition class for finite-volume meshes
SourceFiles
domainDecomposition.C
@ -43,13 +43,11 @@ SourceFiles
#include "PtrList.H"
#include "point.H"
#ifndef namespaceFoam
#define namespaceFoam
using namespace Foam;
#endif
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class domainDecomposition Declaration
Class domainDecomposition Declaration
\*---------------------------------------------------------------------------*/
class domainDecomposition
@ -183,6 +181,11 @@ public:
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void domainDecomposition::distributeCells()
void Foam::domainDecomposition::distributeCells()
{
Info<< "\nCalculating distribution of cells" << endl;

View File

@ -121,7 +121,7 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
// Cells per processor
procCellAddressing_ = invertOneToMany(nProcs_, cellToProc_);
Info << "\nDistributing faces to processors" << endl;
Info<< "\nDistributing faces to processors" << endl;
// Loop through all internal faces and decide which processor they belong to
// First visit all internal faces. If cells at both sides belong to the
@ -479,25 +479,25 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
Info << "\nDistributing points to processors" << endl;
Info<< "\nDistributing points to processors" << endl;
// For every processor, loop through the list of faces for the processor.
// For every face, loop through the list of points and mark the point as
// used for the processor. Collect the list of used points for the
// processor.
forAll (procPointAddressing_, procI)
forAll(procPointAddressing_, procI)
{
boolList pointLabels(nPoints(), false);
// Get reference to list of used faces
const labelList& procFaceLabels = procFaceAddressing_[procI];
forAll (procFaceLabels, facei)
forAll(procFaceLabels, facei)
{
// Because of the turning index, some labels may be negative
const labelList& facePoints = fcs[mag(procFaceLabels[facei]) - 1];
forAll (facePoints, pointi)
forAll(facePoints, pointi)
{
// Mark the point as used
pointLabels[facePoints[pointi]] = true;
@ -511,7 +511,7 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
label nUsedPoints = 0;
forAll (pointLabels, pointi)
forAll(pointLabels, pointi)
{
if (pointLabels[pointi])
{
@ -525,3 +525,5 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
procPointLabels.setSize(nUsedPoints);
}
}
// ************************************************************************* //

View File

@ -26,14 +26,10 @@ License
#include "fvFieldDecomposer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
Foam::fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
(
const unallocLabelList& addressingSlice,
const label addressingOffset
@ -41,15 +37,15 @@ fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
:
directAddressing_(addressingSlice)
{
forAll (directAddressing_, i)
forAll(directAddressing_, i)
{
// Subtract one to align addressing.
// Subtract one to align addressing.
directAddressing_[i] -= addressingOffset + 1;
}
}
fvFieldDecomposer::processorVolPatchFieldDecomposer::
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::
processorVolPatchFieldDecomposer
(
const fvMesh& mesh,
@ -61,9 +57,9 @@ processorVolPatchFieldDecomposer
const labelList& own = mesh.faceOwner();
const labelList& neighb = mesh.faceNeighbour();
forAll (directAddressing_, i)
forAll(directAddressing_, i)
{
// Subtract one to align addressing.
// Subtract one to align addressing.
label ai = mag(addressingSlice[i]) - 1;
if (ai < neighb.size())
@ -97,7 +93,7 @@ processorVolPatchFieldDecomposer
}
fvFieldDecomposer::processorSurfacePatchFieldDecomposer::
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::
processorSurfacePatchFieldDecomposer
(
const unallocLabelList& addressingSlice
@ -106,7 +102,7 @@ processorSurfacePatchFieldDecomposer
addressing_(addressingSlice.size()),
weights_(addressingSlice.size())
{
forAll (addressing_, i)
forAll(addressing_, i)
{
addressing_[i].setSize(1);
weights_[i].setSize(1);
@ -117,7 +113,7 @@ processorSurfacePatchFieldDecomposer
}
fvFieldDecomposer::fvFieldDecomposer
Foam::fvFieldDecomposer::fvFieldDecomposer
(
const fvMesh& completeMesh,
const fvMesh& procMesh,
@ -147,7 +143,7 @@ fvFieldDecomposer::fvFieldDecomposer
static_cast<processorSurfacePatchFieldDecomposer*>(NULL)
)
{
forAll (boundaryAddressing_, patchi)
forAll(boundaryAddressing_, patchi)
{
if (boundaryAddressing_[patchi] >= 0)
{
@ -162,14 +158,14 @@ fvFieldDecomposer::fvFieldDecomposer
}
else
{
processorVolPatchFieldDecomposerPtrs_[patchi] =
processorVolPatchFieldDecomposerPtrs_[patchi] =
new processorVolPatchFieldDecomposer
(
completeMesh_,
procMesh_.boundary()[patchi].patchSlice(faceAddressing_)
);
processorSurfacePatchFieldDecomposerPtrs_[patchi] =
processorSurfacePatchFieldDecomposerPtrs_[patchi] =
new processorSurfacePatchFieldDecomposer
(
static_cast<const unallocLabelList&>
@ -187,9 +183,9 @@ fvFieldDecomposer::fvFieldDecomposer
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
fvFieldDecomposer::~fvFieldDecomposer()
Foam::fvFieldDecomposer::~fvFieldDecomposer()
{
forAll (patchFieldDecomposerPtrs_, patchi)
forAll(patchFieldDecomposerPtrs_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
@ -197,7 +193,7 @@ fvFieldDecomposer::~fvFieldDecomposer()
}
}
forAll (processorVolPatchFieldDecomposerPtrs_, patchi)
forAll(processorVolPatchFieldDecomposerPtrs_, patchi)
{
if (processorVolPatchFieldDecomposerPtrs_[patchi])
{
@ -205,7 +201,7 @@ fvFieldDecomposer::~fvFieldDecomposer()
}
}
forAll (processorSurfacePatchFieldDecomposerPtrs_, patchi)
forAll(processorSurfacePatchFieldDecomposerPtrs_, patchi)
{
if (processorSurfacePatchFieldDecomposerPtrs_[patchi])
{
@ -214,9 +210,4 @@ fvFieldDecomposer::~fvFieldDecomposer()
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -200,10 +200,10 @@ private:
//- List of patch field decomposers
List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
List<processorVolPatchFieldDecomposer*>
List<processorVolPatchFieldDecomposer*>
processorVolPatchFieldDecomposerPtrs_;
List<processorSurfacePatchFieldDecomposer*>
List<processorSurfacePatchFieldDecomposer*>
processorSurfacePatchFieldDecomposerPtrs_;

View File

@ -28,16 +28,11 @@ License
#include "processorFvPatchField.H"
#include "processorFvsPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
fvFieldDecomposer::decomposeField
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::fvFieldDecomposer::decomposeField
(
const GeometricField<Type, fvPatchField, volMesh>& field
) const
@ -48,7 +43,7 @@ fvFieldDecomposer::decomposeField
// Create and map the patch field values
PtrList<fvPatchField<Type> > patchFields(boundaryAddressing_.size());
forAll (boundaryAddressing_, patchi)
forAll(boundaryAddressing_, patchi)
{
if (boundaryAddressing_[patchi] >= 0)
{
@ -106,8 +101,8 @@ fvFieldDecomposer::decomposeField
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
fvFieldDecomposer::decomposeField
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::fvFieldDecomposer::decomposeField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
) const
@ -120,7 +115,7 @@ fvFieldDecomposer::decomposeField
procMesh_.nInternalFaces()
)
);
forAll (mapAddr, i)
forAll(mapAddr, i)
{
mapAddr[i] -= 1;
}
@ -139,18 +134,18 @@ fvFieldDecomposer::decomposeField
// (i.e. using slices)
Field<Type> allFaceField(field.mesh().nFaces());
forAll (field.internalField(), i)
forAll(field.internalField(), i)
{
allFaceField[i] = field.internalField()[i];
}
forAll (field.boundaryField(), patchi)
forAll(field.boundaryField(), patchi)
{
const Field<Type> & p = field.boundaryField()[patchi];
const label patchStart = field.mesh().boundaryMesh()[patchi].start();
forAll (p, i)
forAll(p, i)
{
allFaceField[patchStart + i] = p[i];
}
@ -159,7 +154,7 @@ fvFieldDecomposer::decomposeField
// Create and map the patch field values
PtrList<fvsPatchField<Type> > patchFields(boundaryAddressing_.size());
forAll (boundaryAddressing_, patchi)
forAll(boundaryAddressing_, patchi)
{
if (boundaryAddressing_[patchi] >= 0)
{
@ -217,20 +212,16 @@ fvFieldDecomposer::decomposeField
template<class GeoField>
void fvFieldDecomposer::decomposeFields
void Foam::fvFieldDecomposer::decomposeFields
(
const PtrList<GeoField>& fields
) const
{
forAll (fields, fieldI)
forAll(fields, fieldI)
{
decomposeField(fields[fieldI])().write();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -29,16 +29,10 @@ Description
#include "lagrangianFieldDecomposer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
lagrangianFieldDecomposer::lagrangianFieldDecomposer
Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
(
const polyMesh& mesh,
const polyMesh& procMesh,
@ -88,6 +82,4 @@ lagrangianFieldDecomposer::lagrangianFieldDecomposer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,15 +27,10 @@ License
#include "lagrangianFieldDecomposer.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void lagrangianFieldDecomposer::readFields
void Foam::lagrangianFieldDecomposer::readFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
@ -70,7 +65,8 @@ void lagrangianFieldDecomposer::readFields
template<class Type>
tmp<IOField<Type> > lagrangianFieldDecomposer::decomposeField
Foam::tmp<Foam::IOField<Type> >
Foam::lagrangianFieldDecomposer::decomposeField
(
const word& cloudName,
const IOField<Type>& field
@ -100,7 +96,7 @@ tmp<IOField<Type> > lagrangianFieldDecomposer::decomposeField
template<class GeoField>
void lagrangianFieldDecomposer::decomposeFields
void Foam::lagrangianFieldDecomposer::decomposeFields
(
const word& cloudName,
const PtrList<GeoField>& fields
@ -108,7 +104,7 @@ void lagrangianFieldDecomposer::decomposeFields
{
if (particleIndices_.size())
{
forAll (fields, fieldI)
forAll(fields, fieldI)
{
decomposeField(cloudName, fields[fieldI])().write();
}
@ -116,8 +112,4 @@ void lagrangianFieldDecomposer::decomposeFields
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,9 @@ License
#include "pointFieldDecomposer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
(
const pointPatch& completeMeshPatch,
const pointPatch& procMeshPatch,
@ -52,7 +47,7 @@ pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
forAll (completeMeshPatchPoints, pointi)
forAll(completeMeshPatchPoints, pointi)
{
pointMap[completeMeshPatchPoints[pointi]] = pointi;
}
@ -61,7 +56,7 @@ pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
// patch
const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();
forAll (procMeshPatchPoints, pointi)
forAll(procMeshPatchPoints, pointi)
{
directAddressing_[pointi] =
pointMap[directAddr[procMeshPatchPoints[pointi]]];
@ -79,7 +74,7 @@ pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
}
pointFieldDecomposer::pointFieldDecomposer
Foam::pointFieldDecomposer::pointFieldDecomposer
(
const pointMesh& completeMesh,
const pointMesh& procMesh,
@ -97,7 +92,7 @@ pointFieldDecomposer::pointFieldDecomposer
static_cast<patchFieldDecomposer*>(NULL)
)
{
forAll (boundaryAddressing_, patchi)
forAll(boundaryAddressing_, patchi)
{
if (boundaryAddressing_[patchi] >= 0)
{
@ -114,9 +109,9 @@ pointFieldDecomposer::pointFieldDecomposer
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
pointFieldDecomposer::~pointFieldDecomposer()
Foam::pointFieldDecomposer::~pointFieldDecomposer()
{
forAll (patchFieldDecomposerPtrs_, patchi)
forAll(patchFieldDecomposerPtrs_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
@ -128,6 +123,4 @@ pointFieldDecomposer::~pointFieldDecomposer()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,16 +28,11 @@ License
#include "processorPointPatchFields.H"
#include "globalPointPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh> >
pointFieldDecomposer::decomposeField
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
Foam::pointFieldDecomposer::decomposeField
(
const GeometricField<Type, pointPatchField, pointMesh>& field
) const
@ -53,7 +48,7 @@ pointFieldDecomposer::decomposeField
);
// Create and map the patch field values
forAll (boundaryAddressing_, patchi)
forAll(boundaryAddressing_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
@ -117,12 +112,12 @@ pointFieldDecomposer::decomposeField
template<class GeoField>
void pointFieldDecomposer::decomposeFields
void Foam::pointFieldDecomposer::decomposeFields
(
const PtrList<GeoField>& fields
) const
{
forAll (fields, fieldI)
forAll(fields, fieldI)
{
decomposeField(fields[fieldI])().write();
}
@ -131,6 +126,4 @@ void pointFieldDecomposer::decomposeFields
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,7 +1,3 @@
processorMeshes.C
fvFieldReconstructor.C
pointFieldReconstructor.C
reconstructLagrangianPositions.C
reconstructPar.C
EXE = $(FOAM_APPBIN)/reconstructPar

View File

@ -1,9 +1,11 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-llagrangian \
-lmeshTools
-lmeshTools \
-lreconstruct

View File

@ -8,11 +8,11 @@
PtrList<labelIOList>& faceProcAddressing = procMeshes.faceProcAddressing();
forAll (faceProcAddressing, procI)
forAll(faceProcAddressing, procI)
{
const labelList& curFaceAddr = faceProcAddressing[procI];
forAll (curFaceAddr, faceI)
forAll(curFaceAddr, faceI)
{
if (mag(curFaceAddr[faceI]) < minFaceIndex)
{
@ -33,11 +33,11 @@
<< "the current version fo decomposePar"
<< endl;
forAll (faceProcAddressing, procI)
forAll(faceProcAddressing, procI)
{
labelList& curFaceAddr = faceProcAddressing[procI];
forAll (curFaceAddr, faceI)
forAll(curFaceAddr, faceI)
{
curFaceAddr[faceI] += sign(curFaceAddr[faceI]);
}

View File

@ -1,48 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "fvFieldReconstructor.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvFieldReconstructor::fvFieldReconstructor
(
fvMesh& mesh,
const PtrList<fvMesh>& procMeshes,
const PtrList<labelIOList>& faceProcAddressing,
const PtrList<labelIOList>& cellProcAddressing,
const PtrList<labelIOList>& boundaryProcAddressing
)
:
mesh_(mesh),
procMeshes_(procMeshes),
faceProcAddressing_(faceProcAddressing),
cellProcAddressing_(cellProcAddressing),
boundaryProcAddressing_(boundaryProcAddressing)
{}
// ************************************************************************* //

View File

@ -1,186 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::fvFieldReconstructor
Description
FV volume and surface field reconstructor.
SourceFiles
fvFieldReconstructor.C
fvFieldReconstructorReconstructFields.C
\*---------------------------------------------------------------------------*/
#ifndef fvFieldReconstructor_H
#define fvFieldReconstructor_H
#include "PtrList.H"
#include "fvMesh.H"
#include "IOobjectList.H"
#include "fvPatchFieldMapper.H"
#include "labelIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvFieldReconstructor Declaration
\*---------------------------------------------------------------------------*/
class fvFieldReconstructor
{
// Private data
//- Reconstructed mesh reference
fvMesh& mesh_;
//- List of processor meshes
const PtrList<fvMesh>& procMeshes_;
//- List of processor face addressing lists
const PtrList<labelIOList>& faceProcAddressing_;
//- List of processor cell addressing lists
const PtrList<labelIOList>& cellProcAddressing_;
//- List of processor boundary addressing lists
const PtrList<labelIOList>& boundaryProcAddressing_;
// Private Member Functions
//- Disallow default bitwise copy construct
fvFieldReconstructor(const fvFieldReconstructor&);
//- Disallow default bitwise assignment
void operator=(const fvFieldReconstructor&);
public:
class fvPatchFieldReconstructor
:
public fvPatchFieldMapper
{
label size_;
public:
// Constructors
//- Construct given size
fvPatchFieldReconstructor(const label size)
:
size_(size)
{}
// Member functions
label size() const
{
return size_;
}
bool direct() const
{
return true;
}
const unallocLabelList& directAddressing() const
{
return unallocLabelList::null();
}
};
// Constructors
//- Construct from components
fvFieldReconstructor
(
fvMesh& mesh,
const PtrList<fvMesh>& procMeshes,
const PtrList<labelIOList>& faceProcAddressing,
const PtrList<labelIOList>& cellProcAddressing,
const PtrList<labelIOList>& boundaryProcAddressing
);
// Member Functions
//- Reconstruct volume field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
reconstructFvVolumeField
(
const IOobject& fieldIoObject
);
//- Reconstruct surface field
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
reconstructFvSurfaceField
(
const IOobject& fieldIoObject
);
//- Reconstruct and write all/selected volume fields
template<class Type>
void reconstructFvVolumeFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
//- Reconstruct and write all/selected volume fields
template<class Type>
void reconstructFvSurfaceFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fvFieldReconstructorReconstructFields.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,524 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "fvFieldReconstructor.H"
#include "Time.H"
#include "PtrList.H"
#include "fvPatchFields.H"
#include "emptyFvPatch.H"
#include "emptyFvPatchField.H"
#include "emptyFvsPatchField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::fvFieldReconstructor::reconstructFvVolumeField
(
const IOobject& fieldIoObject
)
{
// Read the field for all the processors
PtrList<GeometricField<Type, fvPatchField, volMesh> > procFields
(
procMeshes_.size()
);
forAll (procMeshes_, procI)
{
procFields.set
(
procI,
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
fieldIoObject.name(),
procMeshes_[procI].time().timeName(),
procMeshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
),
procMeshes_[procI]
)
);
}
// Create the internalField
Field<Type> internalField(mesh_.nCells());
// Create the patch fields
PtrList<fvPatchField<Type> > patchFields(mesh_.boundary().size());
forAll (procMeshes_, procI)
{
const GeometricField<Type, fvPatchField, volMesh>& procField =
procFields[procI];
// Set the cell values in the reconstructed field
internalField.rmap
(
procField.internalField(),
cellProcAddressing_[procI]
);
// Set the boundary patch values in the reconstructed field
forAll(boundaryProcAddressing_[procI], patchI)
{
// Get patch index of the original patch
const label curBPatch = boundaryProcAddressing_[procI][patchI];
// Get addressing slice for this patch
const labelList::subList cp =
procMeshes_[procI].boundary()[patchI].patchSlice
(
faceProcAddressing_[procI]
);
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvPatchField<Type>::New
(
procField.boundaryField()[patchI],
mesh_.boundary()[curBPatch],
DimensionedField<Type, volMesh>::null(),
fvPatchFieldReconstructor
(
mesh_.boundary()[curBPatch].size()
)
)
);
}
const label curPatchStart =
mesh_.boundaryMesh()[curBPatch].start();
labelList reverseAddressing(cp.size());
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
patchFields[curBPatch].rmap
(
procField.boundaryField()[patchI],
reverseAddressing
);
}
else
{
const Field<Type>& curProcPatch =
procField.boundaryField()[patchI];
// In processor patches, there's a mix of internal faces (some
// of them turned) and possible cyclics. Slow loop
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
label curF = cp[faceI] - 1;
// Is the face on the boundary?
if (curF >= mesh_.nInternalFaces())
{
label curBPatch = mesh_.boundaryMesh().whichPatch(curF);
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvPatchField<Type>::New
(
mesh_.boundary()[curBPatch].type(),
mesh_.boundary()[curBPatch],
DimensionedField<Type, volMesh>::null()
)
);
}
// add the face
label curPatchFace =
mesh_.boundaryMesh()
[curBPatch].whichFace(curF);
patchFields[curBPatch][curPatchFace] =
curProcPatch[faceI];
}
}
}
}
}
forAll(mesh_.boundary(), patchI)
{
// add empty patches
if
(
isType<emptyFvPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI)
)
{
patchFields.set
(
patchI,
fvPatchField<Type>::New
(
emptyFvPatchField<Type>::typeName,
mesh_.boundary()[patchI],
DimensionedField<Type, volMesh>::null()
)
);
}
}
// Now construct and write the field
// setting the internalField and patchFields
return tmp<GeometricField<Type, fvPatchField, volMesh> >
(
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
fieldIoObject.name(),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
procFields[0].dimensions(),
internalField,
patchFields
)
);
}
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::fvFieldReconstructor::reconstructFvSurfaceField
(
const IOobject& fieldIoObject
)
{
// Read the field for all the processors
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> > procFields
(
procMeshes_.size()
);
forAll (procMeshes_, procI)
{
procFields.set
(
procI,
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
fieldIoObject.name(),
procMeshes_[procI].time().timeName(),
procMeshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
),
procMeshes_[procI]
)
);
}
// Create the internalField
Field<Type> internalField(mesh_.nInternalFaces());
// Create the patch fields
PtrList<fvsPatchField<Type> > patchFields(mesh_.boundary().size());
forAll (procMeshes_, procI)
{
const GeometricField<Type, fvsPatchField, surfaceMesh>& procField =
procFields[procI];
// Set the face values in the reconstructed field
// It is necessary to create a copy of the addressing array to
// take care of the face direction offset trick.
//
{
labelList curAddr(faceProcAddressing_[procI]);
forAll (curAddr, addrI)
{
curAddr[addrI] -= 1;
}
internalField.rmap
(
procField.internalField(),
curAddr
);
}
// Set the boundary patch values in the reconstructed field
forAll(boundaryProcAddressing_[procI], patchI)
{
// Get patch index of the original patch
const label curBPatch = boundaryProcAddressing_[procI][patchI];
// Get addressing slice for this patch
const labelList::subList cp =
procMeshes_[procI].boundary()[patchI].patchSlice
(
faceProcAddressing_[procI]
);
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvsPatchField<Type>::New
(
procField.boundaryField()[patchI],
mesh_.boundary()[curBPatch],
DimensionedField<Type, surfaceMesh>::null(),
fvPatchFieldReconstructor
(
mesh_.boundary()[curBPatch].size()
)
)
);
}
const label curPatchStart =
mesh_.boundaryMesh()[curBPatch].start();
labelList reverseAddressing(cp.size());
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
patchFields[curBPatch].rmap
(
procField.boundaryField()[patchI],
reverseAddressing
);
}
else
{
const Field<Type>& curProcPatch =
procField.boundaryField()[patchI];
// In processor patches, there's a mix of internal faces (some
// of them turned) and possible cyclics. Slow loop
forAll(cp, faceI)
{
label curF = cp[faceI] - 1;
// Is the face turned the right side round
if (curF >= 0)
{
// Is the face on the boundary?
if (curF >= mesh_.nInternalFaces())
{
label curBPatch =
mesh_.boundaryMesh().whichPatch(curF);
if (!patchFields(curBPatch))
{
patchFields.set
(
curBPatch,
fvsPatchField<Type>::New
(
mesh_.boundary()[curBPatch].type(),
mesh_.boundary()[curBPatch],
DimensionedField<Type, surfaceMesh>
::null()
)
);
}
// add the face
label curPatchFace =
mesh_.boundaryMesh()
[curBPatch].whichFace(curF);
patchFields[curBPatch][curPatchFace] =
curProcPatch[faceI];
}
else
{
// Internal face
internalField[curF] = curProcPatch[faceI];
}
}
}
}
}
}
forAll(mesh_.boundary(), patchI)
{
// add empty patches
if
(
isType<emptyFvPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI)
)
{
patchFields.set
(
patchI,
fvsPatchField<Type>::New
(
emptyFvsPatchField<Type>::typeName,
mesh_.boundary()[patchI],
DimensionedField<Type, surfaceMesh>::null()
)
);
}
}
// Now construct and write the field
// setting the internalField and patchFields
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
fieldIoObject.name(),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
procFields[0].dimensions(),
internalField,
patchFields
)
);
}
// Reconstruct and write all/selected volume fields
template<class Type>
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
const word& fieldClassName =
GeometricField<Type, fvPatchField, volMesh>::typeName;
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructFvVolumeField<Type>(*fieldIter())().write();
}
}
Info<< endl;
}
}
// Reconstruct and write all/selected surface fields
template<class Type>
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
const word& fieldClassName =
GeometricField<Type, fvsPatchField, surfaceMesh>::typeName;
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructFvSurfaceField<Type>(*fieldIter())().write();
}
}
Info<< endl;
}
}
// ************************************************************************* //

View File

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointFieldReconstructor.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointFieldReconstructor::pointFieldReconstructor
(
const pointMesh& mesh,
const PtrList<pointMesh>& procMeshes,
const PtrList<labelIOList>& pointProcAddressing,
const PtrList<labelIOList>& boundaryProcAddressing
)
:
mesh_(mesh),
procMeshes_(procMeshes),
pointProcAddressing_(pointProcAddressing),
boundaryProcAddressing_(boundaryProcAddressing),
patchPointAddressing_(procMeshes.size())
{
// Inverse-addressing of the patch point labels.
labelList pointMap(mesh_.size(), -1);
// Create the pointPatch addressing
forAll(procMeshes_, proci)
{
const pointMesh& procMesh = procMeshes_[proci];
patchPointAddressing_[proci].setSize(procMesh.boundary().size());
forAll(procMesh.boundary(), patchi)
{
if (boundaryProcAddressing_[proci][patchi] >= 0)
{
labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
const labelList& patchPointLabels =
mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
.meshPoints();
// Create the inverse-addressing of the patch point labels.
forAll (patchPointLabels, pointi)
{
pointMap[patchPointLabels[pointi]] = pointi;
}
const labelList& procPatchPoints =
procMesh.boundary()[patchi].meshPoints();
forAll (procPatchPoints, pointi)
{
procPatchAddr[pointi] =
pointMap
[
pointProcAddressing_[proci][procPatchPoints[pointi]]
];
}
if (procPatchAddr.size() && min(procPatchAddr) < 0)
{
FatalErrorIn
(
"pointFieldReconstructor::pointFieldReconstructor"
"(\n"
" const pointMesh& mesh,\n"
" const PtrList<pointMesh>& procMeshes,\n"
" const PtrList<labelIOList>& pointProcAddressing,\n"
" const PtrList<labelIOList>& "
"boundaryProcAddressing\n"
")"
) << "Incomplete patch point addressing"
<< abort(FatalError);
}
}
}
}
}
// ************************************************************************* //

View File

@ -1,162 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pointFieldReconstructor
Description
Point field reconstructor.
SourceFiles
pointFieldReconstructor.C
\*---------------------------------------------------------------------------*/
#ifndef pointFieldReconstructor_H
#define pointFieldReconstructor_H
#include "pointMesh.H"
#include "pointFields.H"
#include "pointPatchFieldMapperPatchRef.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointFieldReconstructor Declaration
\*---------------------------------------------------------------------------*/
class pointFieldReconstructor
{
// Private data
//- Reconstructed mesh reference
const pointMesh& mesh_;
//- List of processor meshes
const PtrList<pointMesh>& procMeshes_;
//- List of processor point addressing lists
const PtrList<labelIOList>& pointProcAddressing_;
//- List of processor boundary addressing lists
const PtrList<labelIOList>& boundaryProcAddressing_;
//- Point patch addressing
labelListListList patchPointAddressing_;
// Private Member Functions
//- Disallow default bitwise copy construct
pointFieldReconstructor
(
const pointFieldReconstructor&
);
//- Disallow default bitwise assignment
void operator=(const pointFieldReconstructor&);
public:
class pointPatchFieldReconstructor
:
public pointPatchFieldMapper
{
label size_;
public:
// Constructors
//- Construct given size
pointPatchFieldReconstructor(const label size)
:
size_(size)
{}
// Member functions
label size() const
{
return size_;
}
bool direct() const
{
return true;
}
const unallocLabelList& directAddressing() const
{
return unallocLabelList::null();
}
};
// Constructors
//- Construct from components
pointFieldReconstructor
(
const pointMesh& mesh,
const PtrList<pointMesh>& procMeshes,
const PtrList<labelIOList>& pointProcAddressing,
const PtrList<labelIOList>& boundaryProcAddressing
);
// Member Functions
//- Reconstruct field
template<class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh> >
reconstructField(const IOobject& fieldIoObject);
//- Reconstruct and write all fields
template<class Type>
void reconstructFields(const IOobjectList& objects);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "pointFieldReconstructorReconstructFields.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointFieldReconstructor.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
{
// Read the field for all the processors
PtrList<GeometricField<Type, pointPatchField, pointMesh> > procFields
(
procMeshes_.size()
);
forAll (procMeshes_, proci)
{
procFields.set
(
proci,
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
fieldIoObject.name(),
procMeshes_[proci]().time().timeName(),
procMeshes_[proci](),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
procMeshes_[proci]
)
);
}
// Create the internalField
Field<Type> internalField(mesh_.size());
// Create the patch fields
PtrList<pointPatchField<Type> > patchFields(mesh_.boundary().size());
forAll (procMeshes_, proci)
{
const GeometricField<Type, pointPatchField, pointMesh>&
procField = procFields[proci];
// Get processor-to-global addressing for use in rmap
const labelList& procToGlobalAddr = pointProcAddressing_[proci];
// Set the cell values in the reconstructed field
internalField.rmap
(
procField.internalField(),
procToGlobalAddr
);
// Set the boundary patch values in the reconstructed field
forAll(boundaryProcAddressing_[proci], patchi)
{
// Get patch index of the original patch
const label curBPatch = boundaryProcAddressing_[proci][patchi];
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
if (!patchFields(curBPatch))
{
patchFields.set(
curBPatch,
pointPatchField<Type>::New
(
procField.boundaryField()[patchi],
mesh_.boundary()[curBPatch],
DimensionedField<Type, pointMesh>::null(),
pointPatchFieldReconstructor
(
mesh_.boundary()[curBPatch].size()
)
)
);
}
patchFields[curBPatch].rmap
(
procField.boundaryField()[patchi],
patchPointAddressing_[proci][patchi]
);
}
}
}
// Construct and write the field
// setting the internalField and patchFields
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
(
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
fieldIoObject.name(),
mesh_().time().timeName(),
mesh_(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
procFields[0].dimensions(),
internalField,
patchFields
)
);
}
// Reconstruct and write all point fields
template<class Type>
void Foam::pointFieldReconstructor::reconstructFields
(
const IOobjectList& objects
)
{
word fieldClassName
(
GeometricField<Type, pointPatchField, pointMesh>::typeName
);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
for
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructField<Type>(*fieldIter())().write();
}
Info<< endl;
}
}
// ************************************************************************* //

View File

@ -1,254 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorMeshes.H"
#include "Time.H"
#include "primitiveMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::processorMeshes::read()
{
forAll (databases_, procI)
{
meshes_.set
(
procI,
new fvMesh
(
IOobject
(
meshName_,
databases_[procI].timeName(),
databases_[procI]
)
)
);
pointProcAddressing_.set
(
procI,
new labelIOList
(
IOobject
(
"pointProcAddressing",
meshes_[procI].facesInstance(),
meshes_[procI].meshSubDir,
meshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
faceProcAddressing_.set
(
procI,
new labelIOList
(
IOobject
(
"faceProcAddressing",
meshes_[procI].facesInstance(),
meshes_[procI].meshSubDir,
meshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
cellProcAddressing_.set
(
procI,
new labelIOList
(
IOobject
(
"cellProcAddressing",
meshes_[procI].facesInstance(),
meshes_[procI].meshSubDir,
meshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
boundaryProcAddressing_.set
(
procI,
new labelIOList
(
IOobject
(
"boundaryProcAddressing",
meshes_[procI].facesInstance(),
meshes_[procI].meshSubDir,
meshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::processorMeshes::processorMeshes
(
PtrList<Time>& databases,
const word& meshName
)
:
databases_(databases),
meshName_(meshName),
meshes_(databases.size()),
pointProcAddressing_(databases.size()),
faceProcAddressing_(databases.size()),
cellProcAddressing_(databases.size()),
boundaryProcAddressing_(databases.size())
{
read();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fvMesh::readUpdateState Foam::processorMeshes::readUpdate()
{
fvMesh::readUpdateState stat = fvMesh::UNCHANGED;
forAll (databases_, procI)
{
// Check if any new meshes need to be read.
fvMesh::readUpdateState procStat = meshes_[procI].readUpdate();
/*
if (procStat != fvMesh::UNCHANGED)
{
Info<< "Processor " << procI
<< " at time " << databases_[procI].timeName()
<< " detected mesh change " << procStat
<< endl;
}
*/
// Combine into overall mesh change status
if (stat == fvMesh::UNCHANGED)
{
stat = procStat;
}
else
{
if (stat != procStat)
{
FatalErrorIn("processorMeshes::readUpdate()")
<< "Processor " << procI
<< " has a different polyMesh at time "
<< databases_[procI].timeName()
<< " compared to any previous processors." << nl
<< "Please check time " << databases_[procI].timeName()
<< " directories on all processors for consistent"
<< " mesh files."
<< exit(FatalError);
}
}
}
if
(
stat == fvMesh::TOPO_CHANGE
|| stat == fvMesh::TOPO_PATCH_CHANGE
)
{
// Reread all meshes and addresssing
read();
}
return stat;
}
void Foam::processorMeshes::reconstructPoints(fvMesh& mesh)
{
// Read the field for all the processors
PtrList<pointIOField> procsPoints(meshes_.size());
forAll (meshes_, procI)
{
procsPoints.set
(
procI,
new pointIOField
(
IOobject
(
"points",
meshes_[procI].time().timeName(),
polyMesh::meshSubDir,
meshes_[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
// Create the new points
vectorField newPoints(mesh.nPoints());
forAll (meshes_, procI)
{
const vectorField& procPoints = procsPoints[procI];
// Set the cell values in the reconstructed field
const labelList& pointProcAddressingI = pointProcAddressing_[procI];
if (pointProcAddressingI.size() != procPoints.size())
{
FatalErrorIn("processorMeshes")
<< "problem :"
<< " pointProcAddressingI:" << pointProcAddressingI.size()
<< " procPoints:" << procPoints.size()
<< abort(FatalError);
}
forAll(pointProcAddressingI, pointI)
{
newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
}
}
mesh.movePoints(newPoints);
mesh.write();
}
// ************************************************************************* //

View File

@ -1,141 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorMeshes
Description
Container for processor mesh addressing.
SourceFiles
processorMeshes.C
\*---------------------------------------------------------------------------*/
#ifndef processorMeshes_H
#define processorMeshes_H
#include "PtrList.H"
#include "fvMesh.H"
#include "IOobjectList.H"
#include "labelIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorMeshes Declaration
\*---------------------------------------------------------------------------*/
class processorMeshes
{
// Private data
//- Processor databases
PtrList<Time>& databases_;
const word meshName_;
//- List of processor meshes
PtrList<fvMesh> meshes_;
//- List of processor point addressing lists
PtrList<labelIOList> pointProcAddressing_;
//- List of processor face addressing lists
PtrList<labelIOList> faceProcAddressing_;
//- List of processor cell addressing lists
PtrList<labelIOList> cellProcAddressing_;
//- List of processor boundary addressing lists
PtrList<labelIOList> boundaryProcAddressing_;
// Private Member Functions
//- Read all meshes
void read();
//- Disallow default bitwise copy construct
processorMeshes(const processorMeshes&);
//- Disallow default bitwise assignment
void operator=(const processorMeshes&);
public:
// Constructors
//- Construct from components
processorMeshes(PtrList<Time>& databases, const word& meshName);
// Member Functions
//- Update the meshes based on the mesh files saved in
// time directories
fvMesh::readUpdateState readUpdate();
//- Reconstruct point position after motion in parallel
void reconstructPoints(fvMesh& mesh);
PtrList<fvMesh>& meshes()
{
return meshes_;
}
const PtrList<labelIOList>& pointProcAddressing() const
{
return pointProcAddressing_;
}
PtrList<labelIOList>& faceProcAddressing()
{
return faceProcAddressing_;
}
const PtrList<labelIOList>& cellProcAddressing() const
{
return cellProcAddressing_;
}
const PtrList<labelIOList>& boundaryProcAddressing() const
{
return boundaryProcAddressing_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,95 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::reconstructLagrangian
Description
SourceFiles
reconstructLagrangianPositions.C
reconstructLagrangianFields.C
\*---------------------------------------------------------------------------*/
#ifndef reconstructLagrangian_H
#define reconstructLagrangian_H
#include "cloud.H"
#include "polyMesh.H"
#include "IOobjectList.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void reconstructLagrangianPositions
(
const polyMesh& mesh,
const word& cloudName,
const PtrList<fvMesh>& meshes,
const PtrList<labelIOList>& faceProcAddressing,
const PtrList<labelIOList>& cellProcAddressing
);
template<class Type>
tmp<IOField<Type> > reconstructLagrangianField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
);
template<class Type>
void reconstructLagrangianFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "reconstructLagrangianFields.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "IOField.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
)
{
// Construct empty field on mesh
tmp<IOField<Type> > tfield
(
new IOField<Type>
(
IOobject
(
fieldName,
mesh.time().timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
Field<Type>(0)
)
);
Field<Type>& field = tfield();
forAll(meshes, i)
{
// Check object on local mesh
IOobject localIOobject
(
fieldName,
meshes[i].time().timeName(),
cloud::prefix/cloudName,
meshes[i],
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (localIOobject.headerOk())
{
IOField<Type> fieldi(localIOobject);
label offset = field.size();
field.setSize(offset + fieldi.size());
forAll(fieldi, j)
{
field[offset + j] = fieldi[j];
}
}
}
return tfield;
}
template<class Type>
void Foam::reconstructLagrangianFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
)
{
word fieldClassName(IOField<Type>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
Info<< endl;
}
}
// ************************************************************************* //

View File

@ -1,76 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "reconstructLagrangian.H"
#include "labelIOList.H"
#include "Cloud.H"
#include "passiveParticle.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::reconstructLagrangianPositions
(
const polyMesh& mesh,
const word& cloudName,
const PtrList<fvMesh>& meshes,
const PtrList<labelIOList>& faceProcAddressing,
const PtrList<labelIOList>& cellProcAddressing
)
{
Cloud<passiveParticle> lagrangianPositions
(
mesh,
cloudName,
IDLList<passiveParticle>()
);
forAll(meshes, i)
{
const labelList& cellMap = cellProcAddressing[i];
Cloud<passiveParticle> lpi(meshes[i], cloudName, false);
forAllIter(Cloud<passiveParticle>, lpi, iter)
{
const passiveParticle& ppi = iter();
lagrangianPositions.append
(
new passiveParticle
(
lagrangianPositions,
ppi.position(),
cellMap[ppi.cell()]
)
);
}
}
IOPosition<passiveParticle>(lagrangianPositions).write();
}
// ************************************************************************* //

View File

@ -50,8 +50,8 @@ int main(int argc, char *argv[])
timeSelector::addOptions(true, true);
argList::noParallel();
# include "addRegionOption.H"
argList::validOptions.insert("fields", "\"(list of fields)\"");
argList::validOptions.insert("noLagrangian", "");
argList::addOption("fields", "\"(list of fields)\"");
argList::addBoolOption("noLagrangian");
# include "setRootCase.H"
# include "createTime.H"
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
// Create the processor databases
PtrList<Time> databases(nProcs);
forAll (databases, procI)
forAll(databases, procI)
{
databases.set
(
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
}
// Set all times on processor meshes equal to reconstructed mesh
forAll (databases, procI)
forAll(databases, procI)
{
databases[procI].setTime(runTime.timeName(), runTime.timeIndex());
}
@ -132,15 +132,15 @@ int main(int argc, char *argv[])
# include "checkFaceAddressingComp.H"
// Loop over all times
forAll (timeDirs, timeI)
forAll(timeDirs, timeI)
{
// Set time for global database
runTime.setTime(timeDirs[timeI], timeI);
Info << "Time = " << runTime.timeName() << endl << endl;
Info<< "Time = " << runTime.timeName() << endl << endl;
// Set time for all databases
forAll (databases, procI)
forAll(databases, procI)
{
databases[procI].setTime(timeDirs[timeI], timeI);
}
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
|| objects.lookupClass(surfaceScalarField::typeName).size()
)
{
Info << "Reconstructing FV fields" << nl << endl;
Info<< "Reconstructing FV fields" << nl << endl;
fvFieldReconstructor fvReconstructor
(
@ -228,7 +228,7 @@ int main(int argc, char *argv[])
}
else
{
Info << "No FV fields" << nl << endl;
Info<< "No FV fields" << nl << endl;
}
@ -242,12 +242,12 @@ int main(int argc, char *argv[])
|| objects.lookupClass(pointTensorField::typeName).size()
)
{
Info << "Reconstructing point fields" << nl << endl;
Info<< "Reconstructing point fields" << nl << endl;
pointMesh pMesh(mesh);
PtrList<pointMesh> pMeshes(procMeshes.meshes().size());
forAll (pMeshes, procI)
forAll(pMeshes, procI)
{
pMeshes.set(procI, new pointMesh(procMeshes.meshes()[procI]));
}
@ -268,7 +268,7 @@ int main(int argc, char *argv[])
}
else
{
Info << "No point fields" << nl << endl;
Info<< "No point fields" << nl << endl;
}
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
{
HashTable<IOobjectList> cloudObjects;
forAll (databases, procI)
forAll(databases, procI)
{
fileNameList cloudDirs
(
@ -294,7 +294,7 @@ int main(int argc, char *argv[])
)
);
forAll (cloudDirs, i)
forAll(cloudDirs, i)
{
// Check if we already have cloud objects for this cloudname
HashTable<IOobjectList>::const_iterator iter =
@ -388,7 +388,7 @@ int main(int argc, char *argv[])
}
else
{
Info << "No lagrangian fields" << nl << endl;
Info<< "No lagrangian fields" << nl << endl;
}
}

View File

@ -281,8 +281,8 @@ autoPtr<mapPolyMesh> mergeSharedPoints
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("mergeTol", "relative merge distance");
argList::validOptions.insert("fullMatch", "");
argList::addOption("mergeTol", "relative merge distance");
argList::addBoolOption("fullMatch");
# include "addTimeOptions.H"
# include "addRegionOption.H"
@ -371,7 +371,7 @@ int main(int argc, char *argv[])
// Read all databases.
PtrList<Time> databases(nProcs);
forAll (databases, procI)
forAll(databases, procI)
{
Info<< "Reading database "
<< args.caseName()/fileName(word("processor") + name(procI))

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude

View File

@ -33,14 +33,20 @@ Description
Balances mesh and writes new mesh to new time directory.
Can also work like decomposePar:
@verbatim
# Create empty processor directories (have to exist for argList)
mkdir processor0
cp -r constant processor0
mpirun -np ddd redistributeMeshPar -parallel
..
mkdir processorN
# Copy undecomposed polyMesh
cp -r constant processor0
# Distribute
mpirun -np ddd redistributeMeshPar -parallel
@endverbatim
\*---------------------------------------------------------------------------*/
#include "Field.H"
#include "fvMesh.H"
#include "decompositionMethod.H"
#include "PstreamReduceOps.H"
@ -62,6 +68,7 @@ static const scalar defaultMergeTol = 1E-6;
autoPtr<fvMesh> createMesh
(
const Time& runTime,
const word& regionName,
const fileName& instDir,
const bool haveMesh
)
@ -69,43 +76,33 @@ autoPtr<fvMesh> createMesh
Pout<< "Create mesh for time = "
<< runTime.timeName() << nl << endl;
// Create dummy mesh. Only used on procs that don't have mesh.
// Note constructed on all processors since does parallel comms.
fvMesh dummyMesh
IOobject io
(
IOobject
(
fvMesh::defaultRegion,
instDir,
runTime,
IOobject::MUST_READ
),
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList())
regionName,
instDir,
runTime,
IOobject::MUST_READ
);
if (!haveMesh)
{
Pout<< "Writing dummy mesh to " << runTime.path()/instDir << endl;
// Create dummy mesh. Only used on procs that don't have mesh.
fvMesh dummyMesh
(
io,
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList()),
false
);
Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath()
<< endl;
dummyMesh.write();
}
Pout<< "Reading mesh from " << runTime.path()/instDir << endl;
autoPtr<fvMesh> meshPtr
(
new fvMesh
(
IOobject
(
fvMesh::defaultRegion,
instDir,
runTime,
IOobject::MUST_READ
)
)
);
Pout<< "Reading mesh from " << io.objectPath() << endl;
autoPtr<fvMesh> meshPtr(new fvMesh(io));
fvMesh& mesh = meshPtr();
@ -229,8 +226,9 @@ autoPtr<fvMesh> createMesh
if (!haveMesh)
{
// We created a dummy mesh file above. Delete it.
Pout<< "Removing dummy mesh in " << runTime.path()/instDir << endl;
rmDir(runTime.path()/instDir/polyMesh::meshSubDir);
Pout<< "Removing dummy mesh " << io.objectPath()
<< endl;
rmDir(io.objectPath());
}
// Force recreation of globalMeshData.
@ -285,7 +283,6 @@ scalar getMergeDistance
void printMeshData(Ostream& os, const polyMesh& mesh)
{
os << "Number of points: " << mesh.points().size() << nl
<< " edges: " << mesh.edges().size() << nl
<< " faces: " << mesh.faces().size() << nl
<< " internal faces: " << mesh.faceNeighbour().size() << nl
<< " cells: " << mesh.cells().size() << nl
@ -506,33 +503,53 @@ void compareFields
int main(int argc, char *argv[])
{
argList::validOptions.insert("mergeTol", "relative merge distance");
# include "addRegionOption.H"
argList::addOption("mergeTol", "relative merge distance");
// Create argList. This will check for non-existing processor dirs.
# include "setRootCase.H"
// Create processor directory if non-existing
if (!Pstream::master() && !isDir(args.path()))
{
Pout<< "Creating case directory " << args.path() << endl;
mkDir(args.path());
}
//- Not useful anymore. See above.
//// Create processor directory if non-existing
//if (!Pstream::master() && !isDir(args.path()))
//{
// Pout<< "Creating case directory " << args.path() << endl;
// mkDir(args.path());
//}
# include "createTime.H"
word regionName = polyMesh::defaultRegion;
fileName meshSubDir;
if (args.optionReadIfPresent("region", regionName))
{
meshSubDir = regionName/polyMesh::meshSubDir;
}
else
{
meshSubDir = polyMesh::meshSubDir;
}
Info<< "Using mesh subdirectory " << meshSubDir << nl << endl;
// Get time instance directory. Since not all processors have meshes
// just use the master one everywhere.
fileName masterInstDir;
if (Pstream::master())
{
masterInstDir = runTime.findInstance(polyMesh::meshSubDir, "points");
masterInstDir = runTime.findInstance(meshSubDir, "points");
}
Pstream::scatter(masterInstDir);
// Check who has a mesh
const fileName meshDir = runTime.path()/masterInstDir/polyMesh::meshSubDir;
const fileName meshPath = runTime.path()/masterInstDir/meshSubDir;
Info<< "Found points in " << meshPath << nl << endl;
boolList haveMesh(Pstream::nProcs(), false);
haveMesh[Pstream::myProcNo()] = isDir(meshDir);
haveMesh[Pstream::myProcNo()] = isDir(meshPath);
Pstream::gatherList(haveMesh);
Pstream::scatterList(haveMesh);
Info<< "Per processor mesh availability : " << haveMesh << endl;
@ -542,6 +559,7 @@ int main(int argc, char *argv[])
autoPtr<fvMesh> meshPtr = createMesh
(
runTime,
regionName,
masterInstDir,
haveMesh[Pstream::myProcNo()]
);
@ -799,7 +817,7 @@ int main(int argc, char *argv[])
<< nl
<< "the processor directories with 0 sized meshes in them." << nl
<< "Below is a sample set of commands to do this."
<< " Take care when issueing these" << nl
<< " Take care when issuing these" << nl
<< "commands." << nl << endl;
forAll(nFaces, procI)
@ -812,8 +830,8 @@ int main(int argc, char *argv[])
}
else
{
fileName timeDir = procDir/runTime.timeName()/polyMesh::meshSubDir;
fileName constDir = procDir/runTime.constant()/polyMesh::meshSubDir;
fileName timeDir = procDir/runTime.timeName()/meshSubDir;
fileName constDir = procDir/runTime.constant()/meshSubDir;
Info<< " rm -r " << constDir.c_str() << nl
<< " mv " << timeDir.c_str()