changed comment; added faceZoneToCell source
This commit is contained in:
parent
9ea05f8371
commit
1aab4aaec8
@ -90,6 +90,7 @@ $(cellSources)/nbrToCell/nbrToCell.C
|
||||
$(cellSources)/zoneToCell/zoneToCell.C
|
||||
$(cellSources)/sphereToCell/sphereToCell.C
|
||||
$(cellSources)/cylinderToCell/cylinderToCell.C
|
||||
$(cellSources)/faceZoneToCell/faceZoneToCell.C
|
||||
|
||||
faceSources = sets/faceSources
|
||||
$(faceSources)/faceToFace/faceToFace.C
|
||||
|
185
src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
Normal file
185
src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
Normal file
@ -0,0 +1,185 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceZoneToCell.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(faceZoneToCell, 0);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
|
||||
|
||||
addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::topoSetSource::addToUsageTable Foam::faceZoneToCell::usage_
|
||||
(
|
||||
faceZoneToCell::typeName,
|
||||
"\n Usage: faceZoneToCell zone master|slave\n\n"
|
||||
" Select master or slave side of the faceZone."
|
||||
" Note:accepts wildcards for zone.\n\n"
|
||||
);
|
||||
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>::names[] =
|
||||
{
|
||||
"master",
|
||||
"slave"
|
||||
};
|
||||
|
||||
|
||||
const Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>
|
||||
Foam::faceZoneToCell::faceActionNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
|
||||
{
|
||||
bool hasMatched = false;
|
||||
|
||||
forAll(mesh_.faceZones(), i)
|
||||
{
|
||||
const faceZone& zone = mesh_.faceZones()[i];
|
||||
|
||||
if (zoneName_.match(zone.name()))
|
||||
{
|
||||
const labelList& cellLabels =
|
||||
(
|
||||
option_ == MASTER
|
||||
? zone.masterCells()
|
||||
: zone.slaveCells()
|
||||
);
|
||||
|
||||
Info<< " Found matching zone " << zone.name()
|
||||
<< " with " << cellLabels.size() << " cells on selected side."
|
||||
<< endl;
|
||||
|
||||
hasMatched = true;
|
||||
|
||||
forAll(cellLabels, i)
|
||||
{
|
||||
// Only do active cells
|
||||
if (cellLabels[i] < mesh_.nCells())
|
||||
{
|
||||
addOrDelete(set, cellLabels[i], add);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasMatched)
|
||||
{
|
||||
WarningIn("faceZoneToCell::combine(topoSet&, const bool)")
|
||||
<< "Cannot find any faceZone named " << zoneName_ << endl
|
||||
<< "Valid names are " << mesh_.faceZones().names() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faceZoneToCell::faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName,
|
||||
const faceAction option
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(zoneName),
|
||||
option_(option)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::faceZoneToCell::faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(dict.lookup("name")),
|
||||
option_(faceActionNames_.read(dict.lookup("option")))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::faceZoneToCell::faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
topoSetSource(mesh),
|
||||
zoneName_(checkIs(is)),
|
||||
option_(faceActionNames_.read(checkIs(is)))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faceZoneToCell::~faceZoneToCell()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceZoneToCell::applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet& set
|
||||
) const
|
||||
{
|
||||
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
|
||||
{
|
||||
Info<< " Adding all " << faceActionNames_[option_]
|
||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
||||
|
||||
combine(set, true);
|
||||
}
|
||||
else if (action == topoSetSource::DELETE)
|
||||
{
|
||||
Info<< " Removing all " << faceActionNames_[option_]
|
||||
<< " cells of faceZone " << zoneName_ << " ..." << endl;
|
||||
|
||||
combine(set, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
138
src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H
Normal file
138
src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H
Normal file
@ -0,0 +1,138 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::faceZoneToCell
|
||||
|
||||
Description
|
||||
A topoSetSource to select cells based on side of faceZone.
|
||||
|
||||
SourceFiles
|
||||
faceZoneToCell.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZoneToCell_H
|
||||
#define faceZoneToCell_H
|
||||
|
||||
#include "topoSetSource.H"
|
||||
#include "wordRe.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceZoneToCell Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faceZoneToCell
|
||||
:
|
||||
public topoSetSource
|
||||
{
|
||||
public:
|
||||
//- Enumeration defining the valid options
|
||||
enum faceAction
|
||||
{
|
||||
MASTER,
|
||||
SLAVE
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
static const NamedEnum<faceAction, 2> faceActionNames_;
|
||||
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
//- Name/regular expression of faceZone
|
||||
wordRe zoneName_;
|
||||
|
||||
//- Option
|
||||
faceAction option_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void combine(topoSet& set, const bool add) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faceZoneToCell");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& zoneName,
|
||||
const faceAction option
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
faceZoneToCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faceZoneToCell();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void applyToSet
|
||||
(
|
||||
const topoSetSource::setAction action,
|
||||
topoSet&
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -47,7 +47,8 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToCell::usage_
|
||||
(
|
||||
zoneToCell::typeName,
|
||||
"\n Usage: zoneToCell zone\n\n"
|
||||
" Select all cells in the cellZone\n\n"
|
||||
" Select all cells in the cellZone."
|
||||
" Note:accepts wildcards for zone.\n\n"
|
||||
);
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_
|
||||
(
|
||||
patchToFace::typeName,
|
||||
"\n Usage: patchToFace patch\n\n"
|
||||
" Select all faces in the patch\n\n"
|
||||
" Select all faces in the patch. Note:accepts wildcards for patch.\n\n"
|
||||
);
|
||||
|
||||
|
||||
|
@ -47,7 +47,8 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToFace::usage_
|
||||
(
|
||||
zoneToFace::typeName,
|
||||
"\n Usage: zoneToFace zone\n\n"
|
||||
" Select all faces in the faceZone\n\n"
|
||||
" Select all faces in the faceZone."
|
||||
" Note:accepts wildcards for zone.\n\n"
|
||||
);
|
||||
|
||||
|
||||
|
@ -47,7 +47,8 @@ Foam::topoSetSource::addToUsageTable Foam::zoneToPoint::usage_
|
||||
(
|
||||
zoneToPoint::typeName,
|
||||
"\n Usage: zoneToPoint zone\n\n"
|
||||
" Select all points in the pointZone\n\n"
|
||||
" Select all points in the pointZone."
|
||||
" Note:accepts wildcards for zone.\n\n"
|
||||
);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user