mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfMesh constructor without AUTO_WRITE, as per polyMesh (#1147)
This commit is contained in:
@ -56,7 +56,6 @@ Foam::surfMeshSample::getOrCreateSurfMesh() const
|
||||
meshedSurface(), // Create as empty surface
|
||||
name()
|
||||
);
|
||||
ptr->setWriteOption(IOobject::NO_WRITE);
|
||||
|
||||
mesh().objectRegistry::store(ptr);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +35,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(surfMesh, 0);
|
||||
defineTypeNameAndDebug(surfMesh, 0);
|
||||
}
|
||||
|
||||
Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
|
||||
@ -56,8 +56,8 @@ Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
|
||||
// zoneName = "zone0";
|
||||
// }
|
||||
//
|
||||
// // set single default zone
|
||||
// zones.setSize(1);
|
||||
// // Set single default zone
|
||||
// zones.resize(1);
|
||||
// zones[0] = surfZone
|
||||
// (
|
||||
// zoneName,
|
||||
@ -130,7 +130,7 @@ Foam::surfMesh::surfMesh
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.writeOpt()
|
||||
),
|
||||
IOobject
|
||||
(
|
||||
@ -139,7 +139,7 @@ Foam::surfMesh::surfMesh
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.writeOpt()
|
||||
),
|
||||
IOobject
|
||||
(
|
||||
@ -148,21 +148,18 @@ Foam::surfMesh::surfMesh
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.writeOpt()
|
||||
)
|
||||
),
|
||||
MeshReference(this->storedIOFaces(), this->storedIOPoints())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<<"IOobject: " << io.path() << nl
|
||||
<<" name: " << io.name()
|
||||
<<" instance: " << io.instance()
|
||||
<<" local: " << io.local()
|
||||
<<" dbDir: " << io.db().dbDir() << endl;
|
||||
Info<<"creating surfMesh at instance " << instance() << endl;
|
||||
Info<<"timeName: " << instance() << endl;
|
||||
}
|
||||
DebugInfo
|
||||
<<"IOobject: " << io.path() << nl
|
||||
<<" name: " << io.name()
|
||||
<<" instance: " << io.instance()
|
||||
<<" local: " << io.local()
|
||||
<<" dbDir: " << io.db().dbDir() << nl
|
||||
<<"creating surfMesh at instance " << instance() << endl;
|
||||
|
||||
copyContents(surf);
|
||||
}
|
||||
@ -184,8 +181,8 @@ Foam::surfMesh::surfMesh
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.readOpt(),
|
||||
io.writeOpt()
|
||||
),
|
||||
IOobject
|
||||
(
|
||||
@ -193,8 +190,8 @@ Foam::surfMesh::surfMesh
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.readOpt(),
|
||||
io.writeOpt()
|
||||
),
|
||||
IOobject
|
||||
(
|
||||
@ -202,22 +199,20 @@ Foam::surfMesh::surfMesh
|
||||
instance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
io.readOpt(),
|
||||
io.writeOpt()
|
||||
)
|
||||
),
|
||||
MeshReference(this->storedIOFaces(), this->storedIOPoints())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<<"IOobject: " << io.path() << nl
|
||||
<<" name: " << io.name()
|
||||
<<" instance: " << io.instance()
|
||||
<<" local: " << io.local()
|
||||
<<" dbDir: " << io.db().dbDir() << endl;
|
||||
Info<<"creating surfMesh at instance " << instance() << endl;
|
||||
Info<<"timeName: " << instance() << endl;
|
||||
}
|
||||
DebugInfo
|
||||
<<"IOobject: " << io.path() << nl
|
||||
<<" name: " << io.name()
|
||||
<<" instance: " << io.instance()
|
||||
<<" local: " << io.local()
|
||||
<<" dbDir: " << io.db().dbDir() << nl
|
||||
<<"creating surfMesh at instance " << instance() << nl
|
||||
<<"timeName: " << instance() << endl;
|
||||
|
||||
transfer(surf);
|
||||
}
|
||||
@ -435,6 +430,7 @@ void Foam::surfMesh::removeFiles(const fileName& instanceDir) const
|
||||
rm(meshFilesPath/"surfZones");
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::removeFiles() const
|
||||
{
|
||||
removeFiles(instance());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -156,15 +156,13 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Read construct from IOobject
|
||||
//- Read construct from IOobject.
|
||||
// Writing = NO_WRITE
|
||||
explicit surfMesh(const IOobject& io);
|
||||
|
||||
//- Read construct from IOobject, with alternative surface name
|
||||
surfMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const word& surfName
|
||||
);
|
||||
// Writing = NO_WRITE
|
||||
surfMesh(const IOobject& io, const word& surfName);
|
||||
|
||||
//- Copy construct from MeshedSurface<face>
|
||||
surfMesh
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,10 +31,7 @@ License
|
||||
|
||||
void Foam::surfMesh::removeZones()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Removing surface zones." << endl;
|
||||
}
|
||||
DebugInFunction << "Removing surface zones." << endl;
|
||||
|
||||
// Remove the surface zones
|
||||
storedZones().clear();
|
||||
@ -47,10 +44,7 @@ void Foam::surfMesh::removeZones()
|
||||
|
||||
void Foam::surfMesh::clearGeom()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Clearing geometric data" << endl;
|
||||
}
|
||||
DebugInFunction << "Clearing geometric data" << endl;
|
||||
|
||||
MeshReference::clearGeom();
|
||||
}
|
||||
@ -58,10 +52,7 @@ void Foam::surfMesh::clearGeom()
|
||||
|
||||
void Foam::surfMesh::clearAddressing()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "clearing topology" << endl;
|
||||
}
|
||||
DebugInFunction << "clearing topology" << endl;
|
||||
|
||||
MeshReference::clearPatchMeshAddr();
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,12 +31,10 @@ License
|
||||
void Foam::surfMesh::setInstance
|
||||
(
|
||||
const fileName& inst,
|
||||
IOobject::writeOption wOpt)
|
||||
IOobject::writeOption wOpt
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Resetting file instance to " << inst << endl;
|
||||
}
|
||||
DebugInFunction << "Resetting file instance to " << inst << endl;
|
||||
|
||||
instance() = inst;
|
||||
Allocator::setInstance(inst);
|
||||
@ -54,30 +52,23 @@ void Foam::surfMesh::setWriteOption(IOobject::writeOption wOpt)
|
||||
|
||||
Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Updating mesh based on saved data." << endl;
|
||||
}
|
||||
DebugInFunction << "Updating mesh based on saved data." << endl;
|
||||
|
||||
// Find point and face instances
|
||||
fileName pointsInst(time().findInstance(meshDir(), "points"));
|
||||
fileName facesInst(time().findInstance(meshDir(), "faces"));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Points instance: old = " << pointsInstance()
|
||||
<< " new = " << pointsInst << nl
|
||||
<< "Faces instance: old = " << facesInstance()
|
||||
<< " new = " << facesInst << endl;
|
||||
}
|
||||
DebugInFunction
|
||||
<< "Points instance: old = " << pointsInstance()
|
||||
<< " new = " << pointsInst << nl
|
||||
<< "Faces instance: old = " << facesInstance()
|
||||
<< " new = " << facesInst << endl;
|
||||
|
||||
if (facesInst != facesInstance())
|
||||
{
|
||||
// Topological change
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Topological change" << endl;
|
||||
}
|
||||
DebugInfo
|
||||
<< "Topological change" << endl;
|
||||
|
||||
clearOut();
|
||||
|
||||
@ -167,10 +158,7 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
else if (pointsInst != pointsInstance())
|
||||
{
|
||||
// Points moved
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Point motion" << endl;
|
||||
}
|
||||
DebugInfo << "Point motion" << endl;
|
||||
|
||||
clearOut();
|
||||
storedIOPoints().instance() = pointsInst;
|
||||
@ -193,10 +181,7 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "No change" << endl;
|
||||
}
|
||||
DebugInfo << "No change" << endl;
|
||||
}
|
||||
|
||||
return surfMesh::UNCHANGED;
|
||||
|
||||
@ -50,7 +50,7 @@ Foam::surfaceRegistry::surfaceRegistry
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
( surfName.size() ? surfName : defaultName ),
|
||||
(surfName.size() ? surfName : defaultName),
|
||||
obr.time().timeName(),
|
||||
prefix,
|
||||
obr,
|
||||
|
||||
Reference in New Issue
Block a user