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