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);
|
defineTypeNameAndDebug(Foam::fieldValues::cellSource, 0);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 1>::
|
const char* NamedEnum<fieldValues::cellSource::sourceType, 2>::
|
||||||
names[] =
|
names[] = {"cellZone", "all"};
|
||||||
{
|
|
||||||
"cellZone"
|
|
||||||
};
|
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 1>
|
const NamedEnum<fieldValues::cellSource::sourceType, 2>
|
||||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
fieldValues::cellSource::sourceTypeNames_;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const char* Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>::
|
const char* Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>::
|
||||||
@ -57,6 +54,10 @@ const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>
|
|||||||
|
|
||||||
void Foam::fieldValues::cellSource::setCellZoneCells()
|
void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||||
{
|
{
|
||||||
|
switch (source_)
|
||||||
|
{
|
||||||
|
case stCellZone:
|
||||||
|
{
|
||||||
label zoneId = mesh().cellZones().findZoneID(sourceName_);
|
label zoneId = mesh().cellZones().findZoneID(sourceName_);
|
||||||
|
|
||||||
if (zoneId < 0)
|
if (zoneId < 0)
|
||||||
@ -67,25 +68,29 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
|||||||
<< nl << exit(FatalError);
|
<< nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cellZone& cZone = mesh().cellZones()[zoneId];
|
cellId_ = mesh().cellZones()[zoneId];
|
||||||
|
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||||
cellId_.setSize(cZone.size());
|
break;
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAll(cZone, i)
|
|
||||||
{
|
|
||||||
label cellI = cZone[i];
|
|
||||||
cellId_[count] = cellI;
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cellId_.setSize(count);
|
case stAll:
|
||||||
|
{
|
||||||
|
cellId_ = identity(mesh().nCells());
|
||||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn("cellSource::setCellZoneCells()")
|
||||||
|
<< "Unknown source type. Valid source types are:"
|
||||||
|
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Original cell zone size = " << cZone.size()
|
Pout<< "Selected source size = " << cellId_.size() << endl;
|
||||||
<< ", new size = " << count << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,20 +99,7 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
|||||||
|
|
||||||
void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||||
{
|
{
|
||||||
switch (source_)
|
|
||||||
{
|
|
||||||
case stCellZone:
|
|
||||||
{
|
|
||||||
setCellZoneCells();
|
setCellZoneCells();
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorIn("cellSource::initialise()")
|
|
||||||
<< "Unknown source type. Valid source types are:"
|
|
||||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name_ << ":" << nl
|
||||||
<< " total cells = " << nCells_ << nl
|
<< " total cells = " << nCells_ << nl
|
||||||
|
|||||||
@ -89,7 +89,8 @@ public:
|
|||||||
//- Source type enumeration
|
//- Source type enumeration
|
||||||
enum sourceType
|
enum sourceType
|
||||||
{
|
{
|
||||||
stCellZone
|
stCellZone,
|
||||||
|
stAll
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Source type names
|
//- Source type names
|
||||||
|
|||||||
Reference in New Issue
Block a user