mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cellSource postprocessing : allow all to select all cells
This commit is contained in:
@ -32,14 +32,11 @@ License
|
||||
defineTypeNameAndDebug(Foam::fieldValues::cellSource, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 1>::
|
||||
names[] =
|
||||
{
|
||||
"cellZone"
|
||||
};
|
||||
const char* NamedEnum<fieldValues::cellSource::sourceType, 2>::
|
||||
names[] = {"cellZone", "all"};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 1>
|
||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
||||
const NamedEnum<fieldValues::cellSource::sourceType, 2>
|
||||
fieldValues::cellSource::sourceTypeNames_;
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>::
|
||||
@ -56,6 +53,10 @@ const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
{
|
||||
switch (source_)
|
||||
{
|
||||
case stCellZone:
|
||||
{
|
||||
label zoneId = mesh().cellZones().findZoneID(sourceName_);
|
||||
|
||||
@ -67,25 +68,29 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const cellZone& cZone = mesh().cellZones()[zoneId];
|
||||
|
||||
cellId_.setSize(cZone.size());
|
||||
|
||||
label count = 0;
|
||||
forAll(cZone, i)
|
||||
{
|
||||
label cellI = cZone[i];
|
||||
cellId_[count] = cellI;
|
||||
count++;
|
||||
cellId_ = mesh().cellZones()[zoneId];
|
||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||
break;
|
||||
}
|
||||
|
||||
cellId_.setSize(count);
|
||||
case stAll:
|
||||
{
|
||||
cellId_ = identity(mesh().nCells());
|
||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("cellSource::setCellZoneCells()")
|
||||
<< "Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Original cell zone size = " << cZone.size()
|
||||
<< ", new size = " << count << endl;
|
||||
Pout<< "Selected source size = " << cellId_.size() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,21 +98,8 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
{
|
||||
switch (source_)
|
||||
{
|
||||
case stCellZone:
|
||||
{
|
||||
setCellZoneCells();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("cellSource::initialise()")
|
||||
<< "Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " total cells = " << nCells_ << nl
|
||||
|
||||
@ -89,7 +89,8 @@ public:
|
||||
//- Source type enumeration
|
||||
enum sourceType
|
||||
{
|
||||
stCellZone
|
||||
stCellZone,
|
||||
stAll
|
||||
};
|
||||
|
||||
//- Source type names
|
||||
|
||||
Reference in New Issue
Block a user