mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use string endsWith in a few places
fieldName.endsWith("_0")
vs
fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
This commit is contained in:
@ -11,9 +11,8 @@ if (!fieldsToUse.found(fieldName))
|
|||||||
{
|
{
|
||||||
variableGood =
|
variableGood =
|
||||||
(
|
(
|
||||||
fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
|
!fieldName.endsWith("_0")
|
||||||
? false
|
&& IOobject
|
||||||
: IOobject
|
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
timeDirs[n1].name(),
|
timeDirs[n1].name(),
|
||||||
|
|||||||
@ -19,13 +19,9 @@ if (timeDirs.size())
|
|||||||
const word& fieldName = obj.name();
|
const word& fieldName = obj.name();
|
||||||
const word& fieldType = obj.headerClassName();
|
const word& fieldType = obj.headerClassName();
|
||||||
|
|
||||||
if (fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0")
|
if (volFieldTypes.found(fieldType) && !fieldName.endsWith("_0"))
|
||||||
{
|
{
|
||||||
// ignore _0 fields
|
// ignore types that we don't handle, and ignore _0 fields
|
||||||
}
|
|
||||||
else if (volFieldTypes.found(fieldType))
|
|
||||||
{
|
|
||||||
// simply ignore types that we don't handle
|
|
||||||
volumeFields.insert(fieldName, fieldType);
|
volumeFields.insert(fieldName, fieldType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -766,10 +766,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTimes() const
|
|||||||
(
|
(
|
||||||
field0Ptr_
|
field0Ptr_
|
||||||
&& timeIndex_ != this->time().timeIndex()
|
&& timeIndex_ != this->time().timeIndex()
|
||||||
&& !(
|
&& !this->name().endsWith("_0")
|
||||||
this->name().size() > 2
|
|
||||||
&& this->name()(this->name().size()-2, 2) == "_0"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
storeOldTime();
|
storeOldTime();
|
||||||
|
|||||||
Reference in New Issue
Block a user