mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated mechanism to create empty sets and zones
This commit is contained in:
@ -29,6 +29,18 @@ License
|
|||||||
#include "stringListOps.H"
|
#include "stringListOps.H"
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<class ZoneType, class MeshType>
|
||||||
|
int Foam::ZoneMesh<ZoneType, MeshType>::disallowGenericZones
|
||||||
|
(
|
||||||
|
debug::debugSwitch("disallowGenericZones", 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class ZoneType, class MeshType>
|
template<class ZoneType, class MeshType>
|
||||||
@ -429,8 +441,40 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID
|
|||||||
<< "List of available zone names: " << names() << endl;
|
<< "List of available zone names: " << names() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disallowGenericZones != 0)
|
||||||
|
{
|
||||||
|
// Create a new ...
|
||||||
|
Info<< "Creating dummy zone " << zoneName << endl;
|
||||||
|
dictionary dict;
|
||||||
|
dict.set("type", ZoneType::typeName);
|
||||||
|
dict.set(ZoneType::labelsName, labelList());
|
||||||
|
|
||||||
|
// flipMap only really applicable for face zones, but should not get
|
||||||
|
// in the way for cell- and point-zones...
|
||||||
|
dict.set("flipMap", boolList());
|
||||||
|
label newZonei = zones.size();
|
||||||
|
|
||||||
|
ZoneMesh<ZoneType, MeshType>& zm =
|
||||||
|
const_cast<ZoneMesh<ZoneType, MeshType>&>(*this);
|
||||||
|
|
||||||
|
zm.append
|
||||||
|
(
|
||||||
|
new ZoneType
|
||||||
|
(
|
||||||
|
zoneName,
|
||||||
|
dict,
|
||||||
|
newZonei,
|
||||||
|
zm
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return newZonei;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Not found
|
// Not found
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,10 @@ class ZoneMesh
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic zones
|
||||||
|
static int disallowGenericZones;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Read constructor given IOobject and a MeshType reference
|
//- Read constructor given IOobject and a MeshType reference
|
||||||
|
|||||||
@ -37,6 +37,11 @@ namespace Foam
|
|||||||
defineRunTimeSelectionTable(topoSet, word);
|
defineRunTimeSelectionTable(topoSet, word);
|
||||||
defineRunTimeSelectionTable(topoSet, size);
|
defineRunTimeSelectionTable(topoSet, size);
|
||||||
defineRunTimeSelectionTable(topoSet, set);
|
defineRunTimeSelectionTable(topoSet, set);
|
||||||
|
|
||||||
|
int Foam::topoSet::disallowGenericSets
|
||||||
|
(
|
||||||
|
debug::debugSwitch("disallowGenericSets", 0)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -297,14 +302,14 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
writeOption w
|
writeOption w
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return IOobject
|
IOobject io
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
mesh.time().findInstance
|
mesh.time().findInstance
|
||||||
(
|
(
|
||||||
mesh.dbDir()/polyMesh::meshSubDir/"sets",
|
mesh.dbDir()/polyMesh::meshSubDir/"sets",
|
||||||
word::null,
|
word::null,
|
||||||
r,
|
IOobject::READ_IF_PRESENT,
|
||||||
mesh.facesInstance()
|
mesh.facesInstance()
|
||||||
),
|
),
|
||||||
polyMesh::meshSubDir/"sets",
|
polyMesh::meshSubDir/"sets",
|
||||||
@ -312,6 +317,14 @@ Foam::IOobject Foam::topoSet::findIOobject
|
|||||||
r,
|
r,
|
||||||
w
|
w
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!io.typeHeaderOk<topoSet>(false) && disallowGenericSets != 0)
|
||||||
|
{
|
||||||
|
DebugInfo<< "Setting no read for set " << name << endl;
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -142,6 +142,9 @@ public:
|
|||||||
//- Name of file set will use.
|
//- Name of file set will use.
|
||||||
static fileName localPath(const polyMesh& mesh, const word& name);
|
static fileName localPath(const polyMesh& mesh, const word& name);
|
||||||
|
|
||||||
|
//- Debug switch to disallow the use of generic sets
|
||||||
|
static int disallowGenericSets;
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection table
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user