mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added zoneSets
This commit is contained in:
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Manipulate a cell/face/point set interactively.
|
||||
Manipulate a cell/face/point/ set or zone interactively.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -82,6 +82,7 @@ Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
|
||||
// Copy set
|
||||
void backup
|
||||
(
|
||||
const word& setType,
|
||||
const polyMesh& mesh,
|
||||
const word& fromName,
|
||||
const topoSet& fromSet,
|
||||
@ -92,9 +93,7 @@ void backup
|
||||
{
|
||||
Pout<< " Backing up " << fromName << " into " << toName << endl;
|
||||
|
||||
topoSet backupSet(mesh, toName, fromSet);
|
||||
|
||||
backupSet.write();
|
||||
topoSet::New(setType, mesh, toName, fromSet)().write();
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,14 +101,21 @@ void backup
|
||||
// Read and copy set
|
||||
void backup
|
||||
(
|
||||
const word& setType,
|
||||
const polyMesh& mesh,
|
||||
const word& fromName,
|
||||
const word& toName
|
||||
)
|
||||
{
|
||||
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
|
||||
autoPtr<topoSet> fromSet = topoSet::New
|
||||
(
|
||||
setType,
|
||||
mesh,
|
||||
fromName,
|
||||
IOobject::READ_IF_PRESENT
|
||||
);
|
||||
|
||||
backup(mesh, fromName, fromSet, toName);
|
||||
backup(setType, mesh, fromName, fromSet(), toName);
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +247,8 @@ void printHelp(Ostream& os)
|
||||
<< "A set command should be of the following form" << endl
|
||||
<< endl
|
||||
<< " cellSet|faceSet|pointSet <setName> <action> <source>"
|
||||
<< endl << endl
|
||||
<< endl
|
||||
<< endl
|
||||
<< "The <action> is one of" << endl
|
||||
<< " list - prints the contents of the set" << endl
|
||||
<< " clear - clears the set" << endl
|
||||
@ -270,6 +277,10 @@ void printHelp(Ostream& os)
|
||||
<< " cellSet c0 add pointToCell p0 any" << endl
|
||||
<< "List set:" << endl
|
||||
<< " cellSet c0 list" << endl
|
||||
<< endl
|
||||
<< "Zones can be set from corresponding sets:" << endl
|
||||
<< " faceZone f0Zone new setToZone f0" << endl
|
||||
<< " cellZone c0Zone new setToZone c0" << endl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -366,7 +377,7 @@ bool doCommand
|
||||
{
|
||||
r = IOobject::NO_READ;
|
||||
|
||||
//backup(mesh, setName, setName + "_old");
|
||||
//backup(setType, mesh, setName, setName + "_old");
|
||||
|
||||
currentSetPtr = topoSet::New(setType, mesh, setName, typSize);
|
||||
}
|
||||
@ -401,7 +412,7 @@ bool doCommand
|
||||
//if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
|
||||
//{
|
||||
// // currentSet has been read so can make copy.
|
||||
// backup(mesh, setName, currentSet, setName + "_old");
|
||||
// backup(setType, mesh, setName, currentSet, setName + "_old");
|
||||
//}
|
||||
|
||||
switch (action)
|
||||
@ -437,15 +448,18 @@ bool doCommand
|
||||
);
|
||||
|
||||
// Backup current set.
|
||||
topoSet oldSet
|
||||
autoPtr<topoSet> oldSet
|
||||
(
|
||||
topoSet::New
|
||||
(
|
||||
setType,
|
||||
mesh,
|
||||
currentSet.name() + "_old2",
|
||||
currentSet
|
||||
)
|
||||
);
|
||||
|
||||
currentSet.clear();
|
||||
currentSet.resize(oldSet.size());
|
||||
setSource().applyToSet(topoSetSource::NEW, currentSet);
|
||||
|
||||
// Combine new value of currentSet with old one.
|
||||
@ -547,7 +561,8 @@ enum commandStatus
|
||||
{
|
||||
QUIT, // quit program
|
||||
INVALID, // token is not a valid set manipulation command
|
||||
VALID // ,, is a valid ,,
|
||||
VALIDSETCMD, // ,, is a valid ,,
|
||||
VALIDZONECMD // ,, is a valid zone ,,
|
||||
};
|
||||
|
||||
|
||||
@ -654,7 +669,16 @@ commandStatus parseType
|
||||
|| setType == "pointSet"
|
||||
)
|
||||
{
|
||||
return VALID;
|
||||
return VALIDSETCMD;
|
||||
}
|
||||
else if
|
||||
(
|
||||
setType == "cellZoneSet"
|
||||
|| setType == "faceZoneSet"
|
||||
|| setType == "pointZoneSet"
|
||||
)
|
||||
{
|
||||
return VALIDZONECMD;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -664,7 +688,7 @@ commandStatus parseType
|
||||
", IStringStream&)"
|
||||
) << "Illegal command " << setType << endl
|
||||
<< "Should be one of 'help', 'list', 'time' or a set type :"
|
||||
<< " 'cellSet', 'faceSet', 'pointSet'"
|
||||
<< " 'cellSet', 'faceSet', 'pointSet', 'faceZoneSet'"
|
||||
<< endl;
|
||||
|
||||
return INVALID;
|
||||
@ -682,7 +706,7 @@ commandStatus parseAction(const word& actionName)
|
||||
{
|
||||
(void)topoSetSource::toAction(actionName);
|
||||
|
||||
stat = VALID;
|
||||
stat = VALIDSETCMD;
|
||||
}
|
||||
catch (Foam::IOerror& fIOErr)
|
||||
{
|
||||
@ -816,12 +840,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
IStringStream is(rawLine + ' ');
|
||||
|
||||
// Type: cellSet, faceSet, pointSet
|
||||
// Type: cellSet, faceSet, pointSet, faceZoneSet
|
||||
is >> setType;
|
||||
|
||||
stat = parseType(runTime, mesh, setType, is);
|
||||
|
||||
if (stat == VALID)
|
||||
if (stat == VALIDSETCMD || stat == VALIDZONECMD)
|
||||
{
|
||||
if (is >> setName)
|
||||
{
|
||||
@ -831,14 +855,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok = true;
|
||||
|
||||
if (stat == QUIT)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (stat == VALID)
|
||||
else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
|
||||
{
|
||||
ok = doCommand(mesh, setType, setName, actionName, writeVTK, is);
|
||||
}
|
||||
|
||||
@ -71,6 +71,9 @@ $(topoSets)/cellSet.C
|
||||
$(topoSets)/topoSet.C
|
||||
$(topoSets)/faceSet.C
|
||||
$(topoSets)/pointSet.C
|
||||
$(topoSets)/cellZoneSet.C
|
||||
$(topoSets)/faceZoneSet.C
|
||||
$(topoSets)/pointZoneSet.C
|
||||
|
||||
sets/topoSetSource/topoSetSource.C
|
||||
|
||||
@ -113,6 +116,18 @@ $(pointSources)/surfaceToPoint/surfaceToPoint.C
|
||||
$(pointSources)/zoneToPoint/zoneToPoint.C
|
||||
$(pointSources)/nearestToPoint/nearestToPoint.C
|
||||
|
||||
faceZoneSources = sets/faceZoneSources
|
||||
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C
|
||||
$(faceZoneSources)/setsToFaceZone/setsToFaceZone.C
|
||||
$(faceZoneSources)/setToFaceZone/setToFaceZone.C
|
||||
|
||||
cellZoneSources = sets/cellZoneSources
|
||||
$(cellZoneSources)/setToCellZone/setToCellZone.C
|
||||
|
||||
pointZoneSources = sets/pointZoneSources
|
||||
$(pointZoneSources)/setToPointZone/setToPointZone.C
|
||||
|
||||
|
||||
surfaceSets/surfaceSets.C
|
||||
|
||||
triSurface/orientedSurface/orientedSurface.C
|
||||
|
||||
@ -106,7 +106,7 @@ void Foam::cellToCell::applyToSet
|
||||
{
|
||||
if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW))
|
||||
{
|
||||
Pout<< " Adding all elements of cellSet " << setName_ << " ..."
|
||||
Info<< " Adding all elements of cellSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
|
||||
// Load the set
|
||||
@ -116,7 +116,7 @@ void Foam::cellToCell::applyToSet
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Pout<< " Removing all elements of cellSet " << setName_ << " ..."
|
||||
Info<< " Removing all elements of cellSet " << setName_ << " ..."
|
||||
<< endl;
|
||||
|
||||
// Load the set
|
||||
|
||||
168
src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C
Normal file
168
src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C
Normal file
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "setToCellZone.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellZoneSet.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(setToCellZone, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToCellZone, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToCellZone, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::setToCellZone::usage_
|
||||
(
|
||||
setToCellZone::typeName,
|
||||
"\n Usage: setToCellZone <cellSet>\n\n"
|
||||
" Select all cells in the cellSet.\n\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::setToCellZone::setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::setToCellZone::setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.lookup("set"))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::setToCellZone::setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::setToCellZone::~setToCellZone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::setToCellZone::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!isA<cellZoneSet>(set))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"setToCellZone::applyToSet(const topoSetSource::setAction"
|
||||
", topoSet"
|
||||
) << "Operation only allowed on a cellZoneSet." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellZoneSet& fzSet = refCast<cellZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the sets
|
||||
cellSet fSet(mesh_, setName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
|
||||
forAllConstIter(cellSet, fSet, iter)
|
||||
{
|
||||
label cellI = iter.key();
|
||||
|
||||
if (!fzSet.found(cellI))
|
||||
{
|
||||
newAddressing.append(cellI);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all cells from cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the set
|
||||
cellSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
115
src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H
Normal file
115
src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H
Normal file
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::setToCellZone
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on usage in a cellSet.
|
||||
|
||||
SourceFiles
|
||||
setToCellZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef setToCellZone_H
|
||||
#define setToCellZone_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class setToCellZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class setToCellZone
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("setToCellZone");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
setToCellZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~setToCellZone();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -217,14 +217,14 @@ void Foam::cellToFace::applyToSet
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Pout<< " Adding faces according to cellSet " << setName_
|
||||
Info<< " Adding faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Pout<< " Removing faces according to cellSet " << setName_
|
||||
Info<< " Removing faces according to cellSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
combine(set, false);
|
||||
|
||||
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceZoneToFaceZone.H"
|
||||
#include "polyMesh.H"
|
||||
#include "faceZoneSet.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(faceZoneToFaceZone, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::faceZoneToFaceZone::usage_
|
||||
(
|
||||
faceZoneToFaceZone::typeName,
|
||||
"\n Usage: faceZoneToFaceZone <faceZone>\n\n"
|
||||
" Select all faces in the faceZone\n\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faceZoneToFaceZone::faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::faceZoneToFaceZone::faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.lookup("zone"))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::faceZoneToFaceZone::faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faceZoneToFaceZone::~faceZoneToFaceZone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceZoneToFaceZone::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!isA<faceZoneSet>(set))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"faceZoneToFaceZone::applyToSet(const topoSetSource::setAction"
|
||||
", topoSet"
|
||||
) << "Operation only allowed on a faceZoneSet." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all faces from faceZone " << setName_ << " ..."
|
||||
<< endl;
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, setName_);
|
||||
|
||||
DynamicList<label> newAddressing(fSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fSet.flipMap());
|
||||
|
||||
forAll(loadedSet.addressing(), i)
|
||||
{
|
||||
if (!fSet.found(loadedSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(loadedSet.addressing()[i]);
|
||||
newFlipMap.append(loadedSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fSet.addressing().transfer(newAddressing);
|
||||
fSet.flipMap().transfer(newFlipMap);
|
||||
fSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all faces from faceZone " << setName_ << " ..."
|
||||
<< endl;
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, setName_);
|
||||
|
||||
DynamicList<label> newAddressing(fSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fSet.flipMap().size());
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fSet.addressing()[i]);
|
||||
newFlipMap.append(fSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fSet.addressing().transfer(newAddressing);
|
||||
fSet.flipMap().transfer(newFlipMap);
|
||||
fSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::faceZoneToFaceZone
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on usage in another faceSet.
|
||||
|
||||
SourceFiles
|
||||
faceZoneToFaceZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZoneToFaceZone_H
|
||||
#define faceZoneToFaceZone_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceZoneToFaceZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faceZoneToFaceZone
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faceZoneToFaceZone");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
faceZoneToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faceZoneToFaceZone();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
175
src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C
Normal file
175
src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C
Normal file
@ -0,0 +1,175 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "setToFaceZone.H"
|
||||
#include "polyMesh.H"
|
||||
#include "faceZoneSet.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(setToFaceZone, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::setToFaceZone::usage_
|
||||
(
|
||||
setToFaceZone::typeName,
|
||||
"\n Usage: setToFaceZone <faceSet>\n\n"
|
||||
" Select all faces in the faceSet."
|
||||
" Sets flipMap.\n\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::setToFaceZone::setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::setToFaceZone::setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.lookup("faceSet"))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::setToFaceZone::setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::setToFaceZone::~setToFaceZone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::setToFaceZone::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!isA<faceZoneSet>(set))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"setToFaceZone::applyToSet(const topoSetSource::setAction"
|
||||
", topoSet"
|
||||
) << "Operation only allowed on a faceZoneSet." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the sets
|
||||
faceSet fSet(mesh_, setName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
|
||||
forAllConstIter(faceSet, fSet, iter)
|
||||
{
|
||||
label faceI = iter.key();
|
||||
|
||||
if (!fzSet.found(faceI))
|
||||
{
|
||||
newAddressing.append(faceI);
|
||||
newFlipMap.append(true);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the set
|
||||
faceSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newFlipMap.append(fzSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
116
src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H
Normal file
116
src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H
Normal file
@ -0,0 +1,116 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::setToFaceZone
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on usage in a faceSet. Sets flipMap
|
||||
to true.
|
||||
|
||||
SourceFiles
|
||||
setToFaceZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef setToFaceZone_H
|
||||
#define setToFaceZone_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class setToFaceZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class setToFaceZone
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("setToFaceZone");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
setToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~setToFaceZone();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,222 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "setsToFaceZone.H"
|
||||
#include "polyMesh.H"
|
||||
#include "faceZoneSet.H"
|
||||
#include "cellSet.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(setsToFaceZone, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::setsToFaceZone::usage_
|
||||
(
|
||||
setsToFaceZone::typeName,
|
||||
"\n Usage: setsToFaceZone <faceSet> <slaveCellSet>\n\n"
|
||||
" Select all faces in the faceSet."
|
||||
" Orientated so slave side is in cellSet.\n\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::setsToFaceZone::setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& faceSetName,
|
||||
const word& cellSetName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
faceSetName_(faceSetName),
|
||||
cellSetName_(cellSetName)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::setsToFaceZone::setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
faceSetName_(dict.lookup("faceSet")),
|
||||
cellSetName_(dict.lookup("cellSet"))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::setsToFaceZone::setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
faceSetName_(checkIs(is)),
|
||||
cellSetName_(checkIs(is))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::setsToFaceZone::~setsToFaceZone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::setsToFaceZone::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!isA<faceZoneSet>(set))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"setsToFaceZone::applyToSet(const topoSetSource::setAction"
|
||||
", topoSet"
|
||||
) << "Operation only allowed on a faceZoneSet." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the sets
|
||||
faceSet fSet(mesh_, faceSetName_);
|
||||
cellSet cSet(mesh_, cellSetName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap());
|
||||
|
||||
forAllConstIter(faceSet, fSet, iter)
|
||||
{
|
||||
label faceI = iter.key();
|
||||
|
||||
if (!fzSet.found(faceI))
|
||||
{
|
||||
bool flip = false;
|
||||
|
||||
label own = mesh_.faceOwner()[faceI];
|
||||
bool ownFound = cSet.found(own);
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
label nei = mesh_.faceNeighbour()[faceI];
|
||||
bool neiFound = cSet.found(nei);
|
||||
|
||||
if (ownFound && !neiFound)
|
||||
{
|
||||
flip = false;
|
||||
}
|
||||
else if(!ownFound && neiFound)
|
||||
{
|
||||
flip = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"setsToFaceZone::applyToSet"
|
||||
"(const topoSetSource::setAction, topoSet)"
|
||||
) << "One of owner or neighbour of internal face "
|
||||
<< faceI << " should be in cellSet "
|
||||
<< cSet.name()
|
||||
<< " to be able to determine orientation."
|
||||
<< endl
|
||||
<< "Face:" << faceI << " own:" << own
|
||||
<< " OwnInCellSet:" << ownFound
|
||||
<< " nei:" << nei
|
||||
<< " NeiInCellSet:" << neiFound
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flip = !ownFound;
|
||||
}
|
||||
|
||||
newAddressing.append(faceI);
|
||||
newFlipMap.append(flip);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all faces from faceSet " << faceSetName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the set
|
||||
faceZoneSet loadedSet(mesh_, faceSetName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
newFlipMap.append(fzSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.flipMap().transfer(newFlipMap);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,119 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::setsToFaceZone
|
||||
|
||||
Description
|
||||
A topoSetSource to select faces based on usage in a faceSet and cellSet
|
||||
|
||||
SourceFiles
|
||||
setsToFaceZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef setsToFaceZone_H
|
||||
#define setsToFaceZone_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class setsToFaceZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class setsToFaceZone
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
word faceSetName_;
|
||||
|
||||
//- Name of set to use
|
||||
word cellSetName_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("setsToFaceZone");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& faceSetName,
|
||||
const word& cellSetName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
setsToFaceZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~setsToFaceZone();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -151,13 +151,13 @@ void Foam::cellToPoint::applyToSet
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Pout<< " Adding from " << setName_ << " ..." << endl;
|
||||
Info<< " Adding from " << setName_ << " ..." << endl;
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Pout<< " Removing from " << setName_ << " ..." << endl;
|
||||
Info<< " Removing from " << setName_ << " ..." << endl;
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "setToPointZone.H"
|
||||
#include "polyMesh.H"
|
||||
#include "pointZoneSet.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(setToPointZone, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToPointZone, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, setToPointZone, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::setToPointZone::usage_
|
||||
(
|
||||
setToPointZone::typeName,
|
||||
"\n Usage: setToPointZone <pointSet>\n\n"
|
||||
" Select all points in the pointSet.\n\n"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::setToPointZone::setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(setName)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::setToPointZone::setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(dict.lookup("set"))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::setToPointZone::setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
setName_(checkIs(is))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::setToPointZone::~setToPointZone()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::setToPointZone::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if (!isA<pointZoneSet>(set))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"setToPointZone::applyToSet(const topoSetSource::setAction"
|
||||
", topoSet"
|
||||
) << "Operation only allowed on a pointZoneSet." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
pointZoneSet& fzSet = refCast<pointZoneSet>(set);
|
||||
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all points from pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the sets
|
||||
pointSet fSet(mesh_, setName_);
|
||||
|
||||
// Start off from copy
|
||||
DynamicList<label> newAddressing(fzSet.addressing());
|
||||
|
||||
forAllConstIter(pointSet, fSet, iter)
|
||||
{
|
||||
label pointI = iter.key();
|
||||
|
||||
if (!fzSet.found(pointI))
|
||||
{
|
||||
newAddressing.append(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all points from pointSet " << setName_
|
||||
<< " ..." << endl;
|
||||
|
||||
// Load the set
|
||||
pointSet loadedSet(mesh_, setName_);
|
||||
|
||||
// Start off empty
|
||||
DynamicList<label> newAddressing(fzSet.addressing().size());
|
||||
|
||||
forAll(fzSet.addressing(), i)
|
||||
{
|
||||
if (!loadedSet.found(fzSet.addressing()[i]))
|
||||
{
|
||||
newAddressing.append(fzSet.addressing()[i]);
|
||||
}
|
||||
}
|
||||
fzSet.addressing().transfer(newAddressing);
|
||||
fzSet.updateSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::setToPointZone
|
||||
|
||||
Description
|
||||
A topoSetSource to select points based on usage in a pointSet.
|
||||
|
||||
SourceFiles
|
||||
setToPointZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef setToPointZone_H
|
||||
#define setToPointZone_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class setToPointZone Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class setToPointZone
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("setToPointZone");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& setName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
setToPointZone
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~setToPointZone();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -41,6 +41,7 @@ defineTypeNameAndDebug(cellSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, cellSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, cellSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, cellSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -78,6 +79,18 @@ cellSet::cellSet
|
||||
{}
|
||||
|
||||
|
||||
cellSet::cellSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
topoSet(mesh, name, set, w)
|
||||
{}
|
||||
|
||||
|
||||
cellSet::cellSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -88,6 +88,15 @@ public:
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from existing set
|
||||
cellSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from labelHashSet
|
||||
cellSet
|
||||
(
|
||||
|
||||
308
src/meshTools/sets/topoSets/cellZoneSet.C
Normal file
308
src/meshTools/sets/topoSets/cellZoneSet.C
Normal file
@ -0,0 +1,308 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cellZoneSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyMesh.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(cellZoneSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, cellZoneSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void cellZoneSet::updateSet()
|
||||
{
|
||||
cellSet::clearStorage();
|
||||
cellSet::resize(2*addressing_.size());
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
cellSet::insert(addressing_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
cellZoneSet::cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
cellSet(mesh, name, 1000), // do not read cellSet
|
||||
mesh_(mesh),
|
||||
addressing_(0)
|
||||
{
|
||||
const cellZoneMesh& cellZones = mesh.cellZones();
|
||||
label zoneID = cellZones.findZoneID(name);
|
||||
|
||||
if
|
||||
(
|
||||
(r == IOobject::MUST_READ)
|
||||
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
|
||||
)
|
||||
{
|
||||
const cellZone& fz = cellZones[zoneID];
|
||||
addressing_ = fz;
|
||||
}
|
||||
|
||||
updateSet();
|
||||
|
||||
check(mesh.nCells());
|
||||
}
|
||||
|
||||
|
||||
cellZoneSet::cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label size,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
cellSet(mesh, name, size, w),
|
||||
mesh_(mesh),
|
||||
addressing_(0)
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
cellZoneSet::cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
cellSet(mesh, name, set.size(), w),
|
||||
mesh_(mesh),
|
||||
addressing_(refCast<const cellZoneSet>(set).addressing())
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
cellZoneSet::~cellZoneSet()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void cellZoneSet::invert(const label maxLen)
|
||||
{
|
||||
label n = 0;
|
||||
|
||||
for (label cellI = 0; cellI < maxLen; cellI++)
|
||||
{
|
||||
if (!found(cellI))
|
||||
{
|
||||
addressing_[n] = cellI;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
addressing_.setSize(n);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label cellI = fSet.addressing()[i];
|
||||
|
||||
if (found(cellI))
|
||||
{
|
||||
newAddressing.append(cellI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
|
||||
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label cellI = fSet.addressing()[i];
|
||||
|
||||
if (!found(cellI))
|
||||
{
|
||||
newAddressing.append(cellI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::deleteSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
|
||||
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label cellI = addressing_[i];
|
||||
|
||||
if (!fSet.found(cellI))
|
||||
{
|
||||
// Not found in fSet so add
|
||||
newAddressing.append(cellI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::sync(const polyMesh& mesh)
|
||||
{}
|
||||
|
||||
|
||||
label cellZoneSet::maxSize(const polyMesh& mesh) const
|
||||
{
|
||||
return mesh.nCells();
|
||||
}
|
||||
|
||||
|
||||
//- Write using given format, version and compression
|
||||
bool cellZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c
|
||||
) const
|
||||
{
|
||||
// Write shadow cellSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = cellSet::typeName;
|
||||
bool ok = cellSet::writeObject(s, v, c);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify cellZone
|
||||
cellZoneMesh& cellZones = const_cast<polyMesh&>(mesh_).cellZones();
|
||||
label zoneID = cellZones.findZoneID(name());
|
||||
|
||||
if (zoneID == -1)
|
||||
{
|
||||
zoneID = cellZones.size();
|
||||
|
||||
cellZones.setSize(zoneID+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneID,
|
||||
new cellZone
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
zoneID,
|
||||
cellZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellZones[zoneID] = addressing_;
|
||||
}
|
||||
return ok && cellZones.write();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||
{
|
||||
// cellZone
|
||||
labelList newAddressing(addressing_.size());
|
||||
|
||||
label n = 0;
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label cellI = addressing_[i];
|
||||
label newCellI = morphMap.reverseCellMap()[cellI];
|
||||
if (newCellI >= 0)
|
||||
{
|
||||
newAddressing[n] = newCellI;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
newAddressing.setSize(n);
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void cellZoneSet::writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh& mesh,
|
||||
const label maxLen
|
||||
) const
|
||||
{
|
||||
cellSet::writeDebug(os, mesh, maxLen);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
173
src/meshTools/sets/topoSets/cellZoneSet.H
Normal file
173
src/meshTools/sets/topoSets/cellZoneSet.H
Normal file
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::cellZoneSet
|
||||
|
||||
Description
|
||||
Like cellSet but updates cellZone when writing.
|
||||
|
||||
SourceFiles
|
||||
cellZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellZoneSet_H
|
||||
#define cellZoneSet_H
|
||||
|
||||
#include "cellSet.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellZoneSet Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellZoneSet
|
||||
:
|
||||
public cellSet
|
||||
{
|
||||
// Private data
|
||||
|
||||
const polyMesh& mesh_;
|
||||
|
||||
labelList addressing_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cellZoneSet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry and name
|
||||
cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r=MUST_READ,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional size of labelHashSet
|
||||
cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from existing set
|
||||
cellZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~cellZoneSet();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
const labelList& addressing() const
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
labelList& addressing()
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
//- Make cellSet part consistent with addressing
|
||||
void updateSet();
|
||||
|
||||
//- Invert contents. (insert all members 0..maxLen-1 which were not in
|
||||
// set)
|
||||
virtual void invert(const label maxLen);
|
||||
|
||||
//- Subset contents. Only elements present in both sets remain.
|
||||
virtual void subset(const topoSet& set);
|
||||
|
||||
//- Add elements present in set.
|
||||
virtual void addSet(const topoSet& set);
|
||||
|
||||
//- Delete elements present in set.
|
||||
virtual void deleteSet(const topoSet& set);
|
||||
|
||||
//- Sync cellZoneSet across coupled patches.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
//- Write maxLen items with label and coordinates.
|
||||
virtual void writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh&,
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write cellZone
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType
|
||||
) const;
|
||||
|
||||
//- Update any stored data for new labels
|
||||
virtual void updateMesh(const mapPolyMesh& morphMap);
|
||||
|
||||
//- Return max index+1.
|
||||
virtual label maxSize(const polyMesh& mesh) const;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -43,6 +43,7 @@ defineTypeNameAndDebug(faceSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, faceSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, faceSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, faceSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -79,6 +80,18 @@ faceSet::faceSet
|
||||
{}
|
||||
|
||||
|
||||
faceSet::faceSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
topoSet(mesh, name, set, w)
|
||||
{}
|
||||
|
||||
|
||||
faceSet::faceSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -83,6 +83,15 @@ public:
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from existing set
|
||||
faceSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional labelHashSet
|
||||
faceSet
|
||||
(
|
||||
|
||||
406
src/meshTools/sets/topoSets/faceZoneSet.C
Normal file
406
src/meshTools/sets/topoSets/faceZoneSet.C
Normal file
@ -0,0 +1,406 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceZoneSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyMesh.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(faceZoneSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, faceZoneSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void faceZoneSet::updateSet()
|
||||
{
|
||||
faceSet::clearStorage();
|
||||
faceSet::resize(2*addressing_.size());
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
faceSet::insert(addressing_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
faceZoneSet::faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
faceSet(mesh, name, 1000), // do not read faceSet
|
||||
mesh_(mesh),
|
||||
addressing_(0),
|
||||
flipMap_(0)
|
||||
{
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
label zoneID = faceZones.findZoneID(name);
|
||||
|
||||
if
|
||||
(
|
||||
(r == IOobject::MUST_READ)
|
||||
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
|
||||
)
|
||||
{
|
||||
const faceZone& fz = faceZones[zoneID];
|
||||
addressing_ = fz;
|
||||
flipMap_ = fz.flipMap();
|
||||
}
|
||||
|
||||
updateSet();
|
||||
|
||||
check(mesh.nFaces());
|
||||
}
|
||||
|
||||
|
||||
faceZoneSet::faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label size,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
faceSet(mesh, name, size, w),
|
||||
mesh_(mesh),
|
||||
addressing_(0),
|
||||
flipMap_(0)
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
faceZoneSet::faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
faceSet(mesh, name, set.size(), w),
|
||||
mesh_(mesh),
|
||||
addressing_(refCast<const faceZoneSet>(set).addressing()),
|
||||
flipMap_(refCast<const faceZoneSet>(set).flipMap())
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
faceZoneSet::~faceZoneSet()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void faceZoneSet::invert(const label maxLen)
|
||||
{
|
||||
label n = 0;
|
||||
|
||||
for (label faceI = 0; faceI < maxLen; faceI++)
|
||||
{
|
||||
if (!found(faceI))
|
||||
{
|
||||
addressing_[n] = faceI;
|
||||
flipMap_[n] = true; //? or false?
|
||||
n++;
|
||||
}
|
||||
}
|
||||
addressing_.setSize(n);
|
||||
flipMap_.setSize(n);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
DynamicList<bool> newFlipMap(flipMap_.size());
|
||||
|
||||
Map<label> faceToIndex(addressing_.size());
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
faceToIndex.insert(addressing_[i], i);
|
||||
}
|
||||
|
||||
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label faceI = fSet.addressing()[i];
|
||||
|
||||
Map<label>::const_iterator iter = faceToIndex.find(faceI);
|
||||
|
||||
if (iter != faceToIndex.end())
|
||||
{
|
||||
label index = iter();
|
||||
|
||||
if (fSet.flipMap()[i] != flipMap_[index])
|
||||
{
|
||||
nConflict++;
|
||||
}
|
||||
newAddressing.append(faceI);
|
||||
newFlipMap.append(flipMap_[index]);
|
||||
}
|
||||
}
|
||||
|
||||
if (nConflict > 0)
|
||||
{
|
||||
WarningIn(" faceZoneSet::subset(const topoSet&)")
|
||||
<< "subset : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
DynamicList<bool> newFlipMap(flipMap_);
|
||||
|
||||
Map<label> faceToIndex(addressing_.size());
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
faceToIndex.insert(addressing_[i], i);
|
||||
}
|
||||
|
||||
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label faceI = fSet.addressing()[i];
|
||||
|
||||
Map<label>::const_iterator iter = faceToIndex.find(faceI);
|
||||
|
||||
if (iter != faceToIndex.end())
|
||||
{
|
||||
label index = iter();
|
||||
|
||||
if (fSet.flipMap()[i] != flipMap_[index])
|
||||
{
|
||||
nConflict++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newAddressing.append(faceI);
|
||||
newFlipMap.append(fSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (nConflict > 0)
|
||||
{
|
||||
WarningIn("faceZoneSet::addSet(const topoSet&)")
|
||||
<< "addSet : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::deleteSet(const topoSet& set)
|
||||
{
|
||||
label nConflict = 0;
|
||||
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
DynamicList<bool> newFlipMap(flipMap_.size());
|
||||
|
||||
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
|
||||
|
||||
Map<label> faceToIndex(fSet.addressing().size());
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
faceToIndex.insert(fSet.addressing()[i], i);
|
||||
}
|
||||
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label faceI = addressing_[i];
|
||||
|
||||
Map<label>::const_iterator iter = faceToIndex.find(faceI);
|
||||
|
||||
if (iter != faceToIndex.end())
|
||||
{
|
||||
label index = iter();
|
||||
|
||||
if (fSet.flipMap()[index] != flipMap_[i])
|
||||
{
|
||||
nConflict++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not found in fSet so add
|
||||
newAddressing.append(faceI);
|
||||
newFlipMap.append(fSet.flipMap()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (nConflict > 0)
|
||||
{
|
||||
WarningIn("faceZoneSet::deleteSet(const topoSet&)")
|
||||
<< "deleteSet : there are " << nConflict
|
||||
<< " faces with different orientation in faceZonesSets "
|
||||
<< name() << " and " << set.name() << endl;
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::sync(const polyMesh& mesh)
|
||||
{}
|
||||
|
||||
|
||||
label faceZoneSet::maxSize(const polyMesh& mesh) const
|
||||
{
|
||||
return mesh.nFaces();
|
||||
}
|
||||
|
||||
|
||||
//- Write using given format, version and compression
|
||||
bool faceZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c
|
||||
) const
|
||||
{
|
||||
// Write shadow faceSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = faceSet::typeName;
|
||||
bool ok = faceSet::writeObject(s, v, c);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify faceZone
|
||||
faceZoneMesh& faceZones = const_cast<polyMesh&>(mesh_).faceZones();
|
||||
label zoneID = faceZones.findZoneID(name());
|
||||
|
||||
if (zoneID == -1)
|
||||
{
|
||||
zoneID = faceZones.size();
|
||||
|
||||
faceZones.setSize(zoneID+1);
|
||||
faceZones.set
|
||||
(
|
||||
zoneID,
|
||||
new faceZone
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
flipMap_,
|
||||
zoneID,
|
||||
faceZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZones[zoneID].resetAddressing(addressing_, flipMap_);
|
||||
}
|
||||
return ok && faceZones.write();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||
{
|
||||
// faceZone
|
||||
labelList newAddressing(addressing_.size());
|
||||
boolList newFlipMap(flipMap_.size());
|
||||
|
||||
label n = 0;
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label faceI = addressing_[i];
|
||||
label newFaceI = morphMap.reverseFaceMap()[faceI];
|
||||
if (newFaceI >= 0)
|
||||
{
|
||||
newAddressing[n] = newFaceI;
|
||||
newFlipMap[n] = flipMap_[i];
|
||||
n++;
|
||||
}
|
||||
}
|
||||
newAddressing.setSize(n);
|
||||
newFlipMap.setSize(n);
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
flipMap_.transfer(newFlipMap);
|
||||
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void faceZoneSet::writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh& mesh,
|
||||
const label maxLen
|
||||
) const
|
||||
{
|
||||
faceSet::writeDebug(os, mesh, maxLen);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
187
src/meshTools/sets/topoSets/faceZoneSet.H
Normal file
187
src/meshTools/sets/topoSets/faceZoneSet.H
Normal file
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::faceZoneSet
|
||||
|
||||
Description
|
||||
Like faceSet but updates faceZone when writing.
|
||||
|
||||
SourceFiles
|
||||
faceZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZoneSet_H
|
||||
#define faceZoneSet_H
|
||||
|
||||
#include "faceSet.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceZoneSet Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faceZoneSet
|
||||
:
|
||||
public faceSet
|
||||
{
|
||||
// Private data
|
||||
|
||||
const polyMesh& mesh_;
|
||||
|
||||
labelList addressing_;
|
||||
|
||||
boolList flipMap_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faceZoneSet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry and name
|
||||
faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r=MUST_READ,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional size of labelHashSet
|
||||
faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from existing set
|
||||
faceZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faceZoneSet();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
const labelList& addressing() const
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
labelList& addressing()
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
|
||||
const boolList& flipMap() const
|
||||
{
|
||||
return flipMap_;
|
||||
}
|
||||
|
||||
boolList& flipMap()
|
||||
{
|
||||
return flipMap_;
|
||||
}
|
||||
|
||||
|
||||
//- Make faceSet part consistent with addressing
|
||||
void updateSet();
|
||||
|
||||
//- Invert contents. (insert all members 0..maxLen-1 which were not in
|
||||
// set)
|
||||
virtual void invert(const label maxLen);
|
||||
|
||||
//- Subset contents. Only elements present in both sets remain.
|
||||
virtual void subset(const topoSet& set);
|
||||
|
||||
//- Add elements present in set.
|
||||
virtual void addSet(const topoSet& set);
|
||||
|
||||
//- Delete elements present in set.
|
||||
virtual void deleteSet(const topoSet& set);
|
||||
|
||||
//- Sync faceZoneSet across coupled patches.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
//- Write maxLen items with label and coordinates.
|
||||
virtual void writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh&,
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write faceZone
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType
|
||||
) const;
|
||||
|
||||
//- Update any stored data for new labels
|
||||
virtual void updateMesh(const mapPolyMesh& morphMap);
|
||||
|
||||
//- Return max index+1.
|
||||
virtual label maxSize(const polyMesh& mesh) const;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -42,6 +42,7 @@ defineTypeNameAndDebug(pointSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, pointSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, pointSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, pointSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -78,6 +79,18 @@ pointSet::pointSet
|
||||
{}
|
||||
|
||||
|
||||
pointSet::pointSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
topoSet(mesh, name, set, w)
|
||||
{}
|
||||
|
||||
|
||||
pointSet::pointSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -83,6 +83,15 @@ public:
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional labelHashSet
|
||||
pointSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional labelHashSet
|
||||
pointSet
|
||||
(
|
||||
|
||||
308
src/meshTools/sets/topoSets/pointZoneSet.C
Normal file
308
src/meshTools/sets/topoSets/pointZoneSet.C
Normal file
@ -0,0 +1,308 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "pointZoneSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyMesh.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(pointZoneSet, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, word);
|
||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, size);
|
||||
addToRunTimeSelectionTable(topoSet, pointZoneSet, set);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void pointZoneSet::updateSet()
|
||||
{
|
||||
pointSet::clearStorage();
|
||||
pointSet::resize(2*addressing_.size());
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
pointSet::insert(addressing_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
pointZoneSet::pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
pointSet(mesh, name, 1000), // do not read pointSet
|
||||
mesh_(mesh),
|
||||
addressing_(0)
|
||||
{
|
||||
const pointZoneMesh& pointZones = mesh.pointZones();
|
||||
label zoneID = pointZones.findZoneID(name);
|
||||
|
||||
if
|
||||
(
|
||||
(r == IOobject::MUST_READ)
|
||||
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
|
||||
)
|
||||
{
|
||||
const pointZone& fz = pointZones[zoneID];
|
||||
addressing_ = fz;
|
||||
}
|
||||
|
||||
updateSet();
|
||||
|
||||
check(mesh.nPoints());
|
||||
}
|
||||
|
||||
|
||||
pointZoneSet::pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label size,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
pointSet(mesh, name, size, w),
|
||||
mesh_(mesh),
|
||||
addressing_(0)
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
pointZoneSet::pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
:
|
||||
pointSet(mesh, name, set.size(), w),
|
||||
mesh_(mesh),
|
||||
addressing_(refCast<const pointZoneSet>(set).addressing())
|
||||
{
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
pointZoneSet::~pointZoneSet()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void pointZoneSet::invert(const label maxLen)
|
||||
{
|
||||
label n = 0;
|
||||
|
||||
for (label pointI = 0; pointI < maxLen; pointI++)
|
||||
{
|
||||
if (!found(pointI))
|
||||
{
|
||||
addressing_[n] = pointI;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
addressing_.setSize(n);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::subset(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label pointI = fSet.addressing()[i];
|
||||
|
||||
if (found(pointI))
|
||||
{
|
||||
newAddressing.append(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::addSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_);
|
||||
|
||||
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
|
||||
|
||||
forAll(fSet.addressing(), i)
|
||||
{
|
||||
label pointI = fSet.addressing()[i];
|
||||
|
||||
if (!found(pointI))
|
||||
{
|
||||
newAddressing.append(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::deleteSet(const topoSet& set)
|
||||
{
|
||||
DynamicList<label> newAddressing(addressing_.size());
|
||||
|
||||
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
|
||||
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label pointI = addressing_[i];
|
||||
|
||||
if (!fSet.found(pointI))
|
||||
{
|
||||
// Not found in fSet so add
|
||||
newAddressing.append(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::sync(const polyMesh& mesh)
|
||||
{}
|
||||
|
||||
|
||||
label pointZoneSet::maxSize(const polyMesh& mesh) const
|
||||
{
|
||||
return mesh.nPoints();
|
||||
}
|
||||
|
||||
|
||||
//- Write using given format, version and compression
|
||||
bool pointZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c
|
||||
) const
|
||||
{
|
||||
// Write shadow pointSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = pointSet::typeName;
|
||||
bool ok = pointSet::writeObject(s, v, c);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify pointZone
|
||||
pointZoneMesh& pointZones = const_cast<polyMesh&>(mesh_).pointZones();
|
||||
label zoneID = pointZones.findZoneID(name());
|
||||
|
||||
if (zoneID == -1)
|
||||
{
|
||||
zoneID = pointZones.size();
|
||||
|
||||
pointZones.setSize(zoneID+1);
|
||||
pointZones.set
|
||||
(
|
||||
zoneID,
|
||||
new pointZone
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
zoneID,
|
||||
pointZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointZones[zoneID] = addressing_;
|
||||
}
|
||||
return ok && pointZones.write();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::updateMesh(const mapPolyMesh& morphMap)
|
||||
{
|
||||
// pointZone
|
||||
labelList newAddressing(addressing_.size());
|
||||
|
||||
label n = 0;
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
label pointI = addressing_[i];
|
||||
label newPointI = morphMap.reversePointMap()[pointI];
|
||||
if (newPointI >= 0)
|
||||
{
|
||||
newAddressing[n] = newPointI;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
newAddressing.setSize(n);
|
||||
|
||||
addressing_.transfer(newAddressing);
|
||||
|
||||
updateSet();
|
||||
}
|
||||
|
||||
|
||||
void pointZoneSet::writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh& mesh,
|
||||
const label maxLen
|
||||
) const
|
||||
{
|
||||
pointSet::writeDebug(os, mesh, maxLen);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
173
src/meshTools/sets/topoSets/pointZoneSet.H
Normal file
173
src/meshTools/sets/topoSets/pointZoneSet.H
Normal file
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::pointZoneSet
|
||||
|
||||
Description
|
||||
Like pointSet but updates pointZone when writing.
|
||||
|
||||
SourceFiles
|
||||
pointZone.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointZoneSet_H
|
||||
#define pointZoneSet_H
|
||||
|
||||
#include "pointSet.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pointZoneSet Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pointZoneSet
|
||||
:
|
||||
public pointSet
|
||||
{
|
||||
// Private data
|
||||
|
||||
const polyMesh& mesh_;
|
||||
|
||||
labelList addressing_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("pointZoneSet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry and name
|
||||
pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
readOption r=MUST_READ,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from additional size of labelHashSet
|
||||
pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const label,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Construct from existing set
|
||||
pointZoneSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet&,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~pointZoneSet();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
const labelList& addressing() const
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
labelList& addressing()
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
//- Make pointSet part consistent with addressing
|
||||
void updateSet();
|
||||
|
||||
//- Invert contents. (insert all members 0..maxLen-1 which were not in
|
||||
// set)
|
||||
virtual void invert(const label maxLen);
|
||||
|
||||
//- Subset contents. Only elements present in both sets remain.
|
||||
virtual void subset(const topoSet& set);
|
||||
|
||||
//- Add elements present in set.
|
||||
virtual void addSet(const topoSet& set);
|
||||
|
||||
//- Delete elements present in set.
|
||||
virtual void deleteSet(const topoSet& set);
|
||||
|
||||
//- Sync pointZoneSet across coupled patches.
|
||||
virtual void sync(const polyMesh& mesh);
|
||||
|
||||
//- Write maxLen items with label and coordinates.
|
||||
virtual void writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh&,
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write pointZone
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType
|
||||
) const;
|
||||
|
||||
//- Update any stored data for new labels
|
||||
virtual void updateMesh(const mapPolyMesh& morphMap);
|
||||
|
||||
//- Return max index+1.
|
||||
virtual label maxSize(const polyMesh& mesh) const;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -39,6 +39,7 @@ namespace Foam
|
||||
defineTypeNameAndDebug(topoSet, 0);
|
||||
defineRunTimeSelectionTable(topoSet, word);
|
||||
defineRunTimeSelectionTable(topoSet, size);
|
||||
defineRunTimeSelectionTable(topoSet, set);
|
||||
|
||||
|
||||
// Construct named object from existing set.
|
||||
@ -103,6 +104,37 @@ autoPtr<topoSet> topoSet::New
|
||||
}
|
||||
|
||||
|
||||
// Construct named object from existing set.
|
||||
autoPtr<topoSet> topoSet::New
|
||||
(
|
||||
const word& setType,
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
)
|
||||
{
|
||||
setConstructorTable::iterator cstrIter =
|
||||
setConstructorTablePtr_
|
||||
->find(setType);
|
||||
|
||||
if (cstrIter == setConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"topoSet::New(const word&, "
|
||||
"const polyMesh&, const word&, const topoSet&, writeOption)"
|
||||
) << "Unknown set type " << setType
|
||||
<< endl << endl
|
||||
<< "Valid set types : " << endl
|
||||
<< setConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<topoSet>(cstrIter()(mesh, name, set, w));
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName topoSet::topoSet::localPath
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -255,9 +287,9 @@ void topoSet::writeDebug
|
||||
) const
|
||||
{
|
||||
// Bounding box of contents.
|
||||
boundBox bb(pointField(coords, toc()));
|
||||
boundBox bb(pointField(coords, toc()), true);
|
||||
|
||||
Pout<< "Set bounding box: min = "
|
||||
os << "Set bounding box: min = "
|
||||
<< bb.min() << " max = " << bb.max() << " meters. " << endl << endl;
|
||||
|
||||
label n = 0;
|
||||
@ -538,18 +570,18 @@ void topoSet::writeDebug(Ostream& os, const label maxLen) const
|
||||
}
|
||||
|
||||
|
||||
void topoSet::writeDebug
|
||||
(
|
||||
Ostream&,
|
||||
const primitiveMesh&,
|
||||
const label
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)"
|
||||
);
|
||||
}
|
||||
//void topoSet::writeDebug
|
||||
//(
|
||||
// Ostream&,
|
||||
// const primitiveMesh&,
|
||||
// const label
|
||||
//) const
|
||||
//{
|
||||
// notImplemented
|
||||
// (
|
||||
// "topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)"
|
||||
// );
|
||||
//}
|
||||
|
||||
|
||||
bool topoSet::writeData(Ostream& os) const
|
||||
@ -564,13 +596,13 @@ void topoSet::updateMesh(const mapPolyMesh&)
|
||||
}
|
||||
|
||||
|
||||
//- Return max index+1.
|
||||
label topoSet::maxSize(const polyMesh&) const
|
||||
{
|
||||
notImplemented("topoSet::maxSize(const polyMesh&)");
|
||||
|
||||
return -1;
|
||||
}
|
||||
////- Return max index+1.
|
||||
//label topoSet::maxSize(const polyMesh&) const
|
||||
//{
|
||||
// notImplemented("topoSet::maxSize(const polyMesh&)");
|
||||
//
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -55,7 +55,6 @@ namespace Foam
|
||||
class mapPolyMesh;
|
||||
class polyMesh;
|
||||
class primitiveMesh;
|
||||
//class directPolyTopoChange;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class topoSet Declaration
|
||||
@ -154,6 +153,21 @@ public:
|
||||
(mesh, name, size, w)
|
||||
);
|
||||
|
||||
// For the constructor as copy
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
topoSet,
|
||||
set,
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w
|
||||
),
|
||||
(mesh, name, set, w)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -208,7 +222,7 @@ public:
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected source
|
||||
//- Return a pointer to a toposet read from file
|
||||
static autoPtr<topoSet> New
|
||||
(
|
||||
const word& setType,
|
||||
@ -218,7 +232,7 @@ public:
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Return a reference to the selected source
|
||||
//- Return a pointer to a new toposet of given size
|
||||
static autoPtr<topoSet> New
|
||||
(
|
||||
const word& setType,
|
||||
@ -228,6 +242,16 @@ public:
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
//- Return a pointer to a new toposet as copy of another toposet
|
||||
static autoPtr<topoSet> New
|
||||
(
|
||||
const word& setType,
|
||||
const polyMesh& mesh,
|
||||
const word& name,
|
||||
const topoSet& set,
|
||||
writeOption w=NO_WRITE
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -256,13 +280,13 @@ public:
|
||||
virtual void writeDebug(Ostream& os, const label maxLen) const;
|
||||
|
||||
//- Like above but also writes mesh related quantity
|
||||
// (usually coordinate). Not implemented.
|
||||
// (usually coordinate).
|
||||
virtual void writeDebug
|
||||
(
|
||||
Ostream& os,
|
||||
const primitiveMesh&,
|
||||
const label maxLen
|
||||
) const;
|
||||
) const = 0;
|
||||
|
||||
//- Write contents.
|
||||
virtual bool writeData(Ostream&) const;
|
||||
@ -271,7 +295,7 @@ public:
|
||||
virtual void updateMesh(const mapPolyMesh& morphMap);
|
||||
|
||||
//- Return max allowable index (+1). Not implemented.
|
||||
virtual label maxSize(const polyMesh& mesh) const;
|
||||
virtual label maxSize(const polyMesh& mesh) const = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user