mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: redistributePar: remove pointFields
This commit is contained in:
@ -81,6 +81,7 @@ Usage
|
|||||||
#include "parLagrangianRedistributor.H"
|
#include "parLagrangianRedistributor.H"
|
||||||
#include "unmappedPassiveParticleCloud.H"
|
#include "unmappedPassiveParticleCloud.H"
|
||||||
#include "hexRef8Data.H"
|
#include "hexRef8Data.H"
|
||||||
|
#include "pointFields.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -838,6 +839,8 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
PtrList<DimensionedField<symmTensor, volMesh>> dimSymmTensorFields;
|
PtrList<DimensionedField<symmTensor, volMesh>> dimSymmTensorFields;
|
||||||
PtrList<DimensionedField<tensor, volMesh>> dimTensorFields;
|
PtrList<DimensionedField<tensor, volMesh>> dimTensorFields;
|
||||||
|
|
||||||
|
DynamicList<word> pointFieldNames;
|
||||||
|
|
||||||
|
|
||||||
if (doReadFields)
|
if (doReadFields)
|
||||||
{
|
{
|
||||||
@ -1051,6 +1054,40 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// pointFields currently not supported. Read their names so we
|
||||||
|
// can delete them.
|
||||||
|
{
|
||||||
|
// Get my objects of type
|
||||||
|
pointFieldNames.append
|
||||||
|
(
|
||||||
|
objects.lookupClass(pointScalarField::typeName).sortedNames()
|
||||||
|
);
|
||||||
|
pointFieldNames.append
|
||||||
|
(
|
||||||
|
objects.lookupClass(pointVectorField::typeName).sortedNames()
|
||||||
|
);
|
||||||
|
pointFieldNames.append
|
||||||
|
(
|
||||||
|
objects.lookupClass
|
||||||
|
(
|
||||||
|
pointSphericalTensorField::typeName
|
||||||
|
).sortedNames()
|
||||||
|
);
|
||||||
|
pointFieldNames.append
|
||||||
|
(
|
||||||
|
objects.lookupClass
|
||||||
|
(
|
||||||
|
pointSymmTensorField::typeName
|
||||||
|
).sortedNames()
|
||||||
|
);
|
||||||
|
pointFieldNames.append
|
||||||
|
(
|
||||||
|
objects.lookupClass(pointTensorField::typeName).sortedNames()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Make sure all processors have the same set
|
||||||
|
Pstream::scatter(pointFieldNames);
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
@ -1138,6 +1175,19 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
mesh.write();
|
mesh.write();
|
||||||
topoSet::removeFiles(mesh);
|
topoSet::removeFiles(mesh);
|
||||||
|
forAll(pointFieldNames, i)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
pointFieldNames[i],
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
fileName fieldFile(io.objectPath());
|
||||||
|
if (topoSet::debug) DebugVar(fieldFile);
|
||||||
|
rm(fieldFile);
|
||||||
|
}
|
||||||
|
|
||||||
// Now we've written all. Reset caseName on master
|
// Now we've written all. Reset caseName on master
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
@ -1148,6 +1198,19 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
{
|
{
|
||||||
mesh.write();
|
mesh.write();
|
||||||
topoSet::removeFiles(mesh);
|
topoSet::removeFiles(mesh);
|
||||||
|
forAll(pointFieldNames, i)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
pointFieldNames[i],
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
fileName fieldFile(io.objectPath());
|
||||||
|
if (topoSet::debug) DebugVar(fieldFile);
|
||||||
|
rm(fieldFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Info<< "Written redistributed mesh to " << mesh.facesInstance() << nl
|
Info<< "Written redistributed mesh to " << mesh.facesInstance() << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -5751,9 +5751,42 @@ bool Foam::hexRef8::write() const
|
|||||||
{
|
{
|
||||||
writeOk = writeOk && history_.write();
|
writeOk = writeOk && history_.write();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refinementHistory::removeFiles(mesh_);
|
||||||
|
}
|
||||||
|
|
||||||
return writeOk;
|
return writeOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::hexRef8::removeFiles(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"dummy",
|
||||||
|
mesh.facesInstance(),
|
||||||
|
mesh.meshSubDir,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
fileName setsDir(io.path());
|
||||||
|
|
||||||
|
if (topoSet::debug) DebugVar(setsDir);
|
||||||
|
|
||||||
|
if (exists(setsDir/"cellLevel"))
|
||||||
|
{
|
||||||
|
rm(setsDir/"cellLevel");
|
||||||
|
}
|
||||||
|
if (exists(setsDir/"pointLevel"))
|
||||||
|
{
|
||||||
|
rm(setsDir/"pointLevel");
|
||||||
|
}
|
||||||
|
if (exists(setsDir/"level0Edge"))
|
||||||
|
{
|
||||||
|
rm(setsDir/"level0Edge");
|
||||||
|
}
|
||||||
|
refinementHistory::removeFiles(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -568,6 +568,9 @@ public:
|
|||||||
//- Force writing refinement+history to polyMesh directory.
|
//- Force writing refinement+history to polyMesh directory.
|
||||||
bool write() const;
|
bool write() const;
|
||||||
|
|
||||||
|
//- Helper: remove all relevant files from mesh instance
|
||||||
|
static void removeFiles(const polyMesh&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "mapDistributePolyMesh.H"
|
#include "mapDistributePolyMesh.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
|
#include "topoSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1736,6 +1737,26 @@ bool Foam::refinementHistory::writeData(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::refinementHistory::removeFiles(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"dummy",
|
||||||
|
mesh.facesInstance(),
|
||||||
|
mesh.meshSubDir,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
fileName setsDir(io.path());
|
||||||
|
|
||||||
|
if (topoSet::debug) DebugVar(setsDir);
|
||||||
|
|
||||||
|
if (exists(setsDir/typeName))
|
||||||
|
{
|
||||||
|
rm(setsDir/typeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, refinementHistory& rh)
|
Foam::Istream& Foam::operator>>(Istream& is, refinementHistory& rh)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,7 +87,7 @@ namespace Foam
|
|||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class mapPolyMesh;
|
class mapPolyMesh;
|
||||||
class mapDistributePolyMesh;
|
class mapDistributePolyMesh;
|
||||||
|
class polyMesh;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
@ -401,6 +401,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Helper: remove all sets files from mesh instance
|
||||||
|
static void removeFiles(const polyMesh&);
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
//- Istream operator. Note: does not do a reduction - does not set
|
//- Istream operator. Note: does not do a reduction - does not set
|
||||||
|
|||||||
@ -3038,6 +3038,30 @@ void Foam::meshRefinement::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::meshRefinement::removeFiles(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"dummy",
|
||||||
|
mesh.facesInstance(),
|
||||||
|
mesh.meshSubDir,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
fileName setsDir(io.path());
|
||||||
|
|
||||||
|
if (topoSet::debug) DebugVar(setsDir);
|
||||||
|
|
||||||
|
// Remove local files
|
||||||
|
if (exists(setsDir/"surfaceIndex"))
|
||||||
|
{
|
||||||
|
rm(setsDir/"surfaceIndex");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove other files
|
||||||
|
hexRef8::removeFiles(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel()
|
Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel()
|
||||||
{
|
{
|
||||||
return writeLevel_;
|
return writeLevel_;
|
||||||
|
|||||||
@ -1447,6 +1447,9 @@ public:
|
|||||||
const fileName&
|
const fileName&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Helper: remove all relevant files from mesh instance
|
||||||
|
static void removeFiles(const polyMesh&);
|
||||||
|
|
||||||
//- Helper: calculate average
|
//- Helper: calculate average
|
||||||
template<class T>
|
template<class T>
|
||||||
static T gAverage
|
static T gAverage
|
||||||
@ -1468,7 +1471,6 @@ public:
|
|||||||
// NamedEnum
|
// NamedEnum
|
||||||
template<class Enum>
|
template<class Enum>
|
||||||
static int readFlags(const Enum& namedEnum, const wordList&);
|
static int readFlags(const Enum& namedEnum, const wordList&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "processorMeshes.H"
|
#include "processorMeshes.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
|
#include "topoSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ void Foam::processorMeshes::removeFiles(const polyMesh& mesh)
|
|||||||
mesh
|
mesh
|
||||||
).objectPath()
|
).objectPath()
|
||||||
);
|
);
|
||||||
if (debug) DebugVar(pointPath);
|
if (topoSet::debug) DebugVar(pointPath);
|
||||||
rm(pointPath);
|
rm(pointPath);
|
||||||
|
|
||||||
rm
|
rm
|
||||||
|
|||||||
Reference in New Issue
Block a user